git: 2520cd382151 - main - if_vtnet: Only set IFCAP_JUMBO_MTU when jumbo MTU is supported

Bryan Venteicher bryanv at FreeBSD.org
Tue Jan 19 05:08:25 UTC 2021


The branch main has been updated by bryanv:

URL: https://cgit.FreeBSD.org/src/commit/?id=2520cd382151a0dd698f23d7eff78f8253cdb657

commit 2520cd382151a0dd698f23d7eff78f8253cdb657
Author:     Bryan Venteicher <bryanv at FreeBSD.org>
AuthorDate: 2021-01-19 04:55:24 +0000
Commit:     Bryan Venteicher <bryanv at FreeBSD.org>
CommitDate: 2021-01-19 04:55:24 +0000

    if_vtnet: Only set IFCAP_JUMBO_MTU when jumbo MTU is supported
    
    Reviewed by: grehan (mentor)
    Differential Revision: https://reviews.freebsd.org/D27912
---
 sys/dev/virtio/network/if_vtnet.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c
index 39009a1de3f0..ec1fc8de1a90 100644
--- a/sys/dev/virtio/network/if_vtnet.c
+++ b/sys/dev/virtio/network/if_vtnet.c
@@ -1027,12 +1027,11 @@ vtnet_setup_interface(struct vtnet_softc *sc)
 	vtnet_get_macaddr(sc);
 	ether_ifattach(ifp, sc->vtnet_hwaddr);
 
-	if (virtio_with_feature(dev, VIRTIO_NET_F_STATUS))
-		ifp->if_capabilities |= IFCAP_LINKSTATE;
-
 	/* Tell the upper layer(s) we support long frames. */
 	ifp->if_hdrlen = sizeof(struct ether_vlan_header);
-	ifp->if_capabilities |= IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU;
+
+	if (virtio_with_feature(dev, VIRTIO_NET_F_STATUS))
+		ifp->if_capabilities |= IFCAP_LINKSTATE;
 
 	if (virtio_with_feature(dev, VIRTIO_NET_F_CSUM)) {
 		int gso;
@@ -1075,6 +1074,10 @@ vtnet_setup_interface(struct vtnet_softc *sc)
 		    IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWCSUM;
 	}
 
+	if (sc->vtnet_max_mtu >= ETHERMTU_JUMBO)
+		ifp->if_capabilities |= IFCAP_JUMBO_MTU;
+	ifp->if_capabilities |= IFCAP_VLAN_MTU;
+
 	ifp->if_capenable = ifp->if_capabilities;
 
 	/*


More information about the dev-commits-src-all mailing list