Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159996228
D54283.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D54283.diff
View Options
diff --git a/share/man/man4/vtnet.4 b/share/man/man4/vtnet.4
--- a/share/man/man4/vtnet.4
+++ b/share/man/man4/vtnet.4
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd September 30, 2025
+.Dd December 18, 2025
.Dt VTNET 4
.Os
.Sh NAME
@@ -271,6 +271,8 @@
The number of requested virtqueue pairs.
.It Va dev.vtnet. Ns Ar X Ns Va .max_vq_pairs
The maximum number of supported virtqueue pairs.
+.It Va dev.vtnet. Ns Ar X Ns Va .flags
+The flags of the interface. Mostly for debugging purposes.
.El
.Sh SEE ALSO
.Xr arp 4 ,
diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c
--- a/sys/dev/virtio/network/if_vtnet.c
+++ b/sys/dev/virtio/network/if_vtnet.c
@@ -40,6 +40,7 @@
#include <sys/mbuf.h>
#include <sys/module.h>
#include <sys/msan.h>
+#include <sys/sbuf.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/random.h>
@@ -4398,6 +4399,22 @@
"Times the transmit interrupt task rescheduled itself");
}
+static int
+vtnet_sysctl_flags(SYSCTL_HANDLER_ARGS)
+{
+ struct vtnet_softc *sc;
+ struct sbuf *sb;
+ int error;
+
+ sb = sbuf_new_auto();
+ sc = (struct vtnet_softc *)arg1;
+ sbuf_printf(sb, "%b", sc->vtnet_flags, VTNET_FLAGS_BITS);
+ sbuf_finish(sb);
+ error = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1);
+ sbuf_delete(sb);
+ return (error);
+}
+
static void
vtnet_setup_sysctl(struct vtnet_softc *sc)
{
@@ -4420,6 +4437,9 @@
SYSCTL_ADD_INT(ctx, child, OID_AUTO, "act_vq_pairs",
CTLFLAG_RD, &sc->vtnet_act_vq_pairs, 0,
"Number of active virtqueue pairs");
+ SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "flags",
+ CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0,
+ vtnet_sysctl_flags, "A", "Flags");
vtnet_setup_stat_sysctl(ctx, child, sc);
}
diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h
--- a/sys/dev/virtio/network/if_vtnetvar.h
+++ b/sys/dev/virtio/network/if_vtnetvar.h
@@ -191,6 +191,11 @@
char vtnet_mtx_name[16];
uint8_t vtnet_hwaddr[ETHER_ADDR_LEN];
};
+/* vtnet flag descriptions for use with printf(9) %b identifier. */
+#define VTNET_FLAGS_BITS \
+ "\20\1MODERN\2MAC\3CTRL_VQ\4CTRL_RX\5CTRL_MAC\6VLAN_FILTER\7TSO_ECN" \
+ "\10MRG_RXBUFS\11LRO_NOMRG\12MQ\13INDIRECT\14EVENT_IDX\15SUSPENDED" \
+ "\16FIXUP_NEEDS_CSUM\17SW_LRO"
static bool
vtnet_modern(struct vtnet_softc *sc)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jun 21, 9:07 AM (4 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34145197
Default Alt Text
D54283.diff (2 KB)
Attached To
Mode
D54283: vtnet: expose flags via sysctl tree
Attached
Detach File
Event Timeline
Log In to Comment