aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-03-28 14:44:06 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-28 14:44:06 -0400
commitc8c3d7e2449a9e63c3cb72d24cebe956229af427 (patch)
tree4024311b54bfb1b335a2ed84caae13aef6ed43f9
parent2405e8f64c14a2cc9967f1f9bbeb1ba48b6cc2a1 (diff)
parented4420a3b412b09cc60d6e3d662428b7e6c36e90 (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 This series contains updates to e1000e, igb, i40e and i40evf Anjali provides i40e fix to remove the ATR filter on RST as well as FIN packets. Cleans up add_del_fdir() because it was used and implemented only for the add, so change the name and drop a parameter. Adds the ability to drop a flow if we wanted to and adds a flow director message level to be used for flow director specific messages. Mitch fixes an issue on i40evf where the Tx watchdog handler was causing an oops when sending an admin queue message to request a reset because the admin queue functions use spinlocks. Greg provides a change to i40e to make the alloc and free queue vector calls orthogonal. Shannon fixes i40e to verify the eeprom checksum and firmware CRC status bits, and shutdown the driver if they fail. This change stops the processing of traffic, but does not kill the PF netdev so that the NVMUpdate process still has a chance at fixing the image. Also provides a fix to make sure the VSI has a netdev before trying to use it in the debugfs netdev_ops commands. Jakub Kicinski provides patches for e1000e and igb to fix a number issues found in the PTP code. v2: - drop patch 11 "i40e: Add a fallback debug flow for the driver" from the series based on feedback from David Miller ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/intel/e1000e/e1000.h2
-rw-r--r--drivers/net/ethernet/intel/e1000e/ethtool.c1
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c10
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e.h1
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_debugfs.c35
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_ethtool.c39
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c62
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.c14
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_type.h1
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_prototype.h2
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_type.h1
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf.h1
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf_main.c10
-rw-r--r--drivers/net/ethernet/intel/igb/igb.h3
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c7
-rw-r--r--drivers/net/ethernet/intel/igb/igb_ptp.c3
16 files changed, 131 insertions, 61 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h
index 5325e3e2154e..1471c5464a89 100644
--- a/drivers/net/ethernet/intel/e1000e/e1000.h
+++ b/drivers/net/ethernet/intel/e1000e/e1000.h
@@ -262,6 +262,7 @@ struct e1000_adapter {
262 u32 tx_head_addr; 262 u32 tx_head_addr;
263 u32 tx_fifo_size; 263 u32 tx_fifo_size;
264 u32 tx_dma_failed; 264 u32 tx_dma_failed;
265 u32 tx_hwtstamp_timeouts;
265 266
266 /* Rx */ 267 /* Rx */
267 bool (*clean_rx) (struct e1000_ring *ring, int *work_done, 268 bool (*clean_rx) (struct e1000_ring *ring, int *work_done,
@@ -334,6 +335,7 @@ struct e1000_adapter {
334 struct hwtstamp_config hwtstamp_config; 335 struct hwtstamp_config hwtstamp_config;
335 struct delayed_work systim_overflow_work; 336 struct delayed_work systim_overflow_work;
336 struct sk_buff *tx_hwtstamp_skb; 337 struct sk_buff *tx_hwtstamp_skb;
338 unsigned long tx_hwtstamp_start;
337 struct work_struct tx_hwtstamp_work; 339 struct work_struct tx_hwtstamp_work;
338 spinlock_t systim_lock; /* protects SYSTIML/H regsters */ 340 spinlock_t systim_lock; /* protects SYSTIML/H regsters */
339 struct cyclecounter cc; 341 struct cyclecounter cc;
diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c
index 3c2898d0c2aa..cad250bc1b99 100644
--- a/drivers/net/ethernet/intel/e1000e/ethtool.c
+++ b/drivers/net/ethernet/intel/e1000e/ethtool.c
@@ -104,6 +104,7 @@ static const struct e1000_stats e1000_gstrings_stats[] = {
104 E1000_STAT("rx_hwtstamp_cleared", rx_hwtstamp_cleared), 104 E1000_STAT("rx_hwtstamp_cleared", rx_hwtstamp_cleared),
105 E1000_STAT("uncorr_ecc_errors", uncorr_errors), 105 E1000_STAT("uncorr_ecc_errors", uncorr_errors),
106 E1000_STAT("corr_ecc_errors", corr_errors), 106 E1000_STAT("corr_ecc_errors", corr_errors),
107 E1000_STAT("tx_hwtstamp_timeouts", tx_hwtstamp_timeouts),
107}; 108};
108 109
109#define E1000_GLOBAL_STATS_LEN ARRAY_SIZE(e1000_gstrings_stats) 110#define E1000_GLOBAL_STATS_LEN ARRAY_SIZE(e1000_gstrings_stats)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 6bd1832e3f3e..f1cce5928e20 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -1148,9 +1148,6 @@ static void e1000e_tx_hwtstamp_work(struct work_struct *work)
1148 tx_hwtstamp_work); 1148 tx_hwtstamp_work);
1149 struct e1000_hw *hw = &adapter->hw; 1149 struct e1000_hw *hw = &adapter->hw;
1150 1150
1151 if (!adapter->tx_hwtstamp_skb)
1152 return;
1153
1154 if (er32(TSYNCTXCTL) & E1000_TSYNCTXCTL_VALID) { 1151 if (er32(TSYNCTXCTL) & E1000_TSYNCTXCTL_VALID) {
1155 struct skb_shared_hwtstamps shhwtstamps; 1152 struct skb_shared_hwtstamps shhwtstamps;
1156 u64 txstmp; 1153 u64 txstmp;
@@ -1163,6 +1160,12 @@ static void e1000e_tx_hwtstamp_work(struct work_struct *work)
1163 skb_tstamp_tx(adapter->tx_hwtstamp_skb, &shhwtstamps); 1160 skb_tstamp_tx(adapter->tx_hwtstamp_skb, &shhwtstamps);
1164 dev_kfree_skb_any(adapter->tx_hwtstamp_skb); 1161 dev_kfree_skb_any(adapter->tx_hwtstamp_skb);
1165 adapter->tx_hwtstamp_skb = NULL; 1162 adapter->tx_hwtstamp_skb = NULL;
1163 } else if (time_after(jiffies, adapter->tx_hwtstamp_start
1164 + adapter->tx_timeout_factor * HZ)) {
1165 dev_kfree_skb_any(adapter->tx_hwtstamp_skb);
1166 adapter->tx_hwtstamp_skb = NULL;
1167 adapter->tx_hwtstamp_timeouts++;
1168 e_warn("clearing Tx timestamp hang");
1166 } else { 1169 } else {
1167 /* reschedule to check later */ 1170 /* reschedule to check later */
1168 schedule_work(&adapter->tx_hwtstamp_work); 1171 schedule_work(&adapter->tx_hwtstamp_work);
@@ -5567,6 +5570,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
5567 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; 5570 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
5568 tx_flags |= E1000_TX_FLAGS_HWTSTAMP; 5571 tx_flags |= E1000_TX_FLAGS_HWTSTAMP;
5569 adapter->tx_hwtstamp_skb = skb_get(skb); 5572 adapter->tx_hwtstamp_skb = skb_get(skb);
5573 adapter->tx_hwtstamp_start = jiffies;
5570 schedule_work(&adapter->tx_hwtstamp_work); 5574 schedule_work(&adapter->tx_hwtstamp_work);
5571 } else { 5575 } else {
5572 skb_tx_timestamp(skb); 5576 skb_tx_timestamp(skb);
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 33cd8b67535d..beb7b4393a6c 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -136,6 +136,7 @@ enum i40e_state_t {
136 __I40E_EMP_RESET_REQUESTED, 136 __I40E_EMP_RESET_REQUESTED,
137 __I40E_FILTER_OVERFLOW_PROMISC, 137 __I40E_FILTER_OVERFLOW_PROMISC,
138 __I40E_SUSPENDED, 138 __I40E_SUSPENDED,
139 __I40E_BAD_EEPROM,
139}; 140};
140 141
141enum i40e_interrupt_policy { 142enum i40e_interrupt_policy {
diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index afd43d7973fa..3c37386fd138 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -2087,9 +2087,13 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp,
2087 if (!vsi) { 2087 if (!vsi) {
2088 dev_info(&pf->pdev->dev, 2088 dev_info(&pf->pdev->dev,
2089 "tx_timeout: VSI %d not found\n", vsi_seid); 2089 "tx_timeout: VSI %d not found\n", vsi_seid);
2090 goto netdev_ops_write_done; 2090 } else if (!vsi->netdev) {
2091 } 2091 dev_info(&pf->pdev->dev, "tx_timeout: no netdev for VSI %d\n",
2092 if (rtnl_trylock()) { 2092 vsi_seid);
2093 } else if (test_bit(__I40E_DOWN, &vsi->state)) {
2094 dev_info(&pf->pdev->dev, "tx_timeout: VSI %d not UP\n",
2095 vsi_seid);
2096 } else if (rtnl_trylock()) {
2093 vsi->netdev->netdev_ops->ndo_tx_timeout(vsi->netdev); 2097 vsi->netdev->netdev_ops->ndo_tx_timeout(vsi->netdev);
2094 rtnl_unlock(); 2098 rtnl_unlock();
2095 dev_info(&pf->pdev->dev, "tx_timeout called\n"); 2099 dev_info(&pf->pdev->dev, "tx_timeout called\n");
@@ -2108,9 +2112,10 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp,
2108 if (!vsi) { 2112 if (!vsi) {
2109 dev_info(&pf->pdev->dev, 2113 dev_info(&pf->pdev->dev,
2110 "change_mtu: VSI %d not found\n", vsi_seid); 2114 "change_mtu: VSI %d not found\n", vsi_seid);
2111 goto netdev_ops_write_done; 2115 } else if (!vsi->netdev) {
2112 } 2116 dev_info(&pf->pdev->dev, "change_mtu: no netdev for VSI %d\n",
2113 if (rtnl_trylock()) { 2117 vsi_seid);
2118 } else if (rtnl_trylock()) {
2114 vsi->netdev->netdev_ops->ndo_change_mtu(vsi->netdev, 2119 vsi->netdev->netdev_ops->ndo_change_mtu(vsi->netdev,
2115 mtu); 2120 mtu);
2116 rtnl_unlock(); 2121 rtnl_unlock();
@@ -2129,9 +2134,10 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp,
2129 if (!vsi) { 2134 if (!vsi) {
2130 dev_info(&pf->pdev->dev, 2135 dev_info(&pf->pdev->dev,
2131 "set_rx_mode: VSI %d not found\n", vsi_seid); 2136 "set_rx_mode: VSI %d not found\n", vsi_seid);
2132 goto netdev_ops_write_done; 2137 } else if (!vsi->netdev) {
2133 } 2138 dev_info(&pf->pdev->dev, "set_rx_mode: no netdev for VSI %d\n",
2134 if (rtnl_trylock()) { 2139 vsi_seid);
2140 } else if (rtnl_trylock()) {
2135 vsi->netdev->netdev_ops->ndo_set_rx_mode(vsi->netdev); 2141 vsi->netdev->netdev_ops->ndo_set_rx_mode(vsi->netdev);
2136 rtnl_unlock(); 2142 rtnl_unlock();
2137 dev_info(&pf->pdev->dev, "set_rx_mode called\n"); 2143 dev_info(&pf->pdev->dev, "set_rx_mode called\n");
@@ -2149,11 +2155,14 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp,
2149 if (!vsi) { 2155 if (!vsi) {
2150 dev_info(&pf->pdev->dev, "napi: VSI %d not found\n", 2156 dev_info(&pf->pdev->dev, "napi: VSI %d not found\n",
2151 vsi_seid); 2157 vsi_seid);
2152 goto netdev_ops_write_done; 2158 } else if (!vsi->netdev) {
2159 dev_info(&pf->pdev->dev, "napi: no netdev for VSI %d\n",
2160 vsi_seid);
2161 } else {
2162 for (i = 0; i < vsi->num_q_vectors; i++)
2163 napi_schedule(&vsi->q_vectors[i]->napi);
2164 dev_info(&pf->pdev->dev, "napi called\n");
2153 } 2165 }
2154 for (i = 0; i < vsi->num_q_vectors; i++)
2155 napi_schedule(&vsi->q_vectors[i]->napi);
2156 dev_info(&pf->pdev->dev, "napi called\n");
2157 } else { 2166 } else {
2158 dev_info(&pf->pdev->dev, "unknown command '%s'\n", 2167 dev_info(&pf->pdev->dev, "unknown command '%s'\n",
2159 i40e_dbg_netdev_ops_buf); 2168 i40e_dbg_netdev_ops_buf);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 28da4125c8c9..aa123f43fb8e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -62,8 +62,8 @@ static const struct i40e_stats i40e_gstrings_net_stats[] = {
62 I40E_NETDEV_STAT(rx_crc_errors), 62 I40E_NETDEV_STAT(rx_crc_errors),
63}; 63};
64 64
65static int i40e_add_del_fdir_ethtool(struct i40e_vsi *vsi, 65static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
66 struct ethtool_rxnfc *cmd, bool add); 66 struct ethtool_rxnfc *cmd);
67 67
68/* These PF_STATs might look like duplicates of some NETDEV_STATs, 68/* These PF_STATs might look like duplicates of some NETDEV_STATs,
69 * but they are separate. This device supports Virtualization, and 69 * but they are separate. This device supports Virtualization, and
@@ -1470,16 +1470,15 @@ static int i40e_del_fdir_entry(struct i40e_vsi *vsi,
1470} 1470}
1471 1471
1472/** 1472/**
1473 * i40e_add_del_fdir_ethtool - Add/Remove Flow Director filters 1473 * i40e_add_fdir_ethtool - Add/Remove Flow Director filters
1474 * @vsi: pointer to the targeted VSI 1474 * @vsi: pointer to the targeted VSI
1475 * @cmd: command to get or set RX flow classification rules 1475 * @cmd: command to get or set RX flow classification rules
1476 * @add: true adds a filter, false removes it
1477 * 1476 *
1478 * Add/Remove Flow Director filters for a specific flow spec based on their 1477 * Add Flow Director filters for a specific flow spec based on their
1479 * protocol. Returns 0 if the filters were successfully added or removed. 1478 * protocol. Returns 0 if the filters were successfully added.
1480 **/ 1479 **/
1481static int i40e_add_del_fdir_ethtool(struct i40e_vsi *vsi, 1480static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
1482 struct ethtool_rxnfc *cmd, bool add) 1481 struct ethtool_rxnfc *cmd)
1483{ 1482{
1484 struct ethtool_rx_flow_spec *fsp; 1483 struct ethtool_rx_flow_spec *fsp;
1485 struct i40e_fdir_filter *input; 1484 struct i40e_fdir_filter *input;
@@ -1494,7 +1493,7 @@ static int i40e_add_del_fdir_ethtool(struct i40e_vsi *vsi,
1494 if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED)) 1493 if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED))
1495 return -EOPNOTSUPP; 1494 return -EOPNOTSUPP;
1496 1495
1497 if (add && (pf->auto_disable_flags & I40E_FLAG_FD_SB_ENABLED)) 1496 if (pf->auto_disable_flags & I40E_FLAG_FD_SB_ENABLED)
1498 return -ENOSPC; 1497 return -ENOSPC;
1499 1498
1500 fsp = (struct ethtool_rx_flow_spec *)&cmd->fs; 1499 fsp = (struct ethtool_rx_flow_spec *)&cmd->fs;
@@ -1504,7 +1503,7 @@ static int i40e_add_del_fdir_ethtool(struct i40e_vsi *vsi,
1504 return -EINVAL; 1503 return -EINVAL;
1505 } 1504 }
1506 1505
1507 if ((fsp->ring_cookie >= vsi->num_queue_pairs) && add) 1506 if (fsp->ring_cookie >= vsi->num_queue_pairs)
1508 return -EINVAL; 1507 return -EINVAL;
1509 1508
1510 input = kzalloc(sizeof(*input), GFP_KERNEL); 1509 input = kzalloc(sizeof(*input), GFP_KERNEL);
@@ -1514,11 +1513,16 @@ static int i40e_add_del_fdir_ethtool(struct i40e_vsi *vsi,
1514 1513
1515 input->fd_id = fsp->location; 1514 input->fd_id = fsp->location;
1516 1515
1516 if (fsp->ring_cookie == RX_CLS_FLOW_DISC)
1517 input->dest_ctl = I40E_FILTER_PROGRAM_DESC_DEST_DROP_PACKET;
1518 else
1519 input->dest_ctl =
1520 I40E_FILTER_PROGRAM_DESC_DEST_DIRECT_PACKET_QINDEX;
1521
1517 input->q_index = fsp->ring_cookie; 1522 input->q_index = fsp->ring_cookie;
1518 input->flex_off = 0; 1523 input->flex_off = 0;
1519 input->pctype = 0; 1524 input->pctype = 0;
1520 input->dest_vsi = vsi->id; 1525 input->dest_vsi = vsi->id;
1521 input->dest_ctl = I40E_FILTER_PROGRAM_DESC_DEST_DIRECT_PACKET_QINDEX;
1522 input->fd_status = I40E_FILTER_PROGRAM_DESC_FD_STATUS_FD_ID; 1526 input->fd_status = I40E_FILTER_PROGRAM_DESC_FD_STATUS_FD_ID;
1523 input->cnt_index = 0; 1527 input->cnt_index = 0;
1524 input->flow_type = fsp->flow_type; 1528 input->flow_type = fsp->flow_type;
@@ -1528,16 +1532,11 @@ static int i40e_add_del_fdir_ethtool(struct i40e_vsi *vsi,
1528 input->src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src; 1532 input->src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src;
1529 input->dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst; 1533 input->dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst;
1530 1534
1531 ret = i40e_add_del_fdir(vsi, input, add); 1535 ret = i40e_add_del_fdir(vsi, input, true);
1532 if (ret) { 1536 if (ret)
1533 kfree(input); 1537 kfree(input);
1534 return ret;
1535 }
1536
1537 if (!ret && add)
1538 i40e_update_ethtool_fdir_entry(vsi, input, fsp->location, NULL);
1539 else 1538 else
1540 kfree(input); 1539 i40e_update_ethtool_fdir_entry(vsi, input, fsp->location, NULL);
1541 1540
1542 return ret; 1541 return ret;
1543} 1542}
@@ -1561,7 +1560,7 @@ static int i40e_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)
1561 ret = i40e_set_rss_hash_opt(pf, cmd); 1560 ret = i40e_set_rss_hash_opt(pf, cmd);
1562 break; 1561 break;
1563 case ETHTOOL_SRXCLSRLINS: 1562 case ETHTOOL_SRXCLSRLINS:
1564 ret = i40e_add_del_fdir_ethtool(vsi, cmd, true); 1563 ret = i40e_add_fdir_ethtool(vsi, cmd);
1565 break; 1564 break;
1566 case ETHTOOL_SRXCLSRLDEL: 1565 case ETHTOOL_SRXCLSRLDEL:
1567 ret = i40e_del_fdir_entry(vsi, cmd); 1566 ret = i40e_del_fdir_entry(vsi, cmd);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 28df88ef3c8b..a1ec793b93db 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -26,6 +26,7 @@
26 26
27/* Local includes */ 27/* Local includes */
28#include "i40e.h" 28#include "i40e.h"
29#include "i40e_diag.h"
29#ifdef CONFIG_I40E_VXLAN 30#ifdef CONFIG_I40E_VXLAN
30#include <net/vxlan.h> 31#include <net/vxlan.h>
31#endif 32#endif
@@ -2877,12 +2878,14 @@ static irqreturn_t i40e_intr(int irq, void *data)
2877 val = rd32(hw, I40E_GLGEN_RSTAT); 2878 val = rd32(hw, I40E_GLGEN_RSTAT);
2878 val = (val & I40E_GLGEN_RSTAT_RESET_TYPE_MASK) 2879 val = (val & I40E_GLGEN_RSTAT_RESET_TYPE_MASK)
2879 >> I40E_GLGEN_RSTAT_RESET_TYPE_SHIFT; 2880 >> I40E_GLGEN_RSTAT_RESET_TYPE_SHIFT;
2880 if (val == I40E_RESET_CORER) 2881 if (val == I40E_RESET_CORER) {
2881 pf->corer_count++; 2882 pf->corer_count++;
2882 else if (val == I40E_RESET_GLOBR) 2883 } else if (val == I40E_RESET_GLOBR) {
2883 pf->globr_count++; 2884 pf->globr_count++;
2884 else if (val == I40E_RESET_EMPR) 2885 } else if (val == I40E_RESET_EMPR) {
2885 pf->empr_count++; 2886 pf->empr_count++;
2887 set_bit(__I40E_EMP_RESET_REQUESTED, &pf->state);
2888 }
2886 } 2889 }
2887 2890
2888 if (icr0 & I40E_PFINT_ICR0_HMC_ERR_MASK) { 2891 if (icr0 & I40E_PFINT_ICR0_HMC_ERR_MASK) {
@@ -4257,8 +4260,9 @@ static int i40e_open(struct net_device *netdev)
4257 struct i40e_pf *pf = vsi->back; 4260 struct i40e_pf *pf = vsi->back;
4258 int err; 4261 int err;
4259 4262
4260 /* disallow open during test */ 4263 /* disallow open during test or if eeprom is broken */
4261 if (test_bit(__I40E_TESTING, &pf->state)) 4264 if (test_bit(__I40E_TESTING, &pf->state) ||
4265 test_bit(__I40E_BAD_EEPROM, &pf->state))
4262 return -EBUSY; 4266 return -EBUSY;
4263 4267
4264 netif_carrier_off(netdev); 4268 netif_carrier_off(netdev);
@@ -5078,6 +5082,31 @@ static void i40e_clean_adminq_subtask(struct i40e_pf *pf)
5078} 5082}
5079 5083
5080/** 5084/**
5085 * i40e_verify_eeprom - make sure eeprom is good to use
5086 * @pf: board private structure
5087 **/
5088static void i40e_verify_eeprom(struct i40e_pf *pf)
5089{
5090 int err;
5091
5092 err = i40e_diag_eeprom_test(&pf->hw);
5093 if (err) {
5094 /* retry in case of garbage read */
5095 err = i40e_diag_eeprom_test(&pf->hw);
5096 if (err) {
5097 dev_info(&pf->pdev->dev, "eeprom check failed (%d), Tx/Rx traffic disabled\n",
5098 err);
5099 set_bit(__I40E_BAD_EEPROM, &pf->state);
5100 }
5101 }
5102
5103 if (!err && test_bit(__I40E_BAD_EEPROM, &pf->state)) {
5104 dev_info(&pf->pdev->dev, "eeprom check passed, Tx/Rx traffic enabled\n");
5105 clear_bit(__I40E_BAD_EEPROM, &pf->state);
5106 }
5107}
5108
5109/**
5081 * i40e_reconstitute_veb - rebuild the VEB and anything connected to it 5110 * i40e_reconstitute_veb - rebuild the VEB and anything connected to it
5082 * @veb: pointer to the VEB instance 5111 * @veb: pointer to the VEB instance
5083 * 5112 *
@@ -5386,6 +5415,12 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)
5386 goto end_core_reset; 5415 goto end_core_reset;
5387 } 5416 }
5388 5417
5418 /* re-verify the eeprom if we just had an EMP reset */
5419 if (test_bit(__I40E_EMP_RESET_REQUESTED, &pf->state)) {
5420 clear_bit(__I40E_EMP_RESET_REQUESTED, &pf->state);
5421 i40e_verify_eeprom(pf);
5422 }
5423
5389 ret = i40e_get_capabilities(pf); 5424 ret = i40e_get_capabilities(pf);
5390 if (ret) { 5425 if (ret) {
5391 dev_info(&pf->pdev->dev, "i40e_get_capabilities failed, %d\n", 5426 dev_info(&pf->pdev->dev, "i40e_get_capabilities failed, %d\n",
@@ -6111,13 +6146,13 @@ static int i40e_init_msix(struct i40e_pf *pf)
6111} 6146}
6112 6147
6113/** 6148/**
6114 * i40e_alloc_q_vector - Allocate memory for a single interrupt vector 6149 * i40e_vsi_alloc_q_vector - Allocate memory for a single interrupt vector
6115 * @vsi: the VSI being configured 6150 * @vsi: the VSI being configured
6116 * @v_idx: index of the vector in the vsi struct 6151 * @v_idx: index of the vector in the vsi struct
6117 * 6152 *
6118 * We allocate one q_vector. If allocation fails we return -ENOMEM. 6153 * We allocate one q_vector. If allocation fails we return -ENOMEM.
6119 **/ 6154 **/
6120static int i40e_alloc_q_vector(struct i40e_vsi *vsi, int v_idx) 6155static int i40e_vsi_alloc_q_vector(struct i40e_vsi *vsi, int v_idx)
6121{ 6156{
6122 struct i40e_q_vector *q_vector; 6157 struct i40e_q_vector *q_vector;
6123 6158
@@ -6143,13 +6178,13 @@ static int i40e_alloc_q_vector(struct i40e_vsi *vsi, int v_idx)
6143} 6178}
6144 6179
6145/** 6180/**
6146 * i40e_alloc_q_vectors - Allocate memory for interrupt vectors 6181 * i40e_vsi_alloc_q_vectors - Allocate memory for interrupt vectors
6147 * @vsi: the VSI being configured 6182 * @vsi: the VSI being configured
6148 * 6183 *
6149 * We allocate one q_vector per queue interrupt. If allocation fails we 6184 * We allocate one q_vector per queue interrupt. If allocation fails we
6150 * return -ENOMEM. 6185 * return -ENOMEM.
6151 **/ 6186 **/
6152static int i40e_alloc_q_vectors(struct i40e_vsi *vsi) 6187static int i40e_vsi_alloc_q_vectors(struct i40e_vsi *vsi)
6153{ 6188{
6154 struct i40e_pf *pf = vsi->back; 6189 struct i40e_pf *pf = vsi->back;
6155 int v_idx, num_q_vectors; 6190 int v_idx, num_q_vectors;
@@ -6164,7 +6199,7 @@ static int i40e_alloc_q_vectors(struct i40e_vsi *vsi)
6164 return -EINVAL; 6199 return -EINVAL;
6165 6200
6166 for (v_idx = 0; v_idx < num_q_vectors; v_idx++) { 6201 for (v_idx = 0; v_idx < num_q_vectors; v_idx++) {
6167 err = i40e_alloc_q_vector(vsi, v_idx); 6202 err = i40e_vsi_alloc_q_vector(vsi, v_idx);
6168 if (err) 6203 if (err)
6169 goto err_out; 6204 goto err_out;
6170 } 6205 }
@@ -7020,7 +7055,7 @@ static int i40e_vsi_setup_vectors(struct i40e_vsi *vsi)
7020 return -EEXIST; 7055 return -EEXIST;
7021 } 7056 }
7022 7057
7023 ret = i40e_alloc_q_vectors(vsi); 7058 ret = i40e_vsi_alloc_q_vectors(vsi);
7024 if (ret) { 7059 if (ret) {
7025 dev_info(&pf->pdev->dev, 7060 dev_info(&pf->pdev->dev,
7026 "failed to allocate %d q_vector for VSI %d, ret=%d\n", 7061 "failed to allocate %d q_vector for VSI %d, ret=%d\n",
@@ -8157,6 +8192,8 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8157 goto err_pf_reset; 8192 goto err_pf_reset;
8158 } 8193 }
8159 8194
8195 i40e_verify_eeprom(pf);
8196
8160 i40e_clear_pxe_mode(hw); 8197 i40e_clear_pxe_mode(hw);
8161 err = i40e_get_capabilities(pf); 8198 err = i40e_get_capabilities(pf);
8162 if (err) 8199 if (err)
@@ -8258,7 +8295,8 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8258 8295
8259 /* prep for VF support */ 8296 /* prep for VF support */
8260 if ((pf->flags & I40E_FLAG_SRIOV_ENABLED) && 8297 if ((pf->flags & I40E_FLAG_SRIOV_ENABLED) &&
8261 (pf->flags & I40E_FLAG_MSIX_ENABLED)) { 8298 (pf->flags & I40E_FLAG_MSIX_ENABLED) &&
8299 !test_bit(__I40E_BAD_EEPROM, &pf->state)) {
8262 u32 val; 8300 u32 val;
8263 8301
8264 /* disable link interrupts for VFs */ 8302 /* disable link interrupts for VFs */
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 851f6537a96a..a329aacb392f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -482,8 +482,9 @@ static void i40e_fd_handle_status(struct i40e_ring *rx_ring,
482 } 482 }
483 } else if (error == 483 } else if (error ==
484 (0x1 << I40E_RX_PROG_STATUS_DESC_NO_FD_ENTRY_SHIFT)) { 484 (0x1 << I40E_RX_PROG_STATUS_DESC_NO_FD_ENTRY_SHIFT)) {
485 netdev_info(rx_ring->vsi->netdev, "ntuple filter loc = %d, could not be removed\n", 485 if (I40E_DEBUG_FD & pf->hw.debug_mask)
486 rx_desc->wb.qword0.hi_dword.fd_id); 486 dev_info(&pdev->dev, "ntuple filter loc = %d, could not be removed\n",
487 rx_desc->wb.qword0.hi_dword.fd_id);
487 } 488 }
488} 489}
489 490
@@ -1624,8 +1625,11 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb,
1624 1625
1625 tx_ring->atr_count++; 1626 tx_ring->atr_count++;
1626 1627
1627 /* sample on all syn/fin packets or once every atr sample rate */ 1628 /* sample on all syn/fin/rst packets or once every atr sample rate */
1628 if (!th->fin && !th->syn && (tx_ring->atr_count < tx_ring->atr_sample_rate)) 1629 if (!th->fin &&
1630 !th->syn &&
1631 !th->rst &&
1632 (tx_ring->atr_count < tx_ring->atr_sample_rate))
1629 return; 1633 return;
1630 1634
1631 tx_ring->atr_count = 0; 1635 tx_ring->atr_count = 0;
@@ -1649,7 +1653,7 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb,
1649 1653
1650 dtype_cmd = I40E_TX_DESC_DTYPE_FILTER_PROG; 1654 dtype_cmd = I40E_TX_DESC_DTYPE_FILTER_PROG;
1651 1655
1652 dtype_cmd |= th->fin ? 1656 dtype_cmd |= (th->fin || th->rst) ?
1653 (I40E_FILTER_PROGRAM_DESC_PCMD_REMOVE << 1657 (I40E_FILTER_PROGRAM_DESC_PCMD_REMOVE <<
1654 I40E_TXD_FLTR_QW1_PCMD_SHIFT) : 1658 I40E_TXD_FLTR_QW1_PCMD_SHIFT) :
1655 (I40E_FILTER_PROGRAM_DESC_PCMD_ADD_UPDATE << 1659 (I40E_FILTER_PROGRAM_DESC_PCMD_ADD_UPDATE <<
diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
index d2f0b95fd0d7..71a968fe557f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
@@ -91,6 +91,7 @@ enum i40e_debug_mask {
91 I40E_DEBUG_FLOW = 0x00000200, 91 I40E_DEBUG_FLOW = 0x00000200,
92 I40E_DEBUG_DCB = 0x00000400, 92 I40E_DEBUG_DCB = 0x00000400,
93 I40E_DEBUG_DIAG = 0x00000800, 93 I40E_DEBUG_DIAG = 0x00000800,
94 I40E_DEBUG_FD = 0x00001000,
94 95
95 I40E_DEBUG_AQ_MESSAGE = 0x01000000, 96 I40E_DEBUG_AQ_MESSAGE = 0x01000000,
96 I40E_DEBUG_AQ_DESCRIPTOR = 0x02000000, 97 I40E_DEBUG_AQ_DESCRIPTOR = 0x02000000,
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_prototype.h b/drivers/net/ethernet/intel/i40evf/i40e_prototype.h
index 862fcdf52675..97ab8c2b76f8 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_prototype.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_prototype.h
@@ -67,7 +67,7 @@ extern struct i40e_rx_ptype_decoded i40evf_ptype_lookup[];
67 67
68static inline struct i40e_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype) 68static inline struct i40e_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)
69{ 69{
70 return i40evf_ptype_lookup[ptype]; 70 return i40evf_ptype_lookup[ptype];
71} 71}
72 72
73/* prototype for functions used for SW locks */ 73/* prototype for functions used for SW locks */
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_type.h b/drivers/net/ethernet/intel/i40evf/i40e_type.h
index efe73ad6fdb9..4673b3381edd 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_type.h
@@ -88,6 +88,7 @@ enum i40e_debug_mask {
88 I40E_DEBUG_FLOW = 0x00000200, 88 I40E_DEBUG_FLOW = 0x00000200,
89 I40E_DEBUG_DCB = 0x00000400, 89 I40E_DEBUG_DCB = 0x00000400,
90 I40E_DEBUG_DIAG = 0x00000800, 90 I40E_DEBUG_DIAG = 0x00000800,
91 I40E_DEBUG_FD = 0x00001000,
91 92
92 I40E_DEBUG_AQ_MESSAGE = 0x01000000, 93 I40E_DEBUG_AQ_MESSAGE = 0x01000000,
93 I40E_DEBUG_AQ_DESCRIPTOR = 0x02000000, 94 I40E_DEBUG_AQ_DESCRIPTOR = 0x02000000,
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf.h b/drivers/net/ethernet/intel/i40evf/i40evf.h
index ccb43d343543..807807d62387 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf.h
+++ b/drivers/net/ethernet/intel/i40evf/i40evf.h
@@ -211,6 +211,7 @@ struct i40evf_adapter {
211#define I40EVF_FLAG_NEED_LINK_UPDATE (u32)(1 << 7) 211#define I40EVF_FLAG_NEED_LINK_UPDATE (u32)(1 << 7)
212#define I40EVF_FLAG_PF_COMMS_FAILED (u32)(1 << 8) 212#define I40EVF_FLAG_PF_COMMS_FAILED (u32)(1 << 8)
213#define I40EVF_FLAG_RESET_PENDING (u32)(1 << 9) 213#define I40EVF_FLAG_RESET_PENDING (u32)(1 << 9)
214#define I40EVF_FLAG_RESET_NEEDED (u32)(1 << 10)
214/* duplcates for common code */ 215/* duplcates for common code */
215#define I40E_FLAG_FDIR_ATR_ENABLED 0 216#define I40E_FLAG_FDIR_ATR_ENABLED 0
216#define I40E_FLAG_DCB_ENABLED 0 217#define I40E_FLAG_DCB_ENABLED 0
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index d3eafa320ba9..51c84c19d2be 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -169,9 +169,7 @@ static void i40evf_tx_timeout(struct net_device *netdev)
169 adapter->tx_timeout_count++; 169 adapter->tx_timeout_count++;
170 dev_info(&adapter->pdev->dev, "TX timeout detected.\n"); 170 dev_info(&adapter->pdev->dev, "TX timeout detected.\n");
171 if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING)) { 171 if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING)) {
172 dev_info(&adapter->pdev->dev, "Requesting reset from PF\n"); 172 adapter->flags |= I40EVF_FLAG_RESET_NEEDED;
173 i40evf_request_reset(adapter);
174 adapter->flags |= I40EVF_FLAG_RESET_PENDING;
175 schedule_work(&adapter->reset_task); 173 schedule_work(&adapter->reset_task);
176 } 174 }
177} 175}
@@ -1484,6 +1482,12 @@ static void i40evf_reset_task(struct work_struct *work)
1484 while (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK, 1482 while (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK,
1485 &adapter->crit_section)) 1483 &adapter->crit_section))
1486 udelay(500); 1484 udelay(500);
1485
1486 if (adapter->flags & I40EVF_FLAG_RESET_NEEDED) {
1487 dev_info(&adapter->pdev->dev, "Requesting reset from PF\n");
1488 i40evf_request_reset(adapter);
1489 }
1490
1487 /* poll until we see the reset actually happen */ 1491 /* poll until we see the reset actually happen */
1488 for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) { 1492 for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) {
1489 rstat_val = rd32(hw, I40E_VFGEN_RSTAT) & 1493 rstat_val = rd32(hw, I40E_VFGEN_RSTAT) &
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
index 411b213c63be..7fbe1e925143 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -492,7 +492,8 @@ struct igb_adapter {
492enum e1000_state_t { 492enum e1000_state_t {
493 __IGB_TESTING, 493 __IGB_TESTING,
494 __IGB_RESETTING, 494 __IGB_RESETTING,
495 __IGB_DOWN 495 __IGB_DOWN,
496 __IGB_PTP_TX_IN_PROGRESS,
496}; 497};
497 498
498enum igb_boards { 499enum igb_boards {
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index cd20409858d1..55fc5596e2d0 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -4980,12 +4980,11 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
4980 first->bytecount = skb->len; 4980 first->bytecount = skb->len;
4981 first->gso_segs = 1; 4981 first->gso_segs = 1;
4982 4982
4983 skb_tx_timestamp(skb);
4984
4985 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) { 4983 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
4986 struct igb_adapter *adapter = netdev_priv(tx_ring->netdev); 4984 struct igb_adapter *adapter = netdev_priv(tx_ring->netdev);
4987 4985
4988 if (!(adapter->ptp_tx_skb)) { 4986 if (!test_and_set_bit_lock(__IGB_PTP_TX_IN_PROGRESS,
4987 &adapter->state)) {
4989 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; 4988 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
4990 tx_flags |= IGB_TX_FLAGS_TSTAMP; 4989 tx_flags |= IGB_TX_FLAGS_TSTAMP;
4991 4990
@@ -4996,6 +4995,8 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
4996 } 4995 }
4997 } 4996 }
4998 4997
4998 skb_tx_timestamp(skb);
4999
4999 if (vlan_tx_tag_present(skb)) { 5000 if (vlan_tx_tag_present(skb)) {
5000 tx_flags |= IGB_TX_FLAGS_VLAN; 5001 tx_flags |= IGB_TX_FLAGS_VLAN;
5001 tx_flags |= (vlan_tx_tag_get(skb) << IGB_TX_FLAGS_VLAN_SHIFT); 5002 tx_flags |= (vlan_tx_tag_get(skb) << IGB_TX_FLAGS_VLAN_SHIFT);
diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
index da55fbb090b2..2cca8fd5e574 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -387,6 +387,7 @@ static void igb_ptp_tx_work(struct work_struct *work)
387 IGB_PTP_TX_TIMEOUT)) { 387 IGB_PTP_TX_TIMEOUT)) {
388 dev_kfree_skb_any(adapter->ptp_tx_skb); 388 dev_kfree_skb_any(adapter->ptp_tx_skb);
389 adapter->ptp_tx_skb = NULL; 389 adapter->ptp_tx_skb = NULL;
390 clear_bit_unlock(__IGB_PTP_TX_IN_PROGRESS, &adapter->state);
390 adapter->tx_hwtstamp_timeouts++; 391 adapter->tx_hwtstamp_timeouts++;
391 dev_warn(&adapter->pdev->dev, "clearing Tx timestamp hang"); 392 dev_warn(&adapter->pdev->dev, "clearing Tx timestamp hang");
392 return; 393 return;
@@ -480,6 +481,7 @@ static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter)
480 skb_tstamp_tx(adapter->ptp_tx_skb, &shhwtstamps); 481 skb_tstamp_tx(adapter->ptp_tx_skb, &shhwtstamps);
481 dev_kfree_skb_any(adapter->ptp_tx_skb); 482 dev_kfree_skb_any(adapter->ptp_tx_skb);
482 adapter->ptp_tx_skb = NULL; 483 adapter->ptp_tx_skb = NULL;
484 clear_bit_unlock(__IGB_PTP_TX_IN_PROGRESS, &adapter->state);
483} 485}
484 486
485/** 487/**
@@ -857,6 +859,7 @@ void igb_ptp_stop(struct igb_adapter *adapter)
857 if (adapter->ptp_tx_skb) { 859 if (adapter->ptp_tx_skb) {
858 dev_kfree_skb_any(adapter->ptp_tx_skb); 860 dev_kfree_skb_any(adapter->ptp_tx_skb);
859 adapter->ptp_tx_skb = NULL; 861 adapter->ptp_tx_skb = NULL;
862 clear_bit_unlock(__IGB_PTP_TX_IN_PROGRESS, &adapter->state);
860 } 863 }
861 864
862 if (adapter->ptp_clock) { 865 if (adapter->ptp_clock) {