Skip to contentSkip to conversation

Intel Wired LAN Driver Updates

PATCH In review Aaron Brown 2 participants 17 messages Feb 13, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover 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.

Jesse Brandeburg (3):
i40e: spelling error
i40e: bump driver version
i40evf: trivial fixes

Akeem G Abodunrin (1):
i40e: Setting i40e_down bit for tx_timeout

Mitch Williams (11):
i40evf: clean up memsets
i40e: remove dead code
i40e: set VF state to active when reset is complete
i40e: reset VFs after PF reset
i40e: enable extant VFs
i40e: don't handle VF reset on unload
i40evf: clean up adapter struct
i40evf: fix bogus comment
i40evf: don't store unnecessary array of strings
i40evf: change type of flags variable
i40evf: refactor reset handling

 drivers/net/ethernet/intel/i40e/i40e_adminq.c      |   5 +-
 drivers/net/ethernet/intel/i40e/i40e_main.c        |  28 +++-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c        |   2 +-
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |  32 ++---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h |   1 +
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c      |   8 +-
 drivers/net/ethernet/intel/i40evf/i40e_type.h      |   4 +-
 drivers/net/ethernet/intel/i40evf/i40evf.h         |  42 ++----
 drivers/net/ethernet/intel/i40evf/i40evf_main.c    | 155 ++++++++++++++++-----
 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    |  15 +-
 10 files changed, 183 insertions(+), 109 deletions(-)
Signature · 1 line
1.8.5.GIT
#1 lore raw

PATCH 1/15 i40e: spelling error

From: Jesse Brandeburg <[email protected]>

Fix a spelling error, s/extention/extension/.

---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c   | 2 +-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +1 -1
index d4bb482..19af4ce 100644
@@ -892,7 +892,7 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
 	      rx_status & (1 << I40E_RX_DESC_STATUS_L3L4P_SHIFT)))
 		return;
 
-	/* likely incorrect csum if alternate IP extention headers found */
+	/* likely incorrect csum if alternate IP extension headers found */
 	if (rx_status & (1 << I40E_RX_DESC_STATUS_IPV6EXADD_SHIFT))
 		return;
 
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +1 -1
index ffdb01d..3bb7558 100644
@@ -722,7 +722,7 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
 	      rx_status & (1 << I40E_RX_DESC_STATUS_L3L4P_SHIFT)))
 		return;
 
-	/* likely incorrect csum if alternate IP extention headers found */
+	/* likely incorrect csum if alternate IP extension headers found */
 	if (rx_status & (1 << I40E_RX_DESC_STATUS_IPV6EXADD_SHIFT))
 		return;
 
Signature · 1 line
1.8.5.GIT
#2 lore raw

PATCH 2/15 i40e: bump driver version

In reply to Aaron Brown

From: Jesse Brandeburg <[email protected]>

Update the driver version to 0.3.31-k.

---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
index b901371..f596f74c 100644
@@ -38,7 +38,7 @@ static const char i40e_driver_string[] =
 
 #define DRV_VERSION_MAJOR 0
 #define DRV_VERSION_MINOR 3
-#define DRV_VERSION_BUILD 30
+#define DRV_VERSION_BUILD 31
 #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
 	     __stringify(DRV_VERSION_MINOR) "." \
 	     __stringify(DRV_VERSION_BUILD)    DRV_KERN
Signature · 1 line
1.8.5.GIT
#3 lore raw

PATCH 3/15 i40evf: trivial fixes

In reply to Aaron Brown

From: Jesse Brandeburg <[email protected]>

This change moves one operator up to the previous line and deletes the duplicate declaration of ETH_ALEN.

Also update copyrights.

Change-ID I88de73093b584e0f3b29d481ccd83fc4b1a1afa5
---
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 6 +++---
 drivers/net/ethernet/intel/i40evf/i40e_type.h | 4 +---
 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +3 -3
