From nobody Mon Dec 06 17:32:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0ABF718C4D08; Mon, 6 Dec 2021 17:32:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J79Vk3Wv5z3jZx; Mon, 6 Dec 2021 17:32:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A91010382; Mon, 6 Dec 2021 17:32:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1B6HWkI5068525; Mon, 6 Dec 2021 17:32:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B6HWkDj068524; Mon, 6 Dec 2021 17:32:46 GMT (envelope-from git) Date: Mon, 6 Dec 2021 17:32:46 GMT Message-Id: <202112061732.1B6HWkDj068524@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 450394af27bc - main - ifnet: use ck_pr(3) store & load setting ifnet pointer in ifindex List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 450394af27bcb61beb6b641ff3ee6a6af01d4bb7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638811966; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=z82UE97qVOy8DXCSZBVS49hcREgnDDDr4ZTB67tact4=; b=ysu+Q2XcbEPHm7f9/OUIagETuMN6iO2+YjLz6q9zlGlbPzcYNt14bEn//Z6zdwtLYCYR3o sCA9aYS5pj8TG3GP6FLz7q4L4G9jzbA/K8qmKCCMEaM3uwhKFGfZaxXm/v6gfsDzahjUbn SvrRz/td/d/xLGosGI7jVOUMVsnqhmC0Hn6NFJCWHTF8t/J6YlNuFvPeA2wEAxfRVMCMoF zwNrGYfG2Xe2vYswZvIJyjRt7Qm3ZNsb6QrGbohIHhFME8x8TUXgqx4o+sZ7oZ8VZTmCnF /enNfrMIpkLLIoxIYLGnCb0hmwjgCCEFLwAheRa6UNrotGdD6mef/mrQD5iGYQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638811966; a=rsa-sha256; cv=none; b=LSOG+GTRJ0Hup8wLw53cfuM+dVg9QRrixW2cVA2PEp61nL2YIcqzirhSseggyEhhAXyAM/ 4KhFB2+WaXchaw57VG4boDnPMsf7k9lz7fxFJ4C2u5sGr51eUYxy+PlLiCmmzPoRT9XdkB Nn02kH7TR6+DG21jFHB8jLFP+oY9+OM66/NsvKhiRXGXvEsmsh6Gg+6VUt89pTfS3GKGkn cd1X4aNpJYXuB9E6oF1bqSDtEn9YxNGMiMJymSCx7kvGMDd0PCT59mvc9kCRksL8QpZzBM Y+vLF9jIhDV+hzEQQz9m2CxmvPlN0tdUWXGH4vz+ST9Crbpqpnkz7Q7U7ZC3oA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=450394af27bcb61beb6b641ff3ee6a6af01d4bb7 commit 450394af27bcb61beb6b641ff3ee6a6af01d4bb7 Author: Gleb Smirnoff AuthorDate: 2021-12-04 17:49:35 +0000 Commit: Gleb Smirnoff CommitDate: 2021-12-06 17:32:30 +0000 ifnet: use ck_pr(3) store & load setting ifnet pointer in ifindex The lockless access to the array is protected by the network epoch. Reviewed by: bz, kp Differential revision: https://reviews.freebsd.org/D33260 --- sys/net/if.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 520e8b4de393..8b820eb562ed 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -350,7 +350,7 @@ ifnet_byindex(u_short idx) if (__predict_false(idx > V_if_index)) return (NULL); - return (V_ifindex_table[idx]); + return (ck_pr_load_ptr(&V_ifindex_table[idx])); } struct ifnet * @@ -403,7 +403,7 @@ ifindex_free(u_short idx) IFNET_WLOCK_ASSERT(); - V_ifindex_table[idx] = NULL; + ck_pr_store_ptr(&V_ifindex_table[idx], NULL); while (V_if_index > 0 && V_ifindex_table[V_if_index] == NULL) V_if_index--; @@ -414,7 +414,7 @@ ifnet_setbyindex(u_short idx, struct ifnet *ifp) { ifp->if_index = idx; - V_ifindex_table[idx] = ifp; + ck_pr_store_ptr(&V_ifindex_table[idx], ifp); } struct ifaddr *