Date: Tue, 26 May 2026 18:27:44 +0000 From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: c564074c9aaa - main - divert: Avoid using atomic_(load|store)_(acq|rel)_16 Message-ID: <6a15e620.41304.be8363a@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c564074c9aaa8a3f9273de3cb802edcb3e2e2a40 commit c564074c9aaa8a3f9273de3cb802edcb3e2e2a40 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2026-05-26 18:21:27 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2026-05-26 18:26:43 +0000 divert: Avoid using atomic_(load|store)_(acq|rel)_16 It's not implemented on some arches. Use a plain int to count the number of sockets in a divert lbgroup. Reported by: Jenkins Fixes: 895a0ae67fe2 ("divert: Define semantics for SO_REUSEPORT_LB on divert sockets") --- sys/netinet/ip_divert.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 839048908f9f..390fdd9368b6 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -50,12 +50,14 @@ #include <sys/socket.h> #include <sys/socketvar.h> #include <sys/sysctl.h> -#include <net/vnet.h> + +#include <machine/atomic.h> #include <net/if.h> #include <net/if_var.h> #include <net/if_private.h> #include <net/netisr.h> +#include <net/vnet.h> #include <netinet/in.h> #include <netinet/in_pcb.h> @@ -152,7 +154,7 @@ struct divcblbgroup { CK_SLIST_ENTRY(divcblbgroup) dl_next; struct epoch_context dl_epochctx; uint16_t dl_port; - uint16_t dl_count; + int dl_count; #define DIVCBLBGROUP_SIZE 32 struct divcb *dl_dcb[DIVCBLBGROUP_SIZE]; }; @@ -297,7 +299,7 @@ divert_packet(struct mbuf *m, uint64_t id, bool incoming) CK_SLIST_FOREACH(dlb, &V_divlbhash[DIVHASH(nport)], dl_next) { uint16_t count; - count = atomic_load_acq_16(&dlb->dl_count); + count = atomic_load_acq_int(&dlb->dl_count); if (dlb->dl_port == nport && count > 0) { uint32_t hash; @@ -666,7 +668,7 @@ div_lbgroup_detach(struct divcb *dcb) count = dlb->dl_count; if (i != count - 1) dlb->dl_dcb[i] = dlb->dl_dcb[count - 1]; - atomic_store_rel_16(&dlb->dl_count, count - 1); + atomic_store_rel_int(&dlb->dl_count, count - 1); if (count == 1) { CK_SLIST_REMOVE(&V_divlbhash[DCBHASH(dcb)], dlb, divcblbgroup, dl_next); @@ -743,7 +745,7 @@ div_bind(struct socket *so, struct sockaddr *nam, struct thread *td) ("div_bind: lbgroup %p has count 0", tmp)); tmp->dl_dcb[tmp->dl_count] = dcb; - atomic_store_rel_16(&tmp->dl_count, tmp->dl_count + 1); + atomic_store_rel_int(&tmp->dl_count, tmp->dl_count + 1); free(dlb, M_PCB); } else { error = ENOSPC;home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a15e620.41304.be8363a>