index 3bb7558..827bb5f 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
- * Copyright(c) 2013 Intel Corporation.
+ * Copyright(c) 2013 - 2014 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -807,8 +807,8 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)
 
 	rx_desc = I40E_RX_DESC(rx_ring, i);
 	qword = le64_to_cpu(rx_desc->wb.qword1.status_error_len);
-	rx_status = (qword & I40E_RXD_QW1_STATUS_MASK)
-				>> I40E_RXD_QW1_STATUS_SHIFT;
+	rx_status = (qword & I40E_RXD_QW1_STATUS_MASK) >>
+		    I40E_RXD_QW1_STATUS_SHIFT;
 
 	while (rx_status & (1 << I40E_RX_DESC_STATUS_DD_SHIFT)) {
 		union i40e_rx_desc *next_rxd;
drivers/net/ethernet/intel/i40evf/i40e_type.h +1 -3
index 3bffac0..092aace 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
- * Copyright(c) 2013 Intel Corporation.
+ * Copyright(c) 2013 - 2014 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -64,8 +64,6 @@
 struct i40e_hw;
 typedef void (*I40E_ADMINQ_CALLBACK)(struct i40e_hw *, struct i40e_aq_desc *);
 
-#define ETH_ALEN	6
-
 /* Data type manipulation macros. */
 
 #define I40E_DESC_UNUSED(R)	\
Signature · 1 line
1.8.5.GIT
#4 lore raw

PATCH 4/15 i40evf: clean up memsets

In reply to Aaron Brown

From: Mitch Williams <[email protected]>

As politely pointed out by Dave Miller, calls to memset do not need a void pointer cast. Additionally, it is preferred to use sizeof(*the actual object) instead of sizeof(type).

Change-ID Id6a02429b7040111531f3865ea03fbe619167cb3
---
 drivers/net/ethernet/intel/i40e/i40e_adminq.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_adminq.c +2 -3
index a50e6b3..ed3902b 100644
@@ -647,9 +647,8 @@ static u16 i40e_clean_asq(struct i40e_hw *hw)
 			desc_cb = *desc;
 			cb_func(hw, &desc_cb);
 		}
-		memset((void *)desc, 0, sizeof(struct i40e_aq_desc));
-		memset((void *)details, 0,
-		       sizeof(struct i40e_asq_cmd_details));
+		memset(desc, 0, sizeof(*desc));
+		memset(details, 0, sizeof(*details));
 		ntc++;
 		if (ntc == asq->count)
 			ntc = 0;
Signature · 1 line
1.8.5.GIT
#5 lore raw

PATCH 5/15 i40e: Setting i40e_down bit for tx_timeout

In reply to Aaron Brown

From: Akeem G Abodunrin <[email protected]>

If tx_timeout recovery failed, then it becomes necessary to set i40e_down bit before actually shutdown the connection.

Change-ID Iaac81df0e302116571827aa0cff450697fbb7fa3
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -0
index f596f74c..8e44411 100644
@@ -305,6 +305,7 @@ static void i40e_tx_timeout(struct net_device *netdev)
 		break;
 	default:
 		netdev_err(netdev, "tx_timeout recovery unsuccessful\n");
+		set_bit(__I40E_DOWN, &vsi->state);
 		i40e_down(vsi);
 		break;
 	}
Signature · 1 line
1.8.5.GIT
#6 lore raw

PATCH 6/15 i40e: remove dead code

In reply to Aaron Brown

From: Mitch Williams <[email protected]>

This looks like a cut and paste error. The code makes no sense where it is, and accomplishes nothing. Since we've removed the goto, we can also get rid of the extraneous brackets.

Change-ID I9315e3eafeee0a5713c94b0dc57b58b60a849124
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1 -9
index b9d1c1c..299372b 100644
@@ -408,18 +408,10 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, enum i40e_vsi_type type)
 				 "Could not allocate VF broadcast filter\n");
 	}
 
-	if (!f) {
-		dev_err(&pf->pdev->dev, "Unable to add ucast filter\n");
-		ret = -ENOMEM;
-		goto error_alloc_vsi_res;
-	}
-
 	/* program mac filter */
 	ret = i40e_sync_vsi_filters(vsi);
