aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2026-07-06 09:16:41 +0000
committerKristof Provost <kp@FreeBSD.org>2026-07-08 07:23:17 +0000
commitc38abd64dbc18ec10a4f80e74ae4a304c075aa5c (patch)
tree3960681146e26dfa0c2d9fe2c01eb33f4211d0c6
parent2039fe8ea421a93c466657485ba83b4b055f81dd (diff)
if_epair: support IFCAP_MEXTPG
Enable IFCAP_MEXTPG by default, which may bring performance benefits. Allow it to be disabled, and when disabled assert that we do not receive any mbufs with M_EXTPG set. This is useful for testing. Default the tests to disabling MEXTPG support. Reviewed by: zlei Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D58054
-rw-r--r--sys/net/if_epair.c7
-rw-r--r--tests/sys/common/vnet.subr4
2 files changed, 9 insertions, 2 deletions
diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c
index 60849ca1d4f2..5addd43b6190 100644
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -351,6 +351,10 @@ epair_transmit(struct ifnet *ifp, struct mbuf *m)
return (E2BIG);
}
+ if ((ifp->if_capenable & IFCAP_MEXTPG) == 0) {
+ M_ASSERTMAPPED(m);
+ }
+
/*
* We are not going to use the interface en/dequeue mechanism
* on the TX side. We are called from ether_output_frame()
@@ -632,7 +636,8 @@ epair_setup_ifp(struct epair_softc *sc, char *name, int unit)
ifp->if_capabilities =
IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING |
IFCAP_TXCSUM | IFCAP_RXCSUM |
- IFCAP_TXCSUM_IPV6 | IFCAP_RXCSUM_IPV6;
+ IFCAP_TXCSUM_IPV6 | IFCAP_RXCSUM_IPV6 |
+ IFCAP_MEXTPG;
ifp->if_capenable = ifp->if_capabilities;
epair_caps_changed(ifp);
ifp->if_transmit = epair_transmit;
diff --git a/tests/sys/common/vnet.subr b/tests/sys/common/vnet.subr
index 245dbaea517a..781bde4943fa 100644
--- a/tests/sys/common/vnet.subr
+++ b/tests/sys/common/vnet.subr
@@ -46,7 +46,9 @@ vnet_mkepair()
# compute checksums, it just marks packets that this computation still
# needs to be done. However, some test cases verify the checksum.
# Therefore disable this for IPv4 and IPv6.
- ifconfig ${ifname} -txcsum -txcsum6
+ # Also disable MEXTPG support, so the tests can verify that the network
+ # stack don't pass MEXTPG mbufs to interfaces that don't support it.
+ ifconfig ${ifname} -txcsum -txcsum6 -mextpg
list_interface $ifname
list_interface ${ifname%a}b
echo ${ifname%a}