Skip to content

Commit 0e42aa4

Browse files
committed
Merge branch 'i40e'
Aaron Brown says: ==================== Intel Wired LAN Driver Updates This series contains updates to i40e and i40evf, primarily reset handling / refactoring along with a fair amount of minor cleanup. Jesse fixes some spelling, bumps the version and other trivial fixes. Akeem sets a bit that is needed before shutdown in the case of tx_timeout recovery failure. Mitch refactors reset handling along with a whole bunch of clean up. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 8815cbd + ef8693e commit 0e42aa4

10 files changed

Lines changed: 183 additions & 109 deletions

File tree

‎drivers/net/ethernet/intel/i40e/i40e_adminq.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,9 +647,8 @@ static u16 i40e_clean_asq(struct i40e_hw *hw)
647647
desc_cb = *desc;
648648
cb_func(hw, &desc_cb);
649649
}
650-
memset((void *)desc, 0, sizeof(struct i40e_aq_desc));
651-
memset((void *)details, 0,
652-
sizeof(struct i40e_asq_cmd_details));
650+
memset(desc, 0, sizeof(*desc));
651+
memset(details, 0, sizeof(*details));
653652
ntc++;
654653
if (ntc == asq->count)
655654
ntc = 0;

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

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static const char i40e_driver_string[] =
3838

3939
#define DRV_VERSION_MAJOR 0
4040
#define DRV_VERSION_MINOR 3
41-
#define DRV_VERSION_BUILD 30
41+
#define DRV_VERSION_BUILD 31
4242
#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
4343
__stringify(DRV_VERSION_MINOR) "." \
4444
__stringify(DRV_VERSION_BUILD) DRV_KERN
@@ -305,6 +305,7 @@ static void i40e_tx_timeout(struct net_device *netdev)
305305
break;
306306
default:
307307
netdev_err(netdev, "tx_timeout recovery unsuccessful\n");
308+
set_bit(__I40E_DOWN, &vsi->state);
308309
i40e_down(vsi);
309310
break;
310311
}
@@ -5331,6 +5332,11 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)
53315332
/* restart the VSIs that were rebuilt and running before the reset */
53325333
i40e_pf_unquiesce_all_vsi(pf);
53335334

5335+
if (pf->num_alloc_vfs) {
5336+
for (v = 0; v < pf->num_alloc_vfs; v++)
5337+
i40e_reset_vf(&pf->vf[v], true);
5338+
}
5339+
53345340
/* tell the firmware that we're starting */
53355341
dv.major_version = DRV_VERSION_MAJOR;
53365342
dv.minor_version = DRV_VERSION_MINOR;
@@ -8070,6 +8076,16 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
80708076
val &= ~I40E_PFGEN_PORTMDIO_NUM_VFLINK_STAT_ENA_MASK;
80718077
wr32(hw, I40E_PFGEN_PORTMDIO_NUM, val);
80728078
i40e_flush(hw);
8079+
8080+
if (pci_num_vf(pdev)) {
8081+
dev_info(&pdev->dev,
8082+
"Active VFs found, allocating resources.\n");
8083+
err = i40e_alloc_vfs(pf, pci_num_vf(pdev));
8084+
if (err)
8085+
dev_info(&pdev->dev,
8086+
"Error %d allocating resources for existing VFs\n",
8087+
err);
8088+
}
80738089
}
80748090

80758091
pfs_found++;
@@ -8165,16 +8181,16 @@ static void i40e_remove(struct pci_dev *pdev)
81658181

81668182
i40e_ptp_stop(pf);
81678183

8168-
if (pf->flags & I40E_FLAG_SRIOV_ENABLED) {
8169-
i40e_free_vfs(pf);
8170-
pf->flags &= ~I40E_FLAG_SRIOV_ENABLED;
8171-
}
8172-
81738184
/* no more scheduling of any task */
81748185
set_bit(__I40E_DOWN, &pf->state);
81758186
del_timer_sync(&pf->service_timer);
81768187
cancel_work_sync(&pf->service_task);
81778188