-	if (ret) {
+	if (ret)
 		dev_err(&pf->pdev->dev, "Unable to program ucast filters\n");
-		goto error_alloc_vsi_res;
-	}
 
 error_alloc_vsi_res:
 	return ret;
Signature · 1 line
1.8.5.GIT
#7 lore raw

PATCH 7/15 i40e: set VF state to active when reset is complete

In reply to Aaron Brown

From: Mitch Williams <[email protected]>

Without this, the VF can never communicate with the PF after a VF reset.

Change-ID I8d10f1d0d0638d50d39f0aff263422e05d83ad83
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1 -0
index 299372b..052be06 100644
@@ -674,6 +674,7 @@ complete_reset:
 	mdelay(10);
 	i40e_alloc_vf_res(vf);
 	i40e_enable_vf_mappings(vf);
+	set_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states);
 
 	/* tell the VF the reset is done */
 	wr32(hw, I40E_VFGEN_RSTAT1(vf->vf_id), I40E_VFR_VFACTIVE);
Signature · 1 line
1.8.5.GIT
#8 lore raw

PATCH 8/15 i40e: reset VFs after PF reset

In reply to Aaron Brown

From: Mitch Williams <[email protected]>

Reset all of the VFs after a PF reset, so that they are in a known state, and the VF driver can detect the reset and reinit itself.

Change-ID I93c5b3a0f8b1371d0da078f92de948b9d3a6413f
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +5 -0
index 8e44411..21d46f4 100644
@@ -5332,6 +5332,11 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)
 	/* restart the VSIs that were rebuilt and running before the reset */
 	i40e_pf_unquiesce_all_vsi(pf);
 
+	if (pf->num_alloc_vfs) {
+		for (v = 0; v < pf->num_alloc_vfs; v++)
+			i40e_reset_vf(&pf->vf[v], true);
+	}
+
 	/* tell the firmware that we're starting */
 	dv.major_version = DRV_VERSION_MAJOR;
 	dv.minor_version = DRV_VERSION_MINOR;
Signature · 1 line
1.8.5.GIT
#9 lore raw

PATCH 9/15 i40e: enable extant VFs

In reply to Aaron Brown

From: Mitch Williams <[email protected]>

If VFs are present when the driver loads, then set up some resources so they can function.

Change-ID I485916a811609a9990ce663d06dc645f625b07ff
---
 drivers/net/ethernet/intel/i40e/i40e_main.c        | 10 ++++++++++
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 18 ++++++++++--------
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h |  1 +
 3 files changed, 21 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +10 -0
index 21d46f4..897452d 100644
@@ -8076,6 +8076,16 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		val &= ~I40E_PFGEN_PORTMDIO_NUM_VFLINK_STAT_ENA_MASK;
 		wr32(hw, I40E_PFGEN_PORTMDIO_NUM, val);
 		i40e_flush(hw);
+
+		if (pci_num_vf(pdev)) {
+			dev_info(&pdev->dev,
+				 "Active VFs found, allocating resources.\n");
+			err = i40e_alloc_vfs(pf, pci_num_vf(pdev));
+			if (err)
+				dev_info(&pdev->dev,
+					 "Error %d allocating resources for existing VFs\n",
+					 err);
+		}
 	}
 
 	pfs_found++;
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +10 -8
index 052be06..9074f63 100644
@@ -840,7 +840,7 @@ void i40e_free_vfs(struct i40e_pf *pf)
  *
  * allocate vf resources
  **/
-static int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs)
+int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs)
 {
 	struct i40e_vf *vfs;
 	int i, ret = 0;
@@ -848,14 +848,16 @@ static int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs)
 	/* Disable interrupt 0 so we don't try to handle the VFLR. */
 	i40e_irq_dynamic_disable_icr0(pf);
 
