vtnet: expose flags via sysctl tree
Provide the flags used for a vtnet interface via the sysctl tree. This is mostly used for debugging purposes. Reviewed by: Timo Völker MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D54283
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd September 30, 2025
|
.Dd December 18, 2025
|
||||||
.Dt VTNET 4
|
.Dt VTNET 4
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -271,6 +271,8 @@ The number of active virtqueue pairs.
|
|||||||
The number of requested virtqueue pairs.
|
The number of requested virtqueue pairs.
|
||||||
.It Va dev.vtnet. Ns Ar X Ns Va .max_vq_pairs
|
.It Va dev.vtnet. Ns Ar X Ns Va .max_vq_pairs
|
||||||
The maximum number of supported virtqueue 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
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr arp 4 ,
|
.Xr arp 4 ,
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include <sys/mbuf.h>
|
#include <sys/mbuf.h>
|
||||||
#include <sys/module.h>
|
#include <sys/module.h>
|
||||||
#include <sys/msan.h>
|
#include <sys/msan.h>
|
||||||
|
#include <sys/sbuf.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <sys/random.h>
|
#include <sys/random.h>
|
||||||
@@ -4398,6 +4399,22 @@ vtnet_setup_stat_sysctl(struct sysctl_ctx_list *ctx,
|
|||||||
"Times the transmit interrupt task rescheduled itself");
|
"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
|
static void
|
||||||
vtnet_setup_sysctl(struct vtnet_softc *sc)
|
vtnet_setup_sysctl(struct vtnet_softc *sc)
|
||||||
{
|
{
|
||||||
@@ -4420,6 +4437,9 @@ vtnet_setup_sysctl(struct vtnet_softc *sc)
|
|||||||
SYSCTL_ADD_INT(ctx, child, OID_AUTO, "act_vq_pairs",
|
SYSCTL_ADD_INT(ctx, child, OID_AUTO, "act_vq_pairs",
|
||||||
CTLFLAG_RD, &sc->vtnet_act_vq_pairs, 0,
|
CTLFLAG_RD, &sc->vtnet_act_vq_pairs, 0,
|
||||||
"Number of active virtqueue pairs");
|
"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);
|
vtnet_setup_stat_sysctl(ctx, child, sc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,6 +191,11 @@ struct vtnet_softc {
|
|||||||
char vtnet_mtx_name[16];
|
char vtnet_mtx_name[16];
|
||||||
uint8_t vtnet_hwaddr[ETHER_ADDR_LEN];
|
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
|
static bool
|
||||||
vtnet_modern(struct vtnet_softc *sc)
|
vtnet_modern(struct vtnet_softc *sc)
|
||||||
|
|||||||
Reference in New Issue
Block a user