8189+
if (pf->flags & I40E_FLAG_SRIOV_ENABLED) {
8190+
i40e_free_vfs(pf);
8191+
pf->flags &= ~I40E_FLAG_SRIOV_ENABLED;
8192+
}
8193+
81788194
i40e_fdir_teardown(pf);
81798195

81808196
/* If there is a switch structure or any orphans, remove them.

‎drivers/net/ethernet/intel/i40e/i40e_txrx.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
892892
rx_status & (1 << I40E_RX_DESC_STATUS_L3L4P_SHIFT)))
893893
return;
894894

895-
/* likely incorrect csum if alternate IP extention headers found */
895+
/* likely incorrect csum if alternate IP extension headers found */
896896
if (rx_status & (1 << I40E_RX_DESC_STATUS_IPV6EXADD_SHIFT))
897897
return;
898898

‎drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c‎

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -408,18 +408,10 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, enum i40e_vsi_type type)
408408
"Could not allocate VF broadcast filter\n");
409409
}
410410

411-
if (!f) {
412-
dev_err(&pf->pdev->dev, "Unable to add ucast filter\n");
413-
ret = -ENOMEM;
414-
goto error_alloc_vsi_res;
415-
}
416-
417411
/* program mac filter */
418412
ret = i40e_sync_vsi_filters(vsi);
419-
if (ret) {
413+
if (ret)
420414
dev_err(&pf->pdev->dev, "Unable to program ucast filters\n");
421-
goto error_alloc_vsi_res;
422-
}
423415

424416
error_alloc_vsi_res:
425417
return ret;
@@ -682,6 +674,7 @@ void i40e_reset_vf(struct i40e_vf *vf, bool flr)
682674
mdelay(10);
683675
i40e_alloc_vf_res(vf);
684676
i40e_enable_vf_mappings(vf);
677+
set_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states);
685678

686679
/* tell the VF the reset is done */
687680
wr32(hw, I40E_VFGEN_RSTAT1(vf->vf_id), I40E_VFR_VFACTIVE);
@@ -847,22 +840,24 @@ void i40e_free_vfs(struct i40e_pf *pf)
847840
*
848841
* allocate vf resources
849842
**/
850-
static int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs)
843+
int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs)
851844
{
852845
struct i40e_vf *vfs;
853846
int i, ret = 0;
854847

855848
/* Disable interrupt 0 so we don't try to handle the VFLR. */
856849
i40e_irq_dynamic_disable_icr0(pf);
857850

858-
ret = pci_enable_sriov(pf->pdev, num_alloc_vfs);
859-
if (ret) {
860-
dev_err(&pf->pdev->dev,
861-
"pci_enable_sriov failed with error %d!\n", ret);
862-
pf->num_alloc_vfs = 0;
863-
goto err_iov;
851+
/* Check to see if we're just allocating resources for extant VFs */
852+
if (pci_num_vf(pf->pdev) != num_alloc_vfs) {
853+
ret = pci_enable_sriov(pf->pdev, num_alloc_vfs);
854+
if (ret) {
855+
dev_err(&pf->pdev->dev,
856+
"Failed to enable SR-IOV, error %d.\n", ret);
857+
pf->num_alloc_vfs = 0;
858+
goto err_iov;
859+
}
864860
}
865-
866861
/* allocate memory */
867862
vfs = kzalloc(num_alloc_vfs * sizeof(struct i40e_vf), GFP_KERNEL);
868863
if (!vfs) {
@@ -1873,7 +1868,8 @@ int i40e_vc_process_vflr_event(struct i40e_pf *pf)
18731868
/* clear the bit in GLGEN_VFLRSTAT */
18741869
wr32(hw, I40E_GLGEN_VFLRSTAT(reg_idx), (1 << bit_idx));
18751870

1876-
i40e_reset_vf(vf, true);
1871+
if (!test_bit(__I40E_DOWN, &pf->state))
1872+
i40e_reset_vf(vf, true);
18771873
}
18781874
}
18791875

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ struct i40e_vf {
102102

103103
void i40e_free_vfs(struct i40e_pf *pf);
104104
int i40e_pci_sriov_configure(struct pci_dev *dev, int num_vfs);
105+
int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs);
105106
int i40e_vc_process_vf_msg(struct i40e_pf *pf, u16 vf_id, u32 v_opcode,
106107
u32 v_retval, u8 *msg, u16 msglen);
107108
int i40e_vc_process_vflr_event(struct i40e_pf *pf);

‎drivers/net/ethernet/intel/i40evf/i40e_txrx.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*******************************************************************************
22
*
33
* Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
4-
* Copyright(c) 2013 Intel Corporation.
4+
* Copyright(c) 2013 - 2014 Intel Corporation.
55
*
66
* This program is free software; you can redistribute it and/or modify it
77
* under the terms and conditions of the GNU General Public License,
@@ -722,7 +722,7 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
722722
rx_status & (1 << I40E_RX_DESC_STATUS_L3L4P_SHIFT)))
723723
return;
724724