-	ret = pci_enable_sriov(pf->pdev, num_alloc_vfs);
-	if (ret) {
-		dev_err(&pf->pdev->dev,
-			"pci_enable_sriov failed with error %d!\n", ret);
-		pf->num_alloc_vfs = 0;
-		goto err_iov;
+	/* Check to see if we're just allocating resources for extant VFs */
+	if (pci_num_vf(pf->pdev) != num_alloc_vfs) {
+		ret = pci_enable_sriov(pf->pdev, num_alloc_vfs);
+		if (ret) {
+			dev_err(&pf->pdev->dev,
+				"Failed to enable SR-IOV, error %d.\n", ret);
+			pf->num_alloc_vfs = 0;
+			goto err_iov;
+		}
 	}
-
 	/* allocate memory */
 	vfs = kzalloc(num_alloc_vfs * sizeof(struct i40e_vf), GFP_KERNEL);
 	if (!vfs) {
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +1 -0
index cc1feee..bedf0ba 100644
@@ -102,6 +102,7 @@ struct i40e_vf {
 
 void i40e_free_vfs(struct i40e_pf *pf);
 int i40e_pci_sriov_configure(struct pci_dev *dev, int num_vfs);
+int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs);
 int i40e_vc_process_vf_msg(struct i40e_pf *pf, u16 vf_id, u32 v_opcode,
 			   u32 v_retval, u8 *msg, u16 msglen);
 int i40e_vc_process_vflr_event(struct i40e_pf *pf);
Signature · 1 line
1.8.5.GIT
#10 lore raw

PATCH 10/15 i40e: don't handle VF reset on unload

In reply to Aaron Brown

From: Mitch Williams <[email protected]>

Set the DOWN flag before attempting to disable VFs when unloading the driver. Also, don't attempt to reset the VFs when the driver is unloading, because the switch configuration will fail. This fixes a panic on unload when VFs are enabled.

Change-ID I25a6567e89c9687145f510ff4f630932412c5c5d
---
 drivers/net/ethernet/intel/i40e/i40e_main.c        | 10 +++++-----
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |  3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +5 -5
index 897452d..628e917 100644
@@ -8181,16 +8181,16 @@ static void i40e_remove(struct pci_dev *pdev)
 
 	i40e_ptp_stop(pf);
 
-	if (pf->flags & I40E_FLAG_SRIOV_ENABLED) {
-		i40e_free_vfs(pf);
-		pf->flags &= ~I40E_FLAG_SRIOV_ENABLED;
-	}
-
 	/* no more scheduling of any task */
 	set_bit(__I40E_DOWN, &pf->state);
 	del_timer_sync(&pf->service_timer);
 	cancel_work_sync(&pf->service_task);
 
+	if (pf->flags & I40E_FLAG_SRIOV_ENABLED) {
+		i40e_free_vfs(pf);
+		pf->flags &= ~I40E_FLAG_SRIOV_ENABLED;
+	}
+
 	i40e_fdir_teardown(pf);
 
 	/* If there is a switch structure or any orphans, remove them.
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2 -1
index 9074f63..7d133fa 100644
@@ -1868,7 +1868,8 @@ int i40e_vc_process_vflr_event(struct i40e_pf *pf)
 			/* clear the bit in GLGEN_VFLRSTAT */
 			wr32(hw, I40E_GLGEN_VFLRSTAT(reg_idx), (1 << bit_idx));
 
-			i40e_reset_vf(vf, true);
+			if (!test_bit(__I40E_DOWN, &pf->state))
+				i40e_reset_vf(vf, true);
 		}
 	}
 
Signature · 1 line
1.8.5.GIT
#11 lore raw

PATCH 11/15 i40evf: clean up adapter struct

In reply to Aaron Brown

From: Mitch Williams <[email protected]>

Remove a bunch of unused structure members that are just wasting space. Remove a completely unused info structure definition as well.

Also update copyrights.

Change-ID I028ab92d9b7bd13a832cf3363bd1dc6610d8a535
---
 drivers/net/ethernet/intel/i40evf/i40evf.h | 29 +----------------------------
 1 file changed, 1 insertion(+), 28 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +1 -28
