Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F154267735
D55588.id172921.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D55588.id172921.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 December 19, 2025
+.Dd February 28, 2026
.Dt VTNET 4
.Os
.Sh NAME
@@ -87,19 +87,6 @@
This also implies that TCP segmentation offloading and large receive offload
are disabled.
The default value is 0.
-.It Va hw.vtnet.fixup_needs_csum
-.It Va hw.vtnet. Ns Ar X Ns Va .fixup_needs_csum
-This tunable enforces the calculation of a valid TCP or UDP checksum for
-packets received with
-.Dv VIRTIO_NET_HDR_F_NEEDS_CSUM
-being set in the
-.Va flags
-field of the structure
-.Vt struct virtio_net_hdr .
-It also marks the checksum as being correct in the mbuf packet header.
-The default value is 0.
-This tunable is deprecated and will be removed in
-.Fx 16 .
.It Va hw.vtnet.tso_disable
.It Va hw.vtnet. Ns Ar X Ns Va .tso_disable
This tunable disables TCP segmentation offloading.
@@ -174,9 +161,8 @@
The different reasons for the failure are counted by
.Va dev.vtnet. Ns Ar X Ns Va .rx_csum_inaccessible_ipproto ,
.Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_ipproto ,
-.Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_ethtype ,
and
-.Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_offset .
+.Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_ethtype .
.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .csum
The number of times receive checksum offloading for UDP or TCP was performed.
.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .ierrors
@@ -239,12 +225,6 @@
.It Va dev.vtnet. Ns Ar X Ns Va .rx_csum_inaccessible_ipproto
The number of times a packet with a request for receive or transmit checksum
offloading was received where the IP protocol was not accessible.
-.It Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_offset
-The number of times fixing the checksum required by
-.Va hw.vtnet.fixup_needs_csum
-or
-.Va hw.vtnet. Ns Ar X Ns Va .fixup_needs_csum
-was attempted for a packet where the csum is not located in the first mbuf.
.It Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_ipproto
The number of times a packet with a request for receive or transmit checksum
offloading was received where the IP protocol was neither TCP nor UDP.
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
@@ -135,7 +135,7 @@
static int vtnet_rxq_enqueue_buf(struct vtnet_rxq *, struct mbuf *);
static int vtnet_rxq_new_buf(struct vtnet_rxq *);
#if defined(INET) || defined(INET6)
-static int vtnet_rxq_csum_needs_csum(struct vtnet_rxq *, struct mbuf *,
+static void vtnet_rxq_csum_needs_csum(struct vtnet_rxq *, struct mbuf *,
bool, int, struct virtio_net_hdr *);
static void vtnet_rxq_csum_data_valid(struct vtnet_rxq *, struct mbuf *,
int);
@@ -273,11 +273,6 @@
SYSCTL_INT(_hw_vtnet, OID_AUTO, csum_disable, CTLFLAG_RDTUN,
&vtnet_csum_disable, 0, "Disables receive and send checksum offload");
-static int vtnet_fixup_needs_csum = 0;
-SYSCTL_INT(_hw_vtnet, OID_AUTO, fixup_needs_csum, CTLFLAG_RDTUN,
- &vtnet_fixup_needs_csum, 0,
- "Calculate valid checksum for NEEDS_CSUM packets");
-
static int vtnet_tso_disable = 0;
SYSCTL_INT(_hw_vtnet, OID_AUTO, tso_disable, CTLFLAG_RDTUN,
&vtnet_tso_disable, 0, "Disables TSO");
@@ -1158,10 +1153,6 @@
if_setcapabilitiesbit(ifp, IFCAP_RXCSUM, 0);
if_setcapabilitiesbit(ifp, IFCAP_RXCSUM_IPV6, 0);
- if (vtnet_tunable_int(sc, "fixup_needs_csum",
- vtnet_fixup_needs_csum) != 0)
- sc->vtnet_flags |= VTNET_FLAG_FIXUP_NEEDS_CSUM;
-
/* Support either "hardware" or software LRO. */
if_setcapabilitiesbit(ifp, IFCAP_LRO, 0);
}
@@ -1784,12 +1775,10 @@
}
#if defined(INET) || defined(INET6)
-static int
+static void
vtnet_rxq_csum_needs_csum(struct vtnet_rxq *rxq, struct mbuf *m, bool isipv6,
int protocol, struct virtio_net_hdr *hdr)
{
- struct vtnet_softc *sc;
-
/*
* The packet is likely from another VM on the same host or from the
* host that itself performed checksum offloading so Tx/Rx is basically
@@ -1800,57 +1789,18 @@
("%s: unsupported IP protocol %d", __func__, protocol));
/*
- * If the user don't want us to fix it up here by computing the
- * checksum, just forward the order to compute the checksum by setting
+ * Just forward the order to compute the checksum by setting
* the corresponding mbuf flag (e.g., CSUM_TCP).
*/
- sc = rxq->vtnrx_sc;
- if ((sc->vtnet_flags & VTNET_FLAG_FIXUP_NEEDS_CSUM) == 0) {
- switch (protocol) {
- case IPPROTO_TCP:
- m->m_pkthdr.csum_flags |=
- (isipv6 ? CSUM_TCP_IPV6 : CSUM_TCP);
- break;
- case IPPROTO_UDP:
- m->m_pkthdr.csum_flags |=
- (isipv6 ? CSUM_UDP_IPV6 : CSUM_UDP);
- break;
- }
- m->m_pkthdr.csum_data = hdr->csum_offset;
- return (0);
- }
-
- /*
- * Compute the checksum in the driver so the packet will contain a
- * valid checksum. The checksum is at csum_offset from csum_start.
- */
- int csum_off, csum_end;
- uint16_t csum;
-
- csum_off = hdr->csum_start + hdr->csum_offset;
- csum_end = csum_off + sizeof(uint16_t);
-
- /* Assume checksum will be in the first mbuf. */
- if (m->m_len < csum_end || m->m_pkthdr.len < csum_end) {
- sc->vtnet_stats.rx_csum_bad_offset++;
- return (1);
+ switch (protocol) {
+ case IPPROTO_TCP:
+ m->m_pkthdr.csum_flags |= (isipv6 ? CSUM_TCP_IPV6 : CSUM_TCP);
+ break;
+ case IPPROTO_UDP:
+ m->m_pkthdr.csum_flags |= (isipv6 ? CSUM_UDP_IPV6 : CSUM_UDP);
+ break;
}
-
- /*
- * Like in_delayed_cksum()/in6_delayed_cksum(), compute the
- * checksum and write it at the specified offset. We could
- * try to verify the packet: csum_start should probably
- * correspond to the start of the TCP/UDP header.
- *
- * BMV: Need to properly handle UDP with zero checksum. Is
- * the IPv4 header checksum implicitly validated?
- */
- csum = in_cksum_skip(m, m->m_pkthdr.len, hdr->csum_start);
- *(uint16_t *)(mtodo(m, csum_off)) = csum;
- m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR;
- m->m_pkthdr.csum_data = 0xFFFF;
-
- return (0);
+ m->m_pkthdr.csum_data = hdr->csum_offset;
}
static void
@@ -1934,8 +1884,7 @@
}
if (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM)
- return (vtnet_rxq_csum_needs_csum(rxq, m, isipv6, protocol,
- hdr));
+ vtnet_rxq_csum_needs_csum(rxq, m, isipv6, protocol, hdr);
else /* VIRTIO_NET_HDR_F_DATA_VALID */
vtnet_rxq_csum_data_valid(rxq, m, protocol);
@@ -4354,9 +4303,6 @@
SYSCTL_ADD_UQUAD(ctx, child, OID_AUTO, "rx_csum_bad_ipproto",
CTLFLAG_RD | CTLFLAG_STATS, &stats->rx_csum_bad_ipproto,
"Received checksum offloaded buffer with incorrect IP protocol");
- SYSCTL_ADD_UQUAD(ctx, child, OID_AUTO, "rx_csum_bad_offset",
- CTLFLAG_RD | CTLFLAG_STATS, &stats->rx_csum_bad_offset,
- "Received checksum offloaded buffer with incorrect offset");
SYSCTL_ADD_UQUAD(ctx, child, OID_AUTO, "rx_csum_inaccessible_ipproto",
CTLFLAG_RD | CTLFLAG_STATS, &stats->rx_csum_inaccessible_ipproto,
"Received checksum offloaded buffer with inaccessible IP protocol");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 28, 12:13 PM (17 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32276486
Default Alt Text
D55588.id172921.diff (6 KB)
Attached To
Mode
D55588: vtnet: remove loader tunable fixup_needs_csum
Attached
Detach File
Event Timeline
Log In to Comment