git: d79539e6f2ee - main - IfAPI: Add if_altq_is_enabled() interface.

From: Justin Hibbits <jhibbits_at_FreeBSD.org>
Date: Tue, 31 Jan 2023 20:03:21 UTC
The branch main has been updated by jhibbits:

URL: https://cgit.FreeBSD.org/src/commit/?id=d79539e6f2eea0d659b1a96e0447e2fa9e2122fa

commit d79539e6f2eea0d659b1a96e0447e2fa9e2122fa
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2023-01-25 20:08:12 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2023-01-31 20:02:17 +0000

    IfAPI: Add if_altq_is_enabled() interface.
    
    Summary:
    The only user of the ALTQ_IS_ENABLED() in a driver checks against the
    ifnet queue.  Abstract that all out and present the interface to check
    if ALTQ is enabled on the interface.
    
    Sponsored by:   Juniper Networks, Inc.
    Reviewed By:    glebius
    Differential Revision: https://reviews.freebsd.org/D38204
---
 sys/net/if.c     | 6 ++++++
 sys/net/if_var.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/sys/net/if.c b/sys/net/if.c
index 2ab12d1ac313..951349b97ffb 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -4905,6 +4905,12 @@ if_getcounter(if_t ifp, ift_counter counter)
 	return (ifp->if_get_counter(ifp, counter));
 }
 
+bool
+if_altq_is_enabled(if_t ifp)
+{
+	return (ALTQ_IS_ENABLED(&ifp->if_snd));
+}
+
 struct vnet *
 if_getvnet(if_t ifp)
 {
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index dbf8796865f0..4c3d4138f7ec 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -646,6 +646,8 @@ struct bpf_if *if_getbpf(if_t ifp);
 uint8_t if_getpcp(if_t ifp);
 void *if_getl2com(if_t ifp);
 struct ifvlantrunk *if_getvlantrunk(if_t ifp);
+bool if_altq_is_enabled(if_t ifp);
+
 void *if_getafdata(if_t ifp, int);
 
 /*