725-
/* likely incorrect csum if alternate IP extention headers found */
725+
/* likely incorrect csum if alternate IP extension headers found */
726726
if (rx_status & (1 << I40E_RX_DESC_STATUS_IPV6EXADD_SHIFT))
727727
return;
728728

@@ -807,8 +807,8 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)
807807

808808
rx_desc = I40E_RX_DESC(rx_ring, i);
809809
qword = le64_to_cpu(rx_desc->wb.qword1.status_error_len);
810-
rx_status = (qword & I40E_RXD_QW1_STATUS_MASK)
811-
>> I40E_RXD_QW1_STATUS_SHIFT;
810+
rx_status = (qword & I40E_RXD_QW1_STATUS_MASK) >>
811+
I40E_RXD_QW1_STATUS_SHIFT;
812812

813813
while (rx_status & (1 << I40E_RX_DESC_STATUS_DD_SHIFT)) {
814814
union i40e_rx_desc *next_rxd;

‎drivers/net/ethernet/intel/i40evf/i40e_type.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*******************************************************************************
22
*
33
* Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
4-
* Copyright(c) 2013 Intel Corporation.
4+
* Copyright(c) 2013 - 2014 Intel Corporation.
55
*
66
* This program is free software; you can redistribute it and/or modify it
77
* under the terms and conditions of the GNU General Public License,
@@ -64,8 +64,6 @@
6464
struct i40e_hw;
6565
typedef void (*I40E_ADMINQ_CALLBACK)(struct i40e_hw *, struct i40e_aq_desc *);
6666

67-
#define ETH_ALEN 6
68-
6967
/* Data type manipulation macros. */
7068

7169
#define I40E_DESC_UNUSED(R) \

‎drivers/net/ethernet/intel/i40evf/i40evf.h‎

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*******************************************************************************
22
*
33
* Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
4-
* Copyright(c) 2013 Intel Corporation.
4+
* Copyright(c) 2013 - 2014 Intel Corporation.
55
*
66
* This program is free software; you can redistribute it and/or modify it
77
* under the terms and conditions of the GNU General Public License,
@@ -164,15 +164,14 @@ struct i40evf_vlan_filter {
164164
/* Driver state. The order of these is important! */
165165
enum i40evf_state_t {
166166
__I40EVF_STARTUP, /* driver loaded, probe complete */
167-
__I40EVF_FAILED, /* PF communication failed. Fatal. */
168167
__I40EVF_REMOVE, /* driver is being unloaded */
169168
__I40EVF_INIT_VERSION_CHECK, /* aq msg sent, awaiting reply */
170169
__I40EVF_INIT_GET_RESOURCES, /* aq msg sent, awaiting reply */
171170
__I40EVF_INIT_SW, /* got resources, setting up structs */
171+
__I40EVF_RESETTING, /* in reset */
172172
/* Below here, watchdog is running */
173173
__I40EVF_DOWN, /* ready, can be opened */
174174
__I40EVF_TESTING, /* in ethtool self-test */
175-
__I40EVF_RESETTING, /* in reset */
176175
__I40EVF_RUNNING, /* opened, working */
177176
};
178177

@@ -185,47 +184,27 @@ enum i40evf_critical_section_t {
185184
/* board specific private data structure */
186185
struct i40evf_adapter {
187186
struct timer_list watchdog_timer;
188-
struct vlan_group *vlgrp;
189187
struct work_struct reset_task;
190188
struct work_struct adminq_task;
191189
struct delayed_work init_task;
192190
struct i40e_q_vector *q_vector[MAX_MSIX_Q_VECTORS];
193191
struct list_head vlan_filter_list;
194-
char name[MAX_MSIX_COUNT][IFNAMSIZ + 9];
195-
196-
/* Interrupt Throttle Rate */
197-
u32 itr_setting;
198-
u16 eitr_low;
199-
u16 eitr_high;
192+
char misc_vector_name[IFNAMSIZ + 9];
200193

201194
/* TX */
202195
struct i40e_ring *tx_rings[I40E_MAX_VSI_QP];
203-
u64 restart_queue;
204-
u64 hw_csum_tx_good;
205-
u64 lsc_int;
206-
u64 hw_tso_ctxt;
207-
u64 hw_tso6_ctxt;
208196
u32 tx_timeout_count;
209197
struct list_head mac_filter_list;
210-
#ifdef DEBUG
211-
bool detect_tx_hung;
212-
#endif /* DEBUG */
213198

214199
/* RX */
215200
struct i40e_ring *rx_rings[I40E_MAX_VSI_QP];
216201
int txd_count;
217202
int rxd_count;
218203
u64 hw_csum_rx_error;
219-
u64 hw_rx_no_dma_resources;
220-
u64 hw_csum_rx_good;
221-
u64 non_eop_descs;
222204
int num_msix_vectors;
223205
struct msix_entry *msix_entries;
224206

225-
u64 rx_hdr_split;
226-
227-
u32 init_state;
228-
volatile unsigned long flags;
207+
u32 flags;
229208
#define I40EVF_FLAG_RX_CSUM_ENABLED (u32)(1)
230209
#define I40EVF_FLAG_RX_1BUF_CAPABLE (u32)(1 << 1)
231210
#define I40EVF_FLAG_RX_PS_CAPABLE (u32)(1 << 2)
@@ -234,6 +213,8 @@ struct i40evf_adapter {
234213
#define I40EVF_FLAG_IMIR_ENABLED (u32)(1 << 5)
235214
#define I40EVF_FLAG_MQ_CAPABLE (u32)(1 << 6)
236215
#define I40EVF_FLAG_NEED_LINK_UPDATE (u32)(1 << 7)
216+
#define I40EVF_FLAG_PF_COMMS_FAILED (u32)(1 << 8)
217+
#define I40EVF_FLAG_RESET_PENDING (u32)(1 << 9)
237218
/* duplcates for common code */
238219
#define I40E_FLAG_FDIR_ATR_ENABLED 0
239220
#define I40E_FLAG_DCB_ENABLED 0
@@ -251,21 +232,19 @@ struct i40evf_adapter {
251232
#define I40EVF_FLAG_AQ_CONFIGURE_QUEUES (u32)(1 << 6)
252233
#define I40EVF_FLAG_AQ_MAP_VECTORS (u32)(1 << 7)
253234
#define I40EVF_FLAG_AQ_HANDLE_RESET (u32)(1 << 8)
235+
254236
/* OS defined structs */
255237
struct net_device *netdev;
256238
struct pci_dev *pdev;
257239
struct net_device_stats net_stats;
258240

259-
/* structs defined in i40e_vf.h */
260-
struct i40e_hw hw;
241+
struct i40e_hw hw; /* defined in i40e_type.h */
261242

262243
enum i40evf_state_t state;
263244
volatile unsigned long crit_section;
264-
u64 tx_busy;
265245

266246
struct work_struct watchdog_task;
267247
bool netdev_registered;
268-
bool dev_closed;
269248
bool link_up;
270249
enum i40e_virtchnl_ops current_op;
271250
struct i40e_virtchnl_vf_resource *vf_res; /* incl. all VSIs */
@@ -276,11 +255,6 @@ struct i40evf_adapter {
276255
u32 aq_wait_count;
277256
};
278257

279-
struct i40evf_info {
280-
enum i40e_mac_type mac;
281-
unsigned int flags;
282-
};
283-
284258

285259
/* needed by i40evf_ethtool.c */
286260
extern char i40evf_driver_name[];

0 commit comments

Comments
 (0)