Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Dec 2025 23:20:02 +0000
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 72ca89482afc - main - bpf: global bpf list doesn't need CK
Message-ID:  <6930c5a2.3e633.361b4798@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=72ca89482afcdec7db1d7555bdb3505498c729c2

commit 72ca89482afcdec7db1d7555bdb3505498c729c2
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-12-03 23:16:50 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-12-03 23:19:45 +0000

    bpf: global bpf list doesn't need CK
    
    All accesses to this list are done with the global lock held.  The
    CK connotation is just confusing the reader.
    
    Fixes:                  699281b545a8a3fc5109b5f2db62d261b65b588b
    Reviewed by:            markj
    Differential Revision:  https://reviews.freebsd.org/D53869
---
 sys/net/bpf.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index aff0d3c761ad..b043773bc876 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -97,7 +97,7 @@ static const struct bpfd_list dead_bpf_if = CK_LIST_HEAD_INITIALIZER();
 
 struct bpf_if {
 	struct bpfd_list	bif_dlist;	/* list of all interfaces */
-	CK_LIST_ENTRY(bpf_if)	bif_next;	/* descriptor list */
+	LIST_ENTRY(bpf_if)	bif_next;	/* descriptor list */
 	u_int		bif_dlt;	/* link layer type */
 	u_int		bif_hdrlen;	/* length of link header */
 	struct bpfd_list bif_wlist;	/* writer-only list */
@@ -175,8 +175,8 @@ struct bpf_dltlist32 {
  * structures registered by different layers in the stack (i.e., 802.11
  * frames, ethernet frames, etc).
  */
-CK_LIST_HEAD(bpf_iflist, bpf_if);
-static struct bpf_iflist bpf_iflist = CK_LIST_HEAD_INITIALIZER();
+LIST_HEAD(bpf_iflist, bpf_if);
+static struct bpf_iflist bpf_iflist = LIST_HEAD_INITIALIZER();
 static struct sx	bpf_sx;		/* bpf global lock */
 
 static void	bpfif_ref(struct bpf_if *);
@@ -2078,7 +2078,7 @@ bpf_setif(struct bpf_d *d, struct ifreq *ifr)
 	/*
 	 * Look through attached interfaces for the named one.
 	 */
-	CK_LIST_FOREACH(bp, &bpf_iflist, bif_next) {
+	LIST_FOREACH(bp, &bpf_iflist, bif_next) {
 		if (bp->bif_ifp == theywant &&
 		    bp->bif_bpf == &theywant->if_bpf)
 			break;
@@ -2799,7 +2799,7 @@ bpfattach2(struct ifnet *ifp, u_int dlt, u_int hdrlen,
 	 */
 	if_ref(ifp);
 	BPF_LOCK();
-	CK_LIST_INSERT_HEAD(&bpf_iflist, bp, bif_next);
+	LIST_INSERT_HEAD(&bpf_iflist, bp, bif_next);
 	BPF_UNLOCK();
 
 	if (bootverbose && IS_DEFAULT_VNET(curvnet))
@@ -2817,7 +2817,7 @@ bpf_ifdetach(struct ifnet *ifp)
 	struct bpf_d *d;
 
 	BPF_LOCK();
-	CK_LIST_FOREACH(bp, &bpf_iflist, bif_next) {
+	LIST_FOREACH(bp, &bpf_iflist, bif_next) {
 		if (bp->bif_ifp != ifp)
 			continue;
 
@@ -2848,11 +2848,11 @@ bpfdetach(struct ifnet *ifp)
 
 	BPF_LOCK();
 	/* Find all bpf_if struct's which reference ifp and detach them. */
-	CK_LIST_FOREACH_SAFE(bp, &bpf_iflist, bif_next, bp_temp) {
+	LIST_FOREACH_SAFE(bp, &bpf_iflist, bif_next, bp_temp) {
 		if (ifp != bp->bif_ifp)
 			continue;
 
-		CK_LIST_REMOVE(bp, bif_next);
+		LIST_REMOVE(bp, bif_next);
 		*bp->bif_bpf = __DECONST(struct bpf_if *, &dead_bpf_if);
 
 		CTR4(KTR_NET,
@@ -2894,7 +2894,7 @@ bpf_getdltlist(struct bpf_d *d, struct bpf_dltlist *bfl)
 
 	ifp = d->bd_bif->bif_ifp;
 	n1 = 0;
-	CK_LIST_FOREACH(bp, &bpf_iflist, bif_next) {
+	LIST_FOREACH(bp, &bpf_iflist, bif_next) {
 		if (bp->bif_ifp == ifp)
 			n1++;
 	}
@@ -2907,7 +2907,7 @@ bpf_getdltlist(struct bpf_d *d, struct bpf_dltlist *bfl)
 
 	lst = malloc(n1 * sizeof(u_int), M_TEMP, M_WAITOK);
 	n = 0;
-	CK_LIST_FOREACH(bp, &bpf_iflist, bif_next) {
+	LIST_FOREACH(bp, &bpf_iflist, bif_next) {
 		if (bp->bif_ifp != ifp)
 			continue;
 		lst[n++] = bp->bif_dlt;
@@ -2939,7 +2939,7 @@ bpf_setdlt(struct bpf_d *d, u_int dlt)
 		return (0);
 
 	ifp = d->bd_bif->bif_ifp;
-	CK_LIST_FOREACH(bp, &bpf_iflist, bif_next) {
+	LIST_FOREACH(bp, &bpf_iflist, bif_next) {
 		if (bp->bif_ifp == ifp && bp->bif_dlt == dlt)
 			break;
 	}
@@ -2986,7 +2986,7 @@ bpf_zero_counters(void)
 	 * We are protected by global lock here, interfaces and
 	 * descriptors can not be deleted while we hold it.
 	 */
-	CK_LIST_FOREACH(bp, &bpf_iflist, bif_next) {
+	LIST_FOREACH(bp, &bpf_iflist, bif_next) {
 		CK_LIST_FOREACH(bd, &bp->bif_dlist, bd_next) {
 			counter_u64_zero(bd->bd_rcount);
 			counter_u64_zero(bd->bd_dcount);
@@ -3074,7 +3074,7 @@ bpf_stats_sysctl(SYSCTL_HANDLER_ARGS)
 	}
 	bpfd_cnt = 0;
 	BPF_LOCK();
-	CK_LIST_FOREACH(bp, &bpf_iflist, bif_next) {
+	LIST_FOREACH(bp, &bpf_iflist, bif_next) {
 		CK_LIST_FOREACH(bd, &bp->bif_wlist, bd_next)
 			bpfd_cnt++;
 		CK_LIST_FOREACH(bd, &bp->bif_dlist, bd_next)
@@ -3090,7 +3090,7 @@ bpf_stats_sysctl(SYSCTL_HANDLER_ARGS)
 	}
 	xbdbuf = malloc(bpfd_cnt * sizeof(*xbd), M_BPF, M_WAITOK);
 	index = 0;
-	CK_LIST_FOREACH(bp, &bpf_iflist, bif_next) {
+	LIST_FOREACH(bp, &bpf_iflist, bif_next) {
 		/* Send writers-only first */
 		CK_LIST_FOREACH(bd, &bp->bif_wlist, bd_next) {
 			MPASS(index <= bpfd_cnt);


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6930c5a2.3e633.361b4798>