Skip to content

Commit c8c3d7e

Browse files
committed
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 <[email protected]>
2 parents 2405e8f + ed4420a commit c8c3d7e

File tree

16 files changed

+131
-61
lines changed

16 files changed

+131
-61
lines changed

drivers/net/ethernet/intel/e1000e/e1000.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ struct e1000_adapter {
262262
u32 tx_head_addr;
263263
u32 tx_fifo_size;
264264
u32 tx_dma_failed;
265+
u32 tx_hwtstamp_timeouts;
265266

266267
/* Rx */
267268
bool (*clean_rx) (struct e1000_ring *ring, int *work_done,
@@ -334,6 +335,7 @@ struct e1000_adapter {
334335
struct hwtstamp_config hwtstamp_config;
335336
struct delayed_work systim_overflow_work;
336337
struct sk_buff *tx_hwtstamp_skb;
338+
unsigned long tx_hwtstamp_start;
337339
struct work_struct tx_hwtstamp_work;
338340
spinlock_t systim_lock; /* protects SYSTIML/H regsters */
339341
struct cyclecounter cc;

drivers/net/ethernet/intel/e1000e/ethtool.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ static const struct e1000_stats e1000_gstrings_stats[] = {
104104
E1000_STAT("rx_hwtstamp_cleared", rx_hwtstamp_cleared),
105105
E1000_STAT("uncorr_ecc_errors", uncorr_errors),
106106
E1000_STAT("corr_ecc_errors", corr_errors),
107+
E1000_STAT("tx_hwtstamp_timeouts", tx_hwtstamp_timeouts),
107108
};
108109

109110
#define E1000_GLOBAL_STATS_LEN ARRAY_SIZE(e1000_gstrings_stats)

drivers/net/ethernet/intel/e1000e/netdev.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,9 +1148,6 @@ static void e1000e_tx_hwtstamp_work(struct work_struct *work)
11481148
tx_hwtstamp_work);
11491149
struct e1000_hw *hw = &adapter->hw;
11501150

1151-
if (!adapter->tx_hwtstamp_skb)
1152-
return;
1153-
11541151
if (er32(TSYNCTXCTL) & E1000_TSYNCTXCTL_VALID) {
11551152
struct skb_shared_hwtstamps shhwtstamps;
11561153
u64 txstmp;
@@ -1163,6 +1160,12 @@ static void e1000e_tx_hwtstamp_work(struct work_struct *work)
11631160
skb_tstamp_tx(adapter->tx_hwtstamp_skb, &shhwtstamps);
11641161
dev_kfree_skb_any(adapter->tx_hwtstamp_skb);
11651162
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");
11661169
} else {
11671170
/* reschedule to check later */
11681171
schedule_work(&adapter->tx_hwtstamp_work);
@@ -5567,6 +5570,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
55675570
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
55685571
tx_flags |= E1000_TX_FLAGS_HWTSTAMP;
55695572
adapter->tx_hwtstamp_skb = skb_get(skb);
5573+
adapter->tx_hwtstamp_start = jiffies;
55705574
schedule_work(&adapter->tx_hwtstamp_work);
55715575
} else {
55725576
skb_tx_timestamp(skb);

drivers/net/ethernet/intel/i40e/i40e.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ enum i40e_state_t {
136136
__I40E_EMP_RESET_REQUESTED,
137137
__I40E_FILTER_OVERFLOW_PROMISC,
138138
__I40E_SUSPENDED,
139+
__I40E_BAD_EEPROM,
139140
};
140141

141142
enum i40e_interrupt_policy {

drivers/net/ethernet/intel/i40e/i40e_debugfs.c

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,9 +2087,13 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp,
20872087
if (!vsi) {
20882088
dev_info(&pf->pdev->dev,
20892089
"tx_timeout: VSI %d not found\n", vsi_seid);
2090-
goto netdev_ops_write_done;
2091-
}
2092-
if (rtnl_trylock()) {
2090+
} else if (!vsi->netdev) {
2091+
dev_info(&pf->pdev->dev, "tx_timeout: no netdev for VSI %d\n",
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()) {
20932097
vsi->netdev->netdev_ops->ndo_tx_timeout(vsi->netdev);
20942098
rtnl_unlock();
20952099
dev_info(&pf->pdev->dev, "tx_timeout called\n");
@@ -2108,9 +2112,10 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp,
21082112
if (!vsi) {
21092113
dev_info(&pf->pdev->dev,
21102114
"change_mtu: VSI %d not found\n", vsi_seid);
2111-
goto netdev_ops_write_done;
2112-
}
2113-
if (rtnl_trylock()) {
2115+
} else if (!vsi->netdev) {
2116+
dev_info(&pf->pdev->dev, "change_mtu: no netdev for VSI %d\n",
2117+
vsi_seid);
2118+
} else if (rtnl_trylock()) {
21142119
vsi->netdev->netdev_ops->ndo_change_mtu(vsi->netdev,
21152120
mtu);
21162121
rtnl_unlock();
@@ -2129,9 +2134,10 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp,
21292134
if (!vsi) {
21302135
dev_info(&pf->pdev->dev,
21312136
"set_rx_mode: VSI %d not found\n", vsi_seid);
2132-
goto netdev_ops_write_done;
2133-
}
2134-
if (rtnl_trylock()) {
2137+
} else if (!vsi->netdev) {
2138+
dev_info(&pf->pdev->dev, "set_rx_mode: no netdev for VSI %d\n",
2139+
vsi_seid);
2140+
} else if (rtnl_trylock()) {
21352141
vsi->netdev->netdev_ops->ndo_set_rx_mode(vsi->netdev);
21362142
rtnl_unlock();
21372143
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,
21492155
if (!vsi) {
21502156
dev_info(&pf->pdev->dev, "napi: VSI %d not found\n",
21512157
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");
21532165
}
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");
21572166
} else {
21582167
dev_info(&pf->pdev->dev, "unknown command '%s'\n",
21592168
i40e_dbg_netdev_ops_buf);

drivers/net/ethernet/intel/i40e/i40e_ethtool.c

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ static const struct i40e_stats i40e_gstrings_net_stats[] = {
6262
I40E_NETDEV_STAT(rx_crc_errors),
6363
};
6464

65-
static int i40e_add_del_fdir_ethtool(struct i40e_vsi *vsi,
66-
struct ethtool_rxnfc *cmd, bool add);
65+
static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
66+
struct ethtool_rxnfc *cmd);
6767

6868
/* These PF_STATs might look like duplicates of some NETDEV_STATs,
6969
* but they are separate. This device supports Virtualization, and
@@ -1470,16 +1470,15 @@ static int i40e_del_fdir_entry(struct i40e_vsi *vsi,
14701470
}
14711471

14721472
/**
1473-
* i40e_add_del_fdir_ethtool - Add/Remove Flow Director filters
1473+
* i40e_add_fdir_ethtool - Add/Remove Flow Director filters
14741474
* @vsi: pointer to the targeted VSI
14751475
* @cmd: command to get or set RX flow classification rules
1476-
* @add: true adds a filter, false removes it
14771476
*
1478-
* Add/Remove Flow Director filters for a specific flow spec based on their
1479-
* protocol. Returns 0 if the filters were successfully added or removed.
1477+
* Add Flow Director filters for a specific flow spec based on their
1478+
* protocol. Returns 0 if the filters were successfully added.
14801479
**/
1481-
static int i40e_add_del_fdir_ethtool(struct i40e_vsi *vsi,
1482-
struct ethtool_rxnfc *cmd, bool add)
1480+
static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
1481+
struct ethtool_rxnfc *cmd)
14831482
{
14841483
struct ethtool_rx_flow_spec *fsp;
14851484
struct i40e_fdir_filter *input;
@@ -1494,7 +1493,7 @@ static int i40e_add_del_fdir_ethtool(struct i40e_vsi *vsi,
14941493
if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED))
14951494
return -EOPNOTSUPP;
14961495

1497-
if (add && (pf->auto_disable_flags & I40E_FLAG_FD_SB_ENABLED))
1496+
if (pf->auto_disable_flags & I40E_FLAG_FD_SB_ENABLED)
14981497
return -ENOSPC;
14991498

15001499
fsp = (struct ethtool_rx_flow_spec *)&cmd->fs;
@@ -1504,7 +1503,7 @@ static int i40e_add_del_fdir_ethtool(struct i40e_vsi *vsi,
15041503
return -EINVAL;
15051504
}
15061505

1507-
if ((fsp->ring_cookie >= vsi->num_queue_pairs) && add)
1506+
if (fsp->ring_cookie >= vsi->num_queue_pairs)
15081507
return -EINVAL;
15091508

15101509
input = kzalloc(sizeof(*input), GFP_KERNEL);
@@ -1514,11 +1513,16 @@ static int i40e_add_del_fdir_ethtool(struct i40e_vsi *vsi,
15141513

15151514
input->fd_id = fsp->location;
15161515

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+
15171522
input->q_index = fsp->ring_cookie;
15181523
input->flex_off = 0;
15191524
input->pctype = 0;
15201525
input->dest_vsi = vsi->id;
1521-
input->dest_ctl = I40E_FILTER_PROGRAM_DESC_DEST_DIRECT_PACKET_QINDEX;
15221526
input->fd_status = I40E_FILTER_PROGRAM_DESC_FD_STATUS_FD_ID;
15231527
input->cnt_index = 0;
15241528
input->flow_type = fsp->flow_type;
@@ -1528,16 +1532,11 @@ static int i40e_add_del_fdir_ethtool(struct i40e_vsi *vsi,
15281532
input->src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src;
15291533
input->dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst;
15301534

1531-
ret = i40e_add_del_fdir(vsi, input, add);
1532-
if (ret) {
1535+
ret = i40e_add_del_fdir(vsi, input, true);
1536+
if (ret)
15331537
kfree(input);
1534-
return ret;
1535-
}
1536-
1537-
if (!ret && add)
1538-
i40e_update_ethtool_fdir_entry(vsi, input, fsp->location, NULL);
15391538
else
1540-
kfree(input);
1539+
i40e_update_ethtool_fdir_entry(vsi, input, fsp->location, NULL);
15411540

15421541
return ret;
15431542
}
@@ -1561,7 +1560,7 @@ static int i40e_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)
15611560
ret = i40e_set_rss_hash_opt(pf, cmd);
15621561
break;
15631562
case ETHTOOL_SRXCLSRLINS:
1564-
ret = i40e_add_del_fdir_ethtool(vsi, cmd, true);
1563+
ret = i40e_add_fdir_ethtool(vsi, cmd);
15651564
break;
15661565
case ETHTOOL_SRXCLSRLDEL:
15671566
ret = i40e_del_fdir_entry(vsi, cmd);

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
/* Local includes */
2828
#include "i40e.h"
29+
#include "i40e_diag.h"
2930
#ifdef CONFIG_I40E_VXLAN
3031
#include <net/vxlan.h>
3132
#endif
@@ -2877,12 +2878,14 @@ static irqreturn_t i40e_intr(int irq, void *data)
28772878
val = rd32(hw, I40E_GLGEN_RSTAT);
28782879
val = (val & I40E_GLGEN_RSTAT_RESET_TYPE_MASK)
28792880
>> I40E_GLGEN_RSTAT_RESET_TYPE_SHIFT;
2880-
if (val == I40E_RESET_CORER)
2881+
if (val == I40E_RESET_CORER) {
28812882
pf->corer_count++;
2882-
else if (val == I40E_RESET_GLOBR)
2883+
} else if (val == I40E_RESET_GLOBR) {
28832884
pf->globr_count++;
2884-
else if (val == I40E_RESET_EMPR)
2885+
} else if (val == I40E_RESET_EMPR) {
28852886
pf->empr_count++;
2887+
set_bit(__I40E_EMP_RESET_REQUESTED, &pf->state);
2888+
}
28862889
}
28872890

28882891
if (icr0 & I40E_PFINT_ICR0_HMC_ERR_MASK) {
@@ -4257,8 +4260,9 @@ static int i40e_open(struct net_device *netdev)
42574260
struct i40e_pf *pf = vsi->back;
42584261
int err;
42594262

4260-
/* disallow open during test */
4261-
if (test_bit(__I40E_TESTING, &pf->state))
4263+
/* disallow open during test or if eeprom is broken */
4264+
if (test_bit(__I40E_TESTING, &pf->state) ||
4265+
test_bit(__I40E_BAD_EEPROM, &pf->state))
42624266
return -EBUSY;
42634267

42644268
netif_carrier_off(netdev);
@@ -5077,6 +5081,31 @@ static void i40e_clean_adminq_subtask(struct i40e_pf *pf)
50775081
kfree(event.msg_buf);
50785082
}
50795083

5084+
/**
5085+
* i40e_verify_eeprom - make sure eeprom is good to use
5086+
* @pf: board private structure
5087+
**/
5088+
static 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+
50805109
/**
50815110
* i40e_reconstitute_veb - rebuild the VEB and anything connected to it
50825111
* @veb: pointer to the VEB instance
@@ -5386,6 +5415,12 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)
53865415
goto end_core_reset;
53875416
}
53885417

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+
53895424
ret = i40e_get_capabilities(pf);
53905425
if (ret) {
53915426
dev_info(&pf->pdev->dev, "i40e_get_capabilities failed, %d\n",
@@ -6111,13 +6146,13 @@ static int i40e_init_msix(struct i40e_pf *pf)
61116146
}
61126147

61136148
/**
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
61156150
* @vsi: the VSI being configured
61166151
* @v_idx: index of the vector in the vsi struct
61176152
*
61186153
* We allocate one q_vector. If allocation fails we return -ENOMEM.
61196154
**/
6120-
static int i40e_alloc_q_vector(struct i40e_vsi *vsi, int v_idx)
6155+
static int i40e_vsi_alloc_q_vector(struct i40e_vsi *vsi, int v_idx)
61216156
{
61226157
struct i40e_q_vector *q_vector;
61236158

@@ -6143,13 +6178,13 @@ static int i40e_alloc_q_vector(struct i40e_vsi *vsi, int v_idx)
61436178
}
61446179

61456180
/**
6146-
* i40e_alloc_q_vectors - Allocate memory for interrupt vectors
6181+
* i40e_vsi_alloc_q_vectors - Allocate memory for interrupt vectors
61476182
* @vsi: the VSI being configured
61486183
*
61496184
* We allocate one q_vector per queue interrupt. If allocation fails we
61506185
* return -ENOMEM.
61516186
**/
6152-
static int i40e_alloc_q_vectors(struct i40e_vsi *vsi)
6187+
static int i40e_vsi_alloc_q_vectors(struct i40e_vsi *vsi)
61536188
{
61546189
struct i40e_pf *pf = vsi->back;
61556190
int v_idx, num_q_vectors;
@@ -6164,7 +6199,7 @@ static int i40e_alloc_q_vectors(struct i40e_vsi *vsi)
61646199
return -EINVAL;
61656200

61666201
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);
61686203
if (err)
61696204
goto err_out;
61706205
}
@@ -7020,7 +7055,7 @@ static int i40e_vsi_setup_vectors(struct i40e_vsi *vsi)
70207055
return -EEXIST;
70217056
}
70227057

7023-
ret = i40e_alloc_q_vectors(vsi);
7058+
ret = i40e_vsi_alloc_q_vectors(vsi);
70247059
if (ret) {
70257060
dev_info(&pf->pdev->dev,
70267061
"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)
81578192
goto err_pf_reset;
81588193
}
81598194

8195+
i40e_verify_eeprom(pf);
8196+
81608197
i40e_clear_pxe_mode(hw);
81618198
err = i40e_get_capabilities(pf);
81628199
if (err)
@@ -8258,7 +8295,8 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
82588295

82598296
/* prep for VF support */
82608297
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)) {
82628300
u32 val;
82638301

82648302
/* disable link interrupts for VFs */

0 commit comments

Comments
 (0)