Index | Thread | Search

From:
Christian Ludwig <cludwig@mailbox.org>
Subject:
Re: dead code tells no tales, 10/16
To:
Miod Vallat <miod@online.fr>, tech@openbsd.org
Date:
Mon, 21 Sep 2026 23:09:13 +0200

Download raw body.

Thread
On Sun, 2026-09-20 at 21:09 +0000, Miod Vallat wrote:
> This routine does not appear to be used anywhere.
> 
> Index: sys/net/if.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/net/if.c,v
> diff -u -p -u -p -r1.765 if.c
> --- sys/net/if.c	16 Sep 2026 06:18:35 -0000	1.765
> +++ sys/net/if.c	20 Sep 2026 16:47:44 -0000
> @@ -707,21 +707,6 @@ if_attach_common(struct ifnet *ifp)
>  }
>  
>  void
> -if_attach_ifq(struct ifnet *ifp, const struct ifq_ops *newops, void
> *args)
> -{
> -	/*
> -	 * only switch the ifq_ops on the first ifq on an interface.
> -	 *
> -	 * the only ifq_ops we provide priq and hfsc, and hfsc only
> -	 * works on a single ifq. because the code uses the ifq_ops
> -	 * on the first ifq (if_snd) to select a queue for an mbuf,
> -	 * by switching only the first one we change both the
> algorithm
> -	 * and force the routing of all new packets to it.
> -	 */
> -	ifq_attach(&ifp->if_snd, newops, args);
> -}
> -
> -void
>  if_start(struct ifnet *ifp)
>  {
>  	KASSERT(ifp->if_qstart == if_qstart_compat);
> Index: sys/net/if.h
> ===================================================================
> RCS file: /OpenBSD/src/sys/net/if.h,v
> diff -u -p -u -p -r1.224 if.h
> --- sys/net/if.h	23 Jun 2026 14:40:40 -0000	1.224
> +++ sys/net/if.h	20 Sep 2026 16:47:44 -0000
> @@ -539,7 +539,6 @@ void	if_free_sadl(struct ifnet *);
>  void	if_attach(struct ifnet *);
>  void	if_attach_queues(struct ifnet *, unsigned int);
>  void	if_attach_iqueues(struct ifnet *, unsigned int);
> -void	if_attach_ifq(struct ifnet *, const struct ifq_ops *, void
> *);
>  void	if_attachhead(struct ifnet *);
>  void	if_deactivate(struct ifnet *);
>  void	if_detach(struct ifnet *);
> 

You can also drop the unused forward declaration a few lines above:

@@ -532,14 +532,12 @@ struct if_sffpage {
 
 struct socket;
 struct ifnet;
-struct ifq_ops;
 
 void   if_alloc_sadl(struct ifnet *);
 void   if_free_sadl(struct ifnet *);
 void   if_attach(struct ifnet *);
 void   if_attach_queues(struct ifnet *, unsigned int);
 void   if_attach_iqueues(struct ifnet *, unsigned int);
-void   if_attach_ifq(struct ifnet *, const struct ifq_ops *, void *);
 void   if_attachhead(struct ifnet *);
 void   if_deactivate(struct ifnet *);
 void   if_detach(struct ifnet *);