Date: Thu, 16 Apr 2026 16:51:33 +0000 From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 547d7095fac1 - stable/14 - divert: Use a better source identifier for netisr_queue_src() calls Message-ID: <69e11395.31588.647d7280@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=547d7095fac1395664aaa41ffae032ffe7b6a783 commit 547d7095fac1395664aaa41ffae032ffe7b6a783 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2026-02-26 20:25:35 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2026-04-16 16:48:50 +0000 divert: Use a better source identifier for netisr_queue_src() calls These opaque IDs are used by netisr to distribute work among threads. The mapping function is simply SourceID % numthreads, so using socket addresses as source IDs isn't going to distribute packets well due to alignment. Use the divert socket's generation number instead, as that suits this purpose much better. Reviewed by: zlei, glebius MFC after: 1 week Sponsored by: OPNsense Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D55537 (cherry picked from commit 5547a7bb39accd8f151b53e90b41d13b55f84c95) --- sys/netinet/ip_divert.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 78ca36fc2a0f..b9a9f0edc946 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -502,8 +502,10 @@ static int div_output_inbound(int family, struct socket *so, struct mbuf *m, struct sockaddr_in *sin) { + struct divcb *dcb; struct ifaddr *ifa; + dcb = so->so_pcb; if (m->m_pkthdr.rcvif == NULL) { /* * No luck with the name, check by IP address. @@ -540,14 +542,14 @@ div_output_inbound(int family, struct socket *so, struct mbuf *m, m->m_flags |= M_MCAST; else if (in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif)) m->m_flags |= M_BCAST; - netisr_queue_src(NETISR_IP, (uintptr_t)so, m); + netisr_queue_src(NETISR_IP, (uintptr_t)dcb->dcb_gencnt, m); DIVSTAT_INC(inbound); break; } #endif #ifdef INET6 case AF_INET6: - netisr_queue_src(NETISR_IPV6, (uintptr_t)so, m); + netisr_queue_src(NETISR_IPV6, (uintptr_t)dcb->dcb_gencnt, m); DIVSTAT_INC(inbound); break; #endifhome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69e11395.31588.647d7280>
