fix #1343: add MTU patches for intel drivers
ported from upstream / in-tree commits 91c527a55664ddf4bee26673a35f91748dae4142 and 45693bcb00cbd379c373ab22ccd9a9d4755cc7ed
This commit is contained in:
parent
6b1201e51a
commit
973ac1a4ef
4 changed files with 124 additions and 0 deletions
3
Makefile
3
Makefile
|
@ -293,6 +293,7 @@ e1000e.ko e1000e: .compile_mark ${E1000ESRC}
|
||||||
# [ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
|
# [ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
|
||||||
cd ${E1000EDIR}; patch -p1 < ../intel-module-gcc6-compat.patch
|
cd ${E1000EDIR}; patch -p1 < ../intel-module-gcc6-compat.patch
|
||||||
cd ${E1000EDIR}; patch -p1 < ../e1000e_4.10_compat.patch
|
cd ${E1000EDIR}; patch -p1 < ../e1000e_4.10_compat.patch
|
||||||
|
cd ${E1000EDIR}; patch -p1 < ../e1000e_4.10_max-mtu.patch
|
||||||
cd ${E1000EDIR}/src; make BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
|
cd ${E1000EDIR}/src; make BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
|
||||||
cp ${E1000EDIR}/src/e1000e.ko e1000e.ko
|
cp ${E1000EDIR}/src/e1000e.ko e1000e.ko
|
||||||
|
|
||||||
|
@ -303,6 +304,7 @@ igb.ko igb: .compile_mark ${IGBSRC}
|
||||||
cd ${IGBDIR}; patch -p1 < ../intel-module-gcc6-compat.patch
|
cd ${IGBDIR}; patch -p1 < ../intel-module-gcc6-compat.patch
|
||||||
cd ${IGBDIR}; patch -p1 < ../igb_4.9_compat.patch
|
cd ${IGBDIR}; patch -p1 < ../igb_4.9_compat.patch
|
||||||
cd ${IGBDIR}; patch -p1 < ../igb_4.10_compat.patch
|
cd ${IGBDIR}; patch -p1 < ../igb_4.10_compat.patch
|
||||||
|
cd ${IGBDIR}; patch -p1 < ../igb_4.10_max-mtu.patch
|
||||||
cd ${IGBDIR}/src; make BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
|
cd ${IGBDIR}/src; make BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
|
||||||
cp ${IGBDIR}/src/igb.ko igb.ko
|
cp ${IGBDIR}/src/igb.ko igb.ko
|
||||||
|
|
||||||
|
@ -311,6 +313,7 @@ ixgbe.ko ixgbe: .compile_mark ${IXGBESRC}
|
||||||
tar xf ${IXGBESRC}
|
tar xf ${IXGBESRC}
|
||||||
# [ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
|
# [ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
|
||||||
cd ${IXGBEDIR}; patch -p1 < ../ixgbe_4.10_compat.patch
|
cd ${IXGBEDIR}; patch -p1 < ../ixgbe_4.10_compat.patch
|
||||||
|
cd ${IXGBEDIR}; patch -p1 < ../ixgbe_4.10_max-mtu.patch
|
||||||
cd ${IXGBEDIR}/src; make CFLAGS_EXTRA="-DIXGBE_NO_LRO" BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
|
cd ${IXGBEDIR}/src; make CFLAGS_EXTRA="-DIXGBE_NO_LRO" BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
|
||||||
cp ${IXGBEDIR}/src/ixgbe.ko ixgbe.ko
|
cp ${IXGBEDIR}/src/ixgbe.ko ixgbe.ko
|
||||||
|
|
||||||
|
|
37
e1000e_4.10_max-mtu.patch
Normal file
37
e1000e_4.10_max-mtu.patch
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
diff --git a/src/netdev.c b/src/netdev.c
|
||||||
|
index 73b0f9a..aef1bc2 100644
|
||||||
|
--- a/src/netdev.c
|
||||||
|
+++ b/src/netdev.c
|
||||||
|
@@ -6724,19 +6724,12 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
|
||||||
|
int max_frame = new_mtu + VLAN_ETH_HLEN + ETH_FCS_LEN;
|
||||||
|
|
||||||
|
/* Jumbo frame support */
|
||||||
|
- if ((max_frame > (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN)) &&
|
||||||
|
+ if ((new_mtu > ETH_DATA_LEN) &&
|
||||||
|
!(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) {
|
||||||
|
e_err("Jumbo Frames not supported.\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- /* Supported frame sizes */
|
||||||
|
- if ((new_mtu < (VLAN_ETH_ZLEN + ETH_FCS_LEN)) ||
|
||||||
|
- (max_frame > adapter->max_hw_frame_size)) {
|
||||||
|
- e_err("Unsupported MTU setting\n");
|
||||||
|
- return -EINVAL;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
/* Jumbo frame workaround on 82579 and newer requires CRC be stripped */
|
||||||
|
if ((adapter->hw.mac.type >= e1000_pch2lan) &&
|
||||||
|
!(adapter->flags2 & FLAG2_CRC_STRIPPING) &&
|
||||||
|
@@ -8262,6 +8255,11 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||||
|
#endif /* HAVE_NETDEV_VLAN_FEATURES */
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* MTU range: 68 - max_hw_frame_size */
|
||||||
|
+ netdev->min_mtu = ETH_MIN_MTU;
|
||||||
|
+ netdev->max_mtu = adapter->max_hw_frame_size -
|
||||||
|
+ (VLAN_ETH_HLEN + ETH_FCS_LEN);
|
||||||
|
+
|
||||||
|
if (e1000e_enable_mng_pass_thru(&adapter->hw))
|
||||||
|
adapter->flags |= FLAG_MNG_PT_ENABLED;
|
||||||
|
|
47
igb_4.10_max-mtu.patch
Normal file
47
igb_4.10_max-mtu.patch
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
diff --git a/src/e1000_defines.h b/src/e1000_defines.h
|
||||||
|
index 6de3988..d58e12f 100644
|
||||||
|
--- a/src/e1000_defines.h
|
||||||
|
+++ b/src/e1000_defines.h
|
||||||
|
@@ -423,7 +423,8 @@
|
||||||
|
#define ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.3ac packet */
|
||||||
|
|
||||||
|
#define ETHERNET_FCS_SIZE 4
|
||||||
|
-#define MAX_JUMBO_FRAME_SIZE 0x3F00
|
||||||
|
+#define MAX_JUMBO_FRAME_SIZE 0x2600
|
||||||
|
+#define MAX_STD_JUMBO_FRAME_SIZE 9216
|
||||||
|
/* The datasheet maximum supported RX size is 9.5KB (9728 bytes) */
|
||||||
|
#define MAX_RX_JUMBO_FRAME_SIZE 0x2600
|
||||||
|
#define E1000_TX_PTR_GAP 0x1F
|
||||||
|
diff --git a/src/igb_main.c b/src/igb_main.c
|
||||||
|
index 2dff0f4..bbfe87e 100644
|
||||||
|
--- a/src/igb_main.c
|
||||||
|
+++ b/src/igb_main.c
|
||||||
|
@@ -2852,6 +2852,10 @@ static int igb_probe(struct pci_dev *pdev,
|
||||||
|
if (pci_using_dac)
|
||||||
|
netdev->features |= NETIF_F_HIGHDMA;
|
||||||
|
|
||||||
|
+ /* MTU range: 68 - 9216 */
|
||||||
|
+ netdev->min_mtu = ETH_MIN_MTU;
|
||||||
|
+ netdev->max_mtu = MAX_STD_JUMBO_FRAME_SIZE;
|
||||||
|
+
|
||||||
|
adapter->en_mng_pt = e1000_enable_mng_pass_thru(hw);
|
||||||
|
#ifdef DEBUG
|
||||||
|
if (adapter->dmac != IGB_DMAC_DISABLE)
|
||||||
|
@@ -5832,17 +5836,6 @@ static int igb_change_mtu(struct net_device *netdev, int new_mtu)
|
||||||
|
struct pci_dev *pdev = adapter->pdev;
|
||||||
|
int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
|
||||||
|
|
||||||
|
- if ((new_mtu < 68) || (max_frame > MAX_JUMBO_FRAME_SIZE)) {
|
||||||
|
- dev_err(pci_dev_to_dev(pdev), "Invalid MTU setting\n");
|
||||||
|
- return -EINVAL;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
-#define MAX_STD_JUMBO_FRAME_SIZE 9238
|
||||||
|
- if (max_frame > MAX_STD_JUMBO_FRAME_SIZE) {
|
||||||
|
- dev_err(pci_dev_to_dev(pdev), "MTU > 9216 not supported.\n");
|
||||||
|
- return -EINVAL;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
/* adjust max frame to be at least the size of a standard frame */
|
||||||
|
if (max_frame < (ETH_FRAME_LEN + ETH_FCS_LEN))
|
||||||
|
max_frame = ETH_FRAME_LEN + ETH_FCS_LEN;
|
37
ixgbe_4.10_max-mtu.patch
Normal file
37
ixgbe_4.10_max-mtu.patch
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
diff --git a/src/ixgbe_main.c b/src/ixgbe_main.c
|
||||||
|
index 83c6250..fe226cd 100644
|
||||||
|
--- a/src/ixgbe_main.c
|
||||||
|
+++ b/src/ixgbe_main.c
|
||||||
|
@@ -6379,11 +6379,6 @@ static void ixgbe_free_all_rx_resources(struct ixgbe_adapter *adapter)
|
||||||
|
static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu)
|
||||||
|
{
|
||||||
|
struct ixgbe_adapter *adapter = netdev_priv(netdev);
|
||||||
|
- int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
|
||||||
|
-
|
||||||
|
- /* MTU < 68 is an error and causes problems on some kernels */
|
||||||
|
- if ((new_mtu < 68) || (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE))
|
||||||
|
- return -EINVAL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For 82599EB we cannot allow legacy VFs to enable their receive
|
||||||
|
@@ -6392,7 +6387,7 @@ static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu)
|
||||||
|
*/
|
||||||
|
if ((adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) &&
|
||||||
|
(adapter->hw.mac.type == ixgbe_mac_82599EB) &&
|
||||||
|
- (max_frame > (ETH_FRAME_LEN + ETH_FCS_LEN)))
|
||||||
|
+ (new_mtu > ETH_DATA_LEN))
|
||||||
|
e_warn(probe, "Setting MTU > 1500 will disable legacy VFs\n");
|
||||||
|
|
||||||
|
e_info(probe, "changing MTU from %d to %d\n", netdev->mtu, new_mtu);
|
||||||
|
@@ -10134,6 +10129,11 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
|
||||||
|
#ifdef IFF_SUPP_NOFCS
|
||||||
|
netdev->priv_flags |= IFF_SUPP_NOFCS;
|
||||||
|
#endif
|
||||||
|
+
|
||||||
|
+ /* MTU range: 68 - 9710 */
|
||||||
|
+ netdev->min_mtu = ETH_MIN_MTU;
|
||||||
|
+ netdev->max_mtu = IXGBE_MAX_JUMBO_FRAME_SIZE - (ETH_HLEN + ETH_FCS_LEN);
|
||||||
|
+
|
||||||
|
#if IS_ENABLED(CONFIG_DCB)
|
||||||
|
if (adapter->flags & IXGBE_FLAG_DCB_CAPABLE)
|
||||||
|
netdev->dcbnl_ops = &dcbnl_ops;
|
Loading…
Reference in a new issue