Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jul 2019 10:14:15 +0000
From:      "aleksandr.fedorov_itglobal.com (Aleksandr Fedorov)" <phabric-noreply@FreeBSD.org>
To:        Phabricator <phabric-noreply@FreeBSD.org>
Cc:        freebsd-net@freebsd.org
Subject:   [Differential] D19422: if_vxlan(4) Allow set MTU more than 1500 bytes.
Message-ID:  <cdb82613d6eb3422df5b497157282e14@localhost.localdomain>
In-Reply-To: <differential-rev-PHID-DREV-bvtxxu4jwhzdkwqxxgd7-req@reviews.freebsd.org>
References:  <differential-rev-PHID-DREV-bvtxxu4jwhzdkwqxxgd7-req@reviews.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
aleksandr.fedorov_itglobal.com updated this revision to Diff 59684.
aleksandr.fedorov_itglobal.com edited the test plan for this revision.
aleksandr.fedorov_itglobal.com added reviewers: krion, jhb.
aleksandr.fedorov_itglobal.com added a comment.
This revision now requires review to proceed.


  I think that mtu handling in ether_ioctl () requires more work and must be done very carefully, because it is used by many other drivers. Some drivers set the IFCAP_JUMBO_MTU flag, but limit the maximum MTU size to less than 9000 bytes. Therefore, it is not so easy to handle the various requirements for drivers in ether_ioctl (), and failback to the standard MTU (1500) size may be reasonable.
  
  Revision changes:
  
  - Increase maximum allowed MTU to 65K - 100 bytes

CHANGES SINCE LAST UPDATE
  https://reviews.freebsd.org/D19422?vs=54585&id=59684

CHANGES SINCE LAST ACTION
  https://reviews.freebsd.org/D19422/new/

REVISION DETAIL
  https://reviews.freebsd.org/D19422

AFFECTED FILES
  sys/net/if_vxlan.c

EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: aleksandr.fedorov_itglobal.com, bryanv, hrs, #network, rgrimes, krion, jhb
Cc: evgueni.gavrilov_itglobal.com, olevole_olevole.ru, ae, freebsd-net-list, krzysztof.galazka_intel.com

[-- Attachment #2 --]
diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c
--- a/sys/net/if_vxlan.c
+++ b/sys/net/if_vxlan.c
@@ -84,6 +84,11 @@
 	int				 vxlsomc_users;
 };
 
+/*
+ * The maximum supported Ethernet length and some space for encapsulation.
+ */
+#define VXLAN_MAX_MTU	65435
+
 #define VXLAN_SO_MC_MAX_GROUPS		32
 
 #define VXLAN_SO_VNI_HASH_SHIFT		6
@@ -2247,10 +2252,11 @@
 	ifr = (struct ifreq *) data;
 	ifd = (struct ifdrv *) data;
 
+	error = 0;
+
 	switch (cmd) {
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
-		error = 0;
 		break;
 
 	case SIOCGDRVSPEC:
@@ -2267,6 +2273,13 @@
 		error = ifmedia_ioctl(ifp, ifr, &sc->vxl_media, cmd);
 		break;
 
+	case SIOCSIFMTU:
+		if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > VXLAN_MAX_MTU)
+			error = EINVAL;
+		else
+			ifp->if_mtu = ifr->ifr_mtu;
+		break;
+
 	default:
 		error = ether_ioctl(ifp, cmd, data);
 		break;
@@ -2747,8 +2760,8 @@
 	ifp->if_ioctl = vxlan_ioctl;
 	ifp->if_transmit = vxlan_transmit;
 	ifp->if_qflush = vxlan_qflush;
-	ifp->if_capabilities |= IFCAP_LINKSTATE;
-	ifp->if_capenable |= IFCAP_LINKSTATE;
+	ifp->if_capabilities |= IFCAP_LINKSTATE | IFCAP_JUMBO_MTU;
+	ifp->if_capenable |= IFCAP_LINKSTATE | IFCAP_JUMBO_MTU;
 
 	ifmedia_init(&sc->vxl_media, 0, vxlan_media_change, vxlan_media_status);
 	ifmedia_add(&sc->vxl_media, IFM_ETHER | IFM_AUTO, 0, NULL);


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cdb82613d6eb3422df5b497157282e14>