From d79539e6f2eea0d659b1a96e0447e2fa9e2122fa Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Wed, 25 Jan 2023 15:08:12 -0500 Subject: [PATCH] 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 2ab12d1ac31..951349b97ff 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 dbf8796865f..4c3d4138f7e 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); /*