Index: sys/arch/amd64/conf/GENERIC.MP =================================================================== RCS file: /mount/openbsd/cvs/src/sys/arch/amd64/conf/GENERIC.MP,v diff -u -p -u -p -r1.16 GENERIC.MP --- sys/arch/amd64/conf/GENERIC.MP 9 Feb 2021 14:06:19 -0000 1.16 +++ sys/arch/amd64/conf/GENERIC.MP 28 Jan 2025 15:59:16 -0000 @@ -4,6 +4,6 @@ include "arch/amd64/conf/GENERIC" option MULTIPROCESSOR #option MP_LOCKDEBUG -#option WITNESS +option WITNESS cpu* at mainbus? Index: sys/arch/arm64/conf/GENERIC.MP =================================================================== RCS file: /mount/openbsd/cvs/src/sys/arch/arm64/conf/GENERIC.MP,v diff -u -p -u -p -r1.5 GENERIC.MP --- sys/arch/arm64/conf/GENERIC.MP 1 Jul 2018 21:05:07 -0000 1.5 +++ sys/arch/arm64/conf/GENERIC.MP 28 Jan 2025 15:59:16 -0000 @@ -4,6 +4,6 @@ include "arch/arm64/conf/GENERIC" option MULTIPROCESSOR #option MP_LOCKDEBUG -#option WITNESS +option WITNESS cpu* at mainbus? Index: sys/arch/i386/conf/GENERIC.MP =================================================================== RCS file: /mount/openbsd/cvs/src/sys/arch/i386/conf/GENERIC.MP,v diff -u -p -u -p -r1.11 GENERIC.MP --- sys/arch/i386/conf/GENERIC.MP 3 Jun 2018 05:18:33 -0000 1.11 +++ sys/arch/i386/conf/GENERIC.MP 28 Jan 2025 15:59:16 -0000 @@ -7,6 +7,6 @@ include "arch/i386/conf/GENERIC" option MULTIPROCESSOR # Multiple processor support #option MP_LOCKDEBUG -#option WITNESS +option WITNESS cpu* at mainbus? Index: sys/arch/macppc/conf/GENERIC.MP =================================================================== RCS file: /mount/openbsd/cvs/src/sys/arch/macppc/conf/GENERIC.MP,v diff -u -p -u -p -r1.2 GENERIC.MP --- sys/arch/macppc/conf/GENERIC.MP 15 Apr 2020 08:09:33 -0000 1.2 +++ sys/arch/macppc/conf/GENERIC.MP 28 Jan 2025 15:59:16 -0000 @@ -4,6 +4,6 @@ include "arch/macppc/conf/GENERIC" option MULTIPROCESSOR #option MP_LOCKDEBUG -#option WITNESS +option WITNESS cpu* at mainbus? Index: sys/arch/powerpc64/conf/GENERIC.MP =================================================================== RCS file: /mount/openbsd/cvs/src/sys/arch/powerpc64/conf/GENERIC.MP,v diff -u -p -u -p -r1.1 GENERIC.MP --- sys/arch/powerpc64/conf/GENERIC.MP 21 Jul 2020 21:38:31 -0000 1.1 +++ sys/arch/powerpc64/conf/GENERIC.MP 28 Jan 2025 15:59:16 -0000 @@ -4,6 +4,6 @@ include "arch/powerpc64/conf/GENERIC" option MULTIPROCESSOR #option MP_LOCKDEBUG -#option WITNESS +option WITNESS cpu* at mainbus? Index: sys/arch/riscv64/conf/GENERIC.MP =================================================================== RCS file: /mount/openbsd/cvs/src/sys/arch/riscv64/conf/GENERIC.MP,v diff -u -p -u -p -r1.1 GENERIC.MP --- sys/arch/riscv64/conf/GENERIC.MP 29 Jun 2021 21:27:52 -0000 1.1 +++ sys/arch/riscv64/conf/GENERIC.MP 28 Jan 2025 15:59:16 -0000 @@ -4,6 +4,6 @@ include "arch/riscv64/conf/GENERIC" option MULTIPROCESSOR #option MP_LOCKDEBUG -#option WITNESS +option WITNESS cpu* at mainbus? Index: sys/net/if.c =================================================================== RCS file: /mount/openbsd/cvs/src/sys/net/if.c,v diff -u -p -u -p -r1.725 if.c --- sys/net/if.c 25 Jan 2025 10:53:36 -0000 1.725 +++ sys/net/if.c 28 Jan 2025 15:59:14 -0000 @@ -975,7 +975,7 @@ if_output_local(struct ifnet *ifp, struc ifiq = ifp->if_iqs[flow % ifp->if_niqs]; - return (ifiq_enqueue(ifiq, m) == 0 ? 0 : ENOBUFS); + return (ifiq_enqueue_qlim(ifiq, m, 8192) == 0 ? 0 : ENOBUFS); } void Index: sys/net/ifq.c =================================================================== RCS file: /mount/openbsd/cvs/src/sys/net/ifq.c,v diff -u -p -u -p -r1.55 ifq.c --- sys/net/ifq.c 20 Nov 2024 02:18:45 -0000 1.55 +++ sys/net/ifq.c 28 Jan 2025 15:59:14 -0000 @@ -796,9 +796,10 @@ ifiq_add_data(struct ifiqueue *ifiq, str } int -ifiq_enqueue(struct ifiqueue *ifiq, struct mbuf *m) +ifiq_enqueue_qlim(struct ifiqueue *ifiq, struct mbuf *m, unsigned int qlim) { struct ifnet *ifp = ifiq->ifiq_if; + unsigned int len; #if NBPFILTER > 0 caddr_t if_bpf = ifp->if_bpf; #endif @@ -825,9 +826,21 @@ ifiq_enqueue(struct ifiqueue *ifiq, stru mtx_enter(&ifiq->ifiq_mtx); ifiq->ifiq_packets++; ifiq->ifiq_bytes += m->m_pkthdr.len; - ifiq->ifiq_enqueues++; - ml_enqueue(&ifiq->ifiq_ml, m); + + if (qlim && ((len = ml_len(&ifiq->ifiq_ml) >= qlim))) { + ifiq->ifiq_qdrops++; + } else { + ifiq->ifiq_enqueues++; + ml_enqueue(&ifiq->ifiq_ml, m); + m = NULL; + } + mtx_leave(&ifiq->ifiq_mtx); + + if (m) { + m_freem(m); + return (0); + } task_add(ifiq->ifiq_softnet, &ifiq->ifiq_task); Index: sys/net/ifq.h =================================================================== RCS file: /mount/openbsd/cvs/src/sys/net/ifq.h,v diff -u -p -u -p -r1.42 ifq.h --- sys/net/ifq.h 20 Nov 2024 02:18:45 -0000 1.42 +++ sys/net/ifq.h 28 Jan 2025 15:59:14 -0000 @@ -488,11 +488,18 @@ ifq_idx(struct ifqueue *ifq, unsigned in void ifiq_init(struct ifiqueue *, struct ifnet *, unsigned int); void ifiq_destroy(struct ifiqueue *); int ifiq_input(struct ifiqueue *, struct mbuf_list *); -int ifiq_enqueue(struct ifiqueue *, struct mbuf *); +int ifiq_enqueue_qlim(struct ifiqueue *, struct mbuf *, + unsigned int); void ifiq_add_data(struct ifiqueue *, struct if_data *); #define ifiq_len(_ifiq) READ_ONCE(ml_len(&(_ifiq)->ifiq_ml)) #define ifiq_empty(_ifiq) (ifiq_len(_ifiq) == 0) + +static inline int +ifiq_enqueue(struct ifiqueue *ifiq, struct mbuf *m) +{ + return ifiq_enqueue_qlim(ifiq, m, 0); +} #endif /* _KERNEL */