aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/intel/e1000e/80003es2lan.c1
-rw-r--r--drivers/net/ethernet/intel/e1000e/82571.c5
-rw-r--r--drivers/net/ethernet/intel/e1000e/e1000.h3
-rw-r--r--drivers/net/ethernet/intel/e1000e/ethtool.c88
-rw-r--r--drivers/net/ethernet/intel/e1000e/ich8lan.c5
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c49
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe.h7
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c202
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ethtool.c46
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ixgbevf.h8
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c81
11 files changed, 175 insertions, 320 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/80003es2lan.c b/drivers/net/ethernet/intel/e1000e/80003es2lan.c
index e4f42257c24c..b7544336cef4 100644
--- a/drivers/net/ethernet/intel/e1000e/80003es2lan.c
+++ b/drivers/net/ethernet/intel/e1000e/80003es2lan.c
@@ -1498,7 +1498,6 @@ struct e1000_info e1000_es2_info = {
1498 | FLAG_HAS_JUMBO_FRAMES 1498 | FLAG_HAS_JUMBO_FRAMES
1499 | FLAG_HAS_WOL 1499 | FLAG_HAS_WOL
1500 | FLAG_APME_IN_CTRL3 1500 | FLAG_APME_IN_CTRL3
1501 | FLAG_RX_CSUM_ENABLED
1502 | FLAG_HAS_CTRLEXT_ON_LOAD 1501 | FLAG_HAS_CTRLEXT_ON_LOAD
1503 | FLAG_RX_NEEDS_RESTART /* errata */ 1502 | FLAG_RX_NEEDS_RESTART /* errata */
1504 | FLAG_TARC_SET_BIT_ZERO /* errata */ 1503 | FLAG_TARC_SET_BIT_ZERO /* errata */
diff --git a/drivers/net/ethernet/intel/e1000e/82571.c b/drivers/net/ethernet/intel/e1000e/82571.c
index 536b3a55c45f..2d4dc53a4fb8 100644
--- a/drivers/net/ethernet/intel/e1000e/82571.c
+++ b/drivers/net/ethernet/intel/e1000e/82571.c
@@ -2019,7 +2019,6 @@ struct e1000_info e1000_82571_info = {
2019 | FLAG_HAS_JUMBO_FRAMES 2019 | FLAG_HAS_JUMBO_FRAMES
2020 | FLAG_HAS_WOL 2020 | FLAG_HAS_WOL
2021 | FLAG_APME_IN_CTRL3 2021 | FLAG_APME_IN_CTRL3
2022 | FLAG_RX_CSUM_ENABLED
2023 | FLAG_HAS_CTRLEXT_ON_LOAD 2022 | FLAG_HAS_CTRLEXT_ON_LOAD
2024 | FLAG_HAS_SMART_POWER_DOWN 2023 | FLAG_HAS_SMART_POWER_DOWN
2025 | FLAG_RESET_OVERWRITES_LAA /* errata */ 2024 | FLAG_RESET_OVERWRITES_LAA /* errata */
@@ -2041,7 +2040,6 @@ struct e1000_info e1000_82572_info = {
2041 | FLAG_HAS_JUMBO_FRAMES 2040 | FLAG_HAS_JUMBO_FRAMES
2042 | FLAG_HAS_WOL 2041 | FLAG_HAS_WOL
2043 | FLAG_APME_IN_CTRL3 2042 | FLAG_APME_IN_CTRL3
2044 | FLAG_RX_CSUM_ENABLED
2045 | FLAG_HAS_CTRLEXT_ON_LOAD 2043 | FLAG_HAS_CTRLEXT_ON_LOAD
2046 | FLAG_TARC_SPEED_MODE_BIT, /* errata */ 2044 | FLAG_TARC_SPEED_MODE_BIT, /* errata */
2047 .flags2 = FLAG2_DISABLE_ASPM_L1 /* errata 13 */ 2045 .flags2 = FLAG2_DISABLE_ASPM_L1 /* errata 13 */
@@ -2059,7 +2057,6 @@ struct e1000_info e1000_82573_info = {
2059 .flags = FLAG_HAS_HW_VLAN_FILTER 2057 .flags = FLAG_HAS_HW_VLAN_FILTER
2060 | FLAG_HAS_WOL 2058 | FLAG_HAS_WOL
2061 | FLAG_APME_IN_CTRL3 2059 | FLAG_APME_IN_CTRL3
2062 | FLAG_RX_CSUM_ENABLED
2063 | FLAG_HAS_SMART_POWER_DOWN 2060 | FLAG_HAS_SMART_POWER_DOWN
2064 | FLAG_HAS_AMT 2061 | FLAG_HAS_AMT
2065 | FLAG_HAS_SWSM_ON_LOAD, 2062 | FLAG_HAS_SWSM_ON_LOAD,
@@ -2080,7 +2077,6 @@ struct e1000_info e1000_82574_info = {
2080 | FLAG_HAS_JUMBO_FRAMES 2077 | FLAG_HAS_JUMBO_FRAMES
2081 | FLAG_HAS_WOL 2078 | FLAG_HAS_WOL
2082 | FLAG_APME_IN_CTRL3 2079 | FLAG_APME_IN_CTRL3
2083 | FLAG_RX_CSUM_ENABLED
2084 | FLAG_HAS_SMART_POWER_DOWN 2080 | FLAG_HAS_SMART_POWER_DOWN
2085 | FLAG_HAS_AMT 2081 | FLAG_HAS_AMT
2086 | FLAG_HAS_CTRLEXT_ON_LOAD, 2082 | FLAG_HAS_CTRLEXT_ON_LOAD,
@@ -2100,7 +2096,6 @@ struct e1000_info e1000_82583_info = {
2100 .flags = FLAG_HAS_HW_VLAN_FILTER 2096 .flags = FLAG_HAS_HW_VLAN_FILTER
2101 | FLAG_HAS_WOL 2097 | FLAG_HAS_WOL
2102 | FLAG_APME_IN_CTRL3 2098 | FLAG_APME_IN_CTRL3
2103 | FLAG_RX_CSUM_ENABLED
2104 | FLAG_HAS_SMART_POWER_DOWN 2099 | FLAG_HAS_SMART_POWER_DOWN
2105 | FLAG_HAS_AMT 2100 | FLAG_HAS_AMT
2106 | FLAG_HAS_JUMBO_FRAMES 2101 | FLAG_HAS_JUMBO_FRAMES
diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h
index fa72052a0031..1b15d1ff583c 100644
--- a/drivers/net/ethernet/intel/e1000e/e1000.h
+++ b/drivers/net/ethernet/intel/e1000e/e1000.h
@@ -440,12 +440,11 @@ struct e1000_info {
440#define FLAG_LSC_GIG_SPEED_DROP (1 << 25) 440#define FLAG_LSC_GIG_SPEED_DROP (1 << 25)
441#define FLAG_SMART_POWER_DOWN (1 << 26) 441#define FLAG_SMART_POWER_DOWN (1 << 26)
442#define FLAG_MSI_ENABLED (1 << 27) 442#define FLAG_MSI_ENABLED (1 << 27)
443#define FLAG_RX_CSUM_ENABLED (1 << 28) 443/* reserved (1 << 28) */
444#define FLAG_TSO_FORCE (1 << 29) 444#define FLAG_TSO_FORCE (1 << 29)
445#define FLAG_RX_RESTART_NOW (1 << 30) 445#define FLAG_RX_RESTART_NOW (1 << 30)
446#define FLAG_MSI_TEST_FAILED (1 << 31) 446#define FLAG_MSI_TEST_FAILED (1 << 31)
447 447
448/* CRC Stripping defines */
449#define FLAG2_CRC_STRIPPING (1 << 0) 448#define FLAG2_CRC_STRIPPING (1 << 0)
450#define FLAG2_HAS_PHY_WAKEUP (1 << 1) 449#define FLAG2_HAS_PHY_WAKEUP (1 << 1)
451#define FLAG2_IS_DISCARDING (1 << 2) 450#define FLAG2_IS_DISCARDING (1 << 2)
diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c
index e0cbd6a0bde8..d96d0b0e08cf 100644
--- a/drivers/net/ethernet/intel/e1000e/ethtool.c
+++ b/drivers/net/ethernet/intel/e1000e/ethtool.c
@@ -367,59 +367,6 @@ out:
367 return retval; 367 return retval;
368} 368}
369 369
370static u32 e1000_get_rx_csum(struct net_device *netdev)
371{
372 struct e1000_adapter *adapter = netdev_priv(netdev);
373 return adapter->flags & FLAG_RX_CSUM_ENABLED;
374}
375
376static int e1000_set_rx_csum(struct net_device *netdev, u32 data)
377{
378 struct e1000_adapter *adapter = netdev_priv(netdev);
379
380 if (data)
381 adapter->flags |= FLAG_RX_CSUM_ENABLED;
382 else
383 adapter->flags &= ~FLAG_RX_CSUM_ENABLED;
384
385 if (netif_running(netdev))
386 e1000e_reinit_locked(adapter);
387 else
388 e1000e_reset(adapter);
389 return 0;
390}
391
392static u32 e1000_get_tx_csum(struct net_device *netdev)
393{
394 return (netdev->features & NETIF_F_HW_CSUM) != 0;
395}
396
397static int e1000_set_tx_csum(struct net_device *netdev, u32 data)
398{
399 if (data)
400 netdev->features |= NETIF_F_HW_CSUM;
401 else
402 netdev->features &= ~NETIF_F_HW_CSUM;
403
404 return 0;
405}
406
407static int e1000_set_tso(struct net_device *netdev, u32 data)
408{
409 struct e1000_adapter *adapter = netdev_priv(netdev);
410
411 if (data) {
412 netdev->features |= NETIF_F_TSO;
413 netdev->features |= NETIF_F_TSO6;
414 } else {
415 netdev->features &= ~NETIF_F_TSO;
416 netdev->features &= ~NETIF_F_TSO6;
417 }
418
419 adapter->flags |= FLAG_TSO_FORCE;
420 return 0;
421}
422
423static u32 e1000_get_msglevel(struct net_device *netdev) 370static u32 e1000_get_msglevel(struct net_device *netdev)
424{ 371{
425 struct e1000_adapter *adapter = netdev_priv(netdev); 372 struct e1000_adapter *adapter = netdev_priv(netdev);
@@ -2014,31 +1961,6 @@ static void e1000_get_strings(struct net_device *netdev, u32 stringset,
2014 } 1961 }
2015} 1962}
2016 1963
2017static int e1000e_set_flags(struct net_device *netdev, u32 data)
2018{
2019 struct e1000_adapter *adapter = netdev_priv(netdev);
2020 bool need_reset = false;
2021 int rc;
2022
2023 need_reset = (data & ETH_FLAG_RXVLAN) !=
2024 (netdev->features & NETIF_F_HW_VLAN_RX);
2025
2026 rc = ethtool_op_set_flags(netdev, data, ETH_FLAG_RXVLAN |
2027 ETH_FLAG_TXVLAN);
2028
2029 if (rc)
2030 return rc;
2031
2032 if (need_reset) {
2033 if (netif_running(netdev))
2034 e1000e_reinit_locked(adapter);
2035 else
2036 e1000e_reset(adapter);
2037 }
2038
2039 return 0;
2040}
2041
2042static const struct ethtool_ops e1000_ethtool_ops = { 1964static const struct ethtool_ops e1000_ethtool_ops = {
2043 .get_settings = e1000_get_settings, 1965 .get_settings = e1000_get_settings,
2044 .set_settings = e1000_set_settings, 1966 .set_settings = e1000_set_settings,
@@ -2058,14 +1980,6 @@ static const struct ethtool_ops e1000_ethtool_ops = {
2058 .set_ringparam = e1000_set_ringparam, 1980 .set_ringparam = e1000_set_ringparam,
2059 .get_pauseparam = e1000_get_pauseparam, 1981 .get_pauseparam = e1000_get_pauseparam,
2060 .set_pauseparam = e1000_set_pauseparam, 1982 .set_pauseparam = e1000_set_pauseparam,
2061 .get_rx_csum = e1000_get_rx_csum,
2062 .set_rx_csum = e1000_set_rx_csum,
2063 .get_tx_csum = e1000_get_tx_csum,
2064 .set_tx_csum = e1000_set_tx_csum,
2065 .get_sg = ethtool_op_get_sg,
2066 .set_sg = ethtool_op_set_sg,
2067 .get_tso = ethtool_op_get_tso,
2068 .set_tso = e1000_set_tso,
2069 .self_test = e1000_diag_test, 1983 .self_test = e1000_diag_test,
2070 .get_strings = e1000_get_strings, 1984 .get_strings = e1000_get_strings,
2071 .set_phys_id = e1000_set_phys_id, 1985 .set_phys_id = e1000_set_phys_id,
@@ -2073,8 +1987,6 @@ static const struct ethtool_ops e1000_ethtool_ops = {
2073 .get_sset_count = e1000e_get_sset_count, 1987 .get_sset_count = e1000e_get_sset_count,
2074 .get_coalesce = e1000_get_coalesce, 1988 .get_coalesce = e1000_get_coalesce,
2075 .set_coalesce = e1000_set_coalesce, 1989 .set_coalesce = e1000_set_coalesce,
2076 .get_flags = ethtool_op_get_flags,
2077 .set_flags = e1000e_set_flags,
2078}; 1990};
2079 1991
2080void e1000e_set_ethtool_ops(struct net_device *netdev) 1992void e1000e_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index 54add27c8f76..3fc3acce9950 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -4058,7 +4058,6 @@ struct e1000_info e1000_ich8_info = {
4058 .mac = e1000_ich8lan, 4058 .mac = e1000_ich8lan,
4059 .flags = FLAG_HAS_WOL 4059 .flags = FLAG_HAS_WOL
4060 | FLAG_IS_ICH 4060 | FLAG_IS_ICH
4061 | FLAG_RX_CSUM_ENABLED
4062 | FLAG_HAS_CTRLEXT_ON_LOAD 4061 | FLAG_HAS_CTRLEXT_ON_LOAD
4063 | FLAG_HAS_AMT 4062 | FLAG_HAS_AMT
4064 | FLAG_HAS_FLASH 4063 | FLAG_HAS_FLASH
@@ -4076,7 +4075,6 @@ struct e1000_info e1000_ich9_info = {
4076 .flags = FLAG_HAS_JUMBO_FRAMES 4075 .flags = FLAG_HAS_JUMBO_FRAMES
4077 | FLAG_IS_ICH 4076 | FLAG_IS_ICH
4078 | FLAG_HAS_WOL 4077 | FLAG_HAS_WOL
4079 | FLAG_RX_CSUM_ENABLED
4080 | FLAG_HAS_CTRLEXT_ON_LOAD 4078 | FLAG_HAS_CTRLEXT_ON_LOAD
4081 | FLAG_HAS_AMT 4079 | FLAG_HAS_AMT
4082 | FLAG_HAS_ERT 4080 | FLAG_HAS_ERT
@@ -4095,7 +4093,6 @@ struct e1000_info e1000_ich10_info = {
4095 .flags = FLAG_HAS_JUMBO_FRAMES 4093 .flags = FLAG_HAS_JUMBO_FRAMES
4096 | FLAG_IS_ICH 4094 | FLAG_IS_ICH
4097 | FLAG_HAS_WOL 4095 | FLAG_HAS_WOL
4098 | FLAG_RX_CSUM_ENABLED
4099 | FLAG_HAS_CTRLEXT_ON_LOAD 4096 | FLAG_HAS_CTRLEXT_ON_LOAD
4100 | FLAG_HAS_AMT 4097 | FLAG_HAS_AMT
4101 | FLAG_HAS_ERT 4098 | FLAG_HAS_ERT
@@ -4113,7 +4110,6 @@ struct e1000_info e1000_pch_info = {
4113 .mac = e1000_pchlan, 4110 .mac = e1000_pchlan,
4114 .flags = FLAG_IS_ICH 4111 .flags = FLAG_IS_ICH
4115 | FLAG_HAS_WOL 4112 | FLAG_HAS_WOL
4116 | FLAG_RX_CSUM_ENABLED
4117 | FLAG_HAS_CTRLEXT_ON_LOAD 4113 | FLAG_HAS_CTRLEXT_ON_LOAD
4118 | FLAG_HAS_AMT 4114 | FLAG_HAS_AMT
4119 | FLAG_HAS_FLASH 4115 | FLAG_HAS_FLASH
@@ -4133,7 +4129,6 @@ struct e1000_info e1000_pch2_info = {
4133 .mac = e1000_pch2lan, 4129 .mac = e1000_pch2lan,
4134 .flags = FLAG_IS_ICH 4130 .flags = FLAG_IS_ICH
4135 | FLAG_HAS_WOL 4131 | FLAG_HAS_WOL
4136 | FLAG_RX_CSUM_ENABLED
4137 | FLAG_HAS_CTRLEXT_ON_LOAD 4132 | FLAG_HAS_CTRLEXT_ON_LOAD
4138 | FLAG_HAS_AMT 4133 | FLAG_HAS_AMT
4139 | FLAG_HAS_FLASH 4134 | FLAG_HAS_FLASH
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 9742bc603cad..4f669995623f 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -3069,7 +3069,7 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
3069 3069
3070 /* Enable Receive Checksum Offload for TCP and UDP */ 3070 /* Enable Receive Checksum Offload for TCP and UDP */
3071 rxcsum = er32(RXCSUM); 3071 rxcsum = er32(RXCSUM);
3072 if (adapter->flags & FLAG_RX_CSUM_ENABLED) { 3072 if (adapter->netdev->features & NETIF_F_RXCSUM) {
3073 rxcsum |= E1000_RXCSUM_TUOFL; 3073 rxcsum |= E1000_RXCSUM_TUOFL;
3074 3074
3075 /* 3075 /*
@@ -5860,6 +5860,26 @@ static void e1000_eeprom_checks(struct e1000_adapter *adapter)
5860 } 5860 }
5861} 5861}
5862 5862
5863static int e1000_set_features(struct net_device *netdev, u32 features)
5864{
5865 struct e1000_adapter *adapter = netdev_priv(netdev);
5866 u32 changed = features ^ netdev->features;
5867
5868 if (changed & (NETIF_F_TSO | NETIF_F_TSO6))
5869 adapter->flags |= FLAG_TSO_FORCE;
5870
5871 if (!(changed & (NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX |
5872 NETIF_F_RXCSUM)))
5873 return 0;
5874
5875 if (netif_running(netdev))
5876 e1000e_reinit_locked(adapter);
5877 else
5878 e1000e_reset(adapter);
5879
5880 return 0;
5881}
5882
5863static const struct net_device_ops e1000e_netdev_ops = { 5883static const struct net_device_ops e1000e_netdev_ops = {
5864 .ndo_open = e1000_open, 5884 .ndo_open = e1000_open,
5865 .ndo_stop = e1000_close, 5885 .ndo_stop = e1000_close,
@@ -5877,6 +5897,7 @@ static const struct net_device_ops e1000e_netdev_ops = {
5877#ifdef CONFIG_NET_POLL_CONTROLLER 5897#ifdef CONFIG_NET_POLL_CONTROLLER
5878 .ndo_poll_controller = e1000_netpoll, 5898 .ndo_poll_controller = e1000_netpoll,
5879#endif 5899#endif
5900 .ndo_set_features = e1000_set_features,
5880}; 5901};
5881 5902
5882/** 5903/**
@@ -6036,21 +6057,25 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
6036 if (e1000_check_reset_block(&adapter->hw)) 6057 if (e1000_check_reset_block(&adapter->hw))
6037 e_info("PHY reset is blocked due to SOL/IDER session.\n"); 6058 e_info("PHY reset is blocked due to SOL/IDER session.\n");
6038 6059
6039 netdev->features = NETIF_F_SG | 6060 /* Set initial default active device features */
6040 NETIF_F_HW_CSUM | 6061 netdev->features = (NETIF_F_SG |
6041 NETIF_F_HW_VLAN_TX | 6062 NETIF_F_HW_VLAN_RX |
6042 NETIF_F_HW_VLAN_RX; 6063 NETIF_F_HW_VLAN_TX |
6064 NETIF_F_TSO |
6065 NETIF_F_TSO6 |
6066 NETIF_F_RXCSUM |
6067 NETIF_F_HW_CSUM);
6068
6069 /* Set user-changeable features (subset of all device features) */
6070 netdev->hw_features = netdev->features;
6043 6071
6044 if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) 6072 if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER)
6045 netdev->features |= NETIF_F_HW_VLAN_FILTER; 6073 netdev->features |= NETIF_F_HW_VLAN_FILTER;
6046 6074
6047 netdev->features |= NETIF_F_TSO; 6075 netdev->vlan_features |= (NETIF_F_SG |
6048 netdev->features |= NETIF_F_TSO6; 6076 NETIF_F_TSO |
6049 6077 NETIF_F_TSO6 |
6050 netdev->vlan_features |= NETIF_F_TSO; 6078 NETIF_F_HW_CSUM);
6051 netdev->vlan_features |= NETIF_F_TSO6;
6052 netdev->vlan_features |= NETIF_F_HW_CSUM;
6053 netdev->vlan_features |= NETIF_F_SG;
6054 6079
6055 if (pci_using_dac) { 6080 if (pci_using_dac) {
6056 netdev->features |= NETIF_F_HIGHDMA; 6081 netdev->features |= NETIF_F_HIGHDMA;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 378ce46a7f92..dc3b12e15331 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -209,6 +209,7 @@ enum ixbge_ring_state_t {
209#define clear_ring_rsc_enabled(ring) \ 209#define clear_ring_rsc_enabled(ring) \
210 clear_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state) 210 clear_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state)
211struct ixgbe_ring { 211struct ixgbe_ring {
212 struct ixgbe_ring *next; /* pointer to next ring in q_vector */
212 void *desc; /* descriptor ring memory */ 213 void *desc; /* descriptor ring memory */
213 struct device *dev; /* device for DMA mapping */ 214 struct device *dev; /* device for DMA mapping */
214 struct net_device *netdev; /* netdev ring belongs to */ 215 struct net_device *netdev; /* netdev ring belongs to */
@@ -277,11 +278,7 @@ struct ixgbe_ring_feature {
277} ____cacheline_internodealigned_in_smp; 278} ____cacheline_internodealigned_in_smp;
278 279
279struct ixgbe_ring_container { 280struct ixgbe_ring_container {
280#if MAX_RX_QUEUES > MAX_TX_QUEUES 281 struct ixgbe_ring *ring; /* pointer to linked list of rings */
281 DECLARE_BITMAP(idx, MAX_RX_QUEUES);
282#else
283 DECLARE_BITMAP(idx, MAX_TX_QUEUES);
284#endif
285 unsigned int total_bytes; /* total bytes processed this int */ 282 unsigned int total_bytes; /* total bytes processed this int */
286 unsigned int total_packets; /* total packets processed this int */ 283 unsigned int total_packets; /* total packets processed this int */
287 u16 work_limit; /* total work allowed per interrupt */ 284 u16 work_limit; /* total work allowed per interrupt */
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index e8aad76fa530..bb54d3d28419 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -804,13 +804,13 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
804 struct ixgbe_tx_buffer *tx_buffer; 804 struct ixgbe_tx_buffer *tx_buffer;
805 union ixgbe_adv_tx_desc *tx_desc; 805 union ixgbe_adv_tx_desc *tx_desc;
806 unsigned int total_bytes = 0, total_packets = 0; 806 unsigned int total_bytes = 0, total_packets = 0;
807 u16 budget = q_vector->tx.work_limit;
807 u16 i = tx_ring->next_to_clean; 808 u16 i = tx_ring->next_to_clean;
808 u16 count;
809 809
810 tx_buffer = &tx_ring->tx_buffer_info[i]; 810 tx_buffer = &tx_ring->tx_buffer_info[i];
811 tx_desc = IXGBE_TX_DESC_ADV(tx_ring, i); 811 tx_desc = IXGBE_TX_DESC_ADV(tx_ring, i);
812 812
813 for (count = 0; count < q_vector->tx.work_limit; count++) { 813 for (; budget; budget--) {
814 union ixgbe_adv_tx_desc *eop_desc = tx_buffer->next_to_watch; 814 union ixgbe_adv_tx_desc *eop_desc = tx_buffer->next_to_watch;
815 815
816 /* if next_to_watch is not set then there is no work pending */ 816 /* if next_to_watch is not set then there is no work pending */
@@ -891,11 +891,11 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
891 ixgbe_tx_timeout_reset(adapter); 891 ixgbe_tx_timeout_reset(adapter);
892 892
893 /* the adapter is about to reset, no point in enabling stuff */ 893 /* the adapter is about to reset, no point in enabling stuff */
894 return true; 894 return budget;
895 } 895 }
896 896
897#define TX_WAKE_THRESHOLD (DESC_NEEDED * 2) 897#define TX_WAKE_THRESHOLD (DESC_NEEDED * 2)
898 if (unlikely(count && netif_carrier_ok(tx_ring->netdev) && 898 if (unlikely(total_packets && netif_carrier_ok(tx_ring->netdev) &&
899 (ixgbe_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD))) { 899 (ixgbe_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD))) {
900 /* Make sure that anybody stopping the queue after this 900 /* Make sure that anybody stopping the queue after this
901 * sees the new next_to_clean. 901 * sees the new next_to_clean.
@@ -908,7 +908,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
908 } 908 }
909 } 909 }
910 910
911 return count < q_vector->tx.work_limit; 911 return budget;
912} 912}
913 913
914#ifdef CONFIG_IXGBE_DCA 914#ifdef CONFIG_IXGBE_DCA
@@ -974,26 +974,17 @@ static void ixgbe_update_tx_dca(struct ixgbe_adapter *adapter,
974static void ixgbe_update_dca(struct ixgbe_q_vector *q_vector) 974static void ixgbe_update_dca(struct ixgbe_q_vector *q_vector)
975{ 975{
976 struct ixgbe_adapter *adapter = q_vector->adapter; 976 struct ixgbe_adapter *adapter = q_vector->adapter;
977 struct ixgbe_ring *ring;
977 int cpu = get_cpu(); 978 int cpu = get_cpu();
978 long r_idx;
979 int i;
980 979
981 if (q_vector->cpu == cpu) 980 if (q_vector->cpu == cpu)
982 goto out_no_update; 981 goto out_no_update;
983 982
984 r_idx = find_first_bit(q_vector->tx.idx, adapter->num_tx_queues); 983 for (ring = q_vector->tx.ring; ring != NULL; ring = ring->next)
985 for (i = 0; i < q_vector->tx.count; i++) { 984 ixgbe_update_tx_dca(adapter, ring, cpu);
986 ixgbe_update_tx_dca(adapter, adapter->tx_ring[r_idx], cpu);
987 r_idx = find_next_bit(q_vector->tx.idx, adapter->num_tx_queues,
988 r_idx + 1);
989 }
990 985
991 r_idx = find_first_bit(q_vector->rx.idx, adapter->num_rx_queues); 986 for (ring = q_vector->rx.ring; ring != NULL; ring = ring->next)
992 for (i = 0; i < q_vector->rx.count; i++) { 987 ixgbe_update_rx_dca(adapter, ring, cpu);
993 ixgbe_update_rx_dca(adapter, adapter->rx_ring[r_idx], cpu);
994 r_idx = find_next_bit(q_vector->rx.idx, adapter->num_rx_queues,
995 r_idx + 1);
996 }
997 988
998 q_vector->cpu = cpu; 989 q_vector->cpu = cpu;
999out_no_update: 990out_no_update:
@@ -1546,7 +1537,7 @@ static int ixgbe_clean_rxonly(struct napi_struct *, int);
1546static void ixgbe_configure_msix(struct ixgbe_adapter *adapter) 1537static void ixgbe_configure_msix(struct ixgbe_adapter *adapter)
1547{ 1538{
1548 struct ixgbe_q_vector *q_vector; 1539 struct ixgbe_q_vector *q_vector;
1549 int i, q_vectors, v_idx, r_idx; 1540 int q_vectors, v_idx;
1550 u32 mask; 1541 u32 mask;
1551 1542
1552 q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; 1543 q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS;
@@ -1556,33 +1547,19 @@ static void ixgbe_configure_msix(struct ixgbe_adapter *adapter)
1556 * corresponding register. 1547 * corresponding register.
1557 */ 1548 */
1558 for (v_idx = 0; v_idx < q_vectors; v_idx++) { 1549 for (v_idx = 0; v_idx < q_vectors; v_idx++) {
1550 struct ixgbe_ring *ring;
1559 q_vector = adapter->q_vector[v_idx]; 1551 q_vector = adapter->q_vector[v_idx];
1560 /* XXX for_each_set_bit(...) */
1561 r_idx = find_first_bit(q_vector->rx.idx,
1562 adapter->num_rx_queues);
1563
1564 for (i = 0; i < q_vector->rx.count; i++) {
1565 u8 reg_idx = adapter->rx_ring[r_idx]->reg_idx;
1566 ixgbe_set_ivar(adapter, 0, reg_idx, v_idx);
1567 r_idx = find_next_bit(q_vector->rx.idx,
1568 adapter->num_rx_queues,
1569 r_idx + 1);
1570 }
1571 r_idx = find_first_bit(q_vector->tx.idx,
1572 adapter->num_tx_queues);
1573
1574 for (i = 0; i < q_vector->tx.count; i++) {
1575 u8 reg_idx = adapter->tx_ring[r_idx]->reg_idx;
1576 ixgbe_set_ivar(adapter, 1, reg_idx, v_idx);
1577 r_idx = find_next_bit(q_vector->tx.idx,
1578 adapter->num_tx_queues,
1579 r_idx + 1);
1580 }
1581 1552
1582 if (q_vector->tx.count && !q_vector->rx.count) 1553 for (ring = q_vector->rx.ring; ring != NULL; ring = ring->next)
1554 ixgbe_set_ivar(adapter, 0, ring->reg_idx, v_idx);
1555
1556 for (ring = q_vector->tx.ring; ring != NULL; ring = ring->next)
1557 ixgbe_set_ivar(adapter, 1, ring->reg_idx, v_idx);
1558
1559 if (q_vector->tx.ring && !q_vector->rx.ring)
1583 /* tx only */ 1560 /* tx only */
1584 q_vector->eitr = adapter->tx_eitr_param; 1561 q_vector->eitr = adapter->tx_eitr_param;
1585 else if (q_vector->rx.count) 1562 else if (q_vector->rx.ring)
1586 /* rx or mixed */ 1563 /* rx or mixed */
1587 q_vector->eitr = adapter->rx_eitr_param; 1564 q_vector->eitr = adapter->rx_eitr_param;
1588 1565
@@ -2006,20 +1983,10 @@ static inline void ixgbe_irq_disable_queues(struct ixgbe_adapter *adapter,
2006static irqreturn_t ixgbe_msix_clean_tx(int irq, void *data) 1983static irqreturn_t ixgbe_msix_clean_tx(int irq, void *data)
2007{ 1984{
2008 struct ixgbe_q_vector *q_vector = data; 1985 struct ixgbe_q_vector *q_vector = data;
2009 struct ixgbe_adapter *adapter = q_vector->adapter;
2010 struct ixgbe_ring *tx_ring;
2011 int i, r_idx;
2012 1986
2013 if (!q_vector->tx.count) 1987 if (!q_vector->tx.count)
2014 return IRQ_HANDLED; 1988 return IRQ_HANDLED;
2015 1989
2016 r_idx = find_first_bit(q_vector->tx.idx, adapter->num_tx_queues);
2017 for (i = 0; i < q_vector->tx.count; i++) {
2018 tx_ring = adapter->tx_ring[r_idx];
2019 r_idx = find_next_bit(q_vector->tx.idx, adapter->num_tx_queues,
2020 r_idx + 1);
2021 }
2022
2023 /* EIAM disabled interrupts (on this vector) for us */ 1990 /* EIAM disabled interrupts (on this vector) for us */
2024 napi_schedule(&q_vector->napi); 1991 napi_schedule(&q_vector->napi);
2025 1992
@@ -2034,22 +2001,6 @@ static irqreturn_t ixgbe_msix_clean_tx(int irq, void *data)
2034static irqreturn_t ixgbe_msix_clean_rx(int irq, void *data) 2001static irqreturn_t ixgbe_msix_clean_rx(int irq, void *data)
2035{ 2002{
2036 struct ixgbe_q_vector *q_vector = data; 2003 struct ixgbe_q_vector *q_vector = data;
2037 struct ixgbe_adapter *adapter = q_vector->adapter;
2038 struct ixgbe_ring *rx_ring;
2039 int r_idx;
2040 int i;
2041
2042#ifdef CONFIG_IXGBE_DCA
2043 if (adapter->flags & IXGBE_FLAG_DCA_ENABLED)
2044 ixgbe_update_dca(q_vector);
2045#endif
2046
2047 r_idx = find_first_bit(q_vector->rx.idx, adapter->num_rx_queues);
2048 for (i = 0; i < q_vector->rx.count; i++) {
2049 rx_ring = adapter->rx_ring[r_idx];
2050 r_idx = find_next_bit(q_vector->rx.idx, adapter->num_rx_queues,
2051 r_idx + 1);
2052 }
2053 2004
2054 if (!q_vector->rx.count) 2005 if (!q_vector->rx.count)
2055 return IRQ_HANDLED; 2006 return IRQ_HANDLED;
@@ -2063,28 +2014,10 @@ static irqreturn_t ixgbe_msix_clean_rx(int irq, void *data)
2063static irqreturn_t ixgbe_msix_clean_many(int irq, void *data) 2014static irqreturn_t ixgbe_msix_clean_many(int irq, void *data)
2064{ 2015{
2065 struct ixgbe_q_vector *q_vector = data; 2016 struct ixgbe_q_vector *q_vector = data;
2066 struct ixgbe_adapter *adapter = q_vector->adapter;
2067 struct ixgbe_ring *ring;
2068 int r_idx;
2069 int i;
2070 2017
2071 if (!q_vector->tx.count && !q_vector->rx.count) 2018 if (!q_vector->tx.count && !q_vector->rx.count)
2072 return IRQ_HANDLED; 2019 return IRQ_HANDLED;
2073 2020
2074 r_idx = find_first_bit(q_vector->tx.idx, adapter->num_tx_queues);
2075 for (i = 0; i < q_vector->tx.count; i++) {
2076 ring = adapter->tx_ring[r_idx];
2077 r_idx = find_next_bit(q_vector->tx.idx, adapter->num_tx_queues,
2078 r_idx + 1);
2079 }
2080
2081 r_idx = find_first_bit(q_vector->rx.idx, adapter->num_rx_queues);
2082 for (i = 0; i < q_vector->rx.count; i++) {
2083 ring = adapter->rx_ring[r_idx];
2084 r_idx = find_next_bit(q_vector->rx.idx, adapter->num_rx_queues,
2085 r_idx + 1);
2086 }
2087
2088 /* EIAM disabled interrupts (on this vector) for us */ 2021 /* EIAM disabled interrupts (on this vector) for us */
2089 napi_schedule(&q_vector->napi); 2022 napi_schedule(&q_vector->napi);
2090 2023
@@ -2104,19 +2037,14 @@ static int ixgbe_clean_rxonly(struct napi_struct *napi, int budget)
2104 struct ixgbe_q_vector *q_vector = 2037 struct ixgbe_q_vector *q_vector =
2105 container_of(napi, struct ixgbe_q_vector, napi); 2038 container_of(napi, struct ixgbe_q_vector, napi);
2106 struct ixgbe_adapter *adapter = q_vector->adapter; 2039 struct ixgbe_adapter *adapter = q_vector->adapter;
2107 struct ixgbe_ring *rx_ring = NULL;
2108 int work_done = 0; 2040 int work_done = 0;
2109 long r_idx;
2110 2041
2111#ifdef CONFIG_IXGBE_DCA 2042#ifdef CONFIG_IXGBE_DCA
2112 if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) 2043 if (adapter->flags & IXGBE_FLAG_DCA_ENABLED)
2113 ixgbe_update_dca(q_vector); 2044 ixgbe_update_dca(q_vector);
2114#endif 2045#endif
2115 2046
2116 r_idx = find_first_bit(q_vector->rx.idx, adapter->num_rx_queues); 2047 ixgbe_clean_rx_irq(q_vector, q_vector->rx.ring, &work_done, budget);
2117 rx_ring = adapter->rx_ring[r_idx];
2118
2119 ixgbe_clean_rx_irq(q_vector, rx_ring, &work_done, budget);
2120 2048
2121 /* If all Rx work done, exit the polling mode */ 2049 /* If all Rx work done, exit the polling mode */
2122 if (work_done < budget) { 2050 if (work_done < budget) {
@@ -2144,38 +2072,29 @@ static int ixgbe_clean_rxtx_many(struct napi_struct *napi, int budget)
2144 struct ixgbe_q_vector *q_vector = 2072 struct ixgbe_q_vector *q_vector =
2145 container_of(napi, struct ixgbe_q_vector, napi); 2073 container_of(napi, struct ixgbe_q_vector, napi);
2146 struct ixgbe_adapter *adapter = q_vector->adapter; 2074 struct ixgbe_adapter *adapter = q_vector->adapter;
2147 struct ixgbe_ring *ring = NULL; 2075 struct ixgbe_ring *ring;
2148 int work_done = 0, i; 2076 int work_done = 0;
2149 long r_idx; 2077 bool clean_complete = true;
2150 bool tx_clean_complete = true;
2151 2078
2152#ifdef CONFIG_IXGBE_DCA 2079#ifdef CONFIG_IXGBE_DCA
2153 if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) 2080 if (adapter->flags & IXGBE_FLAG_DCA_ENABLED)
2154 ixgbe_update_dca(q_vector); 2081 ixgbe_update_dca(q_vector);
2155#endif 2082#endif
2156 2083
2157 r_idx = find_first_bit(q_vector->tx.idx, adapter->num_tx_queues); 2084 for (ring = q_vector->tx.ring; ring != NULL; ring = ring->next)
2158 for (i = 0; i < q_vector->tx.count; i++) { 2085 clean_complete &= ixgbe_clean_tx_irq(q_vector, ring);
2159 ring = adapter->tx_ring[r_idx];
2160 tx_clean_complete &= ixgbe_clean_tx_irq(q_vector, ring);
2161 r_idx = find_next_bit(q_vector->tx.idx, adapter->num_tx_queues,
2162 r_idx + 1);
2163 }
2164 2086
2165 /* attempt to distribute budget to each queue fairly, but don't allow 2087 /* attempt to distribute budget to each queue fairly, but don't allow
2166 * the budget to go below 1 because we'll exit polling */ 2088 * the budget to go below 1 because we'll exit polling */
2167 budget /= (q_vector->rx.count ?: 1); 2089 budget /= (q_vector->rx.count ?: 1);
2168 budget = max(budget, 1); 2090 budget = max(budget, 1);
2169 r_idx = find_first_bit(q_vector->rx.idx, adapter->num_rx_queues); 2091
2170 for (i = 0; i < q_vector->rx.count; i++) { 2092 for (ring = q_vector->rx.ring; ring != NULL; ring = ring->next)
2171 ring = adapter->rx_ring[r_idx];
2172 ixgbe_clean_rx_irq(q_vector, ring, &work_done, budget); 2093 ixgbe_clean_rx_irq(q_vector, ring, &work_done, budget);
2173 r_idx = find_next_bit(q_vector->rx.idx, adapter->num_rx_queues,
2174 r_idx + 1);
2175 }
2176 2094
2177 r_idx = find_first_bit(q_vector->rx.idx, adapter->num_rx_queues); 2095 if (!clean_complete)
2178 ring = adapter->rx_ring[r_idx]; 2096 work_done = budget;
2097
2179 /* If all Rx work done, exit the polling mode */ 2098 /* If all Rx work done, exit the polling mode */
2180 if (work_done < budget) { 2099 if (work_done < budget) {
2181 napi_complete(napi); 2100 napi_complete(napi);
@@ -2203,32 +2122,23 @@ static int ixgbe_clean_txonly(struct napi_struct *napi, int budget)
2203 struct ixgbe_q_vector *q_vector = 2122 struct ixgbe_q_vector *q_vector =
2204 container_of(napi, struct ixgbe_q_vector, napi); 2123 container_of(napi, struct ixgbe_q_vector, napi);
2205 struct ixgbe_adapter *adapter = q_vector->adapter; 2124 struct ixgbe_adapter *adapter = q_vector->adapter;
2206 struct ixgbe_ring *tx_ring = NULL;
2207 int work_done = 0;
2208 long r_idx;
2209 2125
2210#ifdef CONFIG_IXGBE_DCA 2126#ifdef CONFIG_IXGBE_DCA
2211 if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) 2127 if (adapter->flags & IXGBE_FLAG_DCA_ENABLED)
2212 ixgbe_update_dca(q_vector); 2128 ixgbe_update_dca(q_vector);
2213#endif 2129#endif
2214 2130
2215 r_idx = find_first_bit(q_vector->tx.idx, adapter->num_tx_queues); 2131 if (!ixgbe_clean_tx_irq(q_vector, q_vector->tx.ring))
2216 tx_ring = adapter->tx_ring[r_idx]; 2132 return budget;
2217
2218 if (!ixgbe_clean_tx_irq(q_vector, tx_ring))
2219 work_done = budget;
2220 2133
2221 /* If all Tx work done, exit the polling mode */ 2134 /* If all Tx work done, exit the polling mode */
2222 if (work_done < budget) { 2135 napi_complete(napi);
2223 napi_complete(napi); 2136 if (adapter->tx_itr_setting & 1)
2224 if (adapter->tx_itr_setting & 1) 2137 ixgbe_set_itr(q_vector);
2225 ixgbe_set_itr(q_vector); 2138 if (!test_bit(__IXGBE_DOWN, &adapter->state))
2226 if (!test_bit(__IXGBE_DOWN, &adapter->state)) 2139 ixgbe_irq_enable_queues(adapter, ((u64)1 << q_vector->v_idx));
2227 ixgbe_irq_enable_queues(adapter,
2228 ((u64)1 << q_vector->v_idx));
2229 }
2230 2140
2231 return work_done; 2141 return 0;
2232} 2142}
2233 2143
2234static inline void map_vector_to_rxq(struct ixgbe_adapter *a, int v_idx, 2144static inline void map_vector_to_rxq(struct ixgbe_adapter *a, int v_idx,
@@ -2237,9 +2147,10 @@ static inline void map_vector_to_rxq(struct ixgbe_adapter *a, int v_idx,
2237 struct ixgbe_q_vector *q_vector = a->q_vector[v_idx]; 2147 struct ixgbe_q_vector *q_vector = a->q_vector[v_idx];
2238 struct ixgbe_ring *rx_ring = a->rx_ring[r_idx]; 2148 struct ixgbe_ring *rx_ring = a->rx_ring[r_idx];
2239 2149
2240 set_bit(r_idx, q_vector->rx.idx);
2241 q_vector->rx.count++;
2242 rx_ring->q_vector = q_vector; 2150 rx_ring->q_vector = q_vector;
2151 rx_ring->next = q_vector->rx.ring;
2152 q_vector->rx.ring = rx_ring;
2153 q_vector->rx.count++;
2243} 2154}
2244 2155
2245static inline void map_vector_to_txq(struct ixgbe_adapter *a, int v_idx, 2156static inline void map_vector_to_txq(struct ixgbe_adapter *a, int v_idx,
@@ -2248,9 +2159,10 @@ static inline void map_vector_to_txq(struct ixgbe_adapter *a, int v_idx,
2248 struct ixgbe_q_vector *q_vector = a->q_vector[v_idx]; 2159 struct ixgbe_q_vector *q_vector = a->q_vector[v_idx];
2249 struct ixgbe_ring *tx_ring = a->tx_ring[t_idx]; 2160 struct ixgbe_ring *tx_ring = a->tx_ring[t_idx];
2250 2161
2251 set_bit(t_idx, q_vector->tx.idx);
2252 q_vector->tx.count++;
2253 tx_ring->q_vector = q_vector; 2162 tx_ring->q_vector = q_vector;
2163 tx_ring->next = q_vector->tx.ring;
2164 q_vector->tx.ring = tx_ring;
2165 q_vector->tx.count++;
2254 q_vector->tx.work_limit = a->tx_work_limit; 2166 q_vector->tx.work_limit = a->tx_work_limit;
2255} 2167}
2256 2168
@@ -2508,14 +2420,26 @@ static irqreturn_t ixgbe_intr(int irq, void *data)
2508 2420
2509static inline void ixgbe_reset_q_vectors(struct ixgbe_adapter *adapter) 2421static inline void ixgbe_reset_q_vectors(struct ixgbe_adapter *adapter)
2510{ 2422{
2511 int i, q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; 2423 int q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS;
2424 int i;
2425
2426 /* legacy and MSI only use one vector */
2427 if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED))
2428 q_vectors = 1;
2429
2430 for (i = 0; i < adapter->num_rx_queues; i++) {
2431 adapter->rx_ring[i]->q_vector = NULL;
2432 adapter->rx_ring[i]->next = NULL;
2433 }
2434 for (i = 0; i < adapter->num_tx_queues; i++) {
2435 adapter->tx_ring[i]->q_vector = NULL;
2436 adapter->tx_ring[i]->next = NULL;
2437 }
2512 2438
2513 for (i = 0; i < q_vectors; i++) { 2439 for (i = 0; i < q_vectors; i++) {
2514 struct ixgbe_q_vector *q_vector = adapter->q_vector[i]; 2440 struct ixgbe_q_vector *q_vector = adapter->q_vector[i];
2515 bitmap_zero(q_vector->rx.idx, MAX_RX_QUEUES); 2441 memset(&q_vector->rx, 0, sizeof(struct ixgbe_ring_container));
2516 bitmap_zero(q_vector->tx.idx, MAX_TX_QUEUES); 2442 memset(&q_vector->tx, 0, sizeof(struct ixgbe_ring_container));
2517 q_vector->rx.count = 0;
2518 q_vector->tx.count = 0;
2519 } 2443 }
2520} 2444}
2521 2445
@@ -5923,7 +5847,7 @@ static void ixgbe_check_hang_subtask(struct ixgbe_adapter *adapter)
5923 /* get one bit for every active tx/rx interrupt vector */ 5847 /* get one bit for every active tx/rx interrupt vector */
5924 for (i = 0; i < adapter->num_msix_vectors - NON_Q_VECTORS; i++) { 5848 for (i = 0; i < adapter->num_msix_vectors - NON_Q_VECTORS; i++) {
5925 struct ixgbe_q_vector *qv = adapter->q_vector[i]; 5849 struct ixgbe_q_vector *qv = adapter->q_vector[i];
5926 if (qv->rx.count || qv->tx.count) 5850 if (qv->rx.ring || qv->tx.ring)
5927 eics |= ((u64)1 << i); 5851 eics |= ((u64)1 << i);
5928 } 5852 }
5929 } 5853 }
diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
index deee3754b1f7..e1d9e3b63448 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
@@ -117,44 +117,6 @@ static int ixgbevf_get_settings(struct net_device *netdev,
117 return 0; 117 return 0;
118} 118}
119 119
120static u32 ixgbevf_get_rx_csum(struct net_device *netdev)
121{
122 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
123 return adapter->flags & IXGBE_FLAG_RX_CSUM_ENABLED;
124}
125
126static int ixgbevf_set_rx_csum(struct net_device *netdev, u32 data)
127{
128 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
129 if (data)
130 adapter->flags |= IXGBE_FLAG_RX_CSUM_ENABLED;
131 else
132 adapter->flags &= ~IXGBE_FLAG_RX_CSUM_ENABLED;
133
134 if (netif_running(netdev)) {
135 if (!adapter->dev_closed)
136 ixgbevf_reinit_locked(adapter);
137 } else {
138 ixgbevf_reset(adapter);
139 }
140
141 return 0;
142}
143
144static int ixgbevf_set_tso(struct net_device *netdev, u32 data)
145{
146 if (data) {
147 netdev->features |= NETIF_F_TSO;
148 netdev->features |= NETIF_F_TSO6;
149 } else {
150 netif_tx_stop_all_queues(netdev);
151 netdev->features &= ~NETIF_F_TSO;
152 netdev->features &= ~NETIF_F_TSO6;
153 netif_tx_start_all_queues(netdev);
154 }
155 return 0;
156}
157
158static u32 ixgbevf_get_msglevel(struct net_device *netdev) 120static u32 ixgbevf_get_msglevel(struct net_device *netdev)
159{ 121{
160 struct ixgbevf_adapter *adapter = netdev_priv(netdev); 122 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
@@ -720,16 +682,8 @@ static struct ethtool_ops ixgbevf_ethtool_ops = {
720 .get_link = ethtool_op_get_link, 682 .get_link = ethtool_op_get_link,
721 .get_ringparam = ixgbevf_get_ringparam, 683 .get_ringparam = ixgbevf_get_ringparam,
722 .set_ringparam = ixgbevf_set_ringparam, 684 .set_ringparam = ixgbevf_set_ringparam,
723 .get_rx_csum = ixgbevf_get_rx_csum,
724 .set_rx_csum = ixgbevf_set_rx_csum,
725 .get_tx_csum = ethtool_op_get_tx_csum,
726 .set_tx_csum = ethtool_op_set_tx_ipv6_csum,
727 .get_sg = ethtool_op_get_sg,
728 .set_sg = ethtool_op_set_sg,
729 .get_msglevel = ixgbevf_get_msglevel, 685 .get_msglevel = ixgbevf_get_msglevel,
730 .set_msglevel = ixgbevf_set_msglevel, 686 .set_msglevel = ixgbevf_set_msglevel,
731 .get_tso = ethtool_op_get_tso,
732 .set_tso = ixgbevf_set_tso,
733 .self_test = ixgbevf_diag_test, 687 .self_test = ixgbevf_diag_test,
734 .get_sset_count = ixgbevf_get_sset_count, 688 .get_sset_count = ixgbevf_get_sset_count,
735 .get_strings = ixgbevf_get_strings, 689 .get_strings = ixgbevf_get_strings,
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
index 8857df4dd3b9..e6c9d1a927a9 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
@@ -34,6 +34,7 @@
34#include <linux/io.h> 34#include <linux/io.h>
35#include <linux/netdevice.h> 35#include <linux/netdevice.h>
36#include <linux/if_vlan.h> 36#include <linux/if_vlan.h>
37#include <linux/u64_stats_sync.h>
37 38
38#include "vf.h" 39#include "vf.h"
39 40
@@ -71,12 +72,13 @@ struct ixgbevf_ring {
71 struct ixgbevf_rx_buffer *rx_buffer_info; 72 struct ixgbevf_rx_buffer *rx_buffer_info;
72 }; 73 };
73 74
75 u64 total_bytes;
76 u64 total_packets;
77 struct u64_stats_sync syncp;
78
74 u16 head; 79 u16 head;
75 u16 tail; 80 u16 tail;
76 81
77 unsigned int total_bytes;
78 unsigned int total_packets;
79
80 u16 reg_idx; /* holds the special value that gets the hardware register 82 u16 reg_idx; /* holds the special value that gets the hardware register
81 * offset associated with this ring, which is different 83 * offset associated with this ring, which is different
82 * for DCB and RSS modes */ 84 * for DCB and RSS modes */
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index b1e1c2daf5f9..98963970206e 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -203,6 +203,9 @@ static bool ixgbevf_clean_tx_irq(struct ixgbevf_adapter *adapter,
203 (count < tx_ring->work_limit)) { 203 (count < tx_ring->work_limit)) {
204 bool cleaned = false; 204 bool cleaned = false;
205 rmb(); /* read buffer_info after eop_desc */ 205 rmb(); /* read buffer_info after eop_desc */
206 /* eop could change between read and DD-check */
207 if (unlikely(eop != tx_ring->tx_buffer_info[i].next_to_watch))
208 goto cont_loop;
206 for ( ; !cleaned; count++) { 209 for ( ; !cleaned; count++) {
207 struct sk_buff *skb; 210 struct sk_buff *skb;
208 tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, i); 211 tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, i);
@@ -232,6 +235,7 @@ static bool ixgbevf_clean_tx_irq(struct ixgbevf_adapter *adapter,
232 i = 0; 235 i = 0;
233 } 236 }
234 237
238cont_loop:
235 eop = tx_ring->tx_buffer_info[i].next_to_watch; 239 eop = tx_ring->tx_buffer_info[i].next_to_watch;
236 eop_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop); 240 eop_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop);
237 } 241 }
@@ -266,11 +270,10 @@ static bool ixgbevf_clean_tx_irq(struct ixgbevf_adapter *adapter,
266 IXGBE_WRITE_REG(hw, IXGBE_VTEICS, tx_ring->v_idx); 270 IXGBE_WRITE_REG(hw, IXGBE_VTEICS, tx_ring->v_idx);
267 } 271 }
268 272
273 u64_stats_update_begin(&tx_ring->syncp);
269 tx_ring->total_bytes += total_bytes; 274 tx_ring->total_bytes += total_bytes;
270 tx_ring->total_packets += total_packets; 275 tx_ring->total_packets += total_packets;
271 276 u64_stats_update_end(&tx_ring->syncp);
272 netdev->stats.tx_bytes += total_bytes;
273 netdev->stats.tx_packets += total_packets;
274 277
275 return count < tx_ring->work_limit; 278 return count < tx_ring->work_limit;
276} 279}
@@ -593,10 +596,10 @@ next_desc:
593 if (cleaned_count) 596 if (cleaned_count)
594 ixgbevf_alloc_rx_buffers(adapter, rx_ring, cleaned_count); 597 ixgbevf_alloc_rx_buffers(adapter, rx_ring, cleaned_count);
595 598
599 u64_stats_update_begin(&rx_ring->syncp);
596 rx_ring->total_packets += total_rx_packets; 600 rx_ring->total_packets += total_rx_packets;
597 rx_ring->total_bytes += total_rx_bytes; 601 rx_ring->total_bytes += total_rx_bytes;
598 adapter->netdev->stats.rx_bytes += total_rx_bytes; 602 u64_stats_update_end(&rx_ring->syncp);
599 adapter->netdev->stats.rx_packets += total_rx_packets;
600 603
601 return cleaned; 604 return cleaned;
602} 605}
@@ -2256,10 +2259,6 @@ void ixgbevf_update_stats(struct ixgbevf_adapter *adapter)
2256 adapter->stats.vfgotc); 2259 adapter->stats.vfgotc);
2257 UPDATE_VF_COUNTER_32bit(IXGBE_VFMPRC, adapter->stats.last_vfmprc, 2260 UPDATE_VF_COUNTER_32bit(IXGBE_VFMPRC, adapter->stats.last_vfmprc,
2258 adapter->stats.vfmprc); 2261 adapter->stats.vfmprc);
2259
2260 /* Fill out the OS statistics structure */
2261 adapter->netdev->stats.multicast = adapter->stats.vfmprc -
2262 adapter->stats.base_vfmprc;
2263} 2262}
2264 2263
2265/** 2264/**
@@ -3216,17 +3215,69 @@ static void ixgbevf_shutdown(struct pci_dev *pdev)
3216 pci_disable_device(pdev); 3215 pci_disable_device(pdev);
3217} 3216}
3218 3217
3218static struct rtnl_link_stats64 *ixgbevf_get_stats(struct net_device *netdev,
3219 struct rtnl_link_stats64 *stats)
3220{
3221 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
3222 unsigned int start;
3223 u64 bytes, packets;
3224 const struct ixgbevf_ring *ring;
3225 int i;
3226
3227 ixgbevf_update_stats(adapter);
3228
3229 stats->multicast = adapter->stats.vfmprc - adapter->stats.base_vfmprc;
3230
3231 for (i = 0; i < adapter->num_rx_queues; i++) {
3232 ring = &adapter->rx_ring[i];
3233 do {
3234 start = u64_stats_fetch_begin_bh(&ring->syncp);
3235 bytes = ring->total_bytes;
3236 packets = ring->total_packets;
3237 } while (u64_stats_fetch_retry_bh(&ring->syncp, start));
3238 stats->rx_bytes += bytes;
3239 stats->rx_packets += packets;
3240 }
3241
3242 for (i = 0; i < adapter->num_tx_queues; i++) {
3243 ring = &adapter->tx_ring[i];
3244 do {
3245 start = u64_stats_fetch_begin_bh(&ring->syncp);
3246 bytes = ring->total_bytes;
3247 packets = ring->total_packets;
3248 } while (u64_stats_fetch_retry_bh(&ring->syncp, start));
3249 stats->tx_bytes += bytes;
3250 stats->tx_packets += packets;
3251 }
3252
3253 return stats;
3254}
3255
3256static int ixgbevf_set_features(struct net_device *netdev, u32 features)
3257{
3258 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
3259
3260 if (features & NETIF_F_RXCSUM)
3261 adapter->flags |= IXGBE_FLAG_RX_CSUM_ENABLED;
3262 else
3263 adapter->flags &= ~IXGBE_FLAG_RX_CSUM_ENABLED;
3264
3265 return 0;
3266}
3267
3219static const struct net_device_ops ixgbe_netdev_ops = { 3268static const struct net_device_ops ixgbe_netdev_ops = {
3220 .ndo_open = ixgbevf_open, 3269 .ndo_open = ixgbevf_open,
3221 .ndo_stop = ixgbevf_close, 3270 .ndo_stop = ixgbevf_close,
3222 .ndo_start_xmit = ixgbevf_xmit_frame, 3271 .ndo_start_xmit = ixgbevf_xmit_frame,
3223 .ndo_set_rx_mode = ixgbevf_set_rx_mode, 3272 .ndo_set_rx_mode = ixgbevf_set_rx_mode,
3273 .ndo_get_stats64 = ixgbevf_get_stats,
3224 .ndo_validate_addr = eth_validate_addr, 3274 .ndo_validate_addr = eth_validate_addr,
3225 .ndo_set_mac_address = ixgbevf_set_mac, 3275 .ndo_set_mac_address = ixgbevf_set_mac,
3226 .ndo_change_mtu = ixgbevf_change_mtu, 3276 .ndo_change_mtu = ixgbevf_change_mtu,
3227 .ndo_tx_timeout = ixgbevf_tx_timeout, 3277 .ndo_tx_timeout = ixgbevf_tx_timeout,
3228 .ndo_vlan_rx_add_vid = ixgbevf_vlan_rx_add_vid, 3278 .ndo_vlan_rx_add_vid = ixgbevf_vlan_rx_add_vid,
3229 .ndo_vlan_rx_kill_vid = ixgbevf_vlan_rx_kill_vid, 3279 .ndo_vlan_rx_kill_vid = ixgbevf_vlan_rx_kill_vid,
3280 .ndo_set_features = ixgbevf_set_features,
3230}; 3281};
3231 3282
3232static void ixgbevf_assign_netdev_ops(struct net_device *dev) 3283static void ixgbevf_assign_netdev_ops(struct net_device *dev)
@@ -3339,16 +3390,18 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev,
3339 /* setup the private structure */ 3390 /* setup the private structure */
3340 err = ixgbevf_sw_init(adapter); 3391 err = ixgbevf_sw_init(adapter);
3341 3392
3342 netdev->features = NETIF_F_SG | 3393 netdev->hw_features = NETIF_F_SG |
3343 NETIF_F_IP_CSUM | 3394 NETIF_F_IP_CSUM |
3395 NETIF_F_IPV6_CSUM |
3396 NETIF_F_TSO |
3397 NETIF_F_TSO6 |
3398 NETIF_F_RXCSUM;
3399
3400 netdev->features = netdev->hw_features |
3344 NETIF_F_HW_VLAN_TX | 3401 NETIF_F_HW_VLAN_TX |
3345 NETIF_F_HW_VLAN_RX | 3402 NETIF_F_HW_VLAN_RX |
3346 NETIF_F_HW_VLAN_FILTER; 3403 NETIF_F_HW_VLAN_FILTER;
3347 3404
3348 netdev->features |= NETIF_F_IPV6_CSUM;
3349 netdev->features |= NETIF_F_TSO;
3350 netdev->features |= NETIF_F_TSO6;
3351 netdev->features |= NETIF_F_GRO;
3352 netdev->vlan_features |= NETIF_F_TSO; 3405 netdev->vlan_features |= NETIF_F_TSO;
3353 netdev->vlan_features |= NETIF_F_TSO6; 3406 netdev->vlan_features |= NETIF_F_TSO6;
3354 netdev->vlan_features |= NETIF_F_IP_CSUM; 3407 netdev->vlan_features |= NETIF_F_IP_CSUM;