aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-06-11 15:25:12 -0400
committerDavid S. Miller <davem@davemloft.net>2014-06-11 15:25:12 -0400
commitd4f3862017f9aaa1a6b6bade396a99a4b77e2cb2 (patch)
tree7da4b587f102f9c74f6b04205232e037fa39fec9
parent813ebbbf8e6c3d03b2a340ed10b88b551a531452 (diff)
parentf832090249d97c4070230fe225e12dc6126a92d1 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next
Jeff Kirsher says: ==================== Intel Wired LAN Driver Updates 2014-06-11 This series contains updates to igb, i40e and i40evf. Todd makes a change to igb to un-hide invariant returns by getting rid of the E1000_SUCCESS define and converting those returns to return 0. Jacob separates the hardware logic from the set function, so that we can re-use it during a ptp_reset in igb. This enables the reset to return functionality to the last know timestamp mode, rather than resetting the value. Ashish implements context flags for headwb and headwb_addr so that we do not have to keep them always enabled. Shannon updates the admin queue API for the new firmware, which adds set_pf_content, nvm_config_read/write, replaces set_phy_reset with set_phy_debug and removes nvm_read/write_reg_se. Cleans up the driver to use the stored base_queue value since there is no need to read the PCI register for the PF's base queue on every single transmit queue enable and disable as we already have the value stored from reading the capability features at startup. Anjali changes the notion of source and destination for FD_SB in ethtool to align i40e with other drivers. Adds flow director statistics to the PF stats. Fixes a bug in ethtool for flow director drop packet filter where the drop action comes down as a ring_cookie value, so allow it as a special value that can be used to configure destination control. Mitch fixes the i40evf to keep the driver from going down when it is already in a down state. This prevents a CPU soft lock in napi_disable(). Also change the i40evf to check the admin queue error bits since the firmware can indicate any admin queue error states to the driver via some bits in the length registers. Neerav separates out the DCB capability and enabled flags because currently if the firmware reports DCB capability the driver enables I40E_FLAG_DCB_ENABLED flag. When this flag is enabled the driver inserts a tag when transmitting a packet from the port even if there are no DCB traffic classes configured at the port. So by adding the additional flag, I40E_FLAG_DCB_CAPABLE, that will be set when the DCB capability is present and the existing enabled flag will only be set if there are more than one traffic classes configured at the port. Greg fixes the i40e driver to not automatically accept tagged packets by default so that the system must request a VLAN tag packet filter to get packets with that tag. Greg also converts i40e to use the in-kernel ether_addr_copy() instead of mempcy(). Jesse removes the FTYPE field from the receive descriptor to match the hardware implementation. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e.h15
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h96
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_common.c5
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c4
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_ethtool.c37
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c96
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_prototype.h2
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.c7
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_type.h4
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c7
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h96
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_type.h4
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf_main.c57
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c7
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_82575.c28
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_defines.h1
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_i210.c86
-rw-r--r--drivers/net/ethernet/intel/igb/igb_ethtool.c10
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c15
-rw-r--r--drivers/net/ethernet/intel/igb/igb_ptp.c50
20 files changed, 453 insertions, 174 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 2af28fd37bff..65985846345d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -154,11 +154,23 @@ struct i40e_lump_tracking {
154#define I40E_FDIR_BUFFER_FULL_MARGIN 10 154#define I40E_FDIR_BUFFER_FULL_MARGIN 10
155#define I40E_FDIR_BUFFER_HEAD_ROOM 200 155#define I40E_FDIR_BUFFER_HEAD_ROOM 200
156 156
157enum i40e_fd_stat_idx {
158 I40E_FD_STAT_ATR,
159 I40E_FD_STAT_SB,
160 I40E_FD_STAT_PF_COUNT
161};
162#define I40E_FD_STAT_PF_IDX(pf_id) ((pf_id) * I40E_FD_STAT_PF_COUNT)
163#define I40E_FD_ATR_STAT_IDX(pf_id) \
164 (I40E_FD_STAT_PF_IDX(pf_id) + I40E_FD_STAT_ATR)
165#define I40E_FD_SB_STAT_IDX(pf_id) \
166 (I40E_FD_STAT_PF_IDX(pf_id) + I40E_FD_STAT_SB)
167
157struct i40e_fdir_filter { 168struct i40e_fdir_filter {
158 struct hlist_node fdir_node; 169 struct hlist_node fdir_node;
159 /* filter ipnut set */ 170 /* filter ipnut set */
160 u8 flow_type; 171 u8 flow_type;
161 u8 ip4_proto; 172 u8 ip4_proto;
173 /* TX packet view of src and dst */
162 __be32 dst_ip[4]; 174 __be32 dst_ip[4];
163 __be32 src_ip[4]; 175 __be32 src_ip[4];
164 __be16 src_port; 176 __be16 src_port;
@@ -222,6 +234,8 @@ struct i40e_pf {
222 234
223 struct hlist_head fdir_filter_list; 235 struct hlist_head fdir_filter_list;
224 u16 fdir_pf_active_filters; 236 u16 fdir_pf_active_filters;
237 u16 fd_sb_cnt_idx;
238 u16 fd_atr_cnt_idx;
225 239
226#ifdef CONFIG_I40E_VXLAN 240#ifdef CONFIG_I40E_VXLAN
227 __be16 vxlan_ports[I40E_MAX_PF_UDP_OFFLOAD_PORTS]; 241 __be16 vxlan_ports[I40E_MAX_PF_UDP_OFFLOAD_PORTS];
@@ -263,6 +277,7 @@ struct i40e_pf {
263#ifdef CONFIG_I40E_VXLAN 277#ifdef CONFIG_I40E_VXLAN
264#define I40E_FLAG_VXLAN_FILTER_SYNC (u64)(1 << 27) 278#define I40E_FLAG_VXLAN_FILTER_SYNC (u64)(1 << 27)
265#endif 279#endif
280#define I40E_FLAG_DCB_CAPABLE (u64)(1 << 29)
266 281
267 /* tracks features that get auto disabled by errors */ 282 /* tracks features that get auto disabled by errors */
268 u64 auto_disable_flags; 283 u64 auto_disable_flags;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
index f2ba4b76ecd3..15f289f2917f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
@@ -34,7 +34,7 @@
34 */ 34 */
35 35
36#define I40E_FW_API_VERSION_MAJOR 0x0001 36#define I40E_FW_API_VERSION_MAJOR 0x0001
37#define I40E_FW_API_VERSION_MINOR 0x0001 37#define I40E_FW_API_VERSION_MINOR 0x0002
38 38
39struct i40e_aq_desc { 39struct i40e_aq_desc {
40 __le16 flags; 40 __le16 flags;
@@ -123,6 +123,7 @@ enum i40e_admin_queue_opc {
123 i40e_aqc_opc_get_version = 0x0001, 123 i40e_aqc_opc_get_version = 0x0001,
124 i40e_aqc_opc_driver_version = 0x0002, 124 i40e_aqc_opc_driver_version = 0x0002,
125 i40e_aqc_opc_queue_shutdown = 0x0003, 125 i40e_aqc_opc_queue_shutdown = 0x0003,
126 i40e_aqc_opc_set_pf_context = 0x0004,
126 127
127 /* resource ownership */ 128 /* resource ownership */
128 i40e_aqc_opc_request_resource = 0x0008, 129 i40e_aqc_opc_request_resource = 0x0008,
@@ -222,13 +223,15 @@ enum i40e_admin_queue_opc {
222 i40e_aqc_opc_get_partner_advt = 0x0616, 223 i40e_aqc_opc_get_partner_advt = 0x0616,
223 i40e_aqc_opc_set_lb_modes = 0x0618, 224 i40e_aqc_opc_set_lb_modes = 0x0618,
224 i40e_aqc_opc_get_phy_wol_caps = 0x0621, 225 i40e_aqc_opc_get_phy_wol_caps = 0x0621,
225 i40e_aqc_opc_set_phy_reset = 0x0622, 226 i40e_aqc_opc_set_phy_debug = 0x0622,
226 i40e_aqc_opc_upload_ext_phy_fm = 0x0625, 227 i40e_aqc_opc_upload_ext_phy_fm = 0x0625,
227 228
228 /* NVM commands */ 229 /* NVM commands */
229 i40e_aqc_opc_nvm_read = 0x0701, 230 i40e_aqc_opc_nvm_read = 0x0701,
230 i40e_aqc_opc_nvm_erase = 0x0702, 231 i40e_aqc_opc_nvm_erase = 0x0702,
231 i40e_aqc_opc_nvm_update = 0x0703, 232 i40e_aqc_opc_nvm_update = 0x0703,
233 i40e_aqc_opc_nvm_config_read = 0x0704,
234 i40e_aqc_opc_nvm_config_write = 0x0705,
232 235
233 /* virtualization commands */ 236 /* virtualization commands */
234 i40e_aqc_opc_send_msg_to_pf = 0x0801, 237 i40e_aqc_opc_send_msg_to_pf = 0x0801,
@@ -270,8 +273,6 @@ enum i40e_admin_queue_opc {
270 i40e_aqc_opc_debug_set_mode = 0xFF01, 273 i40e_aqc_opc_debug_set_mode = 0xFF01,
271 i40e_aqc_opc_debug_read_reg = 0xFF03, 274 i40e_aqc_opc_debug_read_reg = 0xFF03,
272 i40e_aqc_opc_debug_write_reg = 0xFF04, 275 i40e_aqc_opc_debug_write_reg = 0xFF04,
273 i40e_aqc_opc_debug_read_reg_sg = 0xFF05,
274 i40e_aqc_opc_debug_write_reg_sg = 0xFF06,
275 i40e_aqc_opc_debug_modify_reg = 0xFF07, 276 i40e_aqc_opc_debug_modify_reg = 0xFF07,
276 i40e_aqc_opc_debug_dump_internals = 0xFF08, 277 i40e_aqc_opc_debug_dump_internals = 0xFF08,
277 i40e_aqc_opc_debug_modify_internals = 0xFF09, 278 i40e_aqc_opc_debug_modify_internals = 0xFF09,
@@ -339,6 +340,14 @@ struct i40e_aqc_queue_shutdown {
339 340
340I40E_CHECK_CMD_LENGTH(i40e_aqc_queue_shutdown); 341I40E_CHECK_CMD_LENGTH(i40e_aqc_queue_shutdown);
341 342
343/* Set PF context (0x0004, direct) */
344struct i40e_aqc_set_pf_context {
345 u8 pf_id;
346 u8 reserved[15];
347};
348
349I40E_CHECK_CMD_LENGTH(i40e_aqc_set_pf_context);
350
342/* Request resource ownership (direct 0x0008) 351/* Request resource ownership (direct 0x0008)
343 * Release resource ownership (direct 0x0009) 352 * Release resource ownership (direct 0x0009)
344 */ 353 */
@@ -1404,11 +1413,12 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_configure_switching_comp_bw_limit);
1404struct i40e_aqc_configure_switching_comp_ets_data { 1413struct i40e_aqc_configure_switching_comp_ets_data {
1405 u8 reserved[4]; 1414 u8 reserved[4];
1406 u8 tc_valid_bits; 1415 u8 tc_valid_bits;
1407 u8 reserved1; 1416 u8 seepage;
1417#define I40E_AQ_ETS_SEEPAGE_EN_MASK 0x1
1408 u8 tc_strict_priority_flags; 1418 u8 tc_strict_priority_flags;
1409 u8 reserved2[17]; 1419 u8 reserved1[17];
1410 u8 tc_bw_share_credits[8]; 1420 u8 tc_bw_share_credits[8];
1411 u8 reserved3[96]; 1421 u8 reserved2[96];
1412}; 1422};
1413 1423
1414/* Configure Switching Component Bandwidth Limits per Tc (indirect 0x0416) */ 1424/* Configure Switching Component Bandwidth Limits per Tc (indirect 0x0416) */
@@ -1525,6 +1535,8 @@ enum i40e_aq_phy_type {
1525 I40E_PHY_TYPE_XLPPI = 0x9, 1535 I40E_PHY_TYPE_XLPPI = 0x9,
1526 I40E_PHY_TYPE_40GBASE_CR4_CU = 0xA, 1536 I40E_PHY_TYPE_40GBASE_CR4_CU = 0xA,
1527 I40E_PHY_TYPE_10GBASE_CR1_CU = 0xB, 1537 I40E_PHY_TYPE_10GBASE_CR1_CU = 0xB,
1538 I40E_PHY_TYPE_10GBASE_AOC = 0xC,
1539 I40E_PHY_TYPE_40GBASE_AOC = 0xD,
1528 I40E_PHY_TYPE_100BASE_TX = 0x11, 1540 I40E_PHY_TYPE_100BASE_TX = 0x11,
1529 I40E_PHY_TYPE_1000BASE_T = 0x12, 1541 I40E_PHY_TYPE_1000BASE_T = 0x12,
1530 I40E_PHY_TYPE_10GBASE_T = 0x13, 1542 I40E_PHY_TYPE_10GBASE_T = 0x13,
@@ -1535,7 +1547,10 @@ enum i40e_aq_phy_type {
1535 I40E_PHY_TYPE_40GBASE_CR4 = 0x18, 1547 I40E_PHY_TYPE_40GBASE_CR4 = 0x18,
1536 I40E_PHY_TYPE_40GBASE_SR4 = 0x19, 1548 I40E_PHY_TYPE_40GBASE_SR4 = 0x19,
1537 I40E_PHY_TYPE_40GBASE_LR4 = 0x1A, 1549 I40E_PHY_TYPE_40GBASE_LR4 = 0x1A,
1538 I40E_PHY_TYPE_20GBASE_KR2 = 0x1B, 1550 I40E_PHY_TYPE_1000BASE_SX = 0x1B,
1551 I40E_PHY_TYPE_1000BASE_LX = 0x1C,
1552 I40E_PHY_TYPE_1000BASE_T_OPTICAL = 0x1D,
1553 I40E_PHY_TYPE_20GBASE_KR2 = 0x1E,
1539 I40E_PHY_TYPE_MAX 1554 I40E_PHY_TYPE_MAX
1540}; 1555};
1541 1556
@@ -1679,6 +1694,7 @@ struct i40e_aqc_get_link_status {
1679#define I40E_AQ_LINK_TX_ACTIVE 0x00 1694#define I40E_AQ_LINK_TX_ACTIVE 0x00
1680#define I40E_AQ_LINK_TX_DRAINED 0x01 1695#define I40E_AQ_LINK_TX_DRAINED 0x01
1681#define I40E_AQ_LINK_TX_FLUSHED 0x03 1696#define I40E_AQ_LINK_TX_FLUSHED 0x03
1697#define I40E_AQ_LINK_FORCED_40G 0x10
1682 u8 loopback; /* use defines from i40e_aqc_set_lb_mode */ 1698 u8 loopback; /* use defines from i40e_aqc_set_lb_mode */
1683 __le16 max_frame_size; 1699 __le16 max_frame_size;
1684 u8 config; 1700 u8 config;
@@ -1730,14 +1746,21 @@ struct i40e_aqc_set_lb_mode {
1730 1746
1731I40E_CHECK_CMD_LENGTH(i40e_aqc_set_lb_mode); 1747I40E_CHECK_CMD_LENGTH(i40e_aqc_set_lb_mode);
1732 1748
1733/* Set PHY Reset command (0x0622) */ 1749/* Set PHY Debug command (0x0622) */
1734struct i40e_aqc_set_phy_reset { 1750struct i40e_aqc_set_phy_debug {
1735 u8 reset_flags; 1751 u8 command_flags;
1736#define I40E_AQ_PHY_RESET_REQUEST 0x02 1752#define I40E_AQ_PHY_DEBUG_RESET_INTERNAL 0x02
1753#define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SHIFT 2
1754#define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_MASK (0x03 << \
1755 I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SHIFT)
1756#define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_NONE 0x00
1757#define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_HARD 0x01
1758#define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SOFT 0x02
1759#define I40E_AQ_PHY_DEBUG_DISABLE_LINK_FW 0x10
1737 u8 reserved[15]; 1760 u8 reserved[15];
1738}; 1761};
1739 1762
1740I40E_CHECK_CMD_LENGTH(i40e_aqc_set_phy_reset); 1763I40E_CHECK_CMD_LENGTH(i40e_aqc_set_phy_debug);
1741 1764
1742enum i40e_aq_phy_reg_type { 1765enum i40e_aq_phy_reg_type {
1743 I40E_AQC_PHY_REG_INTERNAL = 0x1, 1766 I40E_AQC_PHY_REG_INTERNAL = 0x1,
@@ -1762,6 +1785,47 @@ struct i40e_aqc_nvm_update {
1762 1785
1763I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_update); 1786I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_update);
1764 1787
1788/* NVM Config Read (indirect 0x0704) */
1789struct i40e_aqc_nvm_config_read {
1790 __le16 cmd_flags;
1791#define ANVM_SINGLE_OR_MULTIPLE_FEATURES_MASK 1
1792#define ANVM_READ_SINGLE_FEATURE 0
1793#define ANVM_READ_MULTIPLE_FEATURES 1
1794 __le16 element_count;
1795 __le16 element_id; /* Feature/field ID */
1796 u8 reserved[2];
1797 __le32 address_high;
1798 __le32 address_low;
1799};
1800
1801I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_read);
1802
1803/* NVM Config Write (indirect 0x0705) */
1804struct i40e_aqc_nvm_config_write {
1805 __le16 cmd_flags;
1806 __le16 element_count;
1807 u8 reserved[4];
1808 __le32 address_high;
1809 __le32 address_low;
1810};
1811
1812I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_write);
1813
1814struct i40e_aqc_nvm_config_data_feature {
1815 __le16 feature_id;
1816 __le16 instance_id;
1817 __le16 feature_options;
1818 __le16 feature_selection;
1819};
1820
1821struct i40e_aqc_nvm_config_data_immediate_field {
1822#define ANVM_FEATURE_OR_IMMEDIATE_MASK 0x2
1823 __le16 field_id;
1824 __le16 instance_id;
1825 __le16 field_options;
1826 __le16 field_value;
1827};
1828
1765/* Send to PF command (indirect 0x0801) id is only used by PF 1829/* Send to PF command (indirect 0x0801) id is only used by PF
1766 * Send to VF command (indirect 0x0802) id is only used by PF 1830 * Send to VF command (indirect 0x0802) id is only used by PF
1767 * Send to Peer PF command (indirect 0x0803) 1831 * Send to Peer PF command (indirect 0x0803)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
index 8e4b33c3e3cd..6e65f19dd6e5 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
@@ -665,10 +665,9 @@ i40e_status i40e_get_mac_addr(struct i40e_hw *hw, u8 *mac_addr)
665 **/ 665 **/
666void i40e_pre_tx_queue_cfg(struct i40e_hw *hw, u32 queue, bool enable) 666void i40e_pre_tx_queue_cfg(struct i40e_hw *hw, u32 queue, bool enable)
667{ 667{
668 u32 reg_val = rd32(hw, I40E_PFLAN_QALLOC); 668 u32 abs_queue_idx = hw->func_caps.base_queue + queue;
669 u32 first_queue = (reg_val & I40E_PFLAN_QALLOC_FIRSTQ_MASK);
670 u32 abs_queue_idx = first_queue + queue;
671 u32 reg_block = 0; 669 u32 reg_block = 0;
670 u32 reg_val;
672 671
673 if (abs_queue_idx >= 128) 672 if (abs_queue_idx >= 128)
674 reg_block = abs_queue_idx / 128; 673 reg_block = abs_queue_idx / 128;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c b/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c
index 871831a535d0..00bc0cdb3a03 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c
@@ -302,8 +302,8 @@ void i40e_dcbnl_setup(struct i40e_vsi *vsi)
302 struct net_device *dev = vsi->netdev; 302 struct net_device *dev = vsi->netdev;
303 struct i40e_pf *pf = i40e_netdev_to_pf(dev); 303 struct i40e_pf *pf = i40e_netdev_to_pf(dev);
304 304
305 /* DCB not enabled */ 305 /* Not DCB capable */
306 if (!(pf->flags & I40E_FLAG_DCB_ENABLED)) 306 if (!(pf->flags & I40E_FLAG_DCB_CAPABLE))
307 return; 307 return;
308 308
309 /* Do not setup DCB NL ops for MFP mode */ 309 /* Do not setup DCB NL ops for MFP mode */
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index b16c25111552..4a488ffcd6b0 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -145,6 +145,9 @@ static struct i40e_stats i40e_gstrings_stats[] = {
145 I40E_PF_STAT("rx_jabber", stats.rx_jabber), 145 I40E_PF_STAT("rx_jabber", stats.rx_jabber),
146 I40E_PF_STAT("VF_admin_queue_requests", vf_aq_requests), 146 I40E_PF_STAT("VF_admin_queue_requests", vf_aq_requests),
147 I40E_PF_STAT("rx_hwtstamp_cleared", rx_hwtstamp_cleared), 147 I40E_PF_STAT("rx_hwtstamp_cleared", rx_hwtstamp_cleared),
148 I40E_PF_STAT("fdir_atr_match", stats.fd_atr_match),
149 I40E_PF_STAT("fdir_sb_match", stats.fd_sb_match),
150
148 /* LPI stats */ 151 /* LPI stats */
149 I40E_PF_STAT("tx_lpi_status", stats.tx_lpi_status), 152 I40E_PF_STAT("tx_lpi_status", stats.tx_lpi_status),
150 I40E_PF_STAT("rx_lpi_status", stats.rx_lpi_status), 153 I40E_PF_STAT("rx_lpi_status", stats.rx_lpi_status),
@@ -1249,11 +1252,18 @@ static int i40e_get_ethtool_fdir_entry(struct i40e_pf *pf,
1249 fsp->m_u.usr_ip4_spec.proto = 0; 1252 fsp->m_u.usr_ip4_spec.proto = 0;
1250 } 1253 }
1251 1254
1252 fsp->h_u.tcp_ip4_spec.psrc = rule->src_port; 1255 /* Reverse the src and dest notion, since the HW views them from
1253 fsp->h_u.tcp_ip4_spec.pdst = rule->dst_port; 1256 * Tx perspective where as the user expects it from Rx filter view.
1254 fsp->h_u.tcp_ip4_spec.ip4src = rule->src_ip[0]; 1257 */
1255 fsp->h_u.tcp_ip4_spec.ip4dst = rule->dst_ip[0]; 1258 fsp->h_u.tcp_ip4_spec.psrc = rule->dst_port;
1256 fsp->ring_cookie = rule->q_index; 1259 fsp->h_u.tcp_ip4_spec.pdst = rule->src_port;
1260 fsp->h_u.tcp_ip4_spec.ip4src = rule->dst_ip[0];
1261 fsp->h_u.tcp_ip4_spec.ip4dst = rule->src_ip[0];
1262
1263 if (rule->dest_ctl == I40E_FILTER_PROGRAM_DESC_DEST_DROP_PACKET)
1264 fsp->ring_cookie = RX_CLS_FLOW_DISC;
1265 else
1266 fsp->ring_cookie = rule->q_index;
1257 1267
1258 return 0; 1268 return 0;
1259} 1269}
@@ -1557,7 +1567,8 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
1557 return -EINVAL; 1567 return -EINVAL;
1558 } 1568 }
1559 1569
1560 if (fsp->ring_cookie >= vsi->num_queue_pairs) 1570 if ((fsp->ring_cookie != RX_CLS_FLOW_DISC) &&
1571 (fsp->ring_cookie >= vsi->num_queue_pairs))
1561 return -EINVAL; 1572 return -EINVAL;
1562 1573
1563 input = kzalloc(sizeof(*input), GFP_KERNEL); 1574 input = kzalloc(sizeof(*input), GFP_KERNEL);
@@ -1578,13 +1589,17 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
1578 input->pctype = 0; 1589 input->pctype = 0;
1579 input->dest_vsi = vsi->id; 1590 input->dest_vsi = vsi->id;
1580 input->fd_status = I40E_FILTER_PROGRAM_DESC_FD_STATUS_FD_ID; 1591 input->fd_status = I40E_FILTER_PROGRAM_DESC_FD_STATUS_FD_ID;
1581 input->cnt_index = 0; 1592 input->cnt_index = pf->fd_sb_cnt_idx;
1582 input->flow_type = fsp->flow_type; 1593 input->flow_type = fsp->flow_type;
1583 input->ip4_proto = fsp->h_u.usr_ip4_spec.proto; 1594 input->ip4_proto = fsp->h_u.usr_ip4_spec.proto;
1584 input->src_port = fsp->h_u.tcp_ip4_spec.psrc; 1595
1585 input->dst_port = fsp->h_u.tcp_ip4_spec.pdst; 1596 /* Reverse the src and dest notion, since the HW expects them to be from
1586 input->src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src; 1597 * Tx perspective where as the input from user is from Rx filter view.
1587 input->dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst; 1598 */
1599 input->dst_port = fsp->h_u.tcp_ip4_spec.psrc;
1600 input->src_port = fsp->h_u.tcp_ip4_spec.pdst;
1601 input->dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src;
1602 input->src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst;
1588 1603
1589 ret = i40e_add_del_fdir(vsi, input, true); 1604 ret = i40e_add_del_fdir(vsi, input, true);
1590 if (ret) 1605 if (ret)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 145cb9fc1516..a84ddaf06a68 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -39,7 +39,7 @@ static const char i40e_driver_string[] =
39 39
40#define DRV_VERSION_MAJOR 0 40#define DRV_VERSION_MAJOR 0
41#define DRV_VERSION_MINOR 4 41#define DRV_VERSION_MINOR 4
42#define DRV_VERSION_BUILD 7 42#define DRV_VERSION_BUILD 10
43#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \ 43#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
44 __stringify(DRV_VERSION_MINOR) "." \ 44 __stringify(DRV_VERSION_MINOR) "." \
45 __stringify(DRV_VERSION_BUILD) DRV_KERN 45 __stringify(DRV_VERSION_BUILD) DRV_KERN
@@ -1013,6 +1013,14 @@ static void i40e_update_pf_stats(struct i40e_pf *pf)
1013 pf->stat_offsets_loaded, 1013 pf->stat_offsets_loaded,
1014 &osd->rx_jabber, &nsd->rx_jabber); 1014 &osd->rx_jabber, &nsd->rx_jabber);
1015 1015
1016 /* FDIR stats */
1017 i40e_stat_update32(hw, I40E_GLQF_PCNT(pf->fd_atr_cnt_idx),
1018 pf->stat_offsets_loaded,
1019 &osd->fd_atr_match, &nsd->fd_atr_match);
1020 i40e_stat_update32(hw, I40E_GLQF_PCNT(pf->fd_sb_cnt_idx),
1021 pf->stat_offsets_loaded,
1022 &osd->fd_sb_match, &nsd->fd_sb_match);
1023
1016 val = rd32(hw, I40E_PRTPM_EEE_STAT); 1024 val = rd32(hw, I40E_PRTPM_EEE_STAT);
1017 nsd->tx_lpi_status = 1025 nsd->tx_lpi_status =
1018 (val & I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_MASK) >> 1026 (val & I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_MASK) >>
@@ -1154,6 +1162,30 @@ struct i40e_mac_filter *i40e_put_mac_in_vlan(struct i40e_vsi *vsi, u8 *macaddr,
1154} 1162}
1155 1163
1156/** 1164/**
1165 * i40e_rm_default_mac_filter - Remove the default MAC filter set by NVM
1166 * @vsi: the PF Main VSI - inappropriate for any other VSI
1167 * @macaddr: the MAC address
1168 **/
1169static void i40e_rm_default_mac_filter(struct i40e_vsi *vsi, u8 *macaddr)
1170{
1171 struct i40e_aqc_remove_macvlan_element_data element;
1172 struct i40e_pf *pf = vsi->back;
1173 i40e_status aq_ret;
1174
1175 /* Only appropriate for the PF main VSI */
1176 if (vsi->type != I40E_VSI_MAIN)
1177 return;
1178
1179 ether_addr_copy(element.mac_addr, macaddr);
1180 element.vlan_tag = 0;
1181 element.flags = I40E_AQC_MACVLAN_DEL_PERFECT_MATCH |
1182 I40E_AQC_MACVLAN_DEL_IGNORE_VLAN;
1183 aq_ret = i40e_aq_remove_macvlan(&pf->hw, vsi->seid, &element, 1, NULL);
1184 if (aq_ret)
1185 dev_err(&pf->pdev->dev, "Could not remove default MAC-VLAN\n");
1186}
1187
1188/**
1157 * i40e_add_filter - Add a mac/vlan filter to the VSI 1189 * i40e_add_filter - Add a mac/vlan filter to the VSI
1158 * @vsi: the VSI to be searched 1190 * @vsi: the VSI to be searched
1159 * @macaddr: the MAC address 1191 * @macaddr: the MAC address
@@ -1178,7 +1210,7 @@ struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi,
1178 if (!f) 1210 if (!f)
1179 goto add_filter_out; 1211 goto add_filter_out;
1180 1212
1181 memcpy(f->macaddr, macaddr, ETH_ALEN); 1213 ether_addr_copy(f->macaddr, macaddr);
1182 f->vlan = vlan; 1214 f->vlan = vlan;
1183 f->changed = true; 1215 f->changed = true;
1184 1216
@@ -1302,7 +1334,7 @@ static int i40e_set_mac(struct net_device *netdev, void *p)
1302 return -EADDRNOTAVAIL; 1334 return -EADDRNOTAVAIL;
1303 } 1335 }
1304 1336
1305 memcpy(vsi->back->hw.mac.addr, addr->sa_data, netdev->addr_len); 1337 ether_addr_copy(vsi->back->hw.mac.addr, addr->sa_data);
1306 } 1338 }
1307 1339
1308 /* In order to be sure to not drop any packets, add the new address 1340 /* In order to be sure to not drop any packets, add the new address
@@ -1316,7 +1348,7 @@ static int i40e_set_mac(struct net_device *netdev, void *p)
1316 i40e_del_filter(vsi, netdev->dev_addr, I40E_VLAN_ANY, false, false); 1348 i40e_del_filter(vsi, netdev->dev_addr, I40E_VLAN_ANY, false, false);
1317 i40e_sync_vsi_filters(vsi); 1349 i40e_sync_vsi_filters(vsi);
1318 1350
1319 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); 1351 ether_addr_copy(netdev->dev_addr, addr->sa_data);
1320 1352
1321 return 0; 1353 return 0;
1322} 1354}
@@ -1573,8 +1605,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
1573 cmd_flags = 0; 1605 cmd_flags = 0;
1574 1606
1575 /* add to delete list */ 1607 /* add to delete list */
1576 memcpy(del_list[num_del].mac_addr, 1608 ether_addr_copy(del_list[num_del].mac_addr, f->macaddr);
1577 f->macaddr, ETH_ALEN);
1578 del_list[num_del].vlan_tag = 1609 del_list[num_del].vlan_tag =
1579 cpu_to_le16((u16)(f->vlan == 1610 cpu_to_le16((u16)(f->vlan ==
1580 I40E_VLAN_ANY ? 0 : f->vlan)); 1611 I40E_VLAN_ANY ? 0 : f->vlan));
@@ -1639,8 +1670,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
1639 cmd_flags = 0; 1670 cmd_flags = 0;
1640 1671
1641 /* add to add array */ 1672 /* add to add array */
1642 memcpy(add_list[num_add].mac_addr, 1673 ether_addr_copy(add_list[num_add].mac_addr, f->macaddr);
1643 f->macaddr, ETH_ALEN);
1644 add_list[num_add].vlan_tag = 1674 add_list[num_add].vlan_tag =
1645 cpu_to_le16( 1675 cpu_to_le16(
1646 (u16)(f->vlan == I40E_VLAN_ANY ? 0 : f->vlan)); 1676 (u16)(f->vlan == I40E_VLAN_ANY ? 0 : f->vlan));
@@ -4130,7 +4160,11 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf)
4130 /* When status is not DISABLED then DCBX in FW */ 4160 /* When status is not DISABLED then DCBX in FW */
4131 pf->dcbx_cap = DCB_CAP_DCBX_LLD_MANAGED | 4161 pf->dcbx_cap = DCB_CAP_DCBX_LLD_MANAGED |
4132 DCB_CAP_DCBX_VER_IEEE; 4162 DCB_CAP_DCBX_VER_IEEE;
4133 pf->flags |= I40E_FLAG_DCB_ENABLED; 4163
4164 pf->flags |= I40E_FLAG_DCB_CAPABLE;
4165 /* Enable DCB tagging only when more than one TC */
4166 if (i40e_dcb_get_num_tc(&hw->local_dcbx_config) > 1)
4167 pf->flags |= I40E_FLAG_DCB_ENABLED;
4134 } 4168 }
4135 } else { 4169 } else {
4136 dev_info(&pf->pdev->dev, "AQ Querying DCB configuration failed: %d\n", 4170 dev_info(&pf->pdev->dev, "AQ Querying DCB configuration failed: %d\n",
@@ -4685,6 +4719,10 @@ static int i40e_handle_lldp_event(struct i40e_pf *pf,
4685 int ret = 0; 4719 int ret = 0;
4686 u8 type; 4720 u8 type;
4687 4721
4722 /* Not DCB capable or capability disabled */
4723 if (!(pf->flags & I40E_FLAG_DCB_CAPABLE))
4724 return ret;
4725
4688 /* Ignore if event is not for Nearest Bridge */ 4726 /* Ignore if event is not for Nearest Bridge */
4689 type = ((mib->type >> I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT) 4727 type = ((mib->type >> I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT)
4690 & I40E_AQ_LLDP_BRIDGE_TYPE_MASK); 4728 & I40E_AQ_LLDP_BRIDGE_TYPE_MASK);
@@ -4726,6 +4764,12 @@ static int i40e_handle_lldp_event(struct i40e_pf *pf,
4726 if (!need_reconfig) 4764 if (!need_reconfig)
4727 goto exit; 4765 goto exit;
4728 4766
4767 /* Enable DCB tagging only when more than one TC */
4768 if (i40e_dcb_get_num_tc(dcbx_cfg) > 1)
4769 pf->flags |= I40E_FLAG_DCB_ENABLED;
4770 else
4771 pf->flags &= ~I40E_FLAG_DCB_ENABLED;
4772
4729 /* Reconfiguration needed quiesce all VSIs */ 4773 /* Reconfiguration needed quiesce all VSIs */
4730 i40e_pf_quiesce_all_vsi(pf); 4774 i40e_pf_quiesce_all_vsi(pf);
4731 4775
@@ -6365,7 +6409,7 @@ static void i40e_init_interrupt_scheme(struct i40e_pf *pf)
6365 if (err) { 6409 if (err) {
6366 pf->flags &= ~(I40E_FLAG_MSIX_ENABLED | 6410 pf->flags &= ~(I40E_FLAG_MSIX_ENABLED |
6367 I40E_FLAG_RSS_ENABLED | 6411 I40E_FLAG_RSS_ENABLED |
6368 I40E_FLAG_DCB_ENABLED | 6412 I40E_FLAG_DCB_CAPABLE |
6369 I40E_FLAG_SRIOV_ENABLED | 6413 I40E_FLAG_SRIOV_ENABLED |
6370 I40E_FLAG_FD_SB_ENABLED | 6414 I40E_FLAG_FD_SB_ENABLED |
6371 I40E_FLAG_FD_ATR_ENABLED | 6415 I40E_FLAG_FD_ATR_ENABLED |
@@ -6568,8 +6612,12 @@ static int i40e_sw_init(struct i40e_pf *pf)
6568 (pf->hw.func_caps.fd_filters_best_effort > 0)) { 6612 (pf->hw.func_caps.fd_filters_best_effort > 0)) {
6569 pf->flags |= I40E_FLAG_FD_ATR_ENABLED; 6613 pf->flags |= I40E_FLAG_FD_ATR_ENABLED;
6570 pf->atr_sample_rate = I40E_DEFAULT_ATR_SAMPLE_RATE; 6614 pf->atr_sample_rate = I40E_DEFAULT_ATR_SAMPLE_RATE;
6615 /* Setup a counter for fd_atr per pf */
6616 pf->fd_atr_cnt_idx = I40E_FD_ATR_STAT_IDX(pf->hw.pf_id);
6571 if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) { 6617 if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) {
6572 pf->flags |= I40E_FLAG_FD_SB_ENABLED; 6618 pf->flags |= I40E_FLAG_FD_SB_ENABLED;
6619 /* Setup a counter for fd_sb per pf */
6620 pf->fd_sb_cnt_idx = I40E_FD_SB_STAT_IDX(pf->hw.pf_id);
6573 } else { 6621 } else {
6574 dev_info(&pf->pdev->dev, 6622 dev_info(&pf->pdev->dev,
6575 "Flow Director Sideband mode Disabled in MFP mode\n"); 6623 "Flow Director Sideband mode Disabled in MFP mode\n");
@@ -6965,7 +7013,15 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
6965 7013
6966 if (vsi->type == I40E_VSI_MAIN) { 7014 if (vsi->type == I40E_VSI_MAIN) {
6967 SET_NETDEV_DEV(netdev, &pf->pdev->dev); 7015 SET_NETDEV_DEV(netdev, &pf->pdev->dev);
6968 memcpy(mac_addr, hw->mac.perm_addr, ETH_ALEN); 7016 ether_addr_copy(mac_addr, hw->mac.perm_addr);
7017 /* The following two steps are necessary to prevent reception
7018 * of tagged packets - by default the NVM loads a MAC-VLAN
7019 * filter that will accept any tagged packet. This is to
7020 * prevent that during normal operations until a specific
7021 * VLAN tag filter has been set.
7022 */
7023 i40e_rm_default_mac_filter(vsi, mac_addr);
7024 i40e_add_filter(vsi, mac_addr, I40E_VLAN_ANY, false, true);
6969 } else { 7025 } else {
6970 /* relate the VSI_VMDQ name to the VSI_MAIN name */ 7026 /* relate the VSI_VMDQ name to the VSI_MAIN name */
6971 snprintf(netdev->name, IFNAMSIZ, "%sv%%d", 7027 snprintf(netdev->name, IFNAMSIZ, "%sv%%d",
@@ -6975,8 +7031,8 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
6975 } 7031 }
6976 i40e_add_filter(vsi, brdcast, I40E_VLAN_ANY, false, false); 7032 i40e_add_filter(vsi, brdcast, I40E_VLAN_ANY, false, false);
6977 7033
6978 memcpy(netdev->dev_addr, mac_addr, ETH_ALEN); 7034 ether_addr_copy(netdev->dev_addr, mac_addr);
6979 memcpy(netdev->perm_addr, mac_addr, ETH_ALEN); 7035 ether_addr_copy(netdev->perm_addr, mac_addr);
6980 /* vlan gets same features (except vlan offload) 7036 /* vlan gets same features (except vlan offload)
6981 * after any tweaks for specific VSI types 7037 * after any tweaks for specific VSI types
6982 */ 7038 */
@@ -8187,13 +8243,13 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf)
8187 pf->flags &= ~(I40E_FLAG_RSS_ENABLED | 8243 pf->flags &= ~(I40E_FLAG_RSS_ENABLED |
8188 I40E_FLAG_FD_SB_ENABLED | 8244 I40E_FLAG_FD_SB_ENABLED |
8189 I40E_FLAG_FD_ATR_ENABLED | 8245 I40E_FLAG_FD_ATR_ENABLED |
8190 I40E_FLAG_DCB_ENABLED | 8246 I40E_FLAG_DCB_CAPABLE |
8191 I40E_FLAG_SRIOV_ENABLED | 8247 I40E_FLAG_SRIOV_ENABLED |
8192 I40E_FLAG_VMDQ_ENABLED); 8248 I40E_FLAG_VMDQ_ENABLED);
8193 } else if (!(pf->flags & (I40E_FLAG_RSS_ENABLED | 8249 } else if (!(pf->flags & (I40E_FLAG_RSS_ENABLED |
8194 I40E_FLAG_FD_SB_ENABLED | 8250 I40E_FLAG_FD_SB_ENABLED |
8195 I40E_FLAG_FD_ATR_ENABLED | 8251 I40E_FLAG_FD_ATR_ENABLED |
8196 I40E_FLAG_DCB_ENABLED))) { 8252 I40E_FLAG_DCB_CAPABLE))) {
8197 /* one qp for PF */ 8253 /* one qp for PF */
8198 pf->rss_size = pf->num_lan_qps = 1; 8254 pf->rss_size = pf->num_lan_qps = 1;
8199 queues_left -= pf->num_lan_qps; 8255 queues_left -= pf->num_lan_qps;
@@ -8205,9 +8261,9 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf)
8205 I40E_FLAG_VMDQ_ENABLED); 8261 I40E_FLAG_VMDQ_ENABLED);
8206 } else { 8262 } else {
8207 /* Not enough queues for all TCs */ 8263 /* Not enough queues for all TCs */
8208 if ((pf->flags & I40E_FLAG_DCB_ENABLED) && 8264 if ((pf->flags & I40E_FLAG_DCB_CAPABLE) &&
8209 (queues_left < I40E_MAX_TRAFFIC_CLASS)) { 8265 (queues_left < I40E_MAX_TRAFFIC_CLASS)) {
8210 pf->flags &= ~I40E_FLAG_DCB_ENABLED; 8266 pf->flags &= ~I40E_FLAG_DCB_CAPABLE;
8211 dev_info(&pf->pdev->dev, "not enough queues for DCB. DCB is disabled.\n"); 8267 dev_info(&pf->pdev->dev, "not enough queues for DCB. DCB is disabled.\n");
8212 } 8268 }
8213 pf->num_lan_qps = pf->rss_size_max; 8269 pf->num_lan_qps = pf->rss_size_max;
@@ -8300,7 +8356,7 @@ static void i40e_print_features(struct i40e_pf *pf)
8300 buf += sprintf(buf, "FD_SB "); 8356 buf += sprintf(buf, "FD_SB ");
8301 buf += sprintf(buf, "NTUPLE "); 8357 buf += sprintf(buf, "NTUPLE ");
8302 } 8358 }
8303 if (pf->flags & I40E_FLAG_DCB_ENABLED) 8359 if (pf->flags & I40E_FLAG_DCB_CAPABLE)
8304 buf += sprintf(buf, "DCB "); 8360 buf += sprintf(buf, "DCB ");
8305 if (pf->flags & I40E_FLAG_PTP) 8361 if (pf->flags & I40E_FLAG_PTP)
8306 buf += sprintf(buf, "PTP "); 8362 buf += sprintf(buf, "PTP ");
@@ -8478,7 +8534,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8478 goto err_mac_addr; 8534 goto err_mac_addr;
8479 } 8535 }
8480 dev_info(&pdev->dev, "MAC address: %pM\n", hw->mac.addr); 8536 dev_info(&pdev->dev, "MAC address: %pM\n", hw->mac.addr);
8481 memcpy(hw->mac.perm_addr, hw->mac.addr, ETH_ALEN); 8537 ether_addr_copy(hw->mac.perm_addr, hw->mac.addr);
8482 8538
8483 pci_set_drvdata(pdev, pf); 8539 pci_set_drvdata(pdev, pf);
8484 pci_save_state(pdev); 8540 pci_save_state(pdev);
@@ -8486,7 +8542,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8486 err = i40e_init_pf_dcb(pf); 8542 err = i40e_init_pf_dcb(pf);
8487 if (err) { 8543 if (err) {
8488 dev_info(&pdev->dev, "init_pf_dcb failed: %d\n", err); 8544 dev_info(&pdev->dev, "init_pf_dcb failed: %d\n", err);
8489 pf->flags &= ~I40E_FLAG_DCB_ENABLED; 8545 pf->flags &= ~I40E_FLAG_DCB_CAPABLE;
8490 /* Continue without DCB enabled */ 8546 /* Continue without DCB enabled */
8491 } 8547 }
8492#endif /* CONFIG_I40E_DCB */ 8548#endif /* CONFIG_I40E_DCB */
diff --git a/drivers/net/ethernet/intel/i40e/i40e_prototype.h b/drivers/net/ethernet/intel/i40e/i40e_prototype.h
index 58c4e1eba5bf..a430699c41d5 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_prototype.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_prototype.h
@@ -70,7 +70,7 @@ i40e_status i40e_aq_get_firmware_version(struct i40e_hw *hw,
70 u16 *fw_major_version, u16 *fw_minor_version, 70 u16 *fw_major_version, u16 *fw_minor_version,
71 u16 *api_major_version, u16 *api_minor_version, 71 u16 *api_major_version, u16 *api_minor_version,
72 struct i40e_asq_cmd_details *cmd_details); 72 struct i40e_asq_cmd_details *cmd_details);
73i40e_status i40e_aq_set_phy_reset(struct i40e_hw *hw, 73i40e_status i40e_aq_set_phy_debug(struct i40e_hw *hw, u8 cmd_flags,
74 struct i40e_asq_cmd_details *cmd_details); 74 struct i40e_asq_cmd_details *cmd_details);
75i40e_status i40e_aq_set_default_vsi(struct i40e_hw *hw, u16 vsi_id, 75i40e_status i40e_aq_set_default_vsi(struct i40e_hw *hw, u16 vsi_id,
76 struct i40e_asq_cmd_details *cmd_details); 76 struct i40e_asq_cmd_details *cmd_details);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index d84f4275f470..e49f31dbd5d8 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -121,7 +121,7 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet,
121 dcc |= I40E_TXD_FLTR_QW1_CNT_ENA_MASK; 121 dcc |= I40E_TXD_FLTR_QW1_CNT_ENA_MASK;
122 dcc |= ((u32)fdir_data->cnt_index << 122 dcc |= ((u32)fdir_data->cnt_index <<
123 I40E_TXD_FLTR_QW1_CNTINDEX_SHIFT) & 123 I40E_TXD_FLTR_QW1_CNTINDEX_SHIFT) &
124 I40E_TXD_FLTR_QW1_CNTINDEX_MASK; 124 I40E_TXD_FLTR_QW1_CNTINDEX_MASK;
125 } 125 }
126 126
127 fdir_desc->dtype_cmd_cntindex = cpu_to_le32(dcc); 127 fdir_desc->dtype_cmd_cntindex = cpu_to_le32(dcc);
@@ -1695,6 +1695,11 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb,
1695 dtype_cmd |= I40E_FILTER_PROGRAM_DESC_FD_STATUS_FD_ID << 1695 dtype_cmd |= I40E_FILTER_PROGRAM_DESC_FD_STATUS_FD_ID <<
1696 I40E_TXD_FLTR_QW1_FD_STATUS_SHIFT; 1696 I40E_TXD_FLTR_QW1_FD_STATUS_SHIFT;
1697 1697
1698 dtype_cmd |= I40E_TXD_FLTR_QW1_CNT_ENA_MASK;
1699 dtype_cmd |=
1700 ((u32)pf->fd_atr_cnt_idx << I40E_TXD_FLTR_QW1_CNTINDEX_SHIFT) &
1701 I40E_TXD_FLTR_QW1_CNTINDEX_MASK;
1702
1698 fdir_desc->qindex_flex_ptype_vsi = cpu_to_le32(flex_ptype); 1703 fdir_desc->qindex_flex_ptype_vsi = cpu_to_le32(flex_ptype);
1699 fdir_desc->dtype_cmd_cntindex = cpu_to_le32(dtype_cmd); 1704 fdir_desc->dtype_cmd_cntindex = cpu_to_le32(dtype_cmd);
1700} 1705}
diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
index 42bfb2aed765..9d39ff23c5fb 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
@@ -663,7 +663,6 @@ enum i40e_rx_desc_ext_status_bits {
663 I40E_RX_DESC_EXT_STATUS_L2TAG3P_SHIFT = 1, 663 I40E_RX_DESC_EXT_STATUS_L2TAG3P_SHIFT = 1,
664 I40E_RX_DESC_EXT_STATUS_FLEXBL_SHIFT = 2, /* 2 BITS */ 664 I40E_RX_DESC_EXT_STATUS_FLEXBL_SHIFT = 2, /* 2 BITS */
665 I40E_RX_DESC_EXT_STATUS_FLEXBH_SHIFT = 4, /* 2 BITS */ 665 I40E_RX_DESC_EXT_STATUS_FLEXBH_SHIFT = 4, /* 2 BITS */
666 I40E_RX_DESC_EXT_STATUS_FTYPE_SHIFT = 6, /* 3 BITS */
667 I40E_RX_DESC_EXT_STATUS_FDLONGB_SHIFT = 9, 666 I40E_RX_DESC_EXT_STATUS_FDLONGB_SHIFT = 9,
668 I40E_RX_DESC_EXT_STATUS_FCOELONGB_SHIFT = 10, 667 I40E_RX_DESC_EXT_STATUS_FCOELONGB_SHIFT = 10,
669 I40E_RX_DESC_EXT_STATUS_PELONGB_SHIFT = 11, 668 I40E_RX_DESC_EXT_STATUS_PELONGB_SHIFT = 11,
@@ -1024,6 +1023,9 @@ struct i40e_hw_port_stats {
1024 u64 tx_size_big; /* ptc9522 */ 1023 u64 tx_size_big; /* ptc9522 */
1025 u64 mac_short_packet_dropped; /* mspdc */ 1024 u64 mac_short_packet_dropped; /* mspdc */
1026 u64 checksum_error; /* xec */ 1025 u64 checksum_error; /* xec */
1026 /* flow director stats */
1027 u64 fd_atr_match;
1028 u64 fd_sb_match;
1027 /* EEE LPI */ 1029 /* EEE LPI */
1028 u32 tx_lpi_status; 1030 u32 tx_lpi_status;
1029 u32 rx_lpi_status; 1031 u32 rx_lpi_status;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 385a46f910d6..f5b9d2062573 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -248,9 +248,8 @@ static int i40e_config_vsi_tx_queue(struct i40e_vf *vf, u16 vsi_idx,
248 tx_ctx.qlen = info->ring_len; 248 tx_ctx.qlen = info->ring_len;
249 tx_ctx.rdylist = le16_to_cpu(pf->vsi[vsi_idx]->info.qs_handle[0]); 249 tx_ctx.rdylist = le16_to_cpu(pf->vsi[vsi_idx]->info.qs_handle[0]);
250 tx_ctx.rdylist_act = 0; 250 tx_ctx.rdylist_act = 0;
251 tx_ctx.head_wb_ena = 1; 251 tx_ctx.head_wb_ena = info->headwb_enabled;
252 tx_ctx.head_wb_addr = info->dma_ring_addr + 252 tx_ctx.head_wb_addr = info->dma_headwb_addr;
253 (info->ring_len * sizeof(struct i40e_tx_desc));
254 253
255 /* clear the context in the HMC */ 254 /* clear the context in the HMC */
256 ret = i40e_clear_lan_tx_queue_context(hw, pf_queue_id); 255 ret = i40e_clear_lan_tx_queue_context(hw, pf_queue_id);
@@ -2076,7 +2075,7 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
2076 ret = -EIO; 2075 ret = -EIO;
2077 goto error_param; 2076 goto error_param;
2078 } 2077 }
2079 memcpy(vf->default_lan_addr.addr, mac, ETH_ALEN); 2078 ether_addr_copy(vf->default_lan_addr.addr, mac);
2080 vf->pf_set_mac = true; 2079 vf->pf_set_mac = true;
2081 dev_info(&pf->pdev->dev, "Reload the VF driver to make this change effective.\n"); 2080 dev_info(&pf->pdev->dev, "Reload the VF driver to make this change effective.\n");
2082 ret = 0; 2081 ret = 0;
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h b/drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h
index 89d9209ff2bd..e656ea7a7920 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h
@@ -34,7 +34,7 @@
34 */ 34 */
35 35
36#define I40E_FW_API_VERSION_MAJOR 0x0001 36#define I40E_FW_API_VERSION_MAJOR 0x0001
37#define I40E_FW_API_VERSION_MINOR 0x0001 37#define I40E_FW_API_VERSION_MINOR 0x0002
38#define I40E_FW_API_VERSION_A0_MINOR 0x0000 38#define I40E_FW_API_VERSION_A0_MINOR 0x0000
39 39
40struct i40e_aq_desc { 40struct i40e_aq_desc {
@@ -124,6 +124,7 @@ enum i40e_admin_queue_opc {
124 i40e_aqc_opc_get_version = 0x0001, 124 i40e_aqc_opc_get_version = 0x0001,
125 i40e_aqc_opc_driver_version = 0x0002, 125 i40e_aqc_opc_driver_version = 0x0002,
126 i40e_aqc_opc_queue_shutdown = 0x0003, 126 i40e_aqc_opc_queue_shutdown = 0x0003,
127 i40e_aqc_opc_set_pf_context = 0x0004,
127 128
128 /* resource ownership */ 129 /* resource ownership */
129 i40e_aqc_opc_request_resource = 0x0008, 130 i40e_aqc_opc_request_resource = 0x0008,
@@ -223,13 +224,15 @@ enum i40e_admin_queue_opc {
223 i40e_aqc_opc_get_partner_advt = 0x0616, 224 i40e_aqc_opc_get_partner_advt = 0x0616,
224 i40e_aqc_opc_set_lb_modes = 0x0618, 225 i40e_aqc_opc_set_lb_modes = 0x0618,
225 i40e_aqc_opc_get_phy_wol_caps = 0x0621, 226 i40e_aqc_opc_get_phy_wol_caps = 0x0621,
226 i40e_aqc_opc_set_phy_reset = 0x0622, 227 i40e_aqc_opc_set_phy_debug = 0x0622,
227 i40e_aqc_opc_upload_ext_phy_fm = 0x0625, 228 i40e_aqc_opc_upload_ext_phy_fm = 0x0625,
228 229
229 /* NVM commands */ 230 /* NVM commands */
230 i40e_aqc_opc_nvm_read = 0x0701, 231 i40e_aqc_opc_nvm_read = 0x0701,
231 i40e_aqc_opc_nvm_erase = 0x0702, 232 i40e_aqc_opc_nvm_erase = 0x0702,
232 i40e_aqc_opc_nvm_update = 0x0703, 233 i40e_aqc_opc_nvm_update = 0x0703,
234 i40e_aqc_opc_nvm_config_read = 0x0704,
235 i40e_aqc_opc_nvm_config_write = 0x0705,
233 236
234 /* virtualization commands */ 237 /* virtualization commands */
235 i40e_aqc_opc_send_msg_to_pf = 0x0801, 238 i40e_aqc_opc_send_msg_to_pf = 0x0801,
@@ -271,8 +274,6 @@ enum i40e_admin_queue_opc {
271 i40e_aqc_opc_debug_set_mode = 0xFF01, 274 i40e_aqc_opc_debug_set_mode = 0xFF01,
272 i40e_aqc_opc_debug_read_reg = 0xFF03, 275 i40e_aqc_opc_debug_read_reg = 0xFF03,
273 i40e_aqc_opc_debug_write_reg = 0xFF04, 276 i40e_aqc_opc_debug_write_reg = 0xFF04,
274 i40e_aqc_opc_debug_read_reg_sg = 0xFF05,
275 i40e_aqc_opc_debug_write_reg_sg = 0xFF06,
276 i40e_aqc_opc_debug_modify_reg = 0xFF07, 277 i40e_aqc_opc_debug_modify_reg = 0xFF07,
277 i40e_aqc_opc_debug_dump_internals = 0xFF08, 278 i40e_aqc_opc_debug_dump_internals = 0xFF08,
278 i40e_aqc_opc_debug_modify_internals = 0xFF09, 279 i40e_aqc_opc_debug_modify_internals = 0xFF09,
@@ -340,6 +341,14 @@ struct i40e_aqc_queue_shutdown {
340 341
341I40E_CHECK_CMD_LENGTH(i40e_aqc_queue_shutdown); 342I40E_CHECK_CMD_LENGTH(i40e_aqc_queue_shutdown);
342 343
344/* Set PF context (0x0004, direct) */
345struct i40e_aqc_set_pf_context {
346 u8 pf_id;
347 u8 reserved[15];
348};
349
350I40E_CHECK_CMD_LENGTH(i40e_aqc_set_pf_context);
351
343/* Request resource ownership (direct 0x0008) 352/* Request resource ownership (direct 0x0008)
344 * Release resource ownership (direct 0x0009) 353 * Release resource ownership (direct 0x0009)
345 */ 354 */
@@ -1408,11 +1417,12 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_configure_switching_comp_bw_limit);
1408struct i40e_aqc_configure_switching_comp_ets_data { 1417struct i40e_aqc_configure_switching_comp_ets_data {
1409 u8 reserved[4]; 1418 u8 reserved[4];
1410 u8 tc_valid_bits; 1419 u8 tc_valid_bits;
1411 u8 reserved1; 1420 u8 seepage;
1421#define I40E_AQ_ETS_SEEPAGE_EN_MASK 0x1
1412 u8 tc_strict_priority_flags; 1422 u8 tc_strict_priority_flags;
1413 u8 reserved2[17]; 1423 u8 reserved1[17];
1414 u8 tc_bw_share_credits[8]; 1424 u8 tc_bw_share_credits[8];
1415 u8 reserved3[96]; 1425 u8 reserved2[96];
1416}; 1426};
1417 1427
1418/* Configure Switching Component Bandwidth Limits per Tc (indirect 0x0416) */ 1428/* Configure Switching Component Bandwidth Limits per Tc (indirect 0x0416) */
@@ -1529,6 +1539,8 @@ enum i40e_aq_phy_type {
1529 I40E_PHY_TYPE_XLPPI = 0x9, 1539 I40E_PHY_TYPE_XLPPI = 0x9,
1530 I40E_PHY_TYPE_40GBASE_CR4_CU = 0xA, 1540 I40E_PHY_TYPE_40GBASE_CR4_CU = 0xA,
1531 I40E_PHY_TYPE_10GBASE_CR1_CU = 0xB, 1541 I40E_PHY_TYPE_10GBASE_CR1_CU = 0xB,
1542 I40E_PHY_TYPE_10GBASE_AOC = 0xC,
1543 I40E_PHY_TYPE_40GBASE_AOC = 0xD,
1532 I40E_PHY_TYPE_100BASE_TX = 0x11, 1544 I40E_PHY_TYPE_100BASE_TX = 0x11,
1533 I40E_PHY_TYPE_1000BASE_T = 0x12, 1545 I40E_PHY_TYPE_1000BASE_T = 0x12,
1534 I40E_PHY_TYPE_10GBASE_T = 0x13, 1546 I40E_PHY_TYPE_10GBASE_T = 0x13,
@@ -1539,7 +1551,10 @@ enum i40e_aq_phy_type {
1539 I40E_PHY_TYPE_40GBASE_CR4 = 0x18, 1551 I40E_PHY_TYPE_40GBASE_CR4 = 0x18,
1540 I40E_PHY_TYPE_40GBASE_SR4 = 0x19, 1552 I40E_PHY_TYPE_40GBASE_SR4 = 0x19,
1541 I40E_PHY_TYPE_40GBASE_LR4 = 0x1A, 1553 I40E_PHY_TYPE_40GBASE_LR4 = 0x1A,
1542 I40E_PHY_TYPE_20GBASE_KR2 = 0x1B, 1554 I40E_PHY_TYPE_1000BASE_SX = 0x1B,
1555 I40E_PHY_TYPE_1000BASE_LX = 0x1C,
1556 I40E_PHY_TYPE_1000BASE_T_OPTICAL = 0x1D,
1557 I40E_PHY_TYPE_20GBASE_KR2 = 0x1E,
1543 I40E_PHY_TYPE_MAX 1558 I40E_PHY_TYPE_MAX
1544}; 1559};
1545 1560
@@ -1683,6 +1698,7 @@ struct i40e_aqc_get_link_status {
1683#define I40E_AQ_LINK_TX_ACTIVE 0x00 1698#define I40E_AQ_LINK_TX_ACTIVE 0x00
1684#define I40E_AQ_LINK_TX_DRAINED 0x01 1699#define I40E_AQ_LINK_TX_DRAINED 0x01
1685#define I40E_AQ_LINK_TX_FLUSHED 0x03 1700#define I40E_AQ_LINK_TX_FLUSHED 0x03
1701#define I40E_AQ_LINK_FORCED_40G 0x10
1686 u8 loopback; /* use defines from i40e_aqc_set_lb_mode */ 1702 u8 loopback; /* use defines from i40e_aqc_set_lb_mode */
1687 __le16 max_frame_size; 1703 __le16 max_frame_size;
1688 u8 config; 1704 u8 config;
@@ -1734,14 +1750,21 @@ struct i40e_aqc_set_lb_mode {
1734 1750
1735I40E_CHECK_CMD_LENGTH(i40e_aqc_set_lb_mode); 1751I40E_CHECK_CMD_LENGTH(i40e_aqc_set_lb_mode);
1736 1752
1737/* Set PHY Reset command (0x0622) */ 1753/* Set PHY Debug command (0x0622) */
1738struct i40e_aqc_set_phy_reset { 1754struct i40e_aqc_set_phy_debug {
1739 u8 reset_flags; 1755 u8 command_flags;
1740#define I40E_AQ_PHY_RESET_REQUEST 0x02 1756#define I40E_AQ_PHY_DEBUG_RESET_INTERNAL 0x02
1757#define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SHIFT 2
1758#define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_MASK (0x03 << \
1759 I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SHIFT)
1760#define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_NONE 0x00
1761#define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_HARD 0x01
1762#define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SOFT 0x02
1763#define I40E_AQ_PHY_DEBUG_DISABLE_LINK_FW 0x10
1741 u8 reserved[15]; 1764 u8 reserved[15];
1742}; 1765};
1743 1766
1744I40E_CHECK_CMD_LENGTH(i40e_aqc_set_phy_reset); 1767I40E_CHECK_CMD_LENGTH(i40e_aqc_set_phy_debug);
1745 1768
1746enum i40e_aq_phy_reg_type { 1769enum i40e_aq_phy_reg_type {
1747 I40E_AQC_PHY_REG_INTERNAL = 0x1, 1770 I40E_AQC_PHY_REG_INTERNAL = 0x1,
@@ -1766,6 +1789,47 @@ struct i40e_aqc_nvm_update {
1766 1789
1767I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_update); 1790I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_update);
1768 1791
1792/* NVM Config Read (indirect 0x0704) */
1793struct i40e_aqc_nvm_config_read {
1794 __le16 cmd_flags;
1795#define ANVM_SINGLE_OR_MULTIPLE_FEATURES_MASK 1
1796#define ANVM_READ_SINGLE_FEATURE 0
1797#define ANVM_READ_MULTIPLE_FEATURES 1
1798 __le16 element_count;
1799 __le16 element_id; /* Feature/field ID */
1800 u8 reserved[2];
1801 __le32 address_high;
1802 __le32 address_low;
1803};
1804
1805I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_read);
1806
1807/* NVM Config Write (indirect 0x0705) */
1808struct i40e_aqc_nvm_config_write {
1809 __le16 cmd_flags;
1810 __le16 element_count;
1811 u8 reserved[4];
1812 __le32 address_high;
1813 __le32 address_low;
1814};
1815
1816I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_write);
1817
1818struct i40e_aqc_nvm_config_data_feature {
1819 __le16 feature_id;
1820 __le16 instance_id;
1821 __le16 feature_options;
1822 __le16 feature_selection;
1823};
1824
1825struct i40e_aqc_nvm_config_data_immediate_field {
1826#define ANVM_FEATURE_OR_IMMEDIATE_MASK 0x2
1827 __le16 field_id;
1828 __le16 instance_id;
1829 __le16 field_options;
1830 __le16 field_value;
1831};
1832
1769/* Send to PF command (indirect 0x0801) id is only used by PF 1833/* Send to PF command (indirect 0x0801) id is only used by PF
1770 * Send to VF command (indirect 0x0802) id is only used by PF 1834 * Send to VF command (indirect 0x0802) id is only used by PF
1771 * Send to Peer PF command (indirect 0x0803) 1835 * Send to Peer PF command (indirect 0x0803)
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_type.h b/drivers/net/ethernet/intel/i40evf/i40e_type.h
index 0a7914d11b6a..d3cf5a69de54 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_type.h
@@ -663,7 +663,6 @@ enum i40e_rx_desc_ext_status_bits {
663 I40E_RX_DESC_EXT_STATUS_L2TAG3P_SHIFT = 1, 663 I40E_RX_DESC_EXT_STATUS_L2TAG3P_SHIFT = 1,
664 I40E_RX_DESC_EXT_STATUS_FLEXBL_SHIFT = 2, /* 2 BITS */ 664 I40E_RX_DESC_EXT_STATUS_FLEXBL_SHIFT = 2, /* 2 BITS */
665 I40E_RX_DESC_EXT_STATUS_FLEXBH_SHIFT = 4, /* 2 BITS */ 665 I40E_RX_DESC_EXT_STATUS_FLEXBH_SHIFT = 4, /* 2 BITS */
666 I40E_RX_DESC_EXT_STATUS_FTYPE_SHIFT = 6, /* 3 BITS */
667 I40E_RX_DESC_EXT_STATUS_FDLONGB_SHIFT = 9, 666 I40E_RX_DESC_EXT_STATUS_FDLONGB_SHIFT = 9,
668 I40E_RX_DESC_EXT_STATUS_FCOELONGB_SHIFT = 10, 667 I40E_RX_DESC_EXT_STATUS_FCOELONGB_SHIFT = 10,
669 I40E_RX_DESC_EXT_STATUS_PELONGB_SHIFT = 11, 668 I40E_RX_DESC_EXT_STATUS_PELONGB_SHIFT = 11,
@@ -1024,6 +1023,9 @@ struct i40e_hw_port_stats {
1024 u64 tx_size_big; /* ptc9522 */ 1023 u64 tx_size_big; /* ptc9522 */
1025 u64 mac_short_packet_dropped; /* mspdc */ 1024 u64 mac_short_packet_dropped; /* mspdc */
1026 u64 checksum_error; /* xec */ 1025 u64 checksum_error; /* xec */
1026 /* flow director stats */
1027 u64 fd_atr_match;
1028 u64 fd_sb_match;
1027 /* EEE LPI */ 1029 /* EEE LPI */
1028 u32 tx_lpi_status; 1030 u32 tx_lpi_status;
1029 u32 rx_lpi_status; 1031 u32 rx_lpi_status;
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index d4157857360d..7fc5f3b5d6bf 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -36,7 +36,7 @@ char i40evf_driver_name[] = "i40evf";
36static const char i40evf_driver_string[] = 36static const char i40evf_driver_string[] =
37 "Intel(R) XL710 X710 Virtual Function Network Driver"; 37 "Intel(R) XL710 X710 Virtual Function Network Driver";
38 38
39#define DRV_VERSION "0.9.31" 39#define DRV_VERSION "0.9.34"
40const char i40evf_driver_version[] = DRV_VERSION; 40const char i40evf_driver_version[] = DRV_VERSION;
41static const char i40evf_copyright[] = 41static const char i40evf_copyright[] =
42 "Copyright (c) 2013 - 2014 Intel Corporation."; 42 "Copyright (c) 2013 - 2014 Intel Corporation.";
@@ -772,7 +772,7 @@ i40evf_mac_filter *i40evf_add_filter(struct i40evf_adapter *adapter,
772 return NULL; 772 return NULL;
773 } 773 }
774 774
775 memcpy(f->macaddr, macaddr, ETH_ALEN); 775 ether_addr_copy(f->macaddr, macaddr);
776 776
777 list_add(&f->list, &adapter->mac_filter_list); 777 list_add(&f->list, &adapter->mac_filter_list);
778 f->add = true; 778 f->add = true;
@@ -805,9 +805,8 @@ static int i40evf_set_mac(struct net_device *netdev, void *p)
805 805
806 f = i40evf_add_filter(adapter, addr->sa_data); 806 f = i40evf_add_filter(adapter, addr->sa_data);
807 if (f) { 807 if (f) {
808 memcpy(hw->mac.addr, addr->sa_data, netdev->addr_len); 808 ether_addr_copy(hw->mac.addr, addr->sa_data);
809 memcpy(netdev->dev_addr, adapter->hw.mac.addr, 809 ether_addr_copy(netdev->dev_addr, adapter->hw.mac.addr);
810 netdev->addr_len);
811 } 810 }
812 811
813 return (f == NULL) ? -ENOMEM : 0; 812 return (f == NULL) ? -ENOMEM : 0;
@@ -968,6 +967,9 @@ void i40evf_down(struct i40evf_adapter *adapter)
968 struct net_device *netdev = adapter->netdev; 967 struct net_device *netdev = adapter->netdev;
969 struct i40evf_mac_filter *f; 968 struct i40evf_mac_filter *f;
970 969
970 if (adapter->state == __I40EVF_DOWN)
971 return;
972
971 /* remove all MAC filters */ 973 /* remove all MAC filters */
972 list_for_each_entry(f, &adapter->mac_filter_list, list) { 974 list_for_each_entry(f, &adapter->mac_filter_list, list) {
973 f->remove = true; 975 f->remove = true;
@@ -1588,6 +1590,7 @@ static void i40evf_adminq_task(struct work_struct *work)
1588 struct i40e_arq_event_info event; 1590 struct i40e_arq_event_info event;
1589 struct i40e_virtchnl_msg *v_msg; 1591 struct i40e_virtchnl_msg *v_msg;
1590 i40e_status ret; 1592 i40e_status ret;
1593 u32 val, oldval;
1591 u16 pending; 1594 u16 pending;
1592 1595
1593 if (adapter->flags & I40EVF_FLAG_PF_COMMS_FAILED) 1596 if (adapter->flags & I40EVF_FLAG_PF_COMMS_FAILED)
@@ -1615,6 +1618,41 @@ static void i40evf_adminq_task(struct work_struct *work)
1615 } 1618 }
1616 } while (pending); 1619 } while (pending);
1617 1620
1621 /* check for error indications */
1622 val = rd32(hw, hw->aq.arq.len);
1623 oldval = val;
1624 if (val & I40E_VF_ARQLEN_ARQVFE_MASK) {
1625 dev_info(&adapter->pdev->dev, "ARQ VF Error detected\n");
1626 val &= ~I40E_VF_ARQLEN_ARQVFE_MASK;
1627 }
1628 if (val & I40E_VF_ARQLEN_ARQOVFL_MASK) {
1629 dev_info(&adapter->pdev->dev, "ARQ Overflow Error detected\n");
1630 val &= ~I40E_VF_ARQLEN_ARQOVFL_MASK;
1631 }
1632 if (val & I40E_VF_ARQLEN_ARQCRIT_MASK) {
1633 dev_info(&adapter->pdev->dev, "ARQ Critical Error detected\n");
1634 val &= ~I40E_VF_ARQLEN_ARQCRIT_MASK;
1635 }
1636 if (oldval != val)
1637 wr32(hw, hw->aq.arq.len, val);
1638
1639 val = rd32(hw, hw->aq.asq.len);
1640 oldval = val;
1641 if (val & I40E_VF_ATQLEN_ATQVFE_MASK) {
1642 dev_info(&adapter->pdev->dev, "ASQ VF Error detected\n");
1643 val &= ~I40E_VF_ATQLEN_ATQVFE_MASK;
1644 }
1645 if (val & I40E_VF_ATQLEN_ATQOVFL_MASK) {
1646 dev_info(&adapter->pdev->dev, "ASQ Overflow Error detected\n");
1647 val &= ~I40E_VF_ATQLEN_ATQOVFL_MASK;
1648 }
1649 if (val & I40E_VF_ATQLEN_ATQCRIT_MASK) {
1650 dev_info(&adapter->pdev->dev, "ASQ Critical Error detected\n");
1651 val &= ~I40E_VF_ATQLEN_ATQCRIT_MASK;
1652 }
1653 if (oldval != val)
1654 wr32(hw, hw->aq.asq.len, val);
1655
1618 /* re-enable Admin queue interrupt cause */ 1656 /* re-enable Admin queue interrupt cause */
1619 i40evf_misc_irq_enable(adapter); 1657 i40evf_misc_irq_enable(adapter);
1620 1658
@@ -1785,12 +1823,11 @@ static int i40evf_close(struct net_device *netdev)
1785 if (adapter->state <= __I40EVF_DOWN) 1823 if (adapter->state <= __I40EVF_DOWN)
1786 return 0; 1824 return 0;
1787 1825
1788 /* signal that we are down to the interrupt handler */
1789 adapter->state = __I40EVF_DOWN;
1790 1826
1791 set_bit(__I40E_DOWN, &adapter->vsi.state); 1827 set_bit(__I40E_DOWN, &adapter->vsi.state);
1792 1828
1793 i40evf_down(adapter); 1829 i40evf_down(adapter);
1830 adapter->state = __I40EVF_DOWN;
1794 i40evf_free_traffic_irqs(adapter); 1831 i40evf_free_traffic_irqs(adapter);
1795 1832
1796 i40evf_free_all_tx_resources(adapter); 1833 i40evf_free_all_tx_resources(adapter);
@@ -2057,8 +2094,8 @@ static void i40evf_init_task(struct work_struct *work)
2057 adapter->hw.mac.addr); 2094 adapter->hw.mac.addr);
2058 random_ether_addr(adapter->hw.mac.addr); 2095 random_ether_addr(adapter->hw.mac.addr);
2059 } 2096 }
2060 memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len); 2097 ether_addr_copy(netdev->dev_addr, adapter->hw.mac.addr);
2061 memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); 2098 ether_addr_copy(netdev->perm_addr, adapter->hw.mac.addr);
2062 2099
2063 INIT_LIST_HEAD(&adapter->mac_filter_list); 2100 INIT_LIST_HEAD(&adapter->mac_filter_list);
2064 INIT_LIST_HEAD(&adapter->vlan_filter_list); 2101 INIT_LIST_HEAD(&adapter->vlan_filter_list);
@@ -2066,7 +2103,7 @@ static void i40evf_init_task(struct work_struct *work)
2066 if (NULL == f) 2103 if (NULL == f)
2067 goto err_sw_init; 2104 goto err_sw_init;
2068 2105
2069 memcpy(f->macaddr, adapter->hw.mac.addr, ETH_ALEN); 2106 ether_addr_copy(f->macaddr, adapter->hw.mac.addr);
2070 f->add = true; 2107 f->add = true;
2071 adapter->aq_required |= I40EVF_FLAG_AQ_ADD_MAC_FILTER; 2108 adapter->aq_required |= I40EVF_FLAG_AQ_ADD_MAC_FILTER;
2072 2109
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
index cd414dac7553..2dc0bac76717 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
@@ -233,6 +233,9 @@ void i40evf_configure_queues(struct i40evf_adapter *adapter)
233 vqpi->txq.queue_id = i; 233 vqpi->txq.queue_id = i;
234 vqpi->txq.ring_len = adapter->tx_rings[i]->count; 234 vqpi->txq.ring_len = adapter->tx_rings[i]->count;
235 vqpi->txq.dma_ring_addr = adapter->tx_rings[i]->dma; 235 vqpi->txq.dma_ring_addr = adapter->tx_rings[i]->dma;
236 vqpi->txq.headwb_enabled = 1;
237 vqpi->txq.dma_headwb_addr = vqpi->txq.dma_ring_addr +
238 (vqpi->txq.ring_len * sizeof(struct i40e_tx_desc));
236 239
237 vqpi->rxq.vsi_id = vqci->vsi_id; 240 vqpi->rxq.vsi_id = vqci->vsi_id;
238 vqpi->rxq.queue_id = i; 241 vqpi->rxq.queue_id = i;
@@ -404,7 +407,7 @@ void i40evf_add_ether_addrs(struct i40evf_adapter *adapter)
404 veal->num_elements = count; 407 veal->num_elements = count;
405 list_for_each_entry(f, &adapter->mac_filter_list, list) { 408 list_for_each_entry(f, &adapter->mac_filter_list, list) {
406 if (f->add) { 409 if (f->add) {
407 memcpy(veal->list[i].addr, f->macaddr, ETH_ALEN); 410 ether_addr_copy(veal->list[i].addr, f->macaddr);
408 i++; 411 i++;
409 f->add = false; 412 f->add = false;
410 } 413 }
@@ -465,7 +468,7 @@ void i40evf_del_ether_addrs(struct i40evf_adapter *adapter)
465 veal->num_elements = count; 468 veal->num_elements = count;
466 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { 469 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) {
467 if (f->remove) { 470 if (f->remove) {
468 memcpy(veal->list[i].addr, f->macaddr, ETH_ALEN); 471 ether_addr_copy(veal->list[i].addr, f->macaddr);
469 i++; 472 i++;
470 list_del(&f->list); 473 list_del(&f->list);
471 kfree(f); 474 kfree(f);
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
index 2e36c670d8df..a2db388cc31e 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
@@ -155,7 +155,7 @@ static s32 igb_check_for_link_media_swap(struct e1000_hw *hw)
155 ret_val = igb_check_for_link_82575(hw); 155 ret_val = igb_check_for_link_82575(hw);
156 } 156 }
157 157
158 return E1000_SUCCESS; 158 return 0;
159} 159}
160 160
161/** 161/**
@@ -1004,7 +1004,6 @@ out:
1004static s32 igb_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active) 1004static s32 igb_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active)
1005{ 1005{
1006 struct e1000_phy_info *phy = &hw->phy; 1006 struct e1000_phy_info *phy = &hw->phy;
1007 s32 ret_val = 0;
1008 u16 data; 1007 u16 data;
1009 1008
1010 data = rd32(E1000_82580_PHY_POWER_MGMT); 1009 data = rd32(E1000_82580_PHY_POWER_MGMT);
@@ -1028,7 +1027,7 @@ static s32 igb_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active)
1028 data &= ~E1000_82580_PM_SPD; } 1027 data &= ~E1000_82580_PM_SPD; }
1029 1028
1030 wr32(E1000_82580_PHY_POWER_MGMT, data); 1029 wr32(E1000_82580_PHY_POWER_MGMT, data);
1031 return ret_val; 1030 return 0;
1032} 1031}
1033 1032
1034/** 1033/**
@@ -1048,7 +1047,6 @@ static s32 igb_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active)
1048static s32 igb_set_d3_lplu_state_82580(struct e1000_hw *hw, bool active) 1047static s32 igb_set_d3_lplu_state_82580(struct e1000_hw *hw, bool active)
1049{ 1048{
1050 struct e1000_phy_info *phy = &hw->phy; 1049 struct e1000_phy_info *phy = &hw->phy;
1051 s32 ret_val = 0;
1052 u16 data; 1050 u16 data;
1053 1051
1054 data = rd32(E1000_82580_PHY_POWER_MGMT); 1052 data = rd32(E1000_82580_PHY_POWER_MGMT);
@@ -1073,7 +1071,7 @@ static s32 igb_set_d3_lplu_state_82580(struct e1000_hw *hw, bool active)
1073 } 1071 }
1074 1072
1075 wr32(E1000_82580_PHY_POWER_MGMT, data); 1073 wr32(E1000_82580_PHY_POWER_MGMT, data);
1076 return ret_val; 1074 return 0;
1077} 1075}
1078 1076
1079/** 1077/**
@@ -1199,7 +1197,6 @@ static void igb_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask)
1199static s32 igb_get_cfg_done_82575(struct e1000_hw *hw) 1197static s32 igb_get_cfg_done_82575(struct e1000_hw *hw)
1200{ 1198{
1201 s32 timeout = PHY_CFG_TIMEOUT; 1199 s32 timeout = PHY_CFG_TIMEOUT;
1202 s32 ret_val = 0;
1203 u32 mask = E1000_NVM_CFG_DONE_PORT_0; 1200 u32 mask = E1000_NVM_CFG_DONE_PORT_0;
1204 1201
1205 if (hw->bus.func == 1) 1202 if (hw->bus.func == 1)
@@ -1223,7 +1220,7 @@ static s32 igb_get_cfg_done_82575(struct e1000_hw *hw)
1223 (hw->phy.type == e1000_phy_igp_3)) 1220 (hw->phy.type == e1000_phy_igp_3))
1224 igb_phy_init_script_igp3(hw); 1221 igb_phy_init_script_igp3(hw);
1225 1222
1226 return ret_val; 1223 return 0;
1227} 1224}
1228 1225
1229/** 1226/**
@@ -1617,7 +1614,7 @@ static s32 igb_setup_serdes_link_82575(struct e1000_hw *hw)
1617{ 1614{
1618 u32 ctrl_ext, ctrl_reg, reg, anadv_reg; 1615 u32 ctrl_ext, ctrl_reg, reg, anadv_reg;
1619 bool pcs_autoneg; 1616 bool pcs_autoneg;
1620 s32 ret_val = E1000_SUCCESS; 1617 s32 ret_val = 0;
1621 u16 data; 1618 u16 data;
1622 1619
1623 if ((hw->phy.media_type != e1000_media_type_internal_serdes) && 1620 if ((hw->phy.media_type != e1000_media_type_internal_serdes) &&
@@ -2518,7 +2515,7 @@ out:
2518static s32 __igb_access_emi_reg(struct e1000_hw *hw, u16 address, 2515static s32 __igb_access_emi_reg(struct e1000_hw *hw, u16 address,
2519 u16 *data, bool read) 2516 u16 *data, bool read)
2520{ 2517{
2521 s32 ret_val = E1000_SUCCESS; 2518 s32 ret_val = 0;
2522 2519
2523 ret_val = hw->phy.ops.write_reg(hw, E1000_EMIADD, address); 2520 ret_val = hw->phy.ops.write_reg(hw, E1000_EMIADD, address);
2524 if (ret_val) 2521 if (ret_val)
@@ -2552,7 +2549,6 @@ s32 igb_read_emi_reg(struct e1000_hw *hw, u16 addr, u16 *data)
2552 **/ 2549 **/
2553s32 igb_set_eee_i350(struct e1000_hw *hw) 2550s32 igb_set_eee_i350(struct e1000_hw *hw)
2554{ 2551{
2555 s32 ret_val = 0;
2556 u32 ipcnfg, eeer; 2552 u32 ipcnfg, eeer;
2557 2553
2558 if ((hw->mac.type < e1000_i350) || 2554 if ((hw->mac.type < e1000_i350) ||
@@ -2586,7 +2582,7 @@ s32 igb_set_eee_i350(struct e1000_hw *hw)
2586 rd32(E1000_EEER); 2582 rd32(E1000_EEER);
2587out: 2583out:
2588 2584
2589 return ret_val; 2585 return 0;
2590} 2586}
2591 2587
2592/** 2588/**
@@ -2713,7 +2709,6 @@ static const u8 e1000_emc_therm_limit[4] = {
2713 **/ 2709 **/
2714static s32 igb_get_thermal_sensor_data_generic(struct e1000_hw *hw) 2710static s32 igb_get_thermal_sensor_data_generic(struct e1000_hw *hw)
2715{ 2711{
2716 s32 status = E1000_SUCCESS;
2717 u16 ets_offset; 2712 u16 ets_offset;
2718 u16 ets_cfg; 2713 u16 ets_cfg;
2719 u16 ets_sensor; 2714 u16 ets_sensor;
@@ -2731,7 +2726,7 @@ static s32 igb_get_thermal_sensor_data_generic(struct e1000_hw *hw)
2731 /* Return the internal sensor only if ETS is unsupported */ 2726 /* Return the internal sensor only if ETS is unsupported */
2732 hw->nvm.ops.read(hw, NVM_ETS_CFG, 1, &ets_offset); 2727 hw->nvm.ops.read(hw, NVM_ETS_CFG, 1, &ets_offset);
2733 if ((ets_offset == 0x0000) || (ets_offset == 0xFFFF)) 2728 if ((ets_offset == 0x0000) || (ets_offset == 0xFFFF))
2734 return status; 2729 return 0;
2735 2730
2736 hw->nvm.ops.read(hw, ets_offset, 1, &ets_cfg); 2731 hw->nvm.ops.read(hw, ets_offset, 1, &ets_cfg);
2737 if (((ets_cfg & NVM_ETS_TYPE_MASK) >> NVM_ETS_TYPE_SHIFT) 2732 if (((ets_cfg & NVM_ETS_TYPE_MASK) >> NVM_ETS_TYPE_SHIFT)
@@ -2755,7 +2750,7 @@ static s32 igb_get_thermal_sensor_data_generic(struct e1000_hw *hw)
2755 E1000_I2C_THERMAL_SENSOR_ADDR, 2750 E1000_I2C_THERMAL_SENSOR_ADDR,
2756 &data->sensor[i].temp); 2751 &data->sensor[i].temp);
2757 } 2752 }
2758 return status; 2753 return 0;
2759} 2754}
2760 2755
2761/** 2756/**
@@ -2767,7 +2762,6 @@ static s32 igb_get_thermal_sensor_data_generic(struct e1000_hw *hw)
2767 **/ 2762 **/
2768static s32 igb_init_thermal_sensor_thresh_generic(struct e1000_hw *hw) 2763static s32 igb_init_thermal_sensor_thresh_generic(struct e1000_hw *hw)
2769{ 2764{
2770 s32 status = E1000_SUCCESS;
2771 u16 ets_offset; 2765 u16 ets_offset;
2772 u16 ets_cfg; 2766 u16 ets_cfg;
2773 u16 ets_sensor; 2767 u16 ets_sensor;
@@ -2793,7 +2787,7 @@ static s32 igb_init_thermal_sensor_thresh_generic(struct e1000_hw *hw)
2793 /* Return the internal sensor only if ETS is unsupported */ 2787 /* Return the internal sensor only if ETS is unsupported */
2794 hw->nvm.ops.read(hw, NVM_ETS_CFG, 1, &ets_offset); 2788 hw->nvm.ops.read(hw, NVM_ETS_CFG, 1, &ets_offset);
2795 if ((ets_offset == 0x0000) || (ets_offset == 0xFFFF)) 2789 if ((ets_offset == 0x0000) || (ets_offset == 0xFFFF))
2796 return status; 2790 return 0;
2797 2791
2798 hw->nvm.ops.read(hw, ets_offset, 1, &ets_cfg); 2792 hw->nvm.ops.read(hw, ets_offset, 1, &ets_cfg);
2799 if (((ets_cfg & NVM_ETS_TYPE_MASK) >> NVM_ETS_TYPE_SHIFT) 2793 if (((ets_cfg & NVM_ETS_TYPE_MASK) >> NVM_ETS_TYPE_SHIFT)
@@ -2824,7 +2818,7 @@ static s32 igb_init_thermal_sensor_thresh_generic(struct e1000_hw *hw)
2824 low_thresh_delta; 2818 low_thresh_delta;
2825 } 2819 }
2826 } 2820 }
2827 return status; 2821 return 0;
2828} 2822}
2829 2823
2830#endif 2824#endif
diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h
index 11ffdbae9f92..2a8bb35c2df2 100644
--- a/drivers/net/ethernet/intel/igb/e1000_defines.h
+++ b/drivers/net/ethernet/intel/igb/e1000_defines.h
@@ -459,7 +459,6 @@
459#define E1000_RAH_POOL_1 0x00040000 459#define E1000_RAH_POOL_1 0x00040000
460 460
461/* Error Codes */ 461/* Error Codes */
462#define E1000_SUCCESS 0
463#define E1000_ERR_NVM 1 462#define E1000_ERR_NVM 1
464#define E1000_ERR_PHY 2 463#define E1000_ERR_PHY 2
465#define E1000_ERR_CONFIG 3 464#define E1000_ERR_CONFIG 3
diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c b/drivers/net/ethernet/intel/igb/e1000_i210.c
index 2231598fb42d..337161f440dd 100644
--- a/drivers/net/ethernet/intel/igb/e1000_i210.c
+++ b/drivers/net/ethernet/intel/igb/e1000_i210.c
@@ -97,7 +97,7 @@ static s32 igb_get_hw_semaphore_i210(struct e1000_hw *hw)
97 return -E1000_ERR_NVM; 97 return -E1000_ERR_NVM;
98 } 98 }
99 99
100 return E1000_SUCCESS; 100 return 0;
101} 101}
102 102
103/** 103/**
@@ -139,7 +139,7 @@ s32 igb_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask)
139 u32 swfw_sync; 139 u32 swfw_sync;
140 u32 swmask = mask; 140 u32 swmask = mask;
141 u32 fwmask = mask << 16; 141 u32 fwmask = mask << 16;
142 s32 ret_val = E1000_SUCCESS; 142 s32 ret_val = 0;
143 s32 i = 0, timeout = 200; /* FIXME: find real value to use here */ 143 s32 i = 0, timeout = 200; /* FIXME: find real value to use here */
144 144
145 while (i < timeout) { 145 while (i < timeout) {
@@ -184,7 +184,7 @@ void igb_release_swfw_sync_i210(struct e1000_hw *hw, u16 mask)
184{ 184{
185 u32 swfw_sync; 185 u32 swfw_sync;
186 186
187 while (igb_get_hw_semaphore_i210(hw) != E1000_SUCCESS) 187 while (igb_get_hw_semaphore_i210(hw))
188 ; /* Empty */ 188 ; /* Empty */
189 189
190 swfw_sync = rd32(E1000_SW_FW_SYNC); 190 swfw_sync = rd32(E1000_SW_FW_SYNC);
@@ -207,7 +207,7 @@ void igb_release_swfw_sync_i210(struct e1000_hw *hw, u16 mask)
207static s32 igb_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words, 207static s32 igb_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words,
208 u16 *data) 208 u16 *data)
209{ 209{
210 s32 status = E1000_SUCCESS; 210 s32 status = 0;
211 u16 i, count; 211 u16 i, count;
212 212
213 /* We cannot hold synchronization semaphores for too long, 213 /* We cannot hold synchronization semaphores for too long,
@@ -217,7 +217,7 @@ static s32 igb_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words,
217 for (i = 0; i < words; i += E1000_EERD_EEWR_MAX_COUNT) { 217 for (i = 0; i < words; i += E1000_EERD_EEWR_MAX_COUNT) {
218 count = (words - i) / E1000_EERD_EEWR_MAX_COUNT > 0 ? 218 count = (words - i) / E1000_EERD_EEWR_MAX_COUNT > 0 ?
219 E1000_EERD_EEWR_MAX_COUNT : (words - i); 219 E1000_EERD_EEWR_MAX_COUNT : (words - i);
220 if (hw->nvm.ops.acquire(hw) == E1000_SUCCESS) { 220 if (!(hw->nvm.ops.acquire(hw))) {
221 status = igb_read_nvm_eerd(hw, offset, count, 221 status = igb_read_nvm_eerd(hw, offset, count,
222 data + i); 222 data + i);
223 hw->nvm.ops.release(hw); 223 hw->nvm.ops.release(hw);
@@ -225,7 +225,7 @@ static s32 igb_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words,
225 status = E1000_ERR_SWFW_SYNC; 225 status = E1000_ERR_SWFW_SYNC;
226 } 226 }
227 227
228 if (status != E1000_SUCCESS) 228 if (status)
229 break; 229 break;
230 } 230 }
231 231
@@ -250,7 +250,7 @@ static s32 igb_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words,
250 struct e1000_nvm_info *nvm = &hw->nvm; 250 struct e1000_nvm_info *nvm = &hw->nvm;
251 u32 i, k, eewr = 0; 251 u32 i, k, eewr = 0;
252 u32 attempts = 100000; 252 u32 attempts = 100000;
253 s32 ret_val = E1000_SUCCESS; 253 s32 ret_val = 0;
254 254
255 /* A check for invalid values: offset too large, too many words, 255 /* A check for invalid values: offset too large, too many words,
256 * too many words for the offset, and not enough words. 256 * too many words for the offset, and not enough words.
@@ -272,13 +272,13 @@ static s32 igb_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words,
272 for (k = 0; k < attempts; k++) { 272 for (k = 0; k < attempts; k++) {
273 if (E1000_NVM_RW_REG_DONE & 273 if (E1000_NVM_RW_REG_DONE &
274 rd32(E1000_SRWR)) { 274 rd32(E1000_SRWR)) {
275 ret_val = E1000_SUCCESS; 275 ret_val = 0;
276 break; 276 break;
277 } 277 }
278 udelay(5); 278 udelay(5);
279 } 279 }
280 280
281 if (ret_val != E1000_SUCCESS) { 281 if (ret_val) {
282 hw_dbg("Shadow RAM write EEWR timed out\n"); 282 hw_dbg("Shadow RAM write EEWR timed out\n");
283 break; 283 break;
284 } 284 }
@@ -307,7 +307,7 @@ out:
307static s32 igb_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words, 307static s32 igb_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words,
308 u16 *data) 308 u16 *data)
309{ 309{
310 s32 status = E1000_SUCCESS; 310 s32 status = 0;
311 u16 i, count; 311 u16 i, count;
312 312
313 /* We cannot hold synchronization semaphores for too long, 313 /* We cannot hold synchronization semaphores for too long,
@@ -317,7 +317,7 @@ static s32 igb_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words,
317 for (i = 0; i < words; i += E1000_EERD_EEWR_MAX_COUNT) { 317 for (i = 0; i < words; i += E1000_EERD_EEWR_MAX_COUNT) {
318 count = (words - i) / E1000_EERD_EEWR_MAX_COUNT > 0 ? 318 count = (words - i) / E1000_EERD_EEWR_MAX_COUNT > 0 ?
319 E1000_EERD_EEWR_MAX_COUNT : (words - i); 319 E1000_EERD_EEWR_MAX_COUNT : (words - i);
320 if (hw->nvm.ops.acquire(hw) == E1000_SUCCESS) { 320 if (!(hw->nvm.ops.acquire(hw))) {
321 status = igb_write_nvm_srwr(hw, offset, count, 321 status = igb_write_nvm_srwr(hw, offset, count,
322 data + i); 322 data + i);
323 hw->nvm.ops.release(hw); 323 hw->nvm.ops.release(hw);
@@ -325,7 +325,7 @@ static s32 igb_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words,
325 status = E1000_ERR_SWFW_SYNC; 325 status = E1000_ERR_SWFW_SYNC;
326 } 326 }
327 327
328 if (status != E1000_SUCCESS) 328 if (status)
329 break; 329 break;
330 } 330 }
331 331
@@ -364,12 +364,12 @@ static s32 igb_read_invm_word_i210(struct e1000_hw *hw, u8 address, u16 *data)
364 *data = INVM_DWORD_TO_WORD_DATA(invm_dword); 364 *data = INVM_DWORD_TO_WORD_DATA(invm_dword);
365 hw_dbg("Read INVM Word 0x%02x = %x\n", 365 hw_dbg("Read INVM Word 0x%02x = %x\n",
366 address, *data); 366 address, *data);
367 status = E1000_SUCCESS; 367 status = 0;
368 break; 368 break;
369 } 369 }
370 } 370 }
371 } 371 }
372 if (status != E1000_SUCCESS) 372 if (status)
373 hw_dbg("Requested word 0x%02x not found in OTP\n", address); 373 hw_dbg("Requested word 0x%02x not found in OTP\n", address);
374 return status; 374 return status;
375} 375}
@@ -385,7 +385,7 @@ static s32 igb_read_invm_word_i210(struct e1000_hw *hw, u8 address, u16 *data)
385static s32 igb_read_invm_i210(struct e1000_hw *hw, u16 offset, 385static s32 igb_read_invm_i210(struct e1000_hw *hw, u16 offset,
386 u16 words __always_unused, u16 *data) 386 u16 words __always_unused, u16 *data)
387{ 387{
388 s32 ret_val = E1000_SUCCESS; 388 s32 ret_val = 0;
389 389
390 /* Only the MAC addr is required to be present in the iNVM */ 390 /* Only the MAC addr is required to be present in the iNVM */
391 switch (offset) { 391 switch (offset) {
@@ -395,42 +395,42 @@ static s32 igb_read_invm_i210(struct e1000_hw *hw, u16 offset,
395 &data[1]); 395 &data[1]);
396 ret_val |= igb_read_invm_word_i210(hw, (u8)offset+2, 396 ret_val |= igb_read_invm_word_i210(hw, (u8)offset+2,
397 &data[2]); 397 &data[2]);
398 if (ret_val != E1000_SUCCESS) 398 if (ret_val)
399 hw_dbg("MAC Addr not found in iNVM\n"); 399 hw_dbg("MAC Addr not found in iNVM\n");
400 break; 400 break;
401 case NVM_INIT_CTRL_2: 401 case NVM_INIT_CTRL_2:
402 ret_val = igb_read_invm_word_i210(hw, (u8)offset, data); 402 ret_val = igb_read_invm_word_i210(hw, (u8)offset, data);
403 if (ret_val != E1000_SUCCESS) { 403 if (ret_val) {
404 *data = NVM_INIT_CTRL_2_DEFAULT_I211; 404 *data = NVM_INIT_CTRL_2_DEFAULT_I211;
405 ret_val = E1000_SUCCESS; 405 ret_val = 0;
406 } 406 }
407 break; 407 break;
408 case NVM_INIT_CTRL_4: 408 case NVM_INIT_CTRL_4:
409 ret_val = igb_read_invm_word_i210(hw, (u8)offset, data); 409 ret_val = igb_read_invm_word_i210(hw, (u8)offset, data);
410 if (ret_val != E1000_SUCCESS) { 410 if (ret_val) {
411 *data = NVM_INIT_CTRL_4_DEFAULT_I211; 411 *data = NVM_INIT_CTRL_4_DEFAULT_I211;
412 ret_val = E1000_SUCCESS; 412 ret_val = 0;
413 } 413 }
414 break; 414 break;
415 case NVM_LED_1_CFG: 415 case NVM_LED_1_CFG:
416 ret_val = igb_read_invm_word_i210(hw, (u8)offset, data); 416 ret_val = igb_read_invm_word_i210(hw, (u8)offset, data);
417 if (ret_val != E1000_SUCCESS) { 417 if (ret_val) {
418 *data = NVM_LED_1_CFG_DEFAULT_I211; 418 *data = NVM_LED_1_CFG_DEFAULT_I211;
419 ret_val = E1000_SUCCESS; 419 ret_val = 0;
420 } 420 }
421 break; 421 break;
422 case NVM_LED_0_2_CFG: 422 case NVM_LED_0_2_CFG:
423 ret_val = igb_read_invm_word_i210(hw, (u8)offset, data); 423 ret_val = igb_read_invm_word_i210(hw, (u8)offset, data);
424 if (ret_val != E1000_SUCCESS) { 424 if (ret_val) {
425 *data = NVM_LED_0_2_CFG_DEFAULT_I211; 425 *data = NVM_LED_0_2_CFG_DEFAULT_I211;
426 ret_val = E1000_SUCCESS; 426 ret_val = 0;
427 } 427 }
428 break; 428 break;
429 case NVM_ID_LED_SETTINGS: 429 case NVM_ID_LED_SETTINGS:
430 ret_val = igb_read_invm_word_i210(hw, (u8)offset, data); 430 ret_val = igb_read_invm_word_i210(hw, (u8)offset, data);
431 if (ret_val != E1000_SUCCESS) { 431 if (ret_val) {
432 *data = ID_LED_RESERVED_FFFF; 432 *data = ID_LED_RESERVED_FFFF;
433 ret_val = E1000_SUCCESS; 433 ret_val = 0;
434 } 434 }
435 break; 435 break;
436 case NVM_SUB_DEV_ID: 436 case NVM_SUB_DEV_ID:
@@ -486,14 +486,14 @@ s32 igb_read_invm_version(struct e1000_hw *hw,
486 /* Check if we have first version location used */ 486 /* Check if we have first version location used */
487 if ((i == 1) && ((*record & E1000_INVM_VER_FIELD_ONE) == 0)) { 487 if ((i == 1) && ((*record & E1000_INVM_VER_FIELD_ONE) == 0)) {
488 version = 0; 488 version = 0;
489 status = E1000_SUCCESS; 489 status = 0;
490 break; 490 break;
491 } 491 }
492 /* Check if we have second version location used */ 492 /* Check if we have second version location used */
493 else if ((i == 1) && 493 else if ((i == 1) &&
494 ((*record & E1000_INVM_VER_FIELD_TWO) == 0)) { 494 ((*record & E1000_INVM_VER_FIELD_TWO) == 0)) {
495 version = (*record & E1000_INVM_VER_FIELD_ONE) >> 3; 495 version = (*record & E1000_INVM_VER_FIELD_ONE) >> 3;
496 status = E1000_SUCCESS; 496 status = 0;
497 break; 497 break;
498 } 498 }
499 /* Check if we have odd version location 499 /* Check if we have odd version location
@@ -504,7 +504,7 @@ s32 igb_read_invm_version(struct e1000_hw *hw,
504 (i != 1))) { 504 (i != 1))) {
505 version = (*next_record & E1000_INVM_VER_FIELD_TWO) 505 version = (*next_record & E1000_INVM_VER_FIELD_TWO)
506 >> 13; 506 >> 13;
507 status = E1000_SUCCESS; 507 status = 0;
508 break; 508 break;
509 } 509 }
510 /* Check if we have even version location 510 /* Check if we have even version location
@@ -513,12 +513,12 @@ s32 igb_read_invm_version(struct e1000_hw *hw,
513 else if (((*record & E1000_INVM_VER_FIELD_TWO) == 0) && 513 else if (((*record & E1000_INVM_VER_FIELD_TWO) == 0) &&
514 ((*record & 0x3) == 0)) { 514 ((*record & 0x3) == 0)) {
515 version = (*record & E1000_INVM_VER_FIELD_ONE) >> 3; 515 version = (*record & E1000_INVM_VER_FIELD_ONE) >> 3;
516 status = E1000_SUCCESS; 516 status = 0;
517 break; 517 break;
518 } 518 }
519 } 519 }
520 520
521 if (status == E1000_SUCCESS) { 521 if (!status) {
522 invm_ver->invm_major = (version & E1000_INVM_MAJOR_MASK) 522 invm_ver->invm_major = (version & E1000_INVM_MAJOR_MASK)
523 >> E1000_INVM_MAJOR_SHIFT; 523 >> E1000_INVM_MAJOR_SHIFT;
524 invm_ver->invm_minor = version & E1000_INVM_MINOR_MASK; 524 invm_ver->invm_minor = version & E1000_INVM_MINOR_MASK;
@@ -531,7 +531,7 @@ s32 igb_read_invm_version(struct e1000_hw *hw,
531 /* Check if we have image type in first location used */ 531 /* Check if we have image type in first location used */
532 if ((i == 1) && ((*record & E1000_INVM_IMGTYPE_FIELD) == 0)) { 532 if ((i == 1) && ((*record & E1000_INVM_IMGTYPE_FIELD) == 0)) {
533 invm_ver->invm_img_type = 0; 533 invm_ver->invm_img_type = 0;
534 status = E1000_SUCCESS; 534 status = 0;
535 break; 535 break;
536 } 536 }
537 /* Check if we have image type in first location used */ 537 /* Check if we have image type in first location used */
@@ -540,7 +540,7 @@ s32 igb_read_invm_version(struct e1000_hw *hw,
540 ((((*record & 0x3) != 0) && (i != 1)))) { 540 ((((*record & 0x3) != 0) && (i != 1)))) {
541 invm_ver->invm_img_type = 541 invm_ver->invm_img_type =
542 (*next_record & E1000_INVM_IMGTYPE_FIELD) >> 23; 542 (*next_record & E1000_INVM_IMGTYPE_FIELD) >> 23;
543 status = E1000_SUCCESS; 543 status = 0;
544 break; 544 break;
545 } 545 }
546 } 546 }
@@ -556,10 +556,10 @@ s32 igb_read_invm_version(struct e1000_hw *hw,
556 **/ 556 **/
557static s32 igb_validate_nvm_checksum_i210(struct e1000_hw *hw) 557static s32 igb_validate_nvm_checksum_i210(struct e1000_hw *hw)
558{ 558{
559 s32 status = E1000_SUCCESS; 559 s32 status = 0;
560 s32 (*read_op_ptr)(struct e1000_hw *, u16, u16, u16 *); 560 s32 (*read_op_ptr)(struct e1000_hw *, u16, u16, u16 *);
561 561
562 if (hw->nvm.ops.acquire(hw) == E1000_SUCCESS) { 562 if (!(hw->nvm.ops.acquire(hw))) {
563 563
564 /* Replace the read function with semaphore grabbing with 564 /* Replace the read function with semaphore grabbing with
565 * the one that skips this for a while. 565 * the one that skips this for a while.
@@ -591,7 +591,7 @@ static s32 igb_validate_nvm_checksum_i210(struct e1000_hw *hw)
591 **/ 591 **/
592static s32 igb_update_nvm_checksum_i210(struct e1000_hw *hw) 592static s32 igb_update_nvm_checksum_i210(struct e1000_hw *hw)
593{ 593{
594 s32 ret_val = E1000_SUCCESS; 594 s32 ret_val = 0;
595 u16 checksum = 0; 595 u16 checksum = 0;
596 u16 i, nvm_data; 596 u16 i, nvm_data;
597 597
@@ -600,12 +600,12 @@ static s32 igb_update_nvm_checksum_i210(struct e1000_hw *hw)
600 * EEPROM read fails 600 * EEPROM read fails
601 */ 601 */
602 ret_val = igb_read_nvm_eerd(hw, 0, 1, &nvm_data); 602 ret_val = igb_read_nvm_eerd(hw, 0, 1, &nvm_data);
603 if (ret_val != E1000_SUCCESS) { 603 if (ret_val) {
604 hw_dbg("EEPROM read failed\n"); 604 hw_dbg("EEPROM read failed\n");
605 goto out; 605 goto out;
606 } 606 }
607 607
608 if (hw->nvm.ops.acquire(hw) == E1000_SUCCESS) { 608 if (!(hw->nvm.ops.acquire(hw))) {
609 /* Do not use hw->nvm.ops.write, hw->nvm.ops.read 609 /* Do not use hw->nvm.ops.write, hw->nvm.ops.read
610 * because we do not want to take the synchronization 610 * because we do not want to take the synchronization
611 * semaphores twice here. 611 * semaphores twice here.
@@ -623,7 +623,7 @@ static s32 igb_update_nvm_checksum_i210(struct e1000_hw *hw)
623 checksum = (u16) NVM_SUM - checksum; 623 checksum = (u16) NVM_SUM - checksum;
624 ret_val = igb_write_nvm_srwr(hw, NVM_CHECKSUM_REG, 1, 624 ret_val = igb_write_nvm_srwr(hw, NVM_CHECKSUM_REG, 1,
625 &checksum); 625 &checksum);
626 if (ret_val != E1000_SUCCESS) { 626 if (ret_val) {
627 hw->nvm.ops.release(hw); 627 hw->nvm.ops.release(hw);
628 hw_dbg("NVM Write Error while updating checksum.\n"); 628 hw_dbg("NVM Write Error while updating checksum.\n");
629 goto out; 629 goto out;
@@ -652,7 +652,7 @@ static s32 igb_pool_flash_update_done_i210(struct e1000_hw *hw)
652 for (i = 0; i < E1000_FLUDONE_ATTEMPTS; i++) { 652 for (i = 0; i < E1000_FLUDONE_ATTEMPTS; i++) {
653 reg = rd32(E1000_EECD); 653 reg = rd32(E1000_EECD);
654 if (reg & E1000_EECD_FLUDONE_I210) { 654 if (reg & E1000_EECD_FLUDONE_I210) {
655 ret_val = E1000_SUCCESS; 655 ret_val = 0;
656 break; 656 break;
657 } 657 }
658 udelay(5); 658 udelay(5);
@@ -685,7 +685,7 @@ bool igb_get_flash_presence_i210(struct e1000_hw *hw)
685 **/ 685 **/
686static s32 igb_update_flash_i210(struct e1000_hw *hw) 686static s32 igb_update_flash_i210(struct e1000_hw *hw)
687{ 687{
688 s32 ret_val = E1000_SUCCESS; 688 s32 ret_val = 0;
689 u32 flup; 689 u32 flup;
690 690
691 ret_val = igb_pool_flash_update_done_i210(hw); 691 ret_val = igb_pool_flash_update_done_i210(hw);
@@ -698,7 +698,7 @@ static s32 igb_update_flash_i210(struct e1000_hw *hw)
698 wr32(E1000_EECD, flup); 698 wr32(E1000_EECD, flup);
699 699
700 ret_val = igb_pool_flash_update_done_i210(hw); 700 ret_val = igb_pool_flash_update_done_i210(hw);
701 if (ret_val == E1000_SUCCESS) 701 if (ret_val)
702 hw_dbg("Flash update complete\n"); 702 hw_dbg("Flash update complete\n");
703 else 703 else
704 hw_dbg("Flash update time out\n"); 704 hw_dbg("Flash update time out\n");
@@ -751,7 +751,7 @@ out:
751static s32 __igb_access_xmdio_reg(struct e1000_hw *hw, u16 address, 751static s32 __igb_access_xmdio_reg(struct e1000_hw *hw, u16 address,
752 u8 dev_addr, u16 *data, bool read) 752 u8 dev_addr, u16 *data, bool read)
753{ 753{
754 s32 ret_val = E1000_SUCCESS; 754 s32 ret_val = 0;
755 755
756 ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, dev_addr); 756 ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, dev_addr);
757 if (ret_val) 757 if (ret_val)
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index d3d2154ed9e1..c737d1f40838 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2738,7 +2738,7 @@ static int igb_get_module_info(struct net_device *netdev,
2738{ 2738{
2739 struct igb_adapter *adapter = netdev_priv(netdev); 2739 struct igb_adapter *adapter = netdev_priv(netdev);
2740 struct e1000_hw *hw = &adapter->hw; 2740 struct e1000_hw *hw = &adapter->hw;
2741 u32 status = E1000_SUCCESS; 2741 u32 status = 0;
2742 u16 sff8472_rev, addr_mode; 2742 u16 sff8472_rev, addr_mode;
2743 bool page_swap = false; 2743 bool page_swap = false;
2744 2744
@@ -2748,12 +2748,12 @@ static int igb_get_module_info(struct net_device *netdev,
2748 2748
2749 /* Check whether we support SFF-8472 or not */ 2749 /* Check whether we support SFF-8472 or not */
2750 status = igb_read_phy_reg_i2c(hw, IGB_SFF_8472_COMP, &sff8472_rev); 2750 status = igb_read_phy_reg_i2c(hw, IGB_SFF_8472_COMP, &sff8472_rev);
2751 if (status != E1000_SUCCESS) 2751 if (status)
2752 return -EIO; 2752 return -EIO;
2753 2753
2754 /* addressing mode is not supported */ 2754 /* addressing mode is not supported */
2755 status = igb_read_phy_reg_i2c(hw, IGB_SFF_8472_SWAP, &addr_mode); 2755 status = igb_read_phy_reg_i2c(hw, IGB_SFF_8472_SWAP, &addr_mode);
2756 if (status != E1000_SUCCESS) 2756 if (status)
2757 return -EIO; 2757 return -EIO;
2758 2758
2759 /* addressing mode is not supported */ 2759 /* addressing mode is not supported */
@@ -2780,7 +2780,7 @@ static int igb_get_module_eeprom(struct net_device *netdev,
2780{ 2780{
2781 struct igb_adapter *adapter = netdev_priv(netdev); 2781 struct igb_adapter *adapter = netdev_priv(netdev);
2782 struct e1000_hw *hw = &adapter->hw; 2782 struct e1000_hw *hw = &adapter->hw;
2783 u32 status = E1000_SUCCESS; 2783 u32 status = 0;
2784 u16 *dataword; 2784 u16 *dataword;
2785 u16 first_word, last_word; 2785 u16 first_word, last_word;
2786 int i = 0; 2786 int i = 0;
@@ -2799,7 +2799,7 @@ static int igb_get_module_eeprom(struct net_device *netdev,
2799 /* Read EEPROM block, SFF-8079/SFF-8472, word at a time */ 2799 /* Read EEPROM block, SFF-8079/SFF-8472, word at a time */
2800 for (i = 0; i < last_word - first_word + 1; i++) { 2800 for (i = 0; i < last_word - first_word + 1; i++) {
2801 status = igb_read_phy_reg_i2c(hw, first_word + i, &dataword[i]); 2801 status = igb_read_phy_reg_i2c(hw, first_word + i, &dataword[i]);
2802 if (status != E1000_SUCCESS) { 2802 if (status) {
2803 /* Error occurred while reading module */ 2803 /* Error occurred while reading module */
2804 kfree(dataword); 2804 kfree(dataword);
2805 return -EIO; 2805 return -EIO;
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 33b3a16dabe1..f145adbb55ac 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2199,11 +2199,11 @@ static void igb_init_mas(struct igb_adapter *adapter)
2199 **/ 2199 **/
2200static s32 igb_init_i2c(struct igb_adapter *adapter) 2200static s32 igb_init_i2c(struct igb_adapter *adapter)
2201{ 2201{
2202 s32 status = E1000_SUCCESS; 2202 s32 status = 0;
2203 2203
2204 /* I2C interface supported on i350 devices */ 2204 /* I2C interface supported on i350 devices */
2205 if (adapter->hw.mac.type != e1000_i350) 2205 if (adapter->hw.mac.type != e1000_i350)
2206 return E1000_SUCCESS; 2206 return 0;
2207 2207
2208 /* Initialize the i2c bus which is controlled by the registers. 2208 /* Initialize the i2c bus which is controlled by the registers.
2209 * This bus will use the i2c_algo_bit structue that implements 2209 * This bus will use the i2c_algo_bit structue that implements
@@ -7935,7 +7935,7 @@ static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf,
7935 wr32(reg_offset, reg_val); 7935 wr32(reg_offset, reg_val);
7936 7936
7937 adapter->vf_data[vf].spoofchk_enabled = setting; 7937 adapter->vf_data[vf].spoofchk_enabled = setting;
7938 return E1000_SUCCESS; 7938 return 0;
7939} 7939}
7940 7940
7941static int igb_ndo_get_vf_config(struct net_device *netdev, 7941static int igb_ndo_get_vf_config(struct net_device *netdev,
@@ -8097,8 +8097,7 @@ s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset,
8097 8097
8098 swfw_mask = E1000_SWFW_PHY0_SM; 8098 swfw_mask = E1000_SWFW_PHY0_SM;
8099 8099
8100 if (hw->mac.ops.acquire_swfw_sync(hw, swfw_mask) 8100 if (hw->mac.ops.acquire_swfw_sync(hw, swfw_mask))
8101 != E1000_SUCCESS)
8102 return E1000_ERR_SWFW_SYNC; 8101 return E1000_ERR_SWFW_SYNC;
8103 8102
8104 status = i2c_smbus_read_byte_data(this_client, byte_offset); 8103 status = i2c_smbus_read_byte_data(this_client, byte_offset);
@@ -8108,7 +8107,7 @@ s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset,
8108 return E1000_ERR_I2C; 8107 return E1000_ERR_I2C;
8109 else { 8108 else {
8110 *data = status; 8109 *data = status;
8111 return E1000_SUCCESS; 8110 return 0;
8112 } 8111 }
8113} 8112}
8114 8113
@@ -8133,7 +8132,7 @@ s32 igb_write_i2c_byte(struct e1000_hw *hw, u8 byte_offset,
8133 if (!this_client) 8132 if (!this_client)
8134 return E1000_ERR_I2C; 8133 return E1000_ERR_I2C;
8135 8134
8136 if (hw->mac.ops.acquire_swfw_sync(hw, swfw_mask) != E1000_SUCCESS) 8135 if (hw->mac.ops.acquire_swfw_sync(hw, swfw_mask))
8137 return E1000_ERR_SWFW_SYNC; 8136 return E1000_ERR_SWFW_SYNC;
8138 status = i2c_smbus_write_byte_data(this_client, byte_offset, data); 8137 status = i2c_smbus_write_byte_data(this_client, byte_offset, data);
8139 hw->mac.ops.release_swfw_sync(hw, swfw_mask); 8138 hw->mac.ops.release_swfw_sync(hw, swfw_mask);
@@ -8141,7 +8140,7 @@ s32 igb_write_i2c_byte(struct e1000_hw *hw, u8 byte_offset,
8141 if (status) 8140 if (status)
8142 return E1000_ERR_I2C; 8141 return E1000_ERR_I2C;
8143 else 8142 else
8144 return E1000_SUCCESS; 8143 return 0;
8145 8144
8146} 8145}
8147 8146
diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
index e291be20dc98..794c139f0cc0 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -559,10 +559,11 @@ int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr)
559 return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ? 559 return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ?
560 -EFAULT : 0; 560 -EFAULT : 0;
561} 561}
562
562/** 563/**
563 * igb_ptp_set_ts_config - control hardware time stamping 564 * igb_ptp_set_timestamp_mode - setup hardware for timestamping
564 * @netdev: 565 * @adapter: networking device structure
565 * @ifreq: 566 * @config: hwtstamp configuration
566 * 567 *
567 * Outgoing time stamping can be enabled and disabled. Play nice and 568 * Outgoing time stamping can be enabled and disabled. Play nice and
568 * disable it when requested, although it shouldn't case any overhead 569 * disable it when requested, although it shouldn't case any overhead
@@ -575,12 +576,11 @@ int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr)
575 * type has to be specified. Matching the kind of event packet is 576 * type has to be specified. Matching the kind of event packet is
576 * not supported, with the exception of "all V2 events regardless of 577 * not supported, with the exception of "all V2 events regardless of
577 * level 2 or 4". 578 * level 2 or 4".
578 **/ 579 */
579int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr) 580static int igb_ptp_set_timestamp_mode(struct igb_adapter *adapter,
581 struct hwtstamp_config *config)
580{ 582{
581 struct igb_adapter *adapter = netdev_priv(netdev);
582 struct e1000_hw *hw = &adapter->hw; 583 struct e1000_hw *hw = &adapter->hw;
583 struct hwtstamp_config *config = &adapter->tstamp_config;
584 u32 tsync_tx_ctl = E1000_TSYNCTXCTL_ENABLED; 584 u32 tsync_tx_ctl = E1000_TSYNCTXCTL_ENABLED;
585 u32 tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED; 585 u32 tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED;
586 u32 tsync_rx_cfg = 0; 586 u32 tsync_rx_cfg = 0;
@@ -588,9 +588,6 @@ int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr)
588 bool is_l2 = false; 588 bool is_l2 = false;
589 u32 regval; 589 u32 regval;
590 590
591 if (copy_from_user(config, ifr->ifr_data, sizeof(*config)))
592 return -EFAULT;
593
594 /* reserved for future extensions */ 591 /* reserved for future extensions */
595 if (config->flags) 592 if (config->flags)
596 return -EINVAL; 593 return -EINVAL;
@@ -725,7 +722,33 @@ int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr)
725 regval = rd32(E1000_RXSTMPL); 722 regval = rd32(E1000_RXSTMPL);
726 regval = rd32(E1000_RXSTMPH); 723 regval = rd32(E1000_RXSTMPH);
727 724
728 return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ? 725 return 0;
726}
727
728/**
729 * igb_ptp_set_ts_config - set hardware time stamping config
730 * @netdev:
731 * @ifreq:
732 *
733 **/
734int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr)
735{
736 struct igb_adapter *adapter = netdev_priv(netdev);
737 struct hwtstamp_config config;
738 int err;
739
740 if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
741 return -EFAULT;
742
743 err = igb_ptp_set_timestamp_mode(adapter, &config);
744 if (err)
745 return err;
746
747 /* save these settings for future reference */
748 memcpy(&adapter->tstamp_config, &config,
749 sizeof(adapter->tstamp_config));
750
751 return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
729 -EFAULT : 0; 752 -EFAULT : 0;
730} 753}
731 754
@@ -820,6 +843,9 @@ void igb_ptp_init(struct igb_adapter *adapter)
820 wr32(E1000_IMS, E1000_IMS_TS); 843 wr32(E1000_IMS, E1000_IMS_TS);
821 } 844 }
822 845
846 adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE;
847 adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF;
848
823 adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps, 849 adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps,
824 &adapter->pdev->dev); 850 &adapter->pdev->dev);
825 if (IS_ERR(adapter->ptp_clock)) { 851 if (IS_ERR(adapter->ptp_clock)) {
@@ -884,7 +910,7 @@ void igb_ptp_reset(struct igb_adapter *adapter)
884 return; 910 return;
885 911
886 /* reset the tstamp_config */ 912 /* reset the tstamp_config */
887 memset(&adapter->tstamp_config, 0, sizeof(adapter->tstamp_config)); 913 igb_ptp_set_timestamp_mode(adapter, &adapter->tstamp_config);
888 914
889 switch (adapter->hw.mac.type) { 915 switch (adapter->hw.mac.type) {
890 case e1000_82576: 916 case e1000_82576: