mirror of
https://github.com/opnsense/src.git
synced 2026-02-18 18:20:26 -05:00
vtnet: improve interface capability handling
Enable the handling of the IFCAP_RXCSUM_IPV6 handling by handling IFCAP_RXCSUM and IFCAP_RXCSUM_IPV6 as a pair. Also make clear, that software and hardware LRO require receive checksum offload. Reviewed by: Timo Völker Differential Revision: https://reviews.freebsd.org/D52682 (cherry picked from commit eaf619fddcb21859311b895a0836da3171a01531)
This commit is contained in:
parent
4ac0fb6ca4
commit
b0b3245d3d
2 changed files with 14 additions and 21 deletions
|
|
@ -22,7 +22,7 @@
|
|||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd September 16, 2025
|
||||
.Dd September 26, 2025
|
||||
.Dt VTNET 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -54,6 +54,8 @@ TCP segmentation offload (TSO), TCP large receive offload (LRO),
|
|||
hardware VLAN tag stripping/insertion features, a multicast hash filter,
|
||||
as well as Jumbo Frames (up to 9216 bytes), which can be
|
||||
configured via the interface MTU setting.
|
||||
TCP/UDP receive checksum offload cannot be configured independently for IPv4
|
||||
and IPv6.
|
||||
Selecting an MTU larger than 1500 bytes with the
|
||||
.Xr ifconfig 8
|
||||
utility configures the adapter to receive and transmit Jumbo Frames.
|
||||
|
|
|
|||
|
|
@ -1151,11 +1151,9 @@ vtnet_setup_interface(struct vtnet_softc *sc)
|
|||
}
|
||||
|
||||
if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_CSUM)) {
|
||||
if_setcapabilitiesbit(ifp, IFCAP_RXCSUM, 0);
|
||||
#ifdef notyet
|
||||
/* BMV: Rx checksums not distinguished between IPv4 and IPv6. */
|
||||
if_setcapabilitiesbit(ifp, IFCAP_RXCSUM, 0);
|
||||
if_setcapabilitiesbit(ifp, IFCAP_RXCSUM_IPV6, 0);
|
||||
#endif
|
||||
|
||||
if (vtnet_tunable_int(sc, "fixup_needs_csum",
|
||||
vtnet_fixup_needs_csum) != 0)
|
||||
|
|
@ -1368,27 +1366,20 @@ vtnet_ioctl_ifcap(struct vtnet_softc *sc, struct ifreq *ifr)
|
|||
if ((mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6 | IFCAP_LRO)) ==
|
||||
IFCAP_LRO && vtnet_software_lro(sc))
|
||||
reinit = update = 0;
|
||||
|
||||
if (mask & IFCAP_RXCSUM)
|
||||
/*
|
||||
* VirtIO does not distinguish between receive checksum offload
|
||||
* for IPv4 and IPv6 packets, so treat them as a pair.
|
||||
*/
|
||||
if (mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) {
|
||||
if_togglecapenable(ifp, IFCAP_RXCSUM);
|
||||
if (mask & IFCAP_RXCSUM_IPV6)
|
||||
if_togglecapenable(ifp, IFCAP_RXCSUM_IPV6);
|
||||
}
|
||||
if (mask & IFCAP_LRO)
|
||||
if_togglecapenable(ifp, IFCAP_LRO);
|
||||
|
||||
/*
|
||||
* VirtIO does not distinguish between IPv4 and IPv6 checksums
|
||||
* so treat them as a pair. Guest TSO (LRO) requires receive
|
||||
* checksums.
|
||||
*/
|
||||
if (if_getcapenable(ifp) & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) {
|
||||
if_setcapenablebit(ifp, IFCAP_RXCSUM, 0);
|
||||
#ifdef notyet
|
||||
if_setcapenablebit(ifp, IFCAP_RXCSUM_IPV6, 0);
|
||||
#endif
|
||||
} else
|
||||
if_setcapenablebit(ifp, 0,
|
||||
(IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6 | IFCAP_LRO));
|
||||
/* Both SW and HW TCP LRO require receive checksum offload. */
|
||||
if ((if_getcapenable(ifp) &
|
||||
(IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) == 0)
|
||||
if_setcapenablebit(ifp, 0, IFCAP_LRO);
|
||||
}
|
||||
|
||||
if (mask & IFCAP_VLAN_HWFILTER) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue