git: 108e5d07805e - main - vtnet(4): Added tunable hw.vtnet.altq_disable

From: Warner Losh <imp_at_FreeBSD.org>
Date: Mon, 28 Apr 2025 16:30:54 UTC
The branch main has been updated by imp:

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

commit 108e5d07805e6bced5e74fb986a65100022b8e87
Author:     Bjoern Jakobsen <Bjoern.Jakobsen@lrz.de>
AuthorDate: 2025-04-28 06:18:32 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-04-28 16:30:36 +0000

    vtnet(4): Added tunable hw.vtnet.altq_disable
    
    Signed-off-by: Bjoern Jakobsen <Bjoern.Jakobsen@lrz.de>
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1679
---
 sys/dev/virtio/network/if_vtnet.c    | 13 +++++++++++++
 sys/dev/virtio/network/if_vtnetvar.h |  4 +++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c
index 5060861ca7e0..ddc691744190 100644
--- a/sys/dev/virtio/network/if_vtnet.c
+++ b/sys/dev/virtio/network/if_vtnet.c
@@ -309,6 +309,19 @@ static int vtnet_lro_mbufq_depth = 0;
 SYSCTL_UINT(_hw_vtnet, OID_AUTO, lro_mbufq_depth, CTLFLAG_RDTUN,
     &vtnet_lro_mbufq_depth, 0, "Depth of software LRO mbuf queue");
 
+/* Deactivate ALTQ Support */
+static int vtnet_altq_disable = 0;
+SYSCTL_INT(_hw_vtnet, OID_AUTO, altq_disable, CTLFLAG_RDTUN,
+    &vtnet_altq_disable, 0, "Disables ALTQ Support");
+
+/*
+ * For the driver to be considered as having altq enabled,
+ * it must be compiled with an ALTQ capable kernel,
+ * and the tunable hw.vtnet.altq_disable must be zero
+ */
+#define VTNET_ALTQ_ENABLED (VTNET_ALTQ_CAPABLE && (!vtnet_altq_disable))
+
+
 static uma_zone_t vtnet_tx_header_zone;
 
 static struct virtio_feature_desc vtnet_feature_desc[] = {
diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h
index 46dad385345d..b47b15543dce 100644
--- a/sys/dev/virtio/network/if_vtnetvar.h
+++ b/sys/dev/virtio/network/if_vtnetvar.h
@@ -29,8 +29,10 @@
 #ifndef _IF_VTNETVAR_H
 #define _IF_VTNETVAR_H
 
+#define VTNET_ALTQ_CAPABLE (0)
 #ifdef ALTQ
-#define	VTNET_LEGACY_TX
+#undef VTNET_ALTQ_CAPABLE
+#define	VTNET_ALTQ_CAPABLE (1)
 #endif
 
 struct vtnet_softc;