rm -rf ${E1000EDIR}
tar xf ${E1000ESRC}
[ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false)
- 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_max-mtu.patch
+ cd ${E1000EDIR}; patch -p1 < ../patches/intel/intel-module-gcc6-compat.patch
+ cd ${E1000EDIR}; patch -p1 < ../patches/intel/e1000e/e1000e_4.10_compat.patch
+ cd ${E1000EDIR}; patch -p1 < ../patches/intel/e1000e/e1000e_4.10_max-mtu.patch
cd ${E1000EDIR}/src; make BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
cp ${E1000EDIR}/src/e1000e.ko e1000e.ko
rm -rf ${IGBDIR}
tar xf ${IGBSRC}
[ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false)
- cd ${IGBDIR}; patch -p1 < ../intel-module-gcc6-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_max-mtu.patch
+ cd ${IGBDIR}; patch -p1 < ../patches/intel/intel-module-gcc6-compat.patch
+ cd ${IGBDIR}; patch -p1 < ../patches/intel/igb/igb_4.9_compat.patch
+ cd ${IGBDIR}; patch -p1 < ../patches/intel/igb/igb_4.10_compat.patch
+ cd ${IGBDIR}; patch -p1 < ../patches/intel/igb/igb_4.10_max-mtu.patch
cd ${IGBDIR}/src; make BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
cp ${IGBDIR}/src/igb.ko igb.ko
rm -rf ${IXGBEDIR}
tar xf ${IXGBESRC}
[ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false)
- cd ${IXGBEDIR}; patch -p1 < ../ixgbe_4.10_compat.patch
- cd ${IXGBEDIR}; patch -p1 < ../ixgbe_4.10_max-mtu.patch
+ cd ${IXGBEDIR}; patch -p1 < ../patches/intel/ixgbe/ixgbe_4.10_compat.patch
+ cd ${IXGBEDIR}; patch -p1 < ../patches/intel/ixgbe/ixgbe_4.10_max-mtu.patch
cd ${IXGBEDIR}/src; make CFLAGS_EXTRA="-DIXGBE_NO_LRO" BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
cp ${IXGBEDIR}/src/ixgbe.ko ixgbe.ko
+++ /dev/null
- src/{netdev.c.orig => netdev.c} | 18 +++++++++---------
- src/{ptp.c.orig => ptp.c} | 4 ++--
- 2 files changed, 11 insertions(+), 11 deletions(-)
-
-diff --git a/src/netdev.c.orig b/src/netdev.c
-index 73b0f9a..480265b 100644
---- a/src/netdev.c.orig
-+++ b/src/netdev.c
-@@ -4833,24 +4833,24 @@ void e1000e_reinit_locked(struct e1000_adapter *adapter)
- /**
- * e1000e_sanitize_systim - sanitize raw cycle counter reads
- * @hw: pointer to the HW structure
-- * @systim: cycle_t value read, sanitized and returned
-+ * @systim: u64 value read, sanitized and returned
- *
- * Errata for 82574/82583 possible bad bits read from SYSTIMH/L:
- * check to see that the time is incrementing at a reasonable
- * rate and is a multiple of incvalue.
- **/
--static cycle_t e1000e_sanitize_systim(struct e1000_hw *hw, cycle_t systim)
-+static u64 e1000e_sanitize_systim(struct e1000_hw *hw, u64 systim)
- {
- u64 time_delta, rem, temp;
-- cycle_t systim_next;
-+ u64 systim_next;
- u32 incvalue;
- int i;
-
- incvalue = er32(TIMINCA) & E1000_TIMINCA_INCVALUE_MASK;
- for (i = 0; i < E1000_MAX_82574_SYSTIM_REREADS; i++) {
- /* latch SYSTIMH on read of SYSTIML */
-- systim_next = (cycle_t)er32(SYSTIML);
-- systim_next |= (cycle_t)er32(SYSTIMH) << 32;
-+ systim_next = (u64)er32(SYSTIML);
-+ systim_next |= (u64)er32(SYSTIMH) << 32;
-
- time_delta = systim_next - systim;
- temp = time_delta;
-@@ -4872,13 +4872,13 @@ static cycle_t e1000e_sanitize_systim(struct e1000_hw *hw, cycle_t systim)
- * e1000e_cyclecounter_read - read raw cycle counter (used by time counter)
- * @cc: cyclecounter structure
- **/
--static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)
-+static u64 e1000e_cyclecounter_read(const struct cyclecounter *cc)
- {
- struct e1000_adapter *adapter = container_of(cc, struct e1000_adapter,
- cc);
- struct e1000_hw *hw = &adapter->hw;
- u32 systimel, systimeh;
-- cycle_t systim;
-+ u64 systim;
- /* SYSTIMH latching upon SYSTIML read does not work well.
- * This means that if SYSTIML overflows after we read it but before
- * we read SYSTIMH, the value of SYSTIMH has been incremented and we
-@@ -4899,8 +4899,8 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)
- systimel = systimel_2;
- }
- }
-- systim = (cycle_t)systimel;
-- systim |= (cycle_t)systimeh << 32;
-+ systim = (u64)systimel;
-+ systim |= (u64)systimeh << 32;
-
- if (adapter->flags2 & FLAG2_CHECK_SYSTIM_OVERFLOW)
- systim = e1000e_sanitize_systim(hw, systim);
-
-diff --git a/src/ptp.c.orig b/src/ptp.c
-index 00c419f..228adce 100644
---- a/src/ptp.c.orig
-+++ b/src/ptp.c
-@@ -136,8 +136,8 @@ static int e1000e_phc_get_syncdevicetime(ktime_t * device,
- unsigned long flags;
- int i;
- u32 tsync_ctrl;
-- cycle_t dev_cycles;
-- cycle_t sys_cycles;
-+ u64 dev_cycles;
-+ u64 sys_cycles;
-
- tsync_ctrl = er32(TSYNCTXCTL);
- tsync_ctrl |= E1000_TSYNCTXCTL_START_SYNC |
+++ /dev/null
-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;
-
+++ /dev/null
- src/{igb_ptp.c.orig => igb_ptp.c} | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/igb_ptp.c.orig b/src/igb_ptp.c
-index 744fa65..f334ac7 100644
---- a/src/igb_ptp.c.orig
-+++ b/src/igb_ptp.c
-@@ -93,7 +93,7 @@
- * SYSTIM read access for the 82576
- */
-
--static cycle_t igb_ptp_read_82576(const struct cyclecounter *cc)
-+static u64 igb_ptp_read_82576(const struct cyclecounter *cc)
- {
- struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc);
- struct e1000_hw *hw = &igb->hw;
-@@ -113,7 +113,7 @@ static cycle_t igb_ptp_read_82576(const struct cyclecounter *cc)
- * SYSTIM read access for the 82580
- */
-
--static cycle_t igb_ptp_read_82580(const struct cyclecounter *cc)
-+static u64 igb_ptp_read_82580(const struct cyclecounter *cc)
- {
- struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc);
- struct e1000_hw *hw = &igb->hw;
+++ /dev/null
-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;
+++ /dev/null
-From 6445198f802d993c73f4b246353b2ceb2dfafc32 Mon Sep 17 00:00:00 2001
-From: Ferruh Yigit <ferruh.yigit@intel.com>
-Date: Mon, 17 Oct 2016 11:23:14 +0100
-Subject: kni: fix build with kernel 4.9
-
-compile error:
- CC [M] .../lib/librte_eal/linuxapp/kni/igb_main.o
-.../lib/librte_eal/linuxapp/kni/igb_main.c:2317:21:
-error: initialization from incompatible pointer type
- [-Werror=incompatible-pointer-types]
- .ndo_set_vf_vlan = igb_ndo_set_vf_vlan,
- ^~~~~~~~~~~~~~~~~~~
-
-Linux kernel 4.9 updates API for ndo_set_vf_vlan:
-Linux: 79aab093a0b5 ("net: Update API for VF vlan protocol 802.1ad support")
-
-Use new API for Linux kernels >= 4.9
-
-Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
-Tested-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
----
- src/igb_main.c | 19 +++++++++++++++++++
- src/kcompat.h | 4 ++++
- 2 files changed, 23 insertions(+)
-
-diff --git a/src/igb_main.c b/src/igb_main.c
-index 23e2d64..f4dca5a 100644
---- a/src/igb_main.c
-+++ b/src/igb_main.c
-@@ -195,7 +195,11 @@ static void igb_process_mdd_event(struct igb_adapter *);
- #ifdef IFLA_VF_MAX
- static int igb_ndo_set_vf_mac( struct net_device *netdev, int vf, u8 *mac);
- static int igb_ndo_set_vf_vlan(struct net_device *netdev,
-+#ifdef HAVE_VF_VLAN_PROTO
-+ int vf, u16 vlan, u8 qos, __be16 vlan_proto);
-+#else
- int vf, u16 vlan, u8 qos);
-+#endif
- #ifdef HAVE_VF_SPOOFCHK_CONFIGURE
- static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf,
- bool setting);
-@@ -6412,7 +6416,11 @@ static void igb_set_vmvir(struct igb_adapter *adapter, u32 vid, u32 vf)
- }
-
- static int igb_ndo_set_vf_vlan(struct net_device *netdev,
-+#ifdef HAVE_VF_VLAN_PROTO
-+ int vf, u16 vlan, u8 qos, __be16 vlan_proto)
-+#else
- int vf, u16 vlan, u8 qos)
-+#endif
- {
- int err = 0;
- struct igb_adapter *adapter = netdev_priv(netdev);
-@@ -6420,6 +6428,12 @@ static int igb_ndo_set_vf_vlan(struct net_device *netdev,
- /* VLAN IDs accepted range 0-4094 */
- if ((vf >= adapter->vfs_allocated_count) || (vlan > VLAN_VID_MASK-1) || (qos > 7))
- return -EINVAL;
-+
-+#ifdef HAVE_VF_VLAN_PROTO
-+ if (vlan_proto != htons(ETH_P_8021Q))
-+ return -EPROTONOSUPPORT;
-+#endif
-+
- if (vlan || qos) {
- err = igb_vlvf_set(adapter, vlan, !!vlan, vf);
- if (err)
-@@ -6580,7 +6594,12 @@ static inline void igb_vf_reset(struct igb_adapter *adapter, u32 vf)
- if (adapter->vf_data[vf].pf_vlan)
- igb_ndo_set_vf_vlan(adapter->netdev, vf,
- adapter->vf_data[vf].pf_vlan,
-+#ifdef HAVE_VF_VLAN_PROTO
-+ adapter->vf_data[vf].pf_qos,
-+ htons(ETH_P_8021Q));
-+#else
- adapter->vf_data[vf].pf_qos);
-+#endif
- else
- igb_clear_vf_vfta(adapter, vf);
- #endif
-diff --git a/src/kcompat.h b/src/kcompat.h
-index 69e0e7a..84826b2 100644
---- a/src/kcompat.h
-+++ b/src/kcompat.h
-@@ -3929,4 +3929,8 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)
- #define vlan_tx_tag_present skb_vlan_tag_present
- #endif
-
-+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0) )
-+#define HAVE_VF_VLAN_PROTO
-+#endif /* >= 4.9.0 */
-+
- #endif /* _KCOMPAT_H_ */
---
-cgit v1.0
-
+++ /dev/null
-diff --git a/src/Makefile.orig b/src/Makefile
-index 8e962f7..50bcdcc 100644
---- a/src/Makefile.orig
-+++ b/src/Makefile
-@@ -123,6 +123,13 @@ ifeq (,$(CC))
- $(error Compiler not found)
- endif
-
-+# workaround for GCC6's default PIE
-+ifeq ($(CC),gcc)
-+ PIE_TEST = [ -z "`$(CC) -fno-PIE -no-pie -x c -c /dev/null -o /dev/null 2>&1`" ]
-+ PIE_FLAGS := $(shell $(PIE_TEST) && echo '-fno-PIE -no-pie')
-+ EXTRA_CFLAGS += $(PIE_FLAGS)
-+endif
-+
- # we need to know what platform the driver is being built on
- # some additional features are only built on Intel platforms
- ARCH := $(shell uname -m | sed 's/i.86/i386/')
+++ /dev/null
- src/{ixgbe_ptp.c.orig => ixgbe_ptp.c} | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/ixgbe_ptp.c.orig b/src/ixgbe_ptp.c
-index fb832f0..b868c68 100644
---- a/src/ixgbe_ptp.c.orig
-+++ b/src/ixgbe_ptp.c
-@@ -244,7 +244,7 @@ static void ixgbe_ptp_setup_sdp_X540(struct ixgbe_adapter *adapter)
- * result of SYSTIME is 32bits of "billions of cycles" and 32 bits of
- * "cycles", rather than seconds and nanoseconds.
- */
--static cycle_t ixgbe_ptp_read_X550(const struct cyclecounter *hw_cc) {
-+static u64 ixgbe_ptp_read_X550(const struct cyclecounter *hw_cc) {
- struct ixgbe_adapter *adapter =
- container_of(hw_cc, struct ixgbe_adapter, hw_cc);
- struct ixgbe_hw *hw = &adapter->hw;
-@@ -280,7 +280,7 @@ static cycle_t ixgbe_ptp_read_X550(const struct cyclecounter *hw_cc) {
- * cyclecounter structure used to construct a ns counter from the
- * arbitrary fixed point registers
- */
--static cycle_t ixgbe_ptp_read_82599(const struct cyclecounter *hw_cc)
-+static u64 ixgbe_ptp_read_82599(const struct cyclecounter *hw_cc)
- {
- struct ixgbe_adapter *adapter =
- container_of(hw_cc, struct ixgbe_adapter, hw_cc);
+++ /dev/null
-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;
--- /dev/null
+ src/{netdev.c.orig => netdev.c} | 18 +++++++++---------
+ src/{ptp.c.orig => ptp.c} | 4 ++--
+ 2 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/src/netdev.c.orig b/src/netdev.c
+index 73b0f9a..480265b 100644
+--- a/src/netdev.c.orig
++++ b/src/netdev.c
+@@ -4833,24 +4833,24 @@ void e1000e_reinit_locked(struct e1000_adapter *adapter)
+ /**
+ * e1000e_sanitize_systim - sanitize raw cycle counter reads
+ * @hw: pointer to the HW structure
+- * @systim: cycle_t value read, sanitized and returned
++ * @systim: u64 value read, sanitized and returned
+ *
+ * Errata for 82574/82583 possible bad bits read from SYSTIMH/L:
+ * check to see that the time is incrementing at a reasonable
+ * rate and is a multiple of incvalue.
+ **/
+-static cycle_t e1000e_sanitize_systim(struct e1000_hw *hw, cycle_t systim)
++static u64 e1000e_sanitize_systim(struct e1000_hw *hw, u64 systim)
+ {
+ u64 time_delta, rem, temp;
+- cycle_t systim_next;
++ u64 systim_next;
+ u32 incvalue;
+ int i;
+
+ incvalue = er32(TIMINCA) & E1000_TIMINCA_INCVALUE_MASK;
+ for (i = 0; i < E1000_MAX_82574_SYSTIM_REREADS; i++) {
+ /* latch SYSTIMH on read of SYSTIML */
+- systim_next = (cycle_t)er32(SYSTIML);
+- systim_next |= (cycle_t)er32(SYSTIMH) << 32;
++ systim_next = (u64)er32(SYSTIML);
++ systim_next |= (u64)er32(SYSTIMH) << 32;
+
+ time_delta = systim_next - systim;
+ temp = time_delta;
+@@ -4872,13 +4872,13 @@ static cycle_t e1000e_sanitize_systim(struct e1000_hw *hw, cycle_t systim)
+ * e1000e_cyclecounter_read - read raw cycle counter (used by time counter)
+ * @cc: cyclecounter structure
+ **/
+-static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)
++static u64 e1000e_cyclecounter_read(const struct cyclecounter *cc)
+ {
+ struct e1000_adapter *adapter = container_of(cc, struct e1000_adapter,
+ cc);
+ struct e1000_hw *hw = &adapter->hw;
+ u32 systimel, systimeh;
+- cycle_t systim;
++ u64 systim;
+ /* SYSTIMH latching upon SYSTIML read does not work well.
+ * This means that if SYSTIML overflows after we read it but before
+ * we read SYSTIMH, the value of SYSTIMH has been incremented and we
+@@ -4899,8 +4899,8 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)
+ systimel = systimel_2;
+ }
+ }
+- systim = (cycle_t)systimel;
+- systim |= (cycle_t)systimeh << 32;
++ systim = (u64)systimel;
++ systim |= (u64)systimeh << 32;
+
+ if (adapter->flags2 & FLAG2_CHECK_SYSTIM_OVERFLOW)
+ systim = e1000e_sanitize_systim(hw, systim);
+
+diff --git a/src/ptp.c.orig b/src/ptp.c
+index 00c419f..228adce 100644
+--- a/src/ptp.c.orig
++++ b/src/ptp.c
+@@ -136,8 +136,8 @@ static int e1000e_phc_get_syncdevicetime(ktime_t * device,
+ unsigned long flags;
+ int i;
+ u32 tsync_ctrl;
+- cycle_t dev_cycles;
+- cycle_t sys_cycles;
++ u64 dev_cycles;
++ u64 sys_cycles;
+
+ tsync_ctrl = er32(TSYNCTXCTL);
+ tsync_ctrl |= E1000_TSYNCTXCTL_START_SYNC |
--- /dev/null
+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;
+
--- /dev/null
+ src/{igb_ptp.c.orig => igb_ptp.c} | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/igb_ptp.c.orig b/src/igb_ptp.c
+index 744fa65..f334ac7 100644
+--- a/src/igb_ptp.c.orig
++++ b/src/igb_ptp.c
+@@ -93,7 +93,7 @@
+ * SYSTIM read access for the 82576
+ */
+
+-static cycle_t igb_ptp_read_82576(const struct cyclecounter *cc)
++static u64 igb_ptp_read_82576(const struct cyclecounter *cc)
+ {
+ struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc);
+ struct e1000_hw *hw = &igb->hw;
+@@ -113,7 +113,7 @@ static cycle_t igb_ptp_read_82576(const struct cyclecounter *cc)
+ * SYSTIM read access for the 82580
+ */
+
+-static cycle_t igb_ptp_read_82580(const struct cyclecounter *cc)
++static u64 igb_ptp_read_82580(const struct cyclecounter *cc)
+ {
+ struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc);
+ struct e1000_hw *hw = &igb->hw;
--- /dev/null
+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;
--- /dev/null
+From 6445198f802d993c73f4b246353b2ceb2dfafc32 Mon Sep 17 00:00:00 2001
+From: Ferruh Yigit <ferruh.yigit@intel.com>
+Date: Mon, 17 Oct 2016 11:23:14 +0100
+Subject: kni: fix build with kernel 4.9
+
+compile error:
+ CC [M] .../lib/librte_eal/linuxapp/kni/igb_main.o
+.../lib/librte_eal/linuxapp/kni/igb_main.c:2317:21:
+error: initialization from incompatible pointer type
+ [-Werror=incompatible-pointer-types]
+ .ndo_set_vf_vlan = igb_ndo_set_vf_vlan,
+ ^~~~~~~~~~~~~~~~~~~
+
+Linux kernel 4.9 updates API for ndo_set_vf_vlan:
+Linux: 79aab093a0b5 ("net: Update API for VF vlan protocol 802.1ad support")
+
+Use new API for Linux kernels >= 4.9
+
+Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
+Tested-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
+---
+ src/igb_main.c | 19 +++++++++++++++++++
+ src/kcompat.h | 4 ++++
+ 2 files changed, 23 insertions(+)
+
+diff --git a/src/igb_main.c b/src/igb_main.c
+index 23e2d64..f4dca5a 100644
+--- a/src/igb_main.c
++++ b/src/igb_main.c
+@@ -195,7 +195,11 @@ static void igb_process_mdd_event(struct igb_adapter *);
+ #ifdef IFLA_VF_MAX
+ static int igb_ndo_set_vf_mac( struct net_device *netdev, int vf, u8 *mac);
+ static int igb_ndo_set_vf_vlan(struct net_device *netdev,
++#ifdef HAVE_VF_VLAN_PROTO
++ int vf, u16 vlan, u8 qos, __be16 vlan_proto);
++#else
+ int vf, u16 vlan, u8 qos);
++#endif
+ #ifdef HAVE_VF_SPOOFCHK_CONFIGURE
+ static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf,
+ bool setting);
+@@ -6412,7 +6416,11 @@ static void igb_set_vmvir(struct igb_adapter *adapter, u32 vid, u32 vf)
+ }
+
+ static int igb_ndo_set_vf_vlan(struct net_device *netdev,
++#ifdef HAVE_VF_VLAN_PROTO
++ int vf, u16 vlan, u8 qos, __be16 vlan_proto)
++#else
+ int vf, u16 vlan, u8 qos)
++#endif
+ {
+ int err = 0;
+ struct igb_adapter *adapter = netdev_priv(netdev);
+@@ -6420,6 +6428,12 @@ static int igb_ndo_set_vf_vlan(struct net_device *netdev,
+ /* VLAN IDs accepted range 0-4094 */
+ if ((vf >= adapter->vfs_allocated_count) || (vlan > VLAN_VID_MASK-1) || (qos > 7))
+ return -EINVAL;
++
++#ifdef HAVE_VF_VLAN_PROTO
++ if (vlan_proto != htons(ETH_P_8021Q))
++ return -EPROTONOSUPPORT;
++#endif
++
+ if (vlan || qos) {
+ err = igb_vlvf_set(adapter, vlan, !!vlan, vf);
+ if (err)
+@@ -6580,7 +6594,12 @@ static inline void igb_vf_reset(struct igb_adapter *adapter, u32 vf)
+ if (adapter->vf_data[vf].pf_vlan)
+ igb_ndo_set_vf_vlan(adapter->netdev, vf,
+ adapter->vf_data[vf].pf_vlan,
++#ifdef HAVE_VF_VLAN_PROTO
++ adapter->vf_data[vf].pf_qos,
++ htons(ETH_P_8021Q));
++#else
+ adapter->vf_data[vf].pf_qos);
++#endif
+ else
+ igb_clear_vf_vfta(adapter, vf);
+ #endif
+diff --git a/src/kcompat.h b/src/kcompat.h
+index 69e0e7a..84826b2 100644
+--- a/src/kcompat.h
++++ b/src/kcompat.h
+@@ -3929,4 +3929,8 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)
+ #define vlan_tx_tag_present skb_vlan_tag_present
+ #endif
+
++#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0) )
++#define HAVE_VF_VLAN_PROTO
++#endif /* >= 4.9.0 */
++
+ #endif /* _KCOMPAT_H_ */
+--
+cgit v1.0
+
--- /dev/null
+diff --git a/src/Makefile.orig b/src/Makefile
+index 8e962f7..50bcdcc 100644
+--- a/src/Makefile.orig
++++ b/src/Makefile
+@@ -123,6 +123,13 @@ ifeq (,$(CC))
+ $(error Compiler not found)
+ endif
+
++# workaround for GCC6's default PIE
++ifeq ($(CC),gcc)
++ PIE_TEST = [ -z "`$(CC) -fno-PIE -no-pie -x c -c /dev/null -o /dev/null 2>&1`" ]
++ PIE_FLAGS := $(shell $(PIE_TEST) && echo '-fno-PIE -no-pie')
++ EXTRA_CFLAGS += $(PIE_FLAGS)
++endif
++
+ # we need to know what platform the driver is being built on
+ # some additional features are only built on Intel platforms
+ ARCH := $(shell uname -m | sed 's/i.86/i386/')
--- /dev/null
+ src/{ixgbe_ptp.c.orig => ixgbe_ptp.c} | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/ixgbe_ptp.c.orig b/src/ixgbe_ptp.c
+index fb832f0..b868c68 100644
+--- a/src/ixgbe_ptp.c.orig
++++ b/src/ixgbe_ptp.c
+@@ -244,7 +244,7 @@ static void ixgbe_ptp_setup_sdp_X540(struct ixgbe_adapter *adapter)
+ * result of SYSTIME is 32bits of "billions of cycles" and 32 bits of
+ * "cycles", rather than seconds and nanoseconds.
+ */
+-static cycle_t ixgbe_ptp_read_X550(const struct cyclecounter *hw_cc) {
++static u64 ixgbe_ptp_read_X550(const struct cyclecounter *hw_cc) {
+ struct ixgbe_adapter *adapter =
+ container_of(hw_cc, struct ixgbe_adapter, hw_cc);
+ struct ixgbe_hw *hw = &adapter->hw;
+@@ -280,7 +280,7 @@ static cycle_t ixgbe_ptp_read_X550(const struct cyclecounter *hw_cc) {
+ * cyclecounter structure used to construct a ns counter from the
+ * arbitrary fixed point registers
+ */
+-static cycle_t ixgbe_ptp_read_82599(const struct cyclecounter *hw_cc)
++static u64 ixgbe_ptp_read_82599(const struct cyclecounter *hw_cc)
+ {
+ struct ixgbe_adapter *adapter =
+ container_of(hw_cc, struct ixgbe_adapter, hw_cc);
--- /dev/null
+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;