index ff6529b..05969b3 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
- * Copyright(c) 2013 Intel Corporation.
+ * Copyright(c) 2013 - 2014 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -185,7 +185,6 @@ enum i40evf_critical_section_t {
 /* board specific private data structure */
 struct i40evf_adapter {
 	struct timer_list watchdog_timer;
-	struct vlan_group *vlgrp;
 	struct work_struct reset_task;
 	struct work_struct adminq_task;
 	struct delayed_work init_task;
@@ -193,38 +192,19 @@ struct i40evf_adapter {
 	struct list_head vlan_filter_list;
 	char name[MAX_MSIX_COUNT][IFNAMSIZ + 9];
 
-	/* Interrupt Throttle Rate */
-	u32 itr_setting;
-	u16 eitr_low;
-	u16 eitr_high;
-
 	/* TX */
 	struct i40e_ring *tx_rings[I40E_MAX_VSI_QP];
-	u64 restart_queue;
-	u64 hw_csum_tx_good;
-	u64 lsc_int;
-	u64 hw_tso_ctxt;
-	u64 hw_tso6_ctxt;
 	u32 tx_timeout_count;
 	struct list_head mac_filter_list;
-#ifdef DEBUG
-	bool detect_tx_hung;
-#endif /* DEBUG */
 
 	/* RX */
 	struct i40e_ring *rx_rings[I40E_MAX_VSI_QP];
 	int txd_count;
 	int rxd_count;
 	u64 hw_csum_rx_error;
-	u64 hw_rx_no_dma_resources;
-	u64 hw_csum_rx_good;
-	u64 non_eop_descs;
 	int num_msix_vectors;
 	struct msix_entry *msix_entries;
 
-	u64 rx_hdr_split;
-
-	u32 init_state;
 	volatile unsigned long flags;
 #define I40EVF_FLAG_RX_CSUM_ENABLED              (u32)(1)
 #define I40EVF_FLAG_RX_1BUF_CAPABLE              (u32)(1 << 1)
@@ -261,11 +241,9 @@ struct i40evf_adapter {
 
 	enum i40evf_state_t state;
 	volatile unsigned long crit_section;
-	u64 tx_busy;
 
 	struct work_struct watchdog_task;
 	bool netdev_registered;
-	bool dev_closed;
 	bool link_up;
 	enum i40e_virtchnl_ops current_op;
 	struct i40e_virtchnl_vf_resource *vf_res; /* incl. all VSIs */
@@ -276,11 +254,6 @@ struct i40evf_adapter {
 	u32 aq_wait_count;
 };
 
-struct i40evf_info {
-	enum i40e_mac_type	mac;
-	unsigned int		flags;
-};
-
 
 /* needed by i40evf_ethtool.c */
 extern char i40evf_driver_name[];
Signature · 1 line
1.8.5.GIT
#12 lore raw

PATCH 12/15 i40evf: fix bogus comment

In reply to Aaron Brown

From: Mitch Williams <[email protected]>

Locate the structure in the correct header file.

Change-ID Ic7853131728812093a44a75d6b70953311a48dab
---
 drivers/net/ethernet/intel/i40evf/i40evf.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +1 -2
index 05969b3..37f5877 100644
@@ -236,8 +236,7 @@ struct i40evf_adapter {
 	struct pci_dev *pdev;
 	struct net_device_stats net_stats;
 
-	/* structs defined in i40e_vf.h */
-	struct i40e_hw hw;
+	struct i40e_hw hw; /* defined in i40e_type.h */
 
 	enum i40evf_state_t state;
 	volatile unsigned long crit_section;
Signature · 1 line
1.8.5.GIT
#13 lore raw

PATCH 13/15 i40evf: don't store unnecessary array of strings

In reply to Aaron Brown

From: Mitch Williams <[email protected]>

Since we store the traffic vector names in the queue vector struct, we don't need to maintain an array of strings for these names in the adapter structure. Replace this array with a single string and use it when allocating the misc irq vector.

Also update copyrights.

Change-ID I664f096c3c008210d6a04a487163e8aa934fee5b
---
 drivers/net/ethernet/intel/i40evf/i40evf.h      | 2 +-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +1 -1
index 37f5877..696c9d1 100644
@@ -190,7 +190,7 @@ struct i40evf_adapter {
 	struct delayed_work init_task;
 	struct i40e_q_vector *q_vector[MAX_MSIX_Q_VECTORS];
 	struct list_head vlan_filter_list;
-	char name[MAX_MSIX_COUNT][IFNAMSIZ + 9];
+	char misc_vector_name[IFNAMSIZ + 9];
 
 	/* TX */
 	struct i40e_ring *tx_rings[I40E_MAX_VSI_QP];
drivers/net/ethernet/intel/i40evf/i40evf_main.c +4 -3
index f5caf44..d271d3a 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
- * Copyright(c) 2013 Intel Corporation.
+ * Copyright(c) 2013 - 2014 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -511,9 +511,10 @@ static int i40evf_request_misc_irq(struct i40evf_adapter *adapter)
 	struct net_device *netdev = adapter->netdev;
 	int err;
 
-	sprintf(adapter->name[0], "i40evf:mbx");
+	sprintf(adapter->misc_vector_name, "i40evf:mbx");
 	err = request_irq(adapter->msix_entries[0].vector,
-			  &i40evf_msix_aq, 0, adapter->name[0], netdev);
+			  &i40evf_msix_aq, 0,
+			  adapter->misc_vector_name, netdev);
 	if (err) {
 		dev_err(&adapter->pdev->dev,
 			"request_irq for msix_aq failed: %d\n", err);
Signature · 1 line
1.8.5.GIT
#14 lore raw

PATCH 14/15 i40evf: change type of flags variable

In reply to Aaron Brown

From: Mitch Williams <[email protected]>

As pointed out by Dan Carpenter (from Oracle), the flags variable is declared as a 64-bit long but all of the flags are defined as u32, which may lead to unintended consequences. Fix this by declaring flags as u32 (since we don't need any more than about a dozen flags right now), and remove the volatile qualifier, since it's unnecessary and just makes checkpatch cry.

Change-ID I137d3bb1842bf7e9456b5929ca54e3b0ed45dcab
CC Dan Carpenter <[email protected]>
---
 drivers/net/ethernet/intel/i40evf/i40evf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +1 -1
index 696c9d1..5e0a344 100644
@@ -205,7 +205,7 @@ struct i40evf_adapter {
 	int num_msix_vectors;
 	struct msix_entry *msix_entries;
 
-	volatile unsigned long flags;
+	u32 flags;
 #define I40EVF_FLAG_RX_CSUM_ENABLED              (u32)(1)
 #define I40EVF_FLAG_RX_1BUF_CAPABLE              (u32)(1 << 1)
 #define I40EVF_FLAG_RX_PS_CAPABLE                (u32)(1 << 2)
Signature · 1 line
1.8.5.GIT
#15 lore raw

PATCH 15/15 i40evf: refactor reset handling

In reply to Aaron Brown

From: Mitch Williams <[email protected]>

Respond better to a VF reset event. When a reset is signaled by the PF, or detected by the watchdog task, prevent the watchdog from processing admin queue requests, and schedule the reset task.

In the reset task, wait first for the reset to start, then for it to complete, then reinit the driver.

If the reset never appears to complete after a long, long time (>10 seconds is possible depending on what's going on with the PF driver), then set a flag to indicate that PF communications have failed.

If this flag is set, check for the reset to complete in the watchdog, and attempt to do a full reinitialization of the driver from scratch.

With these changes the VF driver correctly handles a PF reset event while running on bare metal, or in a VM.

Also update copyrights.

Change-ID I93513efd0b50523a8345e7f6a33a5e4f8a2a5996
---
 drivers/net/ethernet/intel/i40evf/i40evf.h         |   6 +-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c    | 148 ++++++++++++++++-----
 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    |  15 ++-
 3 files changed, 130 insertions(+), 39 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +4 -2
index 5e0a344..a30c4a9 100644
@@ -164,15 +164,14 @@ struct i40evf_vlan_filter {
 /* Driver state. The order of these is important! */
 enum i40evf_state_t {
 	__I40EVF_STARTUP,		/* driver loaded, probe complete */
-	__I40EVF_FAILED,		/* PF communication failed. Fatal. */
 	__I40EVF_REMOVE,		/* driver is being unloaded */
 	__I40EVF_INIT_VERSION_CHECK,	/* aq msg sent, awaiting reply */
 	__I40EVF_INIT_GET_RESOURCES,	/* aq msg sent, awaiting reply */
 	__I40EVF_INIT_SW,		/* got resources, setting up structs */
+	__I40EVF_RESETTING,		/* in reset */
 	/* Below here, watchdog is running */
 	__I40EVF_DOWN,			/* ready, can be opened */
 	__I40EVF_TESTING,		/* in ethtool self-test */
-	__I40EVF_RESETTING,		/* in reset */
 	__I40EVF_RUNNING,		/* opened, working */
 };
 
@@ -214,6 +213,8 @@ struct i40evf_adapter {
 #define I40EVF_FLAG_IMIR_ENABLED                 (u32)(1 << 5)
 #define I40EVF_FLAG_MQ_CAPABLE                   (u32)(1 << 6)
 #define I40EVF_FLAG_NEED_LINK_UPDATE             (u32)(1 << 7)
+#define I40EVF_FLAG_PF_COMMS_FAILED              (u32)(1 << 8)
+#define I40EVF_FLAG_RESET_PENDING                (u32)(1 << 9)
 /* duplcates for common code */
 #define I40E_FLAG_FDIR_ATR_ENABLED		 0
 #define I40E_FLAG_DCB_ENABLED			 0
@@ -231,6 +232,7 @@ struct i40evf_adapter {
 #define I40EVF_FLAG_AQ_CONFIGURE_QUEUES		(u32)(1 << 6)
 #define I40EVF_FLAG_AQ_MAP_VECTORS		(u32)(1 << 7)
 #define I40EVF_FLAG_AQ_HANDLE_RESET		(u32)(1 << 8)
+
 	/* OS defined structs */
 	struct net_device *netdev;
 	struct pci_dev *pdev;
drivers/net/ethernet/intel/i40evf/i40evf_main.c +116 -32

258 lines not on this page · raw message

drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +10 -5
index e6978d7..93891a1 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
- * Copyright(c) 2013 Intel Corporation.
+ * Copyright(c) 2013 - 2014 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -43,6 +43,9 @@ static int i40evf_send_pf_msg(struct i40evf_adapter *adapter,
 	struct i40e_hw *hw = &adapter->hw;
 	i40e_status err;
 
+	if (adapter->flags & I40EVF_FLAG_PF_COMMS_FAILED)
+		return 0; /* nothing to see here, move along */
+
 	err = i40e_aq_send_msg_to_pf(hw, op, 0, msg, len, NULL);
 	if (err)
 		dev_err(&adapter->pdev->dev, "Unable to send opcode %d to PF, error %d, aq status %d\n",
@@ -689,10 +692,12 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
 			}
 			break;
 		case I40E_VIRTCHNL_EVENT_RESET_IMPENDING:
-			adapter->state = __I40EVF_RESETTING;
-			schedule_work(&adapter->reset_task);
-			dev_info(&adapter->pdev->dev,
-				 "%s: hardware reset pending\n", __func__);
+			dev_info(&adapter->pdev->dev, "PF reset warning received\n");
+			if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING)) {
+				adapter->flags |= I40EVF_FLAG_RESET_PENDING;
+				dev_info(&adapter->pdev->dev, "Scheduling reset task\n");
+				schedule_work(&adapter->reset_task);
+			}
 			break;
 		default:
 			dev_err(&adapter->pdev->dev,
Signature · 1 line
1.8.5.GIT
maintainer
#16 lore raw
In reply to Aaron Brown

From: Aaron Brown <[email protected]>
Date: Thu, 13 Feb 2014 03:48:38 -0800

Quoted 7 lines

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.

Series applied, thanks.