From: Miod Vallat Subject: dead code tells no tales, 11/16 To: tech@openbsd.org Date: Sun, 20 Sep 2026 21:10:22 +0000 Keeping ifq_mfreem makes sense from a completeness point of view, but as nothing makes use of it, why not move it to the Attic for a while? Index: sys/net/ifq.c =================================================================== RCS file: /OpenBSD/src/sys/net/ifq.c,v diff -u -p -u -p -r1.62 ifq.c --- sys/net/ifq.c 28 Jul 2025 05:25:44 -0000 1.62 +++ sys/net/ifq.c 20 Sep 2026 16:47:44 -0000 @@ -570,16 +570,6 @@ ifq_q_leave(struct ifqueue *ifq, void *q } void -ifq_mfreem(struct ifqueue *ifq, struct mbuf *m) -{ - MUTEX_ASSERT_LOCKED(&ifq->ifq_mtx); - - ifq->ifq_len--; - ifq->ifq_qdrops++; - ml_enqueue(&ifq->ifq_free, m); -} - -void ifq_mfreeml(struct ifqueue *ifq, struct mbuf_list *ml) { MUTEX_ASSERT_LOCKED(&ifq->ifq_mtx); Index: sys/net/ifq.h =================================================================== RCS file: /OpenBSD/src/sys/net/ifq.h,v diff -u -p -u -p -r1.44 ifq.h --- sys/net/ifq.h 4 Mar 2025 01:13:37 -0000 1.44 +++ sys/net/ifq.h 20 Sep 2026 16:47:44 -0000 @@ -213,15 +213,15 @@ struct ifiqueue { * The queue lock acquired with ifq_q_enter() is released with * ifq_q_leave(). * - * === ifq_mfreem() and ifq_mfreeml() + * === ifq_mfreeml() * * A goal of the API is to avoid freeing an mbuf while mutexes are * held. Because the ifq API manages the lock on behalf of the backend * ifqops, the backend should not directly free mbufs. If a conditioner * backend needs to drop a packet during the handling of ifqop_deq_begin, - * it may free it by calling ifq_mfreem(). This accounts for the drop, - * and schedules the free of the mbuf outside the hold of ifq_mtx. - * ifq_mfreeml() takes an mbuf list as an argument instead. + * it may free it by calling ifq_mfreeml() with an mbuf list. This accounts + * for the drop, and schedules the free of the mbuf outside the hold of + * ifq_mtx. * * * == Network Driver API @@ -437,7 +437,6 @@ void ifq_deq_rollback(struct ifqueue * struct mbuf *ifq_dequeue(struct ifqueue *); int ifq_hdatalen(struct ifqueue *); void ifq_init_maxlen(struct ifqueue *, unsigned int); -void ifq_mfreem(struct ifqueue *, struct mbuf *); void ifq_mfreeml(struct ifqueue *, struct mbuf_list *); unsigned int ifq_purge(struct ifqueue *); void *ifq_q_enter(struct ifqueue *, const struct ifq_ops *);