diff options
author | Todd Fujinaka <todd.fujinaka@intel.com> | 2015-06-19 11:17:56 -0700 |
---|---|---|
committer | Todd Fujinaka <todd.fujinaka@intel.com> | 2015-06-19 11:17:56 -0700 |
commit | 2fdb56a391e9e09ff22837e56d594507fbaf9250 (patch) | |
tree | 00b063737e956d88332a3017f5f682f3b6bb5492 /kmod | |
parent | 365cf04f73715780e123312ddadd83d202aa1bdd (diff) | |
download | Open-AVB-2fdb56a391e9e09ff22837e56d594507fbaf9250.tar.gz |
igb-avb: sync to igb-5.3.2
Diffstat (limited to 'kmod')
34 files changed, 1093 insertions, 432 deletions
diff --git a/kmod/igb/e1000_82575.c b/kmod/igb/e1000_82575.c index 3e8c1ec1..5b933ca2 100644 --- a/kmod/igb/e1000_82575.c +++ b/kmod/igb/e1000_82575.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -112,7 +112,6 @@ static const u16 e1000_82580_rxpbs_table[] = { (sizeof(e1000_82580_rxpbs_table) / \ sizeof(e1000_82580_rxpbs_table[0])) - /** * e1000_sgmii_uses_mdio_82575 - Determine if I2C pins are for external MDIO * @hw: pointer to the HW structure @@ -1046,7 +1045,7 @@ static s32 e1000_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask) u32 swmask = mask; u32 fwmask = mask << 16; s32 ret_val = E1000_SUCCESS; - s32 i = 0, timeout = 200; /* FIXME: find real value to use here */ + s32 i = 0, timeout = 200; DEBUGFUNC("e1000_acquire_swfw_sync_82575"); @@ -1230,7 +1229,7 @@ static s32 e1000_check_for_link_media_swap(struct e1000_hw *hw) DEBUGFUNC("e1000_check_for_link_media_swap"); - /* Check the copper medium. */ + /* Check for copper. */ ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 0); if (ret_val) return ret_val; @@ -1242,7 +1241,7 @@ static s32 e1000_check_for_link_media_swap(struct e1000_hw *hw) if (data & E1000_M88E1112_STATUS_LINK) port = E1000_MEDIA_PORT_COPPER; - /* Check the other medium. */ + /* Check for other. */ ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 1); if (ret_val) return ret_val; @@ -1251,11 +1250,6 @@ static s32 e1000_check_for_link_media_swap(struct e1000_hw *hw) if (ret_val) return ret_val; - /* reset page to 0 */ - ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 0); - if (ret_val) - return ret_val; - if (data & E1000_M88E1112_STATUS_LINK) port = E1000_MEDIA_PORT_OTHER; @@ -1263,8 +1257,20 @@ static s32 e1000_check_for_link_media_swap(struct e1000_hw *hw) if (port && (hw->dev_spec._82575.media_port != port)) { hw->dev_spec._82575.media_port = port; hw->dev_spec._82575.media_changed = true; + } + + if (port == E1000_MEDIA_PORT_COPPER) { + /* reset page to 0 */ + ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 0); + if (ret_val) + return ret_val; + e1000_check_for_link_82575(hw); } else { - ret_val = e1000_check_for_link_82575(hw); + e1000_check_for_link_82575(hw); + /* reset page to 0 */ + ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 0); + if (ret_val) + return ret_val; } return E1000_SUCCESS; @@ -2121,7 +2127,7 @@ static void e1000_clear_hw_cntrs_82575(struct e1000_hw *hw) * e1000_rx_fifo_flush_82575 - Clean rx fifo after Rx enable * @hw: pointer to the HW structure * - * After rx enable if managability is enabled then there is likely some + * After Rx enable, if manageability is enabled then there is likely some * bad data at the start of the fifo and possibly in the DMA fifo. This * function clears the fifos and flushes any packets that came in as rx was * being enabled. @@ -2131,7 +2137,13 @@ void e1000_rx_fifo_flush_82575(struct e1000_hw *hw) u32 rctl, rlpml, rxdctl[4], rfctl, temp_rctl, rx_enabled; int i, ms_wait; - DEBUGFUNC("e1000_rx_fifo_workaround_82575"); + DEBUGFUNC("e1000_rx_fifo_flush_82575"); + + /* disable IPv6 options as per hardware errata */ + rfctl = E1000_READ_REG(hw, E1000_RFCTL); + rfctl |= E1000_RFCTL_IPV6_EX_DIS; + E1000_WRITE_REG(hw, E1000_RFCTL, rfctl); + if (hw->mac.type != e1000_82575 || !(E1000_READ_REG(hw, E1000_MANC) & E1000_MANC_RCV_TCO_EN)) return; @@ -2159,7 +2171,6 @@ void e1000_rx_fifo_flush_82575(struct e1000_hw *hw) * incoming packets are rejected. Set enable and wait 2ms so that * any packet that was coming in as RCTL.EN was set is flushed */ - rfctl = E1000_READ_REG(hw, E1000_RFCTL); E1000_WRITE_REG(hw, E1000_RFCTL, rfctl & ~E1000_RFCTL_LEF); rlpml = E1000_READ_REG(hw, E1000_RLPML); @@ -2889,11 +2900,13 @@ out: /** * e1000_set_eee_i350 - Enable/disable EEE support * @hw: pointer to the HW structure + * @adv1g: boolean flag enabling 1G EEE advertisement + * @adv100m: boolean flag enabling 100M EEE advertisement * * Enable/disable EEE based on setting in dev_spec structure. * **/ -s32 e1000_set_eee_i350(struct e1000_hw *hw) +s32 e1000_set_eee_i350(struct e1000_hw *hw, bool adv1G, bool adv100M) { u32 ipcnfg, eeer; @@ -2909,7 +2922,16 @@ s32 e1000_set_eee_i350(struct e1000_hw *hw) if (!(hw->dev_spec._82575.eee_disable)) { u32 eee_su = E1000_READ_REG(hw, E1000_EEE_SU); - ipcnfg |= (E1000_IPCNFG_EEE_1G_AN | E1000_IPCNFG_EEE_100M_AN); + if (adv100M) + ipcnfg |= E1000_IPCNFG_EEE_100M_AN; + else + ipcnfg &= ~E1000_IPCNFG_EEE_100M_AN; + + if (adv1G) + ipcnfg |= E1000_IPCNFG_EEE_1G_AN; + else + ipcnfg &= ~E1000_IPCNFG_EEE_1G_AN; + eeer |= (E1000_EEER_TX_LPI_EN | E1000_EEER_RX_LPI_EN | E1000_EEER_LPI_FC); @@ -2933,11 +2955,13 @@ out: /** * e1000_set_eee_i354 - Enable/disable EEE support * @hw: pointer to the HW structure + * @adv1g: boolean flag enabling 1G EEE advertisement + * @adv100m: boolean flag enabling 100M EEE advertisement * * Enable/disable EEE legacy mode based on setting in dev_spec structure. * **/ -s32 e1000_set_eee_i354(struct e1000_hw *hw) +s32 e1000_set_eee_i354(struct e1000_hw *hw, bool adv1G, bool adv100M) { struct e1000_phy_info *phy = &hw->phy; s32 ret_val = E1000_SUCCESS; @@ -2979,8 +3003,16 @@ s32 e1000_set_eee_i354(struct e1000_hw *hw) if (ret_val) goto out; - phy_data |= E1000_EEE_ADV_100_SUPPORTED | - E1000_EEE_ADV_1000_SUPPORTED; + if (adv100M) + phy_data |= E1000_EEE_ADV_100_SUPPORTED; + else + phy_data &= ~E1000_EEE_ADV_100_SUPPORTED; + + if (adv1G) + phy_data |= E1000_EEE_ADV_1000_SUPPORTED; + else + phy_data &= ~E1000_EEE_ADV_1000_SUPPORTED; + ret_val = e1000_write_xmdio_reg(hw, E1000_EEE_ADV_ADDR_I354, E1000_EEE_ADV_DEV_I354, phy_data); @@ -3086,7 +3118,6 @@ void e1000_write_vfta_i350(struct e1000_hw *hw, u32 offset, u32 value) E1000_WRITE_FLUSH(hw); } - /** * e1000_set_i2c_bb - Enable I2C bit-bang * @hw: pointer to the HW structure diff --git a/kmod/igb/e1000_82575.h b/kmod/igb/e1000_82575.h index 2541353b..c6b61f71 100644 --- a/kmod/igb/e1000_82575.h +++ b/kmod/igb/e1000_82575.h @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -472,8 +472,8 @@ s32 e1000_init_hw_82575(struct e1000_hw *hw); u16 e1000_rxpbs_adjust_82580(u32 data); s32 e1000_read_emi_reg(struct e1000_hw *hw, u16 addr, u16 *data); -s32 e1000_set_eee_i350(struct e1000_hw *); -s32 e1000_set_eee_i354(struct e1000_hw *); +s32 e1000_set_eee_i350(struct e1000_hw *hw, bool adv1G, bool adv100M); +s32 e1000_set_eee_i354(struct e1000_hw *hw, bool adv1G, bool adv100M); s32 e1000_get_eee_status_i354(struct e1000_hw *, bool *); s32 e1000_initialize_M88E1512_phy(struct e1000_hw *hw); #define E1000_I2C_THERMAL_SENSOR_ADDR 0xF8 diff --git a/kmod/igb/e1000_api.c b/kmod/igb/e1000_api.c index 984a36b6..54faa686 100644 --- a/kmod/igb/e1000_api.c +++ b/kmod/igb/e1000_api.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, diff --git a/kmod/igb/e1000_api.h b/kmod/igb/e1000_api.h index 2b7cfec3..32fce254 100644 --- a/kmod/igb/e1000_api.h +++ b/kmod/igb/e1000_api.h @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -101,20 +101,18 @@ s32 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length); s32 e1000_get_thermal_sensor_data(struct e1000_hw *hw); s32 e1000_init_thermal_sensor_thresh(struct e1000_hw *hw); - - /* * TBI_ACCEPT macro definition: * * This macro requires: - * adapter = a pointer to struct e1000_hw + * a = a pointer to struct e1000_hw * status = the 8 bit status field of the Rx descriptor with EOP set - * error = the 8 bit error field of the Rx descriptor with EOP set + * errors = the 8 bit error field of the Rx descriptor with EOP set * length = the sum of all the length fields of the Rx descriptors that * make up the current frame * last_byte = the last byte of the frame DMAed by the hardware - * max_frame_length = the maximum frame length we want to accept. - * min_frame_length = the minimum frame length we want to accept. + * min_frame_size = the minimum frame length we want to accept. + * max_frame_size = the maximum frame length we want to accept. * * This macro is a conditional that should be used in the interrupt * handler's Rx processing routine when RxErrors have been detected. @@ -140,10 +138,10 @@ s32 e1000_init_thermal_sensor_thresh(struct e1000_hw *hw); (((errors) & E1000_RXD_ERR_FRAME_ERR_MASK) == E1000_RXD_ERR_CE) && \ ((last_byte) == CARRIER_EXTENSION) && \ (((status) & E1000_RXD_STAT_VP) ? \ - (((length) > (min_frame_size - VLAN_TAG_SIZE)) && \ - ((length) <= (max_frame_size + 1))) : \ - (((length) > min_frame_size) && \ - ((length) <= (max_frame_size + VLAN_TAG_SIZE + 1))))) + (((length) > ((min_frame_size) - VLAN_TAG_SIZE)) && \ + ((length) <= ((max_frame_size) + 1))) : \ + (((length) > (min_frame_size)) && \ + ((length) <= ((max_frame_size) + VLAN_TAG_SIZE + 1))))) #ifndef E1000_MAX #define E1000_MAX(a, b) ((a) > (b) ? (a) : (b)) diff --git a/kmod/igb/e1000_defines.h b/kmod/igb/e1000_defines.h index e794f519..4dce56b9 100644 --- a/kmod/igb/e1000_defines.h +++ b/kmod/igb/e1000_defines.h @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -55,11 +55,13 @@ #define E1000_WUS_BC E1000_WUFC_BC /* Extended Device Control */ +#define E1000_CTRL_EXT_LPCD 0x00000004 /* LCD Power Cycle Done */ #define E1000_CTRL_EXT_SDP4_DATA 0x00000010 /* SW Definable Pin 4 data */ #define E1000_CTRL_EXT_SDP6_DATA 0x00000040 /* SW Definable Pin 6 data */ #define E1000_CTRL_EXT_SDP3_DATA 0x00000080 /* SW Definable Pin 3 data */ #define E1000_CTRL_EXT_SDP6_DIR 0x00000400 /* Direction of SDP6 0=in 1=out */ #define E1000_CTRL_EXT_SDP3_DIR 0x00000800 /* Direction of SDP3 0=in 1=out */ +#define E1000_CTRL_EXT_FORCE_SMBUS 0x00000800 /* Force SMBus mode */ #define E1000_CTRL_EXT_EE_RST 0x00002000 /* Reinitialize from EEPROM */ /* Physical Func Reset Done Indication */ #define E1000_CTRL_EXT_PFRSTD 0x00004000 @@ -180,6 +182,7 @@ #define E1000_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */ #define E1000_RCTL_DTYP_PS 0x00000400 /* Packet Split descriptor */ #define E1000_RCTL_RDMTS_HALF 0x00000000 /* Rx desc min thresh size */ +#define E1000_RCTL_RDMTS_HEX 0x00010000 #define E1000_RCTL_MO_SHIFT 12 /* multicast offset shift */ #define E1000_RCTL_MO_3 0x00003000 /* multicast offset 15:4 */ #define E1000_RCTL_BAM 0x00008000 /* broadcast enable */ @@ -262,7 +265,6 @@ #define E1000_CTRL_PHY_RST 0x80000000 /* PHY Reset */ #define E1000_CTRL_I2C_ENA 0x02000000 /* I2C enable */ - #define E1000_CONNSW_ENRGSRC 0x4 #define E1000_CONNSW_PHYSD 0x400 #define E1000_CONNSW_PHY_PDN 0x800 @@ -314,7 +316,6 @@ #define HALF_DUPLEX 1 #define FULL_DUPLEX 2 - #define ADVERTISE_10_HALF 0x0001 #define ADVERTISE_10_FULL 0x0002 #define ADVERTISE_100_HALF 0x0004 @@ -466,6 +467,12 @@ #define E1000_PBS_16K E1000_PBA_16K +/* Uncorrectable/correctable ECC Error counts and enable bits */ +#define E1000_PBECCSTS_CORR_ERR_CNT_MASK 0x000000FF +#define E1000_PBECCSTS_UNCORR_ERR_CNT_MASK 0x0000FF00 +#define E1000_PBECCSTS_UNCORR_ERR_CNT_SHIFT 8 +#define E1000_PBECCSTS_ECC_ENABLE 0x00010000 + #define IFS_MAX 80 #define IFS_MIN 40 #define IFS_RATIO 4 @@ -495,6 +502,7 @@ #define E1000_ICR_GPI_EN3 0x00004000 /* GP Int 3 */ #define E1000_ICR_TXD_LOW 0x00008000 #define E1000_ICR_MNG 0x00040000 /* Manageability event */ +#define E1000_ICR_ECCER 0x00400000 /* Uncorrectable ECC Error */ #define E1000_ICR_TS 0x00080000 /* Time Sync Interrupt */ #define E1000_ICR_DRSTA 0x40000000 /* Device Reset Asserted */ /* If this bit asserted, the driver should claim the interrupt */ @@ -505,7 +513,6 @@ #define E1000_ICR_THS 0x00800000 /* ICR.THS: Thermal Sensor Event*/ #define E1000_ICR_MDDET 0x10000000 /* Malicious Driver Detect */ - /* Extended Interrupt Cause Read */ #define E1000_EICR_RX_QUEUE0 0x00000001 /* Rx Queue 0 Interrupt */ #define E1000_EICR_RX_QUEUE1 0x00000002 /* Rx Queue 1 Interrupt */ @@ -548,6 +555,7 @@ #define E1000_IMS_RXO E1000_ICR_RXO /* Rx overrun */ #define E1000_IMS_RXT0 E1000_ICR_RXT0 /* Rx timer intr */ #define E1000_IMS_TXD_LOW E1000_ICR_TXD_LOW +#define E1000_IMS_ECCER E1000_ICR_ECCER /* Uncorrectable ECC Error */ #define E1000_IMS_TS E1000_ICR_TS /* Time Sync Interrupt */ #define E1000_IMS_DRSTA E1000_ICR_DRSTA /* Device Reset Asserted */ #define E1000_IMS_DOUTSYNC E1000_ICR_DOUTSYNC /* NIC DMA out of sync */ @@ -1062,7 +1070,6 @@ /* Offset of Link Mode bits for 82580 up */ #define NVM_WORD24_82580_LNK_MODE_OFFSET 4 - /* Mask bits for fields in Word 0x0f of the NVM */ #define NVM_WORD0F_PAUSE_MASK 0x3000 #define NVM_WORD0F_PAUSE 0x1000 @@ -1369,7 +1376,6 @@ #define I210_RXPBSIZE_DEFAULT 0x000000A2 /* RXPBSIZE default */ #define I210_TXPBSIZE_DEFAULT 0x04000014 /* TXPBSIZE default */ - /* Proxy Filter Control */ #define E1000_PROXYFC_D0 0x00000001 /* Enable offload in D0 */ #define E1000_PROXYFC_EX 0x00000004 /* Directed exact proxy */ diff --git a/kmod/igb/e1000_hw.h b/kmod/igb/e1000_hw.h index 7430e06e..3bcecf19 100644 --- a/kmod/igb/e1000_hw.h +++ b/kmod/igb/e1000_hw.h @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -441,7 +441,6 @@ struct e1000_hw_stats { u64 b2ogprc; }; - struct e1000_phy_stats { u32 idle_errors; u32 receive_errors; @@ -618,7 +617,7 @@ struct e1000_mac_info { u16 uta_reg_count; /* Maximum size of the MTA register table in all supported adapters */ - #define MAX_MTA_REG 128 +#define MAX_MTA_REG 128 u32 mta_shadow[MAX_MTA_REG]; u16 rar_entry_count; diff --git a/kmod/igb/e1000_i210.c b/kmod/igb/e1000_i210.c index 57e3e382..7e32fd11 100644 --- a/kmod/igb/e1000_i210.c +++ b/kmod/igb/e1000_i210.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, diff --git a/kmod/igb/e1000_i210.h b/kmod/igb/e1000_i210.h index 760ff136..a14e897d 100644 --- a/kmod/igb/e1000_i210.h +++ b/kmod/igb/e1000_i210.h @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, diff --git a/kmod/igb/e1000_mac.c b/kmod/igb/e1000_mac.c index 2388f8e6..f848b995 100644 --- a/kmod/igb/e1000_mac.c +++ b/kmod/igb/e1000_mac.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -311,7 +311,6 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) if (ret_val) return ret_val; - /* Alternate MAC address is handled by the option ROM for 82580 * and newer. SW support not required. */ @@ -870,7 +869,6 @@ static s32 e1000_set_default_fc_generic(struct e1000_hw *hw) 1, &nvm_data); } - if (ret_val) { DEBUGOUT("NVM Read Error\n"); return ret_val; diff --git a/kmod/igb/e1000_mac.h b/kmod/igb/e1000_mac.h index 848be8e1..a3878361 100644 --- a/kmod/igb/e1000_mac.h +++ b/kmod/igb/e1000_mac.h @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, diff --git a/kmod/igb/e1000_manage.c b/kmod/igb/e1000_manage.c index dc3efea9..36671fbd 100644 --- a/kmod/igb/e1000_manage.c +++ b/kmod/igb/e1000_manage.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -550,4 +550,3 @@ s32 e1000_load_firmware(struct e1000_hw *hw, u8 *buffer, u32 length) return E1000_SUCCESS; } - diff --git a/kmod/igb/e1000_manage.h b/kmod/igb/e1000_manage.h index adda2b75..09afc1ae 100644 --- a/kmod/igb/e1000_manage.h +++ b/kmod/igb/e1000_manage.h @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, diff --git a/kmod/igb/e1000_mbx.c b/kmod/igb/e1000_mbx.c index 38cf6128..f2998f47 100644 --- a/kmod/igb/e1000_mbx.c +++ b/kmod/igb/e1000_mbx.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, diff --git a/kmod/igb/e1000_mbx.h b/kmod/igb/e1000_mbx.h index 278f8ce9..28900216 100644 --- a/kmod/igb/e1000_mbx.h +++ b/kmod/igb/e1000_mbx.h @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, diff --git a/kmod/igb/e1000_nvm.c b/kmod/igb/e1000_nvm.c index 0413b95b..c328f40d 100644 --- a/kmod/igb/e1000_nvm.c +++ b/kmod/igb/e1000_nvm.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -747,10 +747,6 @@ s32 e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size) return E1000_SUCCESS; } - - - - /** * e1000_read_mac_addr_generic - Read device MAC address * @hw: pointer to the HW structure @@ -975,4 +971,3 @@ etrack_id: } } - diff --git a/kmod/igb/e1000_nvm.h b/kmod/igb/e1000_nvm.h index 4c9e22ad..a4263113 100644 --- a/kmod/igb/e1000_nvm.h +++ b/kmod/igb/e1000_nvm.h @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -25,7 +25,6 @@ #ifndef _E1000_NVM_H_ #define _E1000_NVM_H_ - struct e1000_fw_version { u32 etrack_id; u16 eep_major; @@ -42,7 +41,6 @@ struct e1000_fw_version { u16 or_patch; }; - void e1000_init_nvm_ops_generic(struct e1000_hw *hw); s32 e1000_null_read_nvm(struct e1000_hw *hw, u16 a, u16 b, u16 *c); void e1000_null_nvm_generic(struct e1000_hw *hw); diff --git a/kmod/igb/e1000_osdep.h b/kmod/igb/e1000_osdep.h index 2158522a..422bba05 100644 --- a/kmod/igb/e1000_osdep.h +++ b/kmod/igb/e1000_osdep.h @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -65,7 +65,6 @@ #define E1000_BIG_ENDIAN __BIG_ENDIAN #endif - #ifdef DEBUG #define DEBUGOUT(S) pr_debug(S) #define DEBUGOUT1(S, A...) pr_debug(S, ## A) diff --git a/kmod/igb/e1000_phy.c b/kmod/igb/e1000_phy.c index 901daed9..0534e4a3 100644 --- a/kmod/igb/e1000_phy.c +++ b/kmod/igb/e1000_phy.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -222,7 +222,6 @@ s32 e1000_get_phy_id(struct e1000_hw *hw) phy->id |= (u32)(phy_id & PHY_REVISION_MASK); phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK); - return E1000_SUCCESS; } diff --git a/kmod/igb/e1000_phy.h b/kmod/igb/e1000_phy.h index 8f54e009..a109c914 100644 --- a/kmod/igb/e1000_phy.h +++ b/kmod/igb/e1000_phy.h @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, diff --git a/kmod/igb/e1000_regs.h b/kmod/igb/e1000_regs.h index 20c351a5..da373a97 100644 --- a/kmod/igb/e1000_regs.h +++ b/kmod/igb/e1000_regs.h @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -148,7 +148,6 @@ /* QAV Tx mode control register */ #define E1000_I210_TQAVCTRL 0x3570 - #define E1000_DTXMXPKTSZ 0x0355C /* High credit registers where _n can be 0 or 1. */ @@ -157,7 +156,7 @@ /* Queues fetch arbitration priority control register */ #define E1000_I210_TQAVARBCTRL 0x3574 /* Queues priority masks where _n and _p can be 0-3. */ -#define E1000_TQAVARBCTRL_QUEUE_PRI(_n, _p) ((_p) << (2 * _n)) +#define E1000_TQAVARBCTRL_QUEUE_PRI(_n, _p) ((_p) << (2 * (_n))) /* QAV Tx mode control registers where _n can be 0 or 1. */ #define E1000_I210_TQAVCC(_n) (0x3004 + 0x40 * (_n)) @@ -170,7 +169,7 @@ #define E1000_PQGPTC(_n) (0x010014 + (0x100 * (_n))) /* Queues packet buffer size masks where _n can be 0-3 and _s 0-63 [kB] */ -#define E1000_I210_TXPBS_SIZE(_n, _s) ((_s) << (6 * _n)) +#define E1000_I210_TXPBS_SIZE(_n, _s) ((_s) << (6 * (_n))) #define E1000_MMDAC 13 /* MMD Access Control */ #define E1000_MMDAAD 14 /* MMD Access Address/Data */ @@ -445,7 +444,6 @@ /* Ext Flexible Host Filter Table */ #define E1000_FHFT_EXT(_n) (0x09A00 + ((_n) * 0x100)) - #define E1000_KMRNCTRLSTA 0x00034 /* MAC-PHY interface - RW */ #define E1000_MANC2H 0x05860 /* Management Control To Host - RW */ /* Management Decision Filters */ @@ -623,6 +621,4 @@ #define E1000_O2BGPTC 0x08FE4 /* OS2BMC packets received by BMC */ #define E1000_O2BSPC 0x0415C /* OS2BMC packets transmitted by host */ - - #endif diff --git a/kmod/igb/igb.h b/kmod/igb/igb.h index 88834d04..dc79d3f4 100644 --- a/kmod/igb/igb.h +++ b/kmod/igb/igb.h @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -27,8 +27,6 @@ #ifndef _IGB_H_ #define _IGB_H_ -#include <linux/types.h> -#include <asm/page.h> #include <linux/kobject.h> #ifndef IGB_NO_LRO @@ -80,7 +78,11 @@ struct igb_user_page { __func__ , ## args)) #ifdef HAVE_PTP_1588_CLOCK +#ifdef HAVE_INCLUDE_LINUX_TIMECOUNTER_H +#include <linux/timecounter.h> +#else #include <linux/clocksource.h> +#endif /* HAVE_INCLUDE_TIMECOUNTER_H */ #include <linux/net_tstamp.h> #include <linux/ptp_clock_kernel.h> #endif /* HAVE_PTP_1588_CLOCK */ @@ -132,7 +134,6 @@ struct igb_user_page { #define OUI_LEN 3 #define IGB_MAX_VMDQ_QUEUES 8 - struct vf_data_storage { unsigned char vf_mac_addresses[ETH_ALEN]; u16 vf_mc_hashes[IGB_MAX_VF_MC_ENTRIES]; @@ -649,6 +650,7 @@ struct igb_adapter { struct delayed_work ptp_overflow_work; struct work_struct ptp_tx_work; struct sk_buff *ptp_tx_skb; + struct hwtstamp_config tstamp_config; unsigned long ptp_tx_start; unsigned long last_rx_ptp_check; unsigned long last_rx_timestamp; @@ -666,7 +668,6 @@ struct igb_adapter { #endif /* HAVE_I2C_SUPPORT */ unsigned long link_check_timeout; - int devrc; int copper_tries; @@ -787,6 +788,7 @@ extern int igb_up(struct igb_adapter *); extern void igb_down(struct igb_adapter *); extern void igb_reinit_locked(struct igb_adapter *); extern void igb_reset(struct igb_adapter *); +extern int igb_reinit_queues(struct igb_adapter *); #ifdef ETHTOOL_SRXFHINDIR extern void igb_write_rss_indir_tbl(struct igb_adapter *); #endif @@ -841,6 +843,8 @@ extern void igb_vlan_mode(struct net_device *, u32); #define E1000_PCS_CFG_IGN_SD 1 +int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr); +int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr); #ifdef IGB_HWMON void igb_sysfs_exit(struct igb_adapter *adapter); int igb_sysfs_init(struct igb_adapter *adapter); diff --git a/kmod/igb/igb_debugfs.c b/kmod/igb/igb_debugfs.c index 7513d944..3f8ecb6f 100644 --- a/kmod/igb/igb_debugfs.c +++ b/kmod/igb/igb_debugfs.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, diff --git a/kmod/igb/igb_ethtool.c b/kmod/igb/igb_ethtool.c index dd6a1419..d1237e44 100644 --- a/kmod/igb/igb_ethtool.c +++ b/kmod/igb/igb_ethtool.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -231,13 +231,13 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) if ((hw->mac.type == e1000_i354) && (status & E1000_STATUS_2P5_SKU) && !(status & E1000_STATUS_2P5_SKU_OVER)) - ecmd->speed = SPEED_2500; + ethtool_cmd_speed_set(ecmd, SPEED_2500); else if (status & E1000_STATUS_SPEED_1000) - ecmd->speed = SPEED_1000; + ethtool_cmd_speed_set(ecmd, SPEED_1000); else if (status & E1000_STATUS_SPEED_100) - ecmd->speed = SPEED_100; + ethtool_cmd_speed_set(ecmd, SPEED_100); else - ecmd->speed = SPEED_10; + ethtool_cmd_speed_set(ecmd, SPEED_10); if ((status & E1000_STATUS_FD) || hw->phy.media_type != e1000_media_type_copper) @@ -246,7 +246,7 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ecmd->duplex = DUPLEX_HALF; } else { - ecmd->speed = -1; + ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN); ecmd->duplex = -1; } @@ -1361,7 +1361,6 @@ static void igb_phy_disable_receiver(struct igb_adapter *adapter) e1000_write_phy_reg(hw, 30, 0x8FF0); } - static int igb_integrated_phy_loopback(struct igb_adapter *adapter) { struct e1000_hw *hw = &adapter->hw; @@ -1433,7 +1432,8 @@ static int igb_setup_loopback_test(struct igb_adapter *adapter) (hw->device_id == E1000_DEV_ID_DH89XXCC_SERDES) || (hw->device_id == E1000_DEV_ID_DH89XXCC_BACKPLANE) || (hw->device_id == E1000_DEV_ID_DH89XXCC_SFP) || - (hw->device_id == E1000_DEV_ID_I354_SGMII)) { + (hw->device_id == E1000_DEV_ID_I354_SGMII) || + (hw->device_id == E1000_DEV_ID_I354_BACKPLANE_2_5GBPS)) { /* Enable DH89xxCC MPHY for near end loopback */ reg = E1000_READ_REG(hw, E1000_MPHY_ADDR_CTL); @@ -1960,11 +1960,34 @@ static int igb_set_coalesce(struct net_device *netdev, struct igb_adapter *adapter = netdev_priv(netdev); int i; + if (ec->rx_max_coalesced_frames || + ec->rx_coalesce_usecs_irq || + ec->rx_max_coalesced_frames_irq || + ec->tx_max_coalesced_frames || + ec->tx_coalesce_usecs_irq || + ec->stats_block_coalesce_usecs || + ec->use_adaptive_rx_coalesce || + ec->use_adaptive_tx_coalesce || + ec->pkt_rate_low || + ec->rx_coalesce_usecs_low || + ec->rx_max_coalesced_frames_low || + ec->tx_coalesce_usecs_low || + ec->tx_max_coalesced_frames_low || + ec->pkt_rate_high || + ec->rx_coalesce_usecs_high || + ec->rx_max_coalesced_frames_high || + ec->tx_coalesce_usecs_high || + ec->tx_max_coalesced_frames_high || + ec->rate_sample_interval) { + netdev_err(netdev, "set_coalesce: invalid parameter"); + return -ENOTSUPP; + } + if ((ec->rx_coalesce_usecs > IGB_MAX_ITR_USECS) || ((ec->rx_coalesce_usecs > 3) && (ec->rx_coalesce_usecs < IGB_MIN_ITR_USECS)) || (ec->rx_coalesce_usecs == 2)) { - netdev_err(netdev, "set_coalesce:invalid parameter.."); + netdev_err(netdev, "set_coalesce: invalid setting"); return -EINVAL; } @@ -2501,6 +2524,7 @@ static int igb_set_eee(struct net_device *netdev, struct igb_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; struct ethtool_eee eee_curr; + bool adv1g_eee = true, adv100m_eee = true; s32 ret_val; if ((hw->mac.type < e1000_i350) || @@ -2525,12 +2549,14 @@ static int igb_set_eee(struct net_device *netdev, return -EINVAL; } - if (edata->advertised & - ~(ADVERTISE_100_FULL | ADVERTISE_1000_FULL)) { + if (!edata->advertised || (edata->advertised & + ~(ADVERTISE_100_FULL | ADVERTISE_1000_FULL))) { dev_err(pci_dev_to_dev(adapter->pdev), - "EEE Advertisement supports 100Base-Tx Full Duplex(0x008) 1000Base-T Full Duplex(0x20) or both(0x028)\n"); + "EEE Advertisement supports 100Base-Tx Full Duplex(0x08) 1000Base-T Full Duplex(0x20) or both(0x28)\n"); return -EINVAL; } + adv100m_eee = !!(edata->advertised & ADVERTISE_100_FULL); + adv1g_eee = !!(edata->advertised & ADVERTISE_1000_FULL); } else if (!edata->eee_enabled) { dev_err(pci_dev_to_dev(adapter->pdev), @@ -2550,6 +2576,17 @@ static int igb_set_eee(struct net_device *netdev, igb_reset(adapter); } + if (hw->mac.type == e1000_i354) + ret_val = e1000_set_eee_i354(hw, adv1g_eee, adv100m_eee); + else + ret_val = e1000_set_eee_i350(hw, adv1g_eee, adv100m_eee); + + if (ret_val) { + dev_err(pci_dev_to_dev(adapter->pdev), + "Problem setting EEE advertisement options\n"); + return -EINVAL; + } + return 0; } #endif /* ETHTOOL_SEEE */ @@ -2755,11 +2792,16 @@ static u32 igb_get_rxfh_indir_size(struct net_device *netdev) return IGB_RETA_SIZE; } -#ifdef ETHTOOL_GRSSH +#if (defined(ETHTOOL_GRSSH) && !defined(HAVE_ETHTOOL_GSRSSH)) +#ifdef HAVE_RXFH_HASHFUNC +static int igb_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, + u8 *hfunc) +#else static int igb_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key) +#endif /* HAVE_RXFH_HASHFUNC */ #else static int igb_get_rxfh_indir(struct net_device *netdev, u32 *indir) -#endif /* ETHTOOL_GRSSH */ +#endif /* HAVE_ETHTOOL_GSRSSH */ { struct igb_adapter *adapter = netdev_priv(netdev); int i; @@ -2822,12 +2864,17 @@ void igb_write_rss_indir_tbl(struct igb_adapter *adapter) } #ifdef HAVE_ETHTOOL_GRXFHINDIR_SIZE -#ifdef ETHTOOL_SRSSH +#if (defined(ETHTOOL_GRSSH) && !defined(HAVE_ETHTOOL_GSRSSH)) +#ifdef HAVE_RXFH_HASHFUNC +static int igb_set_rxfh(struct net_device *netdev, const u32 *indir, + const u8 *key, const u8 hfunc) +#else static int igb_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key) +#endif /* HAVE_RXFH_HASHFUNC */ #else static int igb_set_rxfh_indir(struct net_device *netdev, const u32 *indir) -#endif /* ETHTOOL_SRSSH */ +#endif /* HAVE_ETHTOOL_GSRSSH */ { struct igb_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; @@ -3110,18 +3157,18 @@ static const struct ethtool_ops igb_ethtool_ops = { #ifdef HAVE_ETHTOOL_GRXFHINDIR_SIZE .get_rxfh_indir_size = igb_get_rxfh_indir_size, #endif /* HAVE_ETHTOOL_GRSFHINDIR_SIZE */ -#ifdef ETHTOOL_GRSSH +#if (defined(ETHTOOL_GRSSH) && !defined(HAVE_ETHTOOL_GSRSSH)) .get_rxfh = igb_get_rxfh, #else .get_rxfh_indir = igb_get_rxfh_indir, -#endif /* ETHTOOL_GRSSH */ +#endif /* HAVE_ETHTOOL_GSRSSH */ #endif /* ETHTOOL_GRXFHINDIR */ #ifdef ETHTOOL_SRXFHINDIR -#ifdef ETHTOOL_SRSSH +#if (defined(ETHTOOL_GRSSH) && !defined(HAVE_ETHTOOL_GSRSSH)) .set_rxfh = igb_set_rxfh, #else .set_rxfh_indir = igb_set_rxfh_indir, -#endif /* ETHTOOL_SRSSH */ +#endif /* HAVE_ETHTOOL_GSRSSH */ #endif /* ETHTOOL_SRXFHINDIR */ #ifdef ETHTOOL_GCHANNELS .get_channels = igb_get_channels, diff --git a/kmod/igb/igb_hwmon.c b/kmod/igb/igb_hwmon.c index 602581c1..382057ac 100644 --- a/kmod/igb/igb_hwmon.c +++ b/kmod/igb/igb_hwmon.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, diff --git a/kmod/igb/igb_main.c b/kmod/igb/igb_main.c index c554b291..3e9946d5 100644 --- a/kmod/igb/igb_main.c +++ b/kmod/igb/igb_main.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -79,8 +79,8 @@ #define VERSION_SUFFIX "_AVB" #define MAJ 5 -#define MIN 2 -#define BUILD 9.4 +#define MIN 3 +#define BUILD 2 #define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "."\ __stringify(BUILD) VERSION_SUFFIX DRV_DEBUG DRV_HW_PERF @@ -89,7 +89,7 @@ char igb_driver_version[] = DRV_VERSION; static const char igb_driver_string[] = "Intel(R) Gigabit Ethernet Network Driver"; static const char igb_copyright[] = - "Copyright (c) 2007-2014 Intel Corporation."; + "Copyright (c) 2007-2015 Intel Corporation."; static const struct pci_device_id igb_pci_tbl[] = { { PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_COPPER) }, @@ -126,14 +126,6 @@ static void igb_watchdog(unsigned long); static void igb_watchdog_task(struct work_struct *); static void igb_dma_err_task(struct work_struct *); static void igb_dma_err_timer(unsigned long data); - -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) ) -static u16 igb_select_queue(struct net_device *dev, struct sk_buff *skb); -#else -static u16 igb_select_queue(struct net_device *dev, struct sk_buff *skb, - void *accel_priv, select_queue_fallback_t fallback); -#endif - static netdev_tx_t igb_xmit_frame(struct sk_buff *skb, struct net_device *); static struct net_device_stats *igb_get_stats(struct net_device *); static int igb_change_mtu(struct net_device *, int); @@ -432,33 +424,10 @@ static void igb_cache_ring_register(struct igb_adapter *adapter) int i = 0, j = 0; u32 rbase_offset = adapter->vfs_allocated_count; - switch (adapter->hw.mac.type) { - case e1000_82576: - /* The queues are allocated for virtualization such that VF 0 - * is allocated queues 0 and 8, VF 1 queues 1 and 9, etc. - * In order to avoid collision we start at the first free queue - * and continue consuming queues in the same sequence - */ - if ((adapter->rss_queues > 1) && adapter->vmdq_pools) { - for (; i < adapter->rss_queues; i++) - adapter->rx_ring[i]->reg_idx = rbase_offset + - Q_IDX_82576(i); - } - break; - case e1000_82575: - case e1000_82580: - case e1000_i350: - case e1000_i354: - case e1000_i210: - case e1000_i211: - /* Fall through */ - default: - for (; i < adapter->num_rx_queues; i++) - adapter->rx_ring[i]->reg_idx = rbase_offset + i; - for (; j < adapter->num_tx_queues; j++) - adapter->tx_ring[j]->reg_idx = rbase_offset + j; - break; - } + for (; i < adapter->num_rx_queues; i++) + adapter->rx_ring[i]->reg_idx = rbase_offset + i; + for (; j < adapter->num_tx_queues; j++) + adapter->tx_ring[j]->reg_idx = rbase_offset + j; } u32 e1000_read_reg(struct e1000_hw *hw, u32 reg) @@ -749,43 +718,70 @@ err_out: return err; } -static void igb_reset_interrupt_capability(struct igb_adapter *adapter) -{ - if (adapter->msix_entries) { - pci_disable_msix(adapter->pdev); - kfree(adapter->msix_entries); - adapter->msix_entries = NULL; - } else if (adapter->flags & IGB_FLAG_HAS_MSI) { - pci_disable_msi(adapter->pdev); - } -} - /** * igb_free_q_vector - Free memory allocated for specific interrupt vector * @adapter: board private structure to initialize * @v_idx: Index of vector to be freed * - * This function frees the memory allocated to the q_vector. In addition if - * NAPI is enabled it will delete any references to the NAPI struct prior - * to freeing the q_vector. + * This function frees the memory allocated to the q_vector. **/ static void igb_free_q_vector(struct igb_adapter *adapter, int v_idx) { struct igb_q_vector *q_vector = adapter->q_vector[v_idx]; + adapter->q_vector[v_idx] = NULL; + + /* igb_get_stats64() might access the rings on this vector, + * we must wait a grace period before freeing it. + */ + kfree_rcu(q_vector, rcu); + +#ifndef IGB_NO_LRO + __skb_queue_purge(&q_vector->lrolist.active); +#endif +} + +/** + * igb_reset_q_vector - Reset config for interrupt vector + * @adapter: board private structure to initialize + * @v_idx: Index of vector to be reset + * + * If NAPI is enabled it will delete any references to the + * NAPI struct. This is preparation for igb_free_q_vector. + **/ +static void igb_reset_q_vector(struct igb_adapter *adapter, int v_idx) +{ + struct igb_q_vector *q_vector = adapter->q_vector[v_idx]; + + /* if we're coming from igb_set_interrupt_capability, the vectors are + * not yet allocated */ + if (!q_vector) + return; + if (q_vector->tx.ring) adapter->tx_ring[q_vector->tx.ring->queue_index] = NULL; if (q_vector->rx.ring) adapter->tx_ring[q_vector->rx.ring->queue_index] = NULL; - adapter->q_vector[v_idx] = NULL; netif_napi_del(&q_vector->napi); -#ifndef IGB_NO_LRO - __skb_queue_purge(&q_vector->lrolist.active); -#endif - kfree_rcu(q_vector, rcu); +} + +static void igb_reset_interrupt_capability(struct igb_adapter *adapter) +{ + int v_idx = adapter->num_q_vectors; + + if (adapter->msix_entries) { + pci_disable_msix(adapter->pdev); + kfree(adapter->msix_entries); + adapter->msix_entries = NULL; + } else if (adapter->flags & IGB_FLAG_HAS_MSI) { + pci_disable_msi(adapter->pdev); + } + + while (v_idx--) + igb_reset_q_vector(adapter, v_idx); } /** @@ -804,8 +800,10 @@ static void igb_free_q_vectors(struct igb_adapter *adapter) adapter->num_rx_queues = 0; adapter->num_q_vectors = 0; - while (v_idx--) + while (v_idx--) { + igb_reset_q_vector(adapter, v_idx); igb_free_q_vector(adapter, v_idx); + } } /** @@ -1046,7 +1044,7 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix) numvecs = max_t(int, adapter->num_tx_queues, adapter->num_rx_queues); - /* if tx handler is seperate make it 1 for every queue */ + /* if tx handler is separate make it 1 for every queue */ if (!(adapter->flags & IGB_FLAG_QUEUE_PAIRS)) numvecs = adapter->num_tx_queues + adapter->num_rx_queues; @@ -1130,6 +1128,10 @@ static int igb_alloc_q_vector(struct igb_adapter *adapter, (sizeof(struct igb_ring) * ring_count); /* allocate q_vector and rings */ + q_vector = adapter->q_vector[v_idx]; + if (!q_vector) + q_vector = kzalloc(size, GFP_KERNEL); + else q_vector = kzalloc(size, GFP_KERNEL); if (!q_vector) return -ENOMEM; @@ -1861,8 +1863,6 @@ void igb_down(struct igb_adapter *adapter) del_timer_sync(&adapter->dma_err_timer); del_timer_sync(&adapter->phy_info_timer); - netif_carrier_off(netdev); - /* record the stats before reset*/ igb_update_stats(adapter); @@ -1898,31 +1898,21 @@ void igb_reinit_locked(struct igb_adapter *adapter) * * @adapter: adapter struct **/ -static s32 igb_enable_mas(struct igb_adapter *adapter) +void igb_enable_mas(struct igb_adapter *adapter) { struct e1000_hw *hw = &adapter->hw; u32 connsw; - s32 ret_val = E1000_SUCCESS; connsw = E1000_READ_REG(hw, E1000_CONNSW); - if (hw->phy.media_type == e1000_media_type_copper) { - /* configure for SerDes media detect */ - if (!(connsw & E1000_CONNSW_SERDESD)) { + + /* configure for SerDes media detect */ + if ((hw->phy.media_type == e1000_media_type_copper) && + (!(connsw & E1000_CONNSW_SERDESD))) { connsw |= E1000_CONNSW_ENRGSRC; connsw |= E1000_CONNSW_AUTOSENSE_EN; E1000_WRITE_REG(hw, E1000_CONNSW, connsw); E1000_WRITE_FLUSH(hw); - } else if (connsw & E1000_CONNSW_SERDESD) { - /* already SerDes, no need to enable anything */ - return ret_val; - } else { - dev_info(pci_dev_to_dev(adapter->pdev), - "%s:MAS: Unable to configure feature, disabling..\n", - adapter->netdev->name); - adapter->flags &= ~IGB_FLAG_MAS_ENABLE; - } } - return ret_val; } void igb_reset(struct igb_adapter *adapter) @@ -1936,26 +1926,7 @@ void igb_reset(struct igb_adapter *adapter) /* Repartition Pba for greater than 9k mtu * To take effect CTRL.RST is required. */ - switch (mac->type) { - case e1000_i350: - case e1000_82580: - case e1000_i354: - pba = E1000_READ_REG(hw, E1000_RXPBS); - pba = e1000_rxpbs_adjust_82580(pba); - break; - case e1000_82576: - pba = E1000_READ_REG(hw, E1000_RXPBS); - pba &= E1000_RXPBS_SIZE_MASK_82576; - break; - case e1000_i210: - pba = E1000_PBA_32K; /* for AVB mode */ - break; - case e1000_82575: - case e1000_i211: - default: - pba = E1000_PBA_34K; - break; - } + pba = E1000_PBA_34K; if ((adapter->max_frame_size > ETH_FRAME_LEN + ETH_FCS_LEN) && (mac->type < e1000_82576)) { @@ -2044,11 +2015,6 @@ void igb_reset(struct igb_adapter *adapter) e1000_get_bus_info(hw); adapter->flags &= ~IGB_FLAG_MEDIA_RESET; } - if (adapter->flags & IGB_FLAG_MAS_ENABLE) { - if (igb_enable_mas(adapter)) - dev_err(pci_dev_to_dev(pdev), - "Error enabling Media Auto Sense\n"); - } if (e1000_init_hw(hw)) dev_err(pci_dev_to_dev(pdev), "Hardware Error\n"); @@ -2078,10 +2044,10 @@ void igb_reset(struct igb_adapter *adapter) case e1000_i350: case e1000_i210: case e1000_i211: - e1000_set_eee_i350(hw); + e1000_set_eee_i350(hw, true, true); break; case e1000_i354: - e1000_set_eee_i354(hw); + e1000_set_eee_i354(hw, true, true); break; default: break; @@ -2096,7 +2062,6 @@ void igb_reset(struct igb_adapter *adapter) /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ E1000_WRITE_REG(hw, E1000_VET, ETHERNET_IEEE_VLAN_TYPE); - #ifdef HAVE_PTP_1588_CLOCK /* Re-enable PTP, where applicable. */ igb_ptp_reset(adapter); @@ -2150,13 +2115,16 @@ static int igb_set_features(struct net_device *netdev, static int igb_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], struct net_device *dev, const unsigned char *addr, +#ifdef HAVE_NDO_FDB_ADD_VID + u16 vid, +#endif u16 flags) -#else +#else /* USE_CONST_DEV_UC_CHAR */ static int igb_ndo_fdb_add(struct ndmsg *ndm, struct net_device *dev, unsigned char *addr, u16 flags) -#endif +#endif /* USE_CONST_DEV_UC_CHAR */ { struct igb_adapter *adapter = netdev_priv(dev); struct e1000_hw *hw = &adapter->hw; @@ -2242,8 +2210,14 @@ static int igb_ndo_fdb_dump(struct sk_buff *skb, #endif /* USE_DEFAULT_FDB_DEL_DUMP */ #ifdef HAVE_BRIDGE_ATTRIBS +#ifdef HAVE_NDO_BRIDGE_SET_DEL_LINK_FLAGS +static int igb_ndo_bridge_setlink(struct net_device *dev, + struct nlmsghdr *nlh, + u16 flags) +#else static int igb_ndo_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh) +#endif /* HAVE_NDO_BRIDGE_SET_DEL_LINK_FLAGS */ { struct igb_adapter *adapter = netdev_priv(dev); struct e1000_hw *hw = &adapter->hw; @@ -2287,13 +2261,17 @@ static int igb_ndo_bridge_setlink(struct net_device *dev, return 0; } -#ifdef HAVE_BRIDGE_FILTER +#ifdef HAVE_NDO_BRIDGE_GETLINK_NLFLAGS +static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, + struct net_device *dev, u32 filter_mask, + int nlflags) +#elif defined(HAVE_BRIDGE_FILTER) static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, struct net_device *dev, u32 filter_mask) #else static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, struct net_device *dev) -#endif +#endif /* HAVE_NDO_BRIDGE_GETLINK_NLFLAGS */ { struct igb_adapter *adapter = netdev_priv(dev); u16 mode; @@ -2306,7 +2284,13 @@ static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, else mode = BRIDGE_MODE_VEPA; +#ifdef HAVE_NDO_BRIDGE_GETLINK_NLFLAGS + return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0, nlflags); +#elif defined(HAVE_NDO_FDB_ADD_VID) + return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0); +#else return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode); +#endif /* HAVE_NDO_FDB_ADD_VID */ } #endif /* HAVE_BRIDGE_ATTRIBS */ #endif /* HAVE_FDB_OPS */ @@ -2317,7 +2301,6 @@ static const struct net_device_ops igb_netdev_ops = { .ndo_open = igb_open, .ndo_stop = igb_close, .ndo_start_xmit = igb_xmit_frame, - .ndo_select_queue = igb_select_queue, .ndo_get_stats = igb_get_stats, .ndo_set_rx_mode = igb_set_rx_mode, .ndo_set_mac_address = igb_set_mac, @@ -2988,7 +2971,6 @@ static int igb_probe(struct pci_dev *pdev, dev_info(pci_dev_to_dev(pdev), "%s: PBA No: %s\n", netdev->name, pba_str); - /* Initialize the thermal sensor on i350 devices. */ if (hw->mac.type == e1000_i350) { if (hw->bus.func == 0) { @@ -3023,7 +3005,7 @@ static int igb_probe(struct pci_dev *pdev, case e1000_i210: case e1000_i211: /* Enable EEE for internal copper PHY devices */ - err = e1000_set_eee_i350(hw); + err = e1000_set_eee_i350(hw, true, true); if ((!err) && (adapter->flags & IGB_FLAG_EEE)) adapter->eee_advert = @@ -3032,7 +3014,7 @@ static int igb_probe(struct pci_dev *pdev, case e1000_i354: if ((E1000_READ_REG(hw, E1000_CTRL_EXT)) & (E1000_CTRL_EXT_LINK_MODE_SGMII)) { - err = e1000_set_eee_i354(hw); + err = e1000_set_eee_i354(hw, true, true); if ((!err) && (adapter->flags & IGB_FLAG_EEE)) adapter->eee_advert = @@ -4531,7 +4513,7 @@ static void igb_set_rx_mode(struct net_device *netdev) vmolr |= E1000_VMOLR_ROPE; } #endif /* HAVE_SET_RX_MODE */ - /* rctl |= E1000_RCTL_VFE; Disable VLAN filtering */ + rctl |= E1000_RCTL_VFE; } E1000_WRITE_REG(hw, E1000_RCTL, rctl); @@ -5561,12 +5543,20 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb, first->gso_segs = 1; #ifdef HAVE_PTP_1588_CLOCK +#ifdef SKB_SHARED_TX_IS_UNION + if (unlikely(skb_tx(skb)->hardware)) { +#else if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) { +#endif struct igb_adapter *adapter = netdev_priv(tx_ring->netdev); if (!test_and_set_bit_lock(__IGB_PTP_TX_IN_PROGRESS, &adapter->state)) { +#ifdef SKB_SHARED_TX_IS_UNION + skb_tx(skb)->in_progress = 1; +#else skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; +#endif tx_flags |= IGB_TX_FLAGS_TSTAMP; adapter->ptp_tx_skb = skb_get(skb); @@ -5577,9 +5567,9 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb, } #endif /* HAVE_PTP_1588_CLOCK */ skb_tx_timestamp(skb); - if (vlan_tx_tag_present(skb)) { + if (skb_vlan_tag_present(skb)) { tx_flags |= IGB_TX_FLAGS_VLAN; - tx_flags |= (vlan_tx_tag_get(skb) << IGB_TX_FLAGS_VLAN_SHIFT); + tx_flags |= (skb_vlan_tag_get(skb) << IGB_TX_FLAGS_VLAN_SHIFT); } /* record initial flags and protocol */ @@ -5624,17 +5614,6 @@ static inline struct igb_ring *igb_tx_queue_mapping(struct igb_adapter *adapter, #error This driver must have multi-queue transmit support enabled (CONFIG_NETDEVICES_MULTIQUEUE)! #endif -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) ) -static u16 igb_select_queue(struct net_device *dev, struct sk_buff *skb) -#else -static u16 igb_select_queue(struct net_device *dev, struct sk_buff *skb, - void *accel_priv, select_queue_fallback_t fallback) -#endif -{ - /* remap normal LAN to best effort queue[3] */ - return (3); -} - static netdev_tx_t igb_xmit_frame(struct sk_buff *skb, struct net_device *netdev) { @@ -7365,24 +7344,27 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring, struct sk_buff *skb) { struct page *page = rx_buffer->page; + unsigned char *va = page_address(page) + rx_buffer->page_offset; unsigned int size = le16_to_cpu(rx_desc->wb.upper.length); #if (PAGE_SIZE < 8192) unsigned int truesize = IGB_RX_BUFSZ; #else - unsigned int truesize = ALIGN(size, L1_CACHE_BYTES); + unsigned int truesize = SKB_DATA_ALIGN(size); #endif + unsigned int pull_len; - if ((size <= IGB_RX_HDR_LEN) && !skb_is_nonlinear(skb)) { - unsigned char *va = page_address(page) + rx_buffer->page_offset; + if (unlikely(skb_is_nonlinear(skb))) + goto add_tail_frag; #ifdef HAVE_PTP_1588_CLOCK - if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) { - igb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb); - va += IGB_TS_HDR_LEN; - size -= IGB_TS_HDR_LEN; - } + if (unlikely(igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP))) { + igb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb); + va += IGB_TS_HDR_LEN; + size -= IGB_TS_HDR_LEN; + } #endif /* HAVE_PTP_1588_CLOCK */ + if (likely(size <= IGB_RX_HDR_LEN)) { memcpy(__skb_put(skb, size), va, ALIGN(size, sizeof(long))); /* we can reuse buffer as-is, just make sure it is local */ @@ -7394,8 +7376,21 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring, return false; } + /* we need the header to contain the greater of either ETH_HLEN or + * 60 bytes if the skb->len is less than 60 for skb_pad. + */ + pull_len = eth_get_headlen(va, IGB_RX_HDR_LEN); + + /* align pull length to size of long to optimize memcpy performance */ + memcpy(__skb_put(skb, pull_len), va, ALIGN(pull_len, sizeof(long))); + + /* update all of the pointers */ + va += pull_len; + size -= pull_len; + +add_tail_frag: skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, - rx_buffer->page_offset, size, truesize); + (unsigned long)va & ~PAGE_MASK, size, truesize); return igb_can_reuse_rx_page(rx_buffer, page, truesize); } @@ -7678,6 +7673,9 @@ static void igb_lro_flush(struct igb_q_vector *q_vector, } #ifdef NETIF_F_GSO +#ifdef NAPI_GRO_CB + NAPI_GRO_CB(skb)->data_offset = 0; +#endif skb_shinfo(skb)->gso_size = IGB_CB(skb)->mss; skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; #endif @@ -8681,8 +8679,12 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) return igb_mii_ioctl(netdev, ifr, cmd); #endif #ifdef HAVE_PTP_1588_CLOCK +#ifdef SIOCGHWTSTAMP + case SIOCGHWTSTAMP: + return igb_ptp_get_ts_config(netdev, ifr); +#endif case SIOCSHWTSTAMP: - return igb_ptp_hwtstamp_ioctl(netdev, ifr, cmd); + return igb_ptp_set_ts_config(netdev, ifr); #endif /* HAVE_PTP_1588_CLOCK */ #ifdef ETHTOOL_OPS_COMPAT case SIOCETHTOOL: diff --git a/kmod/igb/igb_param.c b/kmod/igb/igb_param.c index bf47799a..ca700b93 100644 --- a/kmod/igb/igb_param.c +++ b/kmod/igb/igb_param.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, diff --git a/kmod/igb/igb_procfs.c b/kmod/igb/igb_procfs.c index f52cbee2..9302725d 100644 --- a/kmod/igb/igb_procfs.c +++ b/kmod/igb/igb_procfs.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -37,7 +37,6 @@ static struct proc_dir_entry *igb_top_dir; - bool igb_thermal_present(struct igb_adapter *adapter) { s32 status; @@ -64,7 +63,6 @@ bool igb_thermal_present(struct igb_adapter *adapter) return true; } - static int igb_macburn(char *page, char **start, off_t off, int count, int *eof, void *data) { diff --git a/kmod/igb/igb_ptp.c b/kmod/igb/igb_ptp.c index 07de643e..6b772dfd 100644 --- a/kmod/igb/igb_ptp.c +++ b/kmod/igb/igb_ptp.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -29,6 +29,7 @@ #include "igb.h" +#ifdef HAVE_PTP_1588_CLOCK #include <linux/module.h> #include <linux/device.h> #include <linux/pci.h> @@ -325,11 +326,12 @@ static int igb_ptp_adjtime_i210(struct ptp_clock_info *ptp, s64 delta) return 0; } -static int igb_ptp_gettime_82576(struct ptp_clock_info *ptp, - struct timespec *ts) +static int igb_ptp_gettime64_82576(struct ptp_clock_info *ptp, + struct timespec *ts64) { struct igb_adapter *igb = container_of(ptp, struct igb_adapter, ptp_caps); + struct timespec ts; unsigned long flags; u64 ns; u32 remainder; @@ -340,28 +342,104 @@ static int igb_ptp_gettime_82576(struct ptp_clock_info *ptp, spin_unlock_irqrestore(&igb->tmreg_lock, flags); - ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder); - ts->tv_nsec = remainder; + ts.tv_sec = div_u64_rem(ns, 1000000000, &remainder); + ts.tv_nsec = remainder; + *ts64 = timespec_to_timespec64(ts); return 0; } -static int igb_ptp_gettime_i210(struct ptp_clock_info *ptp, - struct timespec *ts) +static int igb_ptp_gettime64_i210(struct ptp_clock_info *ptp, + struct timespec *ts64) { struct igb_adapter *igb = container_of(ptp, struct igb_adapter, ptp_caps); + struct timespec ts; unsigned long flags; spin_lock_irqsave(&igb->tmreg_lock, flags); - igb_ptp_read_i210(igb, ts); + igb_ptp_read_i210(igb, &ts); + *ts64 = timespec_to_timespec64(ts); + + spin_unlock_irqrestore(&igb->tmreg_lock, flags); + + return 0; +} + +#ifdef HAVE_PTP_CLOCK_INFO_GETTIME64 +static int igb_ptp_settime64_82576(struct ptp_clock_info *ptp, + const struct timespec *ts64) +{ + struct igb_adapter *igb = container_of(ptp, struct igb_adapter, + ptp_caps); + struct timespec ts; + unsigned long flags; + u64 ns; + + ts = timespec64_to_timespec(*ts64); + ns = ts.tv_sec * 1000000000ULL; + ns += ts.tv_nsec; + + spin_lock_irqsave(&igb->tmreg_lock, flags); + + timecounter_init(&igb->tc, &igb->cc, ns); spin_unlock_irqrestore(&igb->tmreg_lock, flags); return 0; } +#endif +static int igb_ptp_settime64_i210(struct ptp_clock_info *ptp, + const struct timespec *ts64) +{ + struct igb_adapter *igb = container_of(ptp, struct igb_adapter, + ptp_caps); + struct timespec ts; + unsigned long flags; + + ts = timespec64_to_timespec(*ts64); + spin_lock_irqsave(&igb->tmreg_lock, flags); + + igb_ptp_write_i210(igb, &ts); + + spin_unlock_irqrestore(&igb->tmreg_lock, flags); + + return 0; +} + +#ifndef HAVE_PTP_CLOCK_INFO_GETTIME64 +static int igb_ptp_gettime_82576(struct ptp_clock_info *ptp, + struct timespec *ts) +{ + struct timespec64 ts64; + int err; + + err = igb_ptp_gettime64_82576(ptp, &ts64); + if (err) + return err; + + *ts = timespec64_to_timespec(ts64); + + return 0; +} + +static int igb_ptp_gettime_i210(struct ptp_clock_info *ptp, + struct timespec *ts) +{ + struct timespec64 ts64; + int err; + + err = igb_ptp_gettime64_i210(ptp, &ts64); + if (err) + return err; + + *ts = timespec64_to_timespec(ts64); + + return 0; +} + static int igb_ptp_settime_82576(struct ptp_clock_info *ptp, const struct timespec *ts) { @@ -398,6 +476,7 @@ static int igb_ptp_settime_i210(struct ptp_clock_info *ptp, return 0; } +#endif static int igb_ptp_enable(struct ptp_clock_info *ptp, struct ptp_clock_request *rq, int on) { @@ -439,13 +518,13 @@ void igb_ptp_tx_work(struct work_struct *work) schedule_work(&adapter->ptp_tx_work); } -static void igb_ptp_overflow_check(struct work_struct *work) +static void igb_ptp_overflow_check_82576(struct work_struct *work) { struct igb_adapter *igb = container_of(work, struct igb_adapter, ptp_overflow_work.work); struct timespec ts; - igb->ptp_caps.gettime(&igb->ptp_caps, &ts); + igb_ptp_gettime64_82576(&igb->ptp_caps, &ts); pr_debug("igb overflow check at %ld.%09lu\n", ts.tv_sec, ts.tv_nsec); @@ -583,10 +662,27 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, } /** - * igb_ptp_hwtstamp_ioctl - control hardware time stamping + * igb_ptp_get_ts_config - get hardware time stamping config * @netdev: * @ifreq: - * @cmd: + * + * Get the hwtstamp_config settings to return to the user. Rather than attempt + * to deconstruct the settings from the registers, just return a shadow copy + * of the last known settings. + **/ +int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr) +{ + struct igb_adapter *adapter = netdev_priv(netdev); + struct hwtstamp_config *config = &adapter->tstamp_config; + + return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ? + -EFAULT : 0; +} + +/** + * igb_ptp_set_timestamp_mode - setup hardware for timestamping + * @adapter: networking device structure + * @config: hwtstamp configuration * * Outgoing time stamping can be enabled and disabled. Play nice and * disable it when requested, although it shouldn't case any overhead @@ -600,13 +696,11 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, * not supported, with the exception of "all V2 events regardless of * level 2 or 4". * - **/ -int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, - struct ifreq *ifr, int cmd) + */ +static int igb_ptp_set_timestamp_mode(struct igb_adapter *adapter, + struct hwtstamp_config *config) { - struct igb_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; - struct hwtstamp_config config; u32 tsync_tx_ctl = E1000_TSYNCTXCTL_ENABLED; u32 tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED; u32 tsync_rx_cfg = 0; @@ -614,14 +708,11 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, bool is_l2 = false; u32 regval; - if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) - return -EFAULT; - /* reserved for future extensions */ - if (config.flags) + if (config->flags) return -EINVAL; - switch (config.tx_type) { + switch (config->tx_type) { case HWTSTAMP_TX_OFF: tsync_tx_ctl = 0; case HWTSTAMP_TX_ON: @@ -630,7 +721,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, return -ERANGE; } - switch (config.rx_filter) { + switch (config->rx_filter) { case HWTSTAMP_FILTER_NONE: tsync_rx_ctl = 0; break; @@ -654,7 +745,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_EVENT_V2; - config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; + config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; is_l2 = true; is_l4 = true; break; @@ -666,12 +757,12 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, */ if (hw->mac.type != e1000_82576) { tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL; - config.rx_filter = HWTSTAMP_FILTER_ALL; + config->rx_filter = HWTSTAMP_FILTER_ALL; break; } /* fall through */ default: - config.rx_filter = HWTSTAMP_FILTER_NONE; + config->rx_filter = HWTSTAMP_FILTER_NONE; return -ERANGE; } @@ -689,7 +780,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, if ((hw->mac.type >= e1000_82580) && tsync_rx_ctl) { tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED; tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL; - config.rx_filter = HWTSTAMP_FILTER_ALL; + config->rx_filter = HWTSTAMP_FILTER_ALL; is_l2 = true; is_l4 = true; @@ -753,6 +844,32 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, regval = E1000_READ_REG(hw, E1000_RXSTMPL); regval = E1000_READ_REG(hw, E1000_RXSTMPH); + return 0; +} + +/** + * igb_ptp_set_ts_config - set hardware time stamping config + * @netdev: + * @ifreq: + * + **/ +int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr) +{ + struct igb_adapter *adapter = netdev_priv(netdev); + struct hwtstamp_config config; + int err; + + if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) + return -EFAULT; + + err = igb_ptp_set_timestamp_mode(adapter, &config); + if (err) + return err; + + /* save these settings for future reference */ + memcpy(&adapter->tstamp_config, &config, + sizeof(adapter->tstamp_config)); + return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? -EFAULT : 0; } @@ -771,8 +888,13 @@ void igb_ptp_init(struct igb_adapter *adapter) adapter->ptp_caps.pps = 0; adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82576; adapter->ptp_caps.adjtime = igb_ptp_adjtime_82576; +#ifdef HAVE_PTP_CLOCK_INFO_GETTIME64 + adapter->ptp_caps.gettime64 = igb_ptp_gettime64_82576; + adapter->ptp_caps.settime64 = igb_ptp_settime64_82576; +#else adapter->ptp_caps.gettime = igb_ptp_gettime_82576; adapter->ptp_caps.settime = igb_ptp_settime_82576; +#endif adapter->ptp_caps.enable = igb_ptp_enable; adapter->cc.read = igb_ptp_read_82576; adapter->cc.mask = CLOCKSOURCE_MASK(64); @@ -792,8 +914,13 @@ void igb_ptp_init(struct igb_adapter *adapter) adapter->ptp_caps.pps = 0; adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82580; adapter->ptp_caps.adjtime = igb_ptp_adjtime_82576; +#ifdef HAVE_PTP_CLOCK_INFO_GETTIME64 + adapter->ptp_caps.gettime64 = igb_ptp_gettime64_82576; + adapter->ptp_caps.settime64 = igb_ptp_settime64_82576; +#else adapter->ptp_caps.gettime = igb_ptp_gettime_82576; adapter->ptp_caps.settime = igb_ptp_settime_82576; +#endif adapter->ptp_caps.enable = igb_ptp_enable; adapter->cc.read = igb_ptp_read_82580; adapter->cc.mask = CLOCKSOURCE_MASK(IGB_NBITS_82580); @@ -811,8 +938,13 @@ void igb_ptp_init(struct igb_adapter *adapter) adapter->ptp_caps.pps = 0; adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82580; adapter->ptp_caps.adjtime = igb_ptp_adjtime_i210; +#ifdef HAVE_PTP_CLOCK_INFO_GETTIME64 + adapter->ptp_caps.gettime64 = igb_ptp_gettime64_i210; + adapter->ptp_caps.settime64 = igb_ptp_settime64_i210; +#else adapter->ptp_caps.gettime = igb_ptp_gettime_i210; adapter->ptp_caps.settime = igb_ptp_settime_i210; +#endif adapter->ptp_caps.enable = igb_ptp_enable; /* Enable the timer functions by clearing bit 31. */ E1000_WRITE_REG(hw, E1000_TSAUXC, 0x0); @@ -831,13 +963,13 @@ void igb_ptp_init(struct igb_adapter *adapter) if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) { struct timespec ts = ktime_to_timespec(ktime_get_real()); - igb_ptp_settime_i210(&adapter->ptp_caps, &ts); + igb_ptp_settime64_i210(&adapter->ptp_caps, &ts); } else { timecounter_init(&adapter->tc, &adapter->cc, ktime_to_ns(ktime_get_real())); INIT_DELAYED_WORK(&adapter->ptp_overflow_work, - igb_ptp_overflow_check); + igb_ptp_overflow_check_82576); schedule_delayed_work(&adapter->ptp_overflow_work, IGB_SYSTIM_OVERFLOW_PERIOD); @@ -849,6 +981,9 @@ void igb_ptp_init(struct igb_adapter *adapter) E1000_WRITE_REG(hw, E1000_IMS, E1000_IMS_TS); } + adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE; + adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF; + adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps, &adapter->pdev->dev); if (IS_ERR(adapter->ptp_clock)) { @@ -912,6 +1047,9 @@ void igb_ptp_reset(struct igb_adapter *adapter) if (!(adapter->flags & IGB_FLAG_PTP)) return; + /* reset the tstamp_config */ + igb_ptp_set_timestamp_mode(adapter, &adapter->tstamp_config); + switch (adapter->hw.mac.type) { case e1000_82576: /* Dial the nominal frequency. */ @@ -937,9 +1075,10 @@ void igb_ptp_reset(struct igb_adapter *adapter) if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) { struct timespec ts = ktime_to_timespec(ktime_get_real()); - igb_ptp_settime_i210(&adapter->ptp_caps, &ts); + igb_ptp_settime64_i210(&adapter->ptp_caps, &ts); } else { timecounter_init(&adapter->tc, &adapter->cc, ktime_to_ns(ktime_get_real())); } } +#endif /* HAVE_PTP_1588_CLOCK */ diff --git a/kmod/igb/igb_regtest.h b/kmod/igb/igb_regtest.h index 0d9c4d70..d1c192d8 100644 --- a/kmod/igb/igb_regtest.h +++ b/kmod/igb/igb_regtest.h @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, diff --git a/kmod/igb/igb_vmdq.c b/kmod/igb/igb_vmdq.c index 87b5d6f9..fdc0bcbb 100644 --- a/kmod/igb/igb_vmdq.c +++ b/kmod/igb/igb_vmdq.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -333,11 +333,11 @@ static int igb_vmdq_get_settings(struct net_device *netdev, if ((status & E1000_STATUS_SPEED_1000) || hw->phy.media_type != e1000_media_type_copper) - ecmd->speed = SPEED_1000; + ethtool_cmd_speed_set(ecmd, SPEED_1000); else if (status & E1000_STATUS_SPEED_100) - ecmd->speed = SPEED_100; + ethtool_cmd_speed_set(ecmd, SPEED_100); else - ecmd->speed = SPEED_10; + ethtool_cmd_speed_set(ecmd, SPEED_10); if ((status & E1000_STATUS_FD) || hw->phy.media_type != e1000_media_type_copper) @@ -345,7 +345,7 @@ static int igb_vmdq_get_settings(struct net_device *netdev, else ecmd->duplex = DUPLEX_HALF; } else { - ecmd->speed = -1; + ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN); ecmd->duplex = -1; } diff --git a/kmod/igb/igb_vmdq.h b/kmod/igb/igb_vmdq.h index b4f9027e..1411ac7b 100644 --- a/kmod/igb/igb_vmdq.h +++ b/kmod/igb/igb_vmdq.h @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, diff --git a/kmod/igb/kcompat.c b/kmod/igb/kcompat.c index 059c9ab6..13bfda9e 100644 --- a/kmod/igb/kcompat.c +++ b/kmod/igb/kcompat.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -753,12 +753,8 @@ int _kc_pci_save_state(struct pci_dev *pdev) void _kc_pci_restore_state(struct pci_dev *pdev) { -#if defined(DRIVER_IXGBE) || defined(DRIVER_I40E) || defined(DRIVER_IXGBEVF) - struct adapter_struct *adapter = pci_get_drvdata(pdev); -#else struct net_device *netdev = pci_get_drvdata(pdev); struct adapter_struct *adapter = netdev_priv(netdev); -#endif int size = PCI_CONFIG_SPACE_LEN, i; u16 pcie_cap_offset; u16 pcie_link_status; @@ -986,8 +982,6 @@ out_err: /*****************************************************************************/ #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) ) #ifdef NAPI -#if defined(DRIVER_IXGBE) || defined(DRIVER_IGB) || defined(DRIVER_I40E) || \ - defined(DRIVER_IXGBEVF) struct net_device *napi_to_poll_dev(const struct napi_struct *napi) { struct adapter_q_vector *q_vector = container_of(napi, @@ -995,20 +989,13 @@ struct net_device *napi_to_poll_dev(const struct napi_struct *napi) napi); return &q_vector->poll_dev; } -#endif int __kc_adapter_clean(struct net_device *netdev, int *budget) { int work_done; int work_to_do = min(*budget, netdev->quota); -#if defined(DRIVER_IXGBE) || defined(DRIVER_IGB) || defined(DRIVER_I40E) || \ - defined(E1000E_MQ) || defined(DRIVER_IXGBEVF) /* kcompat.h netif_napi_add puts napi struct in "fake netdev->priv" */ struct napi_struct *napi = netdev->priv; -#else - struct adapter_struct *adapter = netdev_priv(netdev); - struct napi_struct *napi = &adapter->rx_ring[0].napi; -#endif work_done = napi->poll(napi, work_to_do); *budget -= work_done; netdev->quota -= work_done; @@ -1154,7 +1141,7 @@ void _kc_pci_clear_master(struct pci_dev *dev) #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) ) #if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(6,0)) -int _kc_pci_num_vf(struct pci_dev *dev) +int _kc_pci_num_vf(struct pci_dev __maybe_unused *dev) { int num_vf = 0; #ifdef CONFIG_PCI_IOV @@ -1176,8 +1163,6 @@ int _kc_pci_num_vf(struct pci_dev *dev) #endif /* < 2.6.34 */ #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) ) -#if defined(DRIVER_IXGBE) || defined(DRIVER_IGB) || defined(DRIVER_I40E) || \ - defined(DRIVER_IXGBEVF) #ifdef HAVE_TX_MQ #if (!(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,0))) #ifndef CONFIG_NETDEVICES_MULTIQUEUE @@ -1227,7 +1212,6 @@ ssize_t _kc_simple_write_to_buffer(void *to, size_t available, loff_t *ppos, return count; } -#endif /* defined(DRIVER_IXGBE) || defined(DRIVER_IGB) || defined(DRIVER_I40E) */ #endif /* < 2.6.35 */ /*****************************************************************************/ @@ -1255,8 +1239,6 @@ int _kc_ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported) #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) ) #if (!(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE > RHEL_RELEASE_VERSION(6,0))) - - #endif /* !(RHEL_RELEASE_CODE > RHEL_RELEASE_VERSION(6,0)) */ #endif /* < 2.6.39 */ @@ -1271,6 +1253,7 @@ void _kc_skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, skb->truesize += truesize; } +#if !(SLE_VERSION_CODE && SLE_VERSION_CODE >= SLE_VERSION(11,3,0)) int _kc_simple_open(struct inode *inode, struct file *file) { if (inode->i_private) @@ -1278,6 +1261,7 @@ int _kc_simple_open(struct inode *inode, struct file *file) return 0; } +#endif /* SLE_VERSION < 11,3,0 */ #endif /* < 3.4.0 */ @@ -1516,7 +1500,7 @@ int __kc_ndo_dflt_fdb_del(struct ndmsg *ndm, struct net_device *dev, #endif /* HAVE_FDB_OPS */ #ifdef CONFIG_PCI_IOV -int __kc_pci_vfs_assigned(struct pci_dev *dev) +int __kc_pci_vfs_assigned(struct pci_dev __maybe_unused *dev) { unsigned int vfs_assigned = 0; #ifdef HAVE_PCI_DEV_FLAGS_ASSIGNED @@ -1574,6 +1558,21 @@ int __kc_dma_set_mask_and_coherent(struct device *dev, u64 mask) err = dma_set_coherent_mask(dev, mask); return err; } + +void __kc_netdev_rss_key_fill(void *buffer, size_t len) +{ + /* Set of random keys generated using kernel random number generator */ + static const u8 seed[NETDEV_RSS_KEY_LEN] = {0xE6, 0xFA, 0x35, 0x62, + 0x95, 0x12, 0x3E, 0xA3, 0xFB, 0x46, 0xC1, 0x5F, + 0xB1, 0x43, 0x82, 0x5B, 0x6A, 0x49, 0x50, 0x95, + 0xCD, 0xAB, 0xD8, 0x11, 0x8F, 0xC5, 0xBD, 0xBC, + 0x6A, 0x4A, 0xB2, 0xD4, 0x1F, 0xFE, 0xBC, 0x41, + 0xBF, 0xAC, 0xB2, 0x9A, 0x8F, 0x70, 0xE9, 0x2A, + 0xD7, 0xB2, 0x80, 0xB6, 0x5B, 0xAA, 0x9D, 0x20}; + + BUG_ON(len > NETDEV_RSS_KEY_LEN); + memcpy(buffer, seed, len); +} #endif /* 3.13.0 */ #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) ) @@ -1747,3 +1746,175 @@ void __kc_dev_addr_unsync_dev(struct dev_addr_list **list, int *count, #endif /* HAVE_SET_RX_MODE */ #endif /* 3.16.0 */ +/******************************************************************************/ +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) ) +#ifndef NO_PTP_SUPPORT +static void __kc_sock_efree(struct sk_buff *skb) +{ + sock_put(skb->sk); +} + +struct sk_buff *__kc_skb_clone_sk(struct sk_buff *skb) +{ + struct sock *sk = skb->sk; + struct sk_buff *clone; + + if (!sk || !atomic_inc_not_zero(&sk->sk_refcnt)) + return NULL; + + clone = skb_clone(skb, GFP_ATOMIC); + if (!clone) { + sock_put(sk); + return NULL; + } + + clone->sk = sk; + clone->destructor = __kc_sock_efree; + + return clone; +} + +void __kc_skb_complete_tx_timestamp(struct sk_buff *skb, + struct skb_shared_hwtstamps *hwtstamps) +{ + struct sock_exterr_skb *serr; + struct sock *sk = skb->sk; + int err; + + sock_hold(sk); + + *skb_hwtstamps(skb) = *hwtstamps; + + serr = SKB_EXT_ERR(skb); + memset(serr, 0, sizeof(*serr)); + serr->ee.ee_errno = ENOMSG; + serr->ee.ee_origin = SO_EE_ORIGIN_TIMESTAMPING; + + err = sock_queue_err_skb(sk, skb); + if (err) + kfree_skb(skb); + + sock_put(sk); +} +#endif + +/* include headers needed for get_headlen function */ +#ifdef HAVE_SCTP +#include <linux/sctp.h> +#endif + +unsigned int __kc_eth_get_headlen(unsigned char *data, unsigned int max_len) +{ + union { + unsigned char *network; + /* l2 headers */ + struct ethhdr *eth; + struct vlan_hdr *vlan; + /* l3 headers */ + struct iphdr *ipv4; + struct ipv6hdr *ipv6; + } hdr; + __be16 proto; + u8 nexthdr = 0; /* default to not TCP */ + u8 hlen; + + /* this should never happen, but better safe than sorry */ + if (max_len < ETH_HLEN) + return max_len; + + /* initialize network frame pointer */ + hdr.network = data; + + /* set first protocol and move network header forward */ + proto = hdr.eth->h_proto; + hdr.network += ETH_HLEN; + +again: + switch (proto) { + /* handle any vlan tag if present */ + case __constant_htons(ETH_P_8021AD): + case __constant_htons(ETH_P_8021Q): + if ((hdr.network - data) > (max_len - VLAN_HLEN)) + return max_len; + + proto = hdr.vlan->h_vlan_encapsulated_proto; + hdr.network += VLAN_HLEN; + goto again; + /* handle L3 protocols */ + case __constant_htons(ETH_P_IP): + if ((hdr.network - data) > (max_len - sizeof(struct iphdr))) + return max_len; + + /* access ihl as a u8 to avoid unaligned access on ia64 */ + hlen = (hdr.network[0] & 0x0F) << 2; + + /* verify hlen meets minimum size requirements */ + if (hlen < sizeof(struct iphdr)) + return hdr.network - data; + + /* record next protocol if header is present */ + if (!(hdr.ipv4->frag_off & htons(IP_OFFSET))) + nexthdr = hdr.ipv4->protocol; + + hdr.network += hlen; + break; +#ifdef NETIF_F_TSO6 + case __constant_htons(ETH_P_IPV6): + if ((hdr.network - data) > (max_len - sizeof(struct ipv6hdr))) + return max_len; + + /* record next protocol */ + nexthdr = hdr.ipv6->nexthdr; + hdr.network += sizeof(struct ipv6hdr); + break; +#endif /* NETIF_F_TSO6 */ + default: + return hdr.network - data; + } + + /* finally sort out L4 */ + switch (nexthdr) { + case IPPROTO_TCP: + if ((hdr.network - data) > (max_len - sizeof(struct tcphdr))) + return max_len; + + /* access doff as a u8 to avoid unaligned access on ia64 */ + hdr.network += max_t(u8, sizeof(struct tcphdr), + (hdr.network[12] & 0xF0) >> 2); + + break; + case IPPROTO_UDP: + case IPPROTO_UDPLITE: + hdr.network += sizeof(struct udphdr); + break; +#ifdef HAVE_SCTP + case IPPROTO_SCTP: + hdr.network += sizeof(struct sctphdr); + break; +#endif + } + + /* + * If everything has gone correctly hdr.network should be the + * data section of the packet and will be the end of the header. + * If not then it probably represents the end of the last recognized + * header. + */ + return min_t(unsigned int, hdr.network - data, max_len); +} + +#endif /* < 3.18.0 */ + +/******************************************************************************/ +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) ) +#ifdef HAVE_NET_GET_RANDOM_ONCE +static u8 __kc_netdev_rss_key[NETDEV_RSS_KEY_LEN]; + +void __kc_netdev_rss_key_fill(void *buffer, size_t len) +{ + BUG_ON(len > sizeof(__kc_netdev_rss_key)); + net_get_random_once(__kc_netdev_rss_key, sizeof(__kc_netdev_rss_key)); + memcpy(buffer, __kc_netdev_rss_key, len); +} +#endif +#endif diff --git a/kmod/igb/kcompat.h b/kmod/igb/kcompat.h index a4b3db90..8316bd59 100644 --- a/kmod/igb/kcompat.h +++ b/kmod/igb/kcompat.h @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, @@ -45,6 +45,8 @@ #include <linux/sched.h> #include <linux/in.h> #include <linux/ip.h> +#include <linux/ipv6.h> +#include <linux/tcp.h> #include <linux/udp.h> #include <linux/mii.h> #include <linux/vmalloc.h> @@ -52,6 +54,16 @@ #include <linux/ethtool.h> #include <linux/if_vlan.h> +/* UTS_RELEASE is in a different header starting in kernel 2.6.18 */ +#ifndef UTS_RELEASE +/* utsrelease.h changed locations in 2.6.33 */ +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) ) +#include <linux/utsrelease.h> +#else +#include <generated/utsrelease.h> +#endif +#endif + /* NAPI enable/disable flags here */ #define NAPI @@ -119,6 +131,12 @@ struct msix_entry { #define _Bool char #endif +#undef __always_unused +#define __always_unused __attribute__((__unused__)) + +#undef __maybe_unused +#define __maybe_unused __attribute__((__unused__)) + /* kernels less than 2.4.14 don't have this */ #ifndef ETH_P_8021Q #define ETH_P_8021Q 0x8100 @@ -200,10 +218,19 @@ struct msix_entry { #define NETIF_F_NTUPLE (1 << 27) #endif +#ifndef NETIF_F_ALL_FCOE +#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \ + NETIF_F_FSO) +#endif + #ifndef IPPROTO_SCTP #define IPPROTO_SCTP 132 #endif +#ifndef IPPROTO_UDPLITE +#define IPPROTO_UDPLITE 136 +#endif + #ifndef CHECKSUM_PARTIAL #define CHECKSUM_PARTIAL CHECKSUM_HW #define CHECKSUM_COMPLETE CHECKSUM_HW @@ -267,14 +294,6 @@ struct msix_entry { #define VLAN_ETH_FRAME_LEN 1518 #endif -#if !defined(IXGBE_DCA) && !defined(IGB_DCA) -#define dca_get_tag(b) 0 -#define dca_add_requester(a) -1 -#define dca_remove_requester(b) do { } while(0) -#define DCA_PROVIDER_ADD 0x0001 -#define DCA_PROVIDER_REMOVE 0x0002 -#endif - #ifndef DCA_GET_TAG_TWO_ARGS #define dca3_get_tag(a,b) dca_get_tag(b) #endif @@ -330,7 +349,6 @@ struct _kc_vlan_hdr { #define VLAN_PRIO_SHIFT 13 #endif - #ifndef __GFP_COLD #define __GFP_COLD 0 #endif @@ -339,6 +357,10 @@ struct _kc_vlan_hdr { #define __GFP_COMP 0 #endif +#ifndef IP_OFFSET +#define IP_OFFSET 0x1FFF /* "Fragment Offset" part */ +#endif + /*****************************************************************************/ /* Installations with ethtool version without eeprom, adapter id, or statistics * support */ @@ -693,6 +715,58 @@ struct _kc_ethtool_pauseparam { #define RHEL_RELEASE_CODE 0 #endif +/* Ubuntu Release ABI is the 4th digit of their kernel version. You can find + * it in /usr/src/linux/$(uname -r)/include/generated/utsrelease.h for new + * enough versions of Ubuntu. Otherwise you can simply see it in the output of + * uname as the 4th digit of the kernel. The UTS_UBUNTU_RELEASE_ABI is not in + * the linux-source package, but in the linux-headers package. It begins to + * appear in later releases of 14.04 and 14.10. + * + * Ex: + * <Ubuntu 14.04.1> + * $uname -r + * 3.13.0-45-generic + * ABI is 45 + * + * <Ubuntu 14.10> + * $uname -r + * 3.16.0-23-generic + * ABI is 23 + */ +#ifndef UTS_UBUNTU_RELEASE_ABI +#define UTS_UBUNTU_RELEASE_ABI 0 +#define UBUNTU_VERSION_CODE 0 +#else +/* Ubuntu does not provide actual release version macro, so we use the kernel + * version plus the ABI to generate a unique version code specific to Ubuntu. + * In addition, we mask the lower 8 bits of LINUX_VERSION_CODE in order to + * ignore differences in sublevel which are not important since we have the + * ABI value. Otherwise, it becomes impossible to correlate ABI to version for + * ordering checks. + */ +#define UBUNTU_VERSION_CODE (((LINUX_VERSION_CODE & ~0xFF) << 8) + (UTS_UBUNTU_RELEASE_ABI)) + +#if UTS_UBUNTU_RELEASE_ABI > 255 +#error UTS_UBUNTU_RELEASE_ABI is too large... +#endif /* UTS_UBUNTU_RELEASE_ABI > 255 */ + +#if ( LINUX_VERSION_CODE <= KERNEL_VERSION(3,0,0) ) +/* Our version code scheme does not make sense for non 3.x or newer kernels, + * and we have no support in kcompat for this scenario. Thus, treat this as a + * non-Ubuntu kernel. Possibly might be better to error here. + */ +#define UTS_UBUNTU_RELEASE_ABI 0 +#define UBUNTU_VERSION_CODE 0 +#endif + +#endif + +/* Note that the 3rd digit is always zero, and will be ignored. This is + * because Ubuntu kernels are based on x.y.0-ABI values, and while their linux + * version codes are 3 digit, this 3rd digit is superseded by the ABI value. + */ +#define UBUNTU_VERSION(a,b,c,d) ((KERNEL_VERSION(a,b,0) << 8) + (d)) + /* SuSE version macro is the same as Linux kernel version */ #ifndef SLE_VERSION #define SLE_VERSION(a,b,c) KERNEL_VERSION(a,b,c) @@ -710,6 +784,9 @@ struct _kc_ethtool_pauseparam { #elif ((LINUX_VERSION_CODE == KERNEL_VERSION(3,0,76))) /* SLES11 SP3 is 3.0.76 based */ #define SLE_VERSION_CODE SLE_VERSION(11,3,0) +#elif ((LINUX_VERSION_CODE == KERNEL_VERSION(3,0,101))) +/* SLES11 SP4 is 3.0.101 based */ +#define SLE_VERSION_CODE SLE_VERSION(11,4,0) /* new SLES kernels must be added here with >= based on kernel * the idea is to order from newest to oldest and just catch all * of them using the >= @@ -1348,7 +1425,6 @@ extern unsigned long _kc_find_next_bit(const unsigned long *addr, unsigned long offset); #define find_first_bit(addr, size) find_next_bit((addr), (size), 0) - #ifndef netdev_name static inline const char *_kc_netdev_name(const struct net_device *dev) { @@ -1956,10 +2032,6 @@ typedef irqreturn_t (*irq_handler_t)(int, void*, struct pt_regs *); #if (RHEL_RELEASE_CODE && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(6,0)) #undef CONFIG_INET_LRO #undef CONFIG_INET_LRO_MODULE -#ifdef IXGBE_FCOE -#undef CONFIG_FCOE -#undef CONFIG_FCOE_MODULE -#endif /* IXGBE_FCOE */ #endif typedef irqreturn_t (*new_handler_t)(int, void*); static inline irqreturn_t _kc_request_irq(unsigned int irq, new_handler_t handler, unsigned long flags, const char *devname, void *dev_id) @@ -1996,7 +2068,7 @@ extern void _kc_pci_restore_state(struct pci_dev *); extern void _kc_free_netdev(struct net_device *); #define free_netdev(netdev) _kc_free_netdev(netdev) #endif -static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev) +static inline int pci_enable_pcie_error_reporting(struct pci_dev __always_unused *dev) { return 0; } @@ -2248,35 +2320,53 @@ struct napi_struct { #ifdef NAPI extern int __kc_adapter_clean(struct net_device *, int *); +/* The following definitions are multi-queue aware, and thus we have a driver + * define list which determines which drivers support multiple queues, and + * thus need these stronger defines. If a driver does not support multi-queue + * functionality, you don't need to add it to this list. + */ extern struct net_device *napi_to_poll_dev(const struct napi_struct *napi); -#define netif_napi_add(_netdev, _napi, _poll, _weight) \ - do { \ - struct napi_struct *__napi = (_napi); \ - struct net_device *poll_dev = napi_to_poll_dev(__napi); \ - poll_dev->poll = &(__kc_adapter_clean); \ - poll_dev->priv = (_napi); \ - poll_dev->weight = (_weight); \ - set_bit(__LINK_STATE_RX_SCHED, &poll_dev->state); \ - set_bit(__LINK_STATE_START, &poll_dev->state);\ - dev_hold(poll_dev); \ - __napi->poll = &(_poll); \ - __napi->weight = (_weight); \ - __napi->dev = (_netdev); \ - } while (0) -#define netif_napi_del(_napi) \ - do { \ - struct net_device *poll_dev = napi_to_poll_dev(_napi); \ - WARN_ON(!test_bit(__LINK_STATE_RX_SCHED, &poll_dev->state)); \ - dev_put(poll_dev); \ - memset(poll_dev, 0, sizeof(struct net_device));\ - } while (0) -#define napi_schedule_prep(_napi) \ - (netif_running((_napi)->dev) && netif_rx_schedule_prep(napi_to_poll_dev(_napi))) -#define napi_schedule(_napi) \ - do { \ - if (napi_schedule_prep(_napi)) \ - __netif_rx_schedule(napi_to_poll_dev(_napi)); \ - } while (0) + +static inline void __kc_mq_netif_napi_add(struct net_device *dev, struct napi_struct *napi, + int (*poll)(struct napi_struct *, int), int weight) +{ + struct net_device *poll_dev = napi_to_poll_dev(napi); + poll_dev->poll = __kc_adapter_clean; + poll_dev->priv = napi; + poll_dev->weight = weight; + set_bit(__LINK_STATE_RX_SCHED, &poll_dev->state); + set_bit(__LINK_STATE_START, &poll_dev->state); + dev_hold(poll_dev); + napi->poll = poll; + napi->weight = weight; + napi->dev = dev; +} +#define netif_napi_add __kc_mq_netif_napi_add + +static inline void __kc_mq_netif_napi_del(struct napi_struct *napi) +{ + struct net_device *poll_dev = napi_to_poll_dev(napi); + WARN_ON(!test_bit(__LINK_STATE_RX_SCHED, &poll_dev->state)); + dev_put(poll_dev); + memset(poll_dev, 0, sizeof(struct net_device)); +} + +#define netif_napi_del __kc_mq_netif_napi_del + +static inline bool __kc_mq_napi_schedule_prep(struct napi_struct *napi) +{ + return netif_running(napi->dev) && + netif_rx_schedule_prep(napi_to_poll_dev(napi)); +} +#define napi_schedule_prep __kc_mq_napi_schedule_prep + +static inline void __kc_mq_napi_schedule(struct napi_struct *napi) +{ + if (napi_schedule_prep(napi)) + __netif_rx_schedule(napi_to_poll_dev(napi)); +} +#define napi_schedule __kc_mq_napi_schedule + #define napi_enable(_napi) netif_poll_enable(napi_to_poll_dev(_napi)) #define napi_disable(_napi) netif_poll_disable(napi_to_poll_dev(_napi)) #ifdef CONFIG_SMP @@ -2293,25 +2383,27 @@ static inline void napi_synchronize(const struct napi_struct *n) #define napi_synchronize(n) barrier() #endif /* CONFIG_SMP */ #define __napi_schedule(_napi) __netif_rx_schedule(napi_to_poll_dev(_napi)) -#ifndef NETIF_F_GRO -#define napi_complete(_napi) netif_rx_complete(napi_to_poll_dev(_napi)) -#else -#define napi_complete(_napi) \ - do { \ - napi_gro_flush(_napi); \ - netif_rx_complete(napi_to_poll_dev(_napi)); \ - } while (0) -#endif /* NETIF_F_GRO */ +static inline void _kc_napi_complete(struct napi_struct *napi) +{ +#ifdef NETIF_F_GRO + napi_gro_flush(napi); +#endif + netif_rx_complete(napi_to_poll_dev(napi)); +} +#define napi_complete _kc_napi_complete #else /* NAPI */ -#define netif_napi_add(_netdev, _napi, _poll, _weight) \ - do { \ - struct napi_struct *__napi = _napi; \ - _netdev->poll = &(_poll); \ - _netdev->weight = (_weight); \ - __napi->poll = &(_poll); \ - __napi->weight = (_weight); \ - __napi->dev = (_netdev); \ - } while (0) + +/* The following definitions are only used if we don't support NAPI at all. */ + +static inline __kc_netif_napi_add(struct net_device *dev, struct napi_struct *napi, + int (*poll)(struct napi_struct *, int), int weight) +{ + dev->poll = poll; + dev->weight = weight; + napi->poll = poll; + napi->weight = weight; + napi->dev = dev; +} #define netif_napi_del(_a) do {} while (0) #endif /* NAPI */ @@ -2354,6 +2446,7 @@ static inline int _kc_skb_is_gso_v6(const struct sk_buff *skb) /*****************************************************************************/ #if ( LINUX_VERSION_CODE > KERNEL_VERSION(2,6,24) ) #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0) ) +#define INCLUDE_PM_QOS_PARAMS_H #include <linux/pm_qos_params.h> #else /* >= 3.2.0 */ #include <linux/pm_qos.h> @@ -2418,7 +2511,6 @@ static inline int _kc_strict_strtol(const char *buf, unsigned int base, long *re } #endif - #if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ) #ifndef IGB_PROCFS #define IGB_PROCFS @@ -2427,7 +2519,6 @@ static inline int _kc_strict_strtol(const char *buf, unsigned int base, long *re #else /* < 2.6.25 */ - #if IS_ENABLED(CONFIG_HWMON) #ifndef IGB_HWMON #define IGB_HWMON @@ -2452,6 +2543,7 @@ static inline int _kc_strict_strtol(const char *buf, unsigned int base, long *re extern void _kc_pci_disable_link_state(struct pci_dev *dev, int state); #define pci_disable_link_state(p, s) _kc_pci_disable_link_state(p, s) #else /* < 2.6.26 */ +#define NETDEV_CAN_SET_GSO_MAX_SIZE #include <linux/pci-aspm.h> #define HAVE_NETDEV_VLAN_FEATURES #ifndef PCI_EXP_LNKCAP_ASPMS @@ -2638,6 +2730,7 @@ extern void _kc_pci_clear_master(struct pci_dev *dev); /*****************************************************************************/ #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) ) +#define NO_PTP_SUPPORT #define skb_rx_queue_recorded(a) false #define skb_get_rx_queue(a) 0 #define skb_record_rx_queue(a, b) do {} while (0) @@ -2738,11 +2831,6 @@ static inline void _kc_synchronize_irq(unsigned int a) #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) ) #undef netdev_tx_t #define netdev_tx_t int -#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) -#ifndef NETIF_F_FCOE_MTU -#define NETIF_F_FCOE_MTU (1 << 26) -#endif -#endif /* CONFIG_FCOE || CONFIG_FCOE_MODULE */ #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ) static inline int _kc_pm_runtime_get_sync() @@ -2751,7 +2839,7 @@ static inline int _kc_pm_runtime_get_sync() } #define pm_runtime_get_sync(dev) _kc_pm_runtime_get_sync() #else /* 2.6.0 => 2.6.32 */ -static inline int _kc_pm_runtime_get_sync(struct device *dev) +static inline int _kc_pm_runtime_get_sync(struct device __always_unused *dev) { return 1; } @@ -2790,11 +2878,11 @@ static inline int _kc_pm_runtime_get_sync(struct device *dev) #define pm_runtime_get_noresume(dev) do {} while (0) #endif #else /* < 2.6.32 */ -#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) -#ifndef HAVE_NETDEV_OPS_FCOE_ENABLE -#define HAVE_NETDEV_OPS_FCOE_ENABLE -#endif -#endif /* CONFIG_FCOE || CONFIG_FCOE_MODULE */ +#if (RHEL_RELEASE_CODE && \ + (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,1)) && \ + (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,0))) +#define HAVE_RHEL6_NET_DEVICE_EXTENDED +#endif /* RHEL >= 6.1 && RHEL < 7.0 */ #ifdef CONFIG_DCB #ifndef HAVE_DCBNL_OPS_GETAPP #define HAVE_DCBNL_OPS_GETAPP @@ -2819,11 +2907,6 @@ static inline int _kc_pm_runtime_get_sync(struct device *dev) /* Features back-ported to RHEL6 or SLES11 SP1 after 2.6.32 */ #if ( (RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,0)) || \ (SLE_VERSION_CODE && SLE_VERSION_CODE >= SLE_VERSION(11,1,0)) ) -#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) -#ifndef HAVE_NETDEV_OPS_FCOE_GETWWN -#define HAVE_NETDEV_OPS_FCOE_GETWWN -#endif -#endif /* CONFIG_FCOE || CONFIG_FCOE_MODULE */ #endif /* RHEL6 or SLES11 SP1 */ #ifndef __percpu #define __percpu @@ -2865,13 +2948,6 @@ static inline bool pci_is_pcie(struct pci_dev *dev) } #endif /* RHEL_RELEASE_CODE */ -#ifndef __always_unused -#define __always_unused __attribute__((__unused__)) -#endif -#ifndef __maybe_unused -#define __maybe_unused __attribute__((__unused__)) -#endif - #if (!(RHEL_RELEASE_CODE && \ (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,2)))) #define sk_tx_queue_get(_sk) (-1) @@ -2885,14 +2961,14 @@ static inline bool pci_is_pcie(struct pci_dev *dev) #define HAVE_ETHTOOL_GRXFHINDIR_SIZE #define HAVE_ETHTOOL_SET_PHYS_ID #define HAVE_ETHTOOL_GET_TS_INFO +#if (RHEL_RELEASE_CODE > RHEL_RELEASE_VERSION(6,5)) +#define HAVE_ETHTOOL_GSRSSH +#define HAVE_RHEL6_SRIOV_CONFIGURE +#define HAVE_RXFH_NONCONST +#endif /* RHEL > 6.5 */ #endif /* RHEL >= 6.4 && RHEL < 7.0 */ #else /* < 2.6.33 */ -#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) -#ifndef HAVE_NETDEV_OPS_FCOE_GETWWN -#define HAVE_NETDEV_OPS_FCOE_GETWWN -#endif -#endif /* CONFIG_FCOE || CONFIG_FCOE_MODULE */ #endif /* < 2.6.33 */ /*****************************************************************************/ @@ -3081,7 +3157,7 @@ static inline bool _kc_pm_runtime_suspended() } #define pm_runtime_suspended(dev) _kc_pm_runtime_suspended() #else /* 2.6.0 => 2.6.34 */ -static inline bool _kc_pm_runtime_suspended(struct device *dev) +static inline bool _kc_pm_runtime_suspended(struct device __always_unused *dev) { return false; } @@ -3203,7 +3279,6 @@ do { \ #else /* < 2.6.36 */ - #define HAVE_PM_QOS_REQUEST_ACTIVE #define HAVE_8021P_SUPPORT #define HAVE_NDO_GET_STATS64 @@ -3211,9 +3286,17 @@ do { \ /*****************************************************************************/ #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37) ) + +/* RHEL 6.4 and SLES 11 SP2 backported skb_tx_timestamp */ +#if ( ( RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,4) ) || \ + ( SLE_VERSION_CODE && SLE_VERSION_CODE >= SLE_VERSION(11,2,0) ) ) +#else +static inline void skb_tx_timestamp(struct sk_buff __always_unused *skb) { return; } +#endif + #ifndef netif_set_real_num_rx_queues -static inline int __kc_netif_set_real_num_rx_queues(struct net_device *dev, - unsigned int rxq) +static inline int __kc_netif_set_real_num_rx_queues(struct net_device __always_unused *dev, + unsigned int __always_unused rxq) { return 0; } @@ -3353,11 +3436,6 @@ static inline __wsum __kc_udp_csum(struct sk_buff *skb) } #endif /* udp_csum */ #else /* < 2.6.39 */ -#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) -#ifndef HAVE_NETDEV_OPS_FCOE_DDP_TARGET -#define HAVE_NETDEV_OPS_FCOE_DDP_TARGET -#endif -#endif /* CONFIG_FCOE || CONFIG_FCOE_MODULE */ #ifndef HAVE_MQPRIO #define HAVE_MQPRIO #endif @@ -3430,7 +3508,7 @@ struct _kc_ethtool_rx_flow_spec { #endif /* kfree_rcu */ #ifndef kstrtol_from_user #define kstrtol_from_user(s, c, b, r) _kc_kstrtol_from_user(s, c, b, r) -static inline int _kc_kstrtol_from_user(const char __user *s, size_t count, +static inline int _kc_kstrtol_from_user(const char __user *s, size_t count, unsigned int base, long *res) { /* sign, base 2 representation, newline, terminator */ @@ -3567,6 +3645,8 @@ static inline void __kc_skb_frag_unref(skb_frag_t *frag) #ifndef HAVE_SKB_L4_RXHASH #define HAVE_SKB_L4_RXHASH #endif +#define HAVE_IOMMU_PRESENT +#define HAVE_PM_QOS_REQUEST_LIST_NEW #endif /* < 3.2.0 */ #if (RHEL_RELEASE_CODE && RHEL_RELEASE_CODE == RHEL_RELEASE_VERSION(6,2)) @@ -3591,6 +3671,7 @@ typedef u32 netdev_features_t; #if (SLE_VERSION_CODE && SLE_VERSION_CODE >= SLE_VERSION(11,3,0)) #define HAVE_ETHTOOL_GRXFHINDIR_SIZE #endif /* SLE_VERSION(11,3,0) */ +#define netif_xmit_stopped(_q) netif_tx_queue_stopped(_q) #else /* ! < 3.3.0 */ #define HAVE_ETHTOOL_GRXFHINDIR_SIZE #define HAVE_INT_NDO_VLAN_RX_ADD_VID @@ -3615,7 +3696,6 @@ int _kc_simple_open(struct inode *inode, struct file *file); #define simple_open _kc_simple_open #endif /* !(SLE_VERSION_CODE && SLE_VERSION_CODE >= SLE_VERSION(11,3,0)) */ - #ifndef skb_add_rx_frag #define skb_add_rx_frag _kc_skb_add_rx_frag extern void _kc_skb_add_rx_frag(struct sk_buff *, int, struct page *, @@ -3634,19 +3714,15 @@ extern void _kc_skb_add_rx_frag(struct sk_buff *, int, struct page *, #endif /* >= 3.4.0 */ /*****************************************************************************/ -#if defined(E1000E_PTP) || defined(IGB_PTP) || defined(IXGBE_PTP) || defined(I40E_PTP) || defined(DRIVER_FM10K) -#if ( ( LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) ) || \ - ( RHEL_RELEASE_CODE && ( RHEL_RELEASE_CODE > RHEL_RELEASE_VERSION(6,4) ) ) ) && \ - IS_ENABLED(CONFIG_PTP_1588_CLOCK) +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) ) || \ + ( RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,4) ) +#if !defined(NO_PTP_SUPPORT) && IS_ENABLED(CONFIG_PTP_1588_CLOCK) #define HAVE_PTP_1588_CLOCK -#else -#error Cannot enable PTP Hardware Clock support due to a pre-3.0 kernel version or CONFIG_PTP_1588_CLOCK not enabled in the kernel -#endif /* > 3.0.0 && IS_ENABLED(CONFIG_PTP_1588_CLOCK) */ -#endif /* E1000E_PTP || IGB_PTP || IXGBE_PTP || I40E_PTP || DRIVER_FM10K */ +#endif /* !NO_PTP_SUPPORT && IS_ENABLED(CONFIG_PTP_1588_CLOCK) */ +#endif /* >= 3.0.0 || RHEL_RELEASE > 6.4 */ /*****************************************************************************/ #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) ) -#define skb_tx_timestamp(skb) do {} while (0) #ifndef ether_addr_equal static inline bool __kc_ether_addr_equal(const u8 *addr1, const u8 *addr2) @@ -3692,7 +3768,9 @@ static inline void _kc_eth_random_addr(u8 *addr) addr[0] &= 0xfe; /* clear multicast */ addr[0] |= 0x02; /* set local assignment */ } -#endif +#endif /* eth_random_addr */ +#else /* < 3.6.0 */ +#define HAVE_STRUCT_PAGE_PFMEMALLOC #endif /* < 3.6.0 */ /******************************************************************************/ @@ -3824,7 +3902,11 @@ static inline u8 pci_pcie_type(struct pci_dev *pdev) #endif /* < 2.6.24 */ #endif /* pci_pcie_type */ +#if ( ! ( RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,4) ) ) && \ + ( ! ( SLE_VERSION_CODE >= SLE_VERSION(11,3,0) ) ) && \ + ( LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) ) #define ptp_clock_register(caps, args...) ptp_clock_register(caps) +#endif #ifndef pcie_capability_read_word int __kc_pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val); @@ -3858,6 +3940,8 @@ int __kc_pcie_capability_clear_word(struct pci_dev *dev, int pos, #define USE_CONST_DEV_UC_CHAR #endif +#define napi_gro_flush(_napi, _flush_old) napi_gro_flush(_napi) + #else /* >= 3.7.0 */ #define HAVE_CONST_STRUCT_PCI_ERROR_HANDLERS #define USE_CONST_DEV_UC_CHAR @@ -3866,7 +3950,7 @@ int __kc_pcie_capability_clear_word(struct pci_dev *dev, int pos, /*****************************************************************************/ #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) ) #ifndef pci_sriov_set_totalvfs -static inline int __kc_pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs) +static inline int __kc_pci_sriov_set_totalvfs(struct pci_dev __always_unused *dev, u16 __always_unused numvfs) { return 0; } @@ -3903,6 +3987,10 @@ static inline bool __kc_is_link_local_ether_addr(const u8 *addr) #define __devinitdata #endif +#ifndef __devinitconst +#define __devinitconst +#endif + #ifndef __devexit #define __devexit #endif @@ -3975,7 +4063,7 @@ extern u16 __kc_netdev_pick_tx(struct net_device *dev, struct sk_buff *skb); #ifdef CONFIG_PCI_IOV extern int __kc_pci_vfs_assigned(struct pci_dev *dev); #else -static inline int __kc_pci_vfs_assigned(struct pci_dev *dev) +static inline int __kc_pci_vfs_assigned(struct pci_dev __always_unused *dev) { return 0; } @@ -4025,11 +4113,12 @@ extern int __kc_ndo_dflt_fdb_del(struct ndmsg *ndm, struct net_device *dev, #endif /* HAVE_FDB_OPS */ #ifndef PCI_DEVID -#define PCI_DEVID(bus, devfn) ((((u16)bus) << 8) | devfn) +#define PCI_DEVID(bus, devfn) ((((u16)(bus)) << 8) | (devfn)) #endif #else /* >= 3.10.0 */ #define HAVE_ENCAP_TSO_OFFLOAD #define USE_DEFAULT_FDB_DEL_DUMP +#define HAVE_SKB_INNER_NETWORK_HEADER #endif /* >= 3.10.0 */ /*****************************************************************************/ @@ -4041,6 +4130,9 @@ extern int __kc_ndo_dflt_fdb_del(struct ndmsg *ndm, struct net_device *dev, /*****************************************************************************/ #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0) ) #else /* >= 3.12.0 */ +#if ( SLE_VERSION_CODE && SLE_VERSION_CODE >= SLE_VERSION(12,0,0)) +#define HAVE_NDO_SELECT_QUEUE_ACCEL_FALLBACK +#endif #define HAVE_VXLAN_RX_OFFLOAD #define HAVE_NDO_GET_PHYS_PORT_ID #endif /* >= 3.12.0 */ @@ -4049,16 +4141,34 @@ extern int __kc_ndo_dflt_fdb_del(struct ndmsg *ndm, struct net_device *dev, #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) ) #define dma_set_mask_and_coherent(_p, _m) __kc_dma_set_mask_and_coherent(_p, _m) extern int __kc_dma_set_mask_and_coherent(struct device *dev, u64 mask); +#ifndef u64_stats_init +#define u64_stats_init(a) do { } while(0) +#endif +#ifndef BIT_ULL +#define BIT_ULL(n) (1ULL << (n)) +#endif #else /* >= 3.13.0 */ #define HAVE_VXLAN_CHECKS +#if (UBUNTU_VERSION_CODE && UBUNTU_VERSION_CODE >= UBUNTU_VERSION(3,13,0,24)) +#define HAVE_NDO_SELECT_QUEUE_ACCEL_FALLBACK +#else #define HAVE_NDO_SELECT_QUEUE_ACCEL #endif +#define HAVE_NET_GET_RANDOM_ONCE +#endif /*****************************************************************************/ #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) ) +#ifndef U32_MAX +#define U32_MAX ((u32)~0U) +#endif + +#define dev_consume_skb_any(x) dev_kfree_skb_any(x) + #if (!(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,0)) && \ !(SLE_VERSION_CODE && SLE_VERSION_CODE >= SLE_VERSION(12,0,0))) + /* it isn't expected that this would be a #define unless we made it so */ #ifndef skb_set_hash @@ -4068,7 +4178,9 @@ extern int __kc_dma_set_mask_and_coherent(struct device *dev, u64 mask); #define PKT_HASH_TYPE_L4 3 #define skb_set_hash __kc_skb_set_hash -static inline void __kc_skb_set_hash(struct sk_buff *skb, u32 hash, int type) +static inline void __kc_skb_set_hash(struct sk_buff __maybe_unused *skb, + u32 __maybe_unused hash, + int __maybe_unused type) { #ifdef HAVE_SKB_L4_RXHASH skb->l4_rxhash = (type == PKT_HASH_TYPE_L4); @@ -4078,6 +4190,20 @@ static inline void __kc_skb_set_hash(struct sk_buff *skb, u32 hash, int type) #endif } #endif /* !skb_set_hash */ + +#else + +#ifndef HAVE_ENCAP_TSO_OFFLOAD +#define HAVE_ENCAP_TSO_OFFLOAD +#endif /* HAVE_ENCAP_TSO_OFFLOAD */ + +#ifndef HAVE_VXLAN_RX_OFFLOAD +#define HAVE_VXLAN_RX_OFFLOAD +#endif /* HAVE_VXLAN_RX_OFFLOAD */ + +#ifndef HAVE_VXLAN_CHECKS +#define HAVE_VXLAN_CHECKS +#endif /* HAVE_VXLAN_CHECKS */ #endif /* !(RHEL_RELEASE_CODE&&RHEL_RELEASE_CODE>=RHEL_RELEASE_VERSION(7,0)) */ #ifndef pci_enable_msix_range @@ -4116,12 +4242,23 @@ static inline void __kc_ether_addr_copy(u8 *dst, const u8 *src) /*****************************************************************************/ #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0) ) + +#if (!( UBUNTU_VERSION_CODE && UBUNTU_VERSION_CODE >= UBUNTU_VERSION(3,13,0,30))) #define u64_stats_fetch_begin_irq u64_stats_fetch_begin_bh #define u64_stats_fetch_retry_irq u64_stats_fetch_retry_bh +#endif + +#else +#define HAVE_PTP_1588_CLOCK_PINS +#define HAVE_NETDEV_PORT #endif /* 3.15.0 */ /*****************************************************************************/ #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0) ) +#ifndef smp_mb__before_atomic +#define smp_mb__before_atomic() smp_mb() +#define smp_mb__after_atomic() smp_mb() +#endif #ifndef __dev_uc_sync #ifdef HAVE_SET_RX_MODE #ifdef NETDEV_HW_ADDR_T_UNICAST @@ -4144,9 +4281,9 @@ void __kc_dev_addr_unsync_dev(struct dev_addr_list **list, int *count, #endif #endif /* HAVE_SET_RX_MODE */ -static inline int __kc_dev_uc_sync(struct net_device *dev, - int (*sync)(struct net_device *, const unsigned char *), - int (*unsync)(struct net_device *, const unsigned char *)) +static inline int __kc_dev_uc_sync(struct net_device __maybe_unused *dev, + int __maybe_unused (*sync)(struct net_device *, const unsigned char *), + int __maybe_unused (*unsync)(struct net_device *, const unsigned char *)) { #ifdef NETDEV_HW_ADDR_T_UNICAST return __kc_hw_addr_sync_dev(&dev->uc, dev, sync, unsync); @@ -4159,8 +4296,8 @@ static inline int __kc_dev_uc_sync(struct net_device *dev, } #define __dev_uc_sync __kc_dev_uc_sync -static inline void __kc_dev_uc_unsync(struct net_device *dev, - int (*unsync)(struct net_device *, const unsigned char *)) +static inline void __kc_dev_uc_unsync(struct net_device __maybe_unused *dev, + int __maybe_unused (*unsync)(struct net_device *, const unsigned char *)) { #ifdef HAVE_SET_RX_MODE #ifdef NETDEV_HW_ADDR_T_UNICAST @@ -4172,9 +4309,9 @@ static inline void __kc_dev_uc_unsync(struct net_device *dev, } #define __dev_uc_unsync __kc_dev_uc_unsync -static inline int __kc_dev_mc_sync(struct net_device *dev, - int (*sync)(struct net_device *, const unsigned char *), - int (*unsync)(struct net_device *, const unsigned char *)) +static inline int __kc_dev_mc_sync(struct net_device __maybe_unused *dev, + int __maybe_unused (*sync)(struct net_device *, const unsigned char *), + int __maybe_unused (*unsync)(struct net_device *, const unsigned char *)) { #ifdef NETDEV_HW_ADDR_T_MULTICAST return __kc_hw_addr_sync_dev(&dev->mc, dev, sync, unsync); @@ -4184,12 +4321,12 @@ static inline int __kc_dev_mc_sync(struct net_device *dev, #else return 0; #endif - + } #define __dev_mc_sync __kc_dev_mc_sync -static inline void __kc_dev_mc_unsync(struct net_device *dev, - int (*unsync)(struct net_device *, const unsigned char *)) +static inline void __kc_dev_mc_unsync(struct net_device __maybe_unused *dev, + int __maybe_unused (*unsync)(struct net_device *, const unsigned char *)) { #ifdef HAVE_SET_RX_MODE #ifdef NETDEV_HW_ADDR_T_MULTICAST @@ -4203,7 +4340,152 @@ static inline void __kc_dev_mc_unsync(struct net_device *dev, #endif /* __dev_uc_sync */ #else #define HAVE_NDO_SET_VF_MIN_MAX_TX_RATE -#define HAVE_DCBNL_OPS_SETAPP_RETURN_INT #endif /* 3.16.0 */ +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0) ) +#define timespec64 timespec +static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) +{ + return ts; +} +static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64) +{ + return ts64; +} +#define timespec64_equal timespec_equal +#define timespec64_compare timespec_compare +#define set_normalized_timespec64 set_normalized_timespec +#define timespec64_add_safe timespec_add_safe +#define timespec64_add timespec_add +#define timespec64_sub timespec_sub +#define timespec64_valid timespec_valid +#define timespec64_valid_strict timespec_valid_strict +#define timespec64_to_ns timespec_to_ns +#define ns_to_timespec64 ns_to_timespec +#define timespec64_add_ns timespec_add_ns +#define hlist_add_behind(_a, _b) hlist_add_after(_b, _a) +#else +#define HAVE_DCBNL_OPS_SETAPP_RETURN_INT +#endif /* 3.17.0 */ + +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) ) +#ifndef NO_PTP_SUPPORT +#include <linux/errqueue.h> +extern struct sk_buff *__kc_skb_clone_sk(struct sk_buff *skb); +extern void __kc_skb_complete_tx_timestamp(struct sk_buff *skb, + struct skb_shared_hwtstamps *hwtstamps); +#define skb_clone_sk __kc_skb_clone_sk +#define skb_complete_tx_timestamp __kc_skb_complete_tx_timestamp +#endif +extern unsigned int __kc_eth_get_headlen(unsigned char *data, unsigned int max_len); +#define eth_get_headlen __kc_eth_get_headlen +#ifndef ETH_P_XDSA +#define ETH_P_XDSA 0x00F8 +#endif +#else /* 3.18.0 */ +#define HAVE_SKBUFF_CSUM_LEVEL +#define HAVE_SKB_XMIT_MORE +#endif /* 3.18.0 */ + +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,18,4) ) +#else +#define HAVE_NDO_FEATURES_CHECK +#endif /* 3.18.4 */ + +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) ) +/* netdev_phys_port_id renamed to netdev_phys_item_id */ +#define netdev_phys_item_id netdev_phys_port_id + +#ifndef NETDEV_RSS_KEY_LEN +#define NETDEV_RSS_KEY_LEN (13 * 4) +#endif +#if ( !(RHEL_RELEASE_CODE && \ + (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,7) && \ + (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,0)))) ) +#define netdev_rss_key_fill(buffer, len) __kc_netdev_rss_key_fill(buffer, len) +#endif /* RHEL_RELEASE_CODE */ +extern void __kc_netdev_rss_key_fill(void *buffer, size_t len); +#define SPEED_20000 20000 +#define SPEED_40000 40000 +#ifndef dma_rmb +#define dma_rmb() rmb() +#endif +#ifndef dev_alloc_pages +#define dev_alloc_pages(order) alloc_pages(GFP_ATOMIC, (order)); +#endif +#if ( !(RHEL_RELEASE_CODE && \ + (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,7) && \ + (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,0)))) && \ + !(SLE_VERSION_CODE && \ + (SLE_VERSION_CODE >= SLE_VERSION(11,4,0)) && \ + (SLE_VERSION_CODE < SLE_VERSION(12,0,0)) ) ) + +/** + * skb_put_padto - increase size and pad an skbuff up to a minimal size + * @skb: buffer to pad + * @len: minimal length + * + * Pads up a buffer to ensure the trailing bytes exist and are + * blanked. If the buffer already contains sufficient data it + * is untouched. Otherwise it is extended. Returns zero on + * success. The skb is freed on error. + */ +static inline int skb_put_padto(struct sk_buff *skb, unsigned int len) +{ + unsigned int size = skb->len; + + if (unlikely(size < len)) { + len -= size; + if (skb_pad(skb, len)) + return -ENOMEM; + __skb_put(skb, len); + } + return 0; +} +static inline int eth_skb_pad(struct sk_buff *skb) +{ + return skb_put_padto(skb, ETH_ZLEN); +} +#endif /* RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(6,7)) */ +#ifndef napi_alloc_skb +static inline struct sk_buff *__kc_napi_alloc_skb(struct napi_struct *napi, unsigned int length) +{ + return netdev_alloc_skb_ip_align(napi->dev, length); +} +#define napi_alloc_skb(napi,len) __kc_napi_alloc_skb(napi,len) +#endif /* napi_alloc_skb */ +#define HAVE_CONFIG_PM_RUNTIME +#else /* 3.19.0 */ +#define HAVE_NDO_FDB_ADD_VID +/* ethtool get/set_rxfh function got a new argument */ +#define HAVE_RXFH_HASHFUNC +#endif /* 3.19.0 */ + +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,20,0) ) +/* vlan_tx_xx functions got renamed to skb_vlan */ +#define skb_vlan_tag_get vlan_tx_tag_get +#define skb_vlan_tag_present vlan_tx_tag_present +#else +#define HAVE_INCLUDE_LINUX_TIMECOUNTER_H +#define HAVE_NDO_BRIDGE_SET_DEL_LINK_FLAGS +#endif /* 3.20.0 */ + +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) ) +#ifndef NO_PTP_SUPPORT +#ifdef HAVE_INCLUDE_LINUX_TIMECOUNTER_H +#include <linux/timecounter.h> +#else +#include <linux/clocksource.h> +#endif +static inline void __kc_timecounter_adjtime(struct timecounter *tc, s64 delta) +{ + tc->nsec += delta; +} +#define timecounter_adjtime __kc_timecounter_adjtime +#endif +#else +#define HAVE_PTP_CLOCK_INFO_GETTIME64 +#define HAVE_NDO_BRIDGE_GETLINK_NLFLAGS +#endif /* 4,1,0 */ + #endif /* _KCOMPAT_H_ */ diff --git a/kmod/igb/kcompat_ethtool.c b/kmod/igb/kcompat_ethtool.c index e32a226a..0bcae160 100644 --- a/kmod/igb/kcompat_ethtool.c +++ b/kmod/igb/kcompat_ethtool.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007-2014 Intel Corporation. + Copyright(c) 2007-2015 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, |