Skip to contentSkip to conversation

i40e/i40evf updates

PATCH New Joshua Hay 2 participants 32 messages Jan 15, 2016 – Jan 27, 2016

Subsystems (2)
lore
Share & tools
lore

Joshua Hay

author
#0 lore raw

cover i40e/i40evf updates

Anjali Singhai Jain adds a SW workaround for lost Interrupts, fixes PROMISC mode for Multi-function per port (MFP) devices, does not disable queues in the Legacy/MSI Interrupt handler, applies promisc mode to Tx Traffic when in promisc mode as well.

Jesse Brandeburg drops unused debugfs file "dump", cleans up use of pf->hw.

Kiran Patil removes code which relies on BASE VEB SEID.

Mitch Williams gets rid of magic number, supports packet split receive, avoids atomics, expands comment, sets adapter state on reset failure.

Shannon Nelson adds better error reporting for nvmupdate, cleans event descriptor before use.

 drivers/net/ethernet/intel/i40e/i40e.h             |   4 +-
 drivers/net/ethernet/intel/i40e/i40e_adminq.c      |  20 +-
 drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h  |   3 +-
 drivers/net/ethernet/intel/i40e/i40e_common.c      |   9 +-
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c     | 266 +--------------------
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c     |  40 ++--
 drivers/net/ethernet/intel/i40e/i40e_main.c        |  69 +++---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c        |  44 ++--
 drivers/net/ethernet/intel/i40e/i40e_txrx.h        |   3 +-
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |   8 +-
 drivers/net/ethernet/intel/i40evf/i40e_adminq.c    |   5 +-
 .../net/ethernet/intel/i40evf/i40e_adminq_cmd.h    |   3 +-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c      |  31 ++-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.h      |   3 +-
 drivers/net/ethernet/intel/i40evf/i40evf.h         |   6 +-
 drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c |  67 +++++-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c    |  67 +++---
 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    |   4 +
 18 files changed, 253 insertions(+), 399 deletions(-)
Signature · 1 line
2.1.0
author
#1 lore raw

PATCH 1/15 i40e: get rid of magic number

From: Mitch Williams <[email protected]>

We have a define for this, use it. No functional change.

Change-ID Ic0e3ea4f562e46de63b2a8de07f291ccc10205fd

---
Testing Hints: No functional change. Just make sure it compiles.

 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1 -1
index 3e0d87e..597f209 100644
@@ -461,7 +461,7 @@ static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_id,
 		rx_ctx.hbuff = info->hdr_size >> I40E_RXQ_CTX_HBUFF_SHIFT;
 
 		/* set splitalways mode 10b */
-		rx_ctx.dtype = 0x2;
+		rx_ctx.dtype = I40E_RX_DTYPE_HEADER_SPLIT;
 	}
 
 	/* databuffer length validation */
Signature · 1 line
2.1.0
#2 lore raw

PATCH 1/15 i40e: get rid of magic number

Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Joshua Hay
Sent: Friday, January 15, 2016 2:33 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S28 01/15] i40e: get rid of magic number

From: Mitch Williams <[email protected]>

We have a define for this, use it. No functional change.

Quoted 7 lines
Change-ID Ic0e3ea4f562e46de63b2a8de07f291ccc10205fd

---
Testing Hints: No functional change. Just make sure it compiles.

 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch code changes correctly applied, compiles correctly

author
#3 lore raw

PATCH 2/15 i40e: drop unused debugfs file "dump"

In reply to Joshua Hay

From: Jesse Brandeburg <[email protected]>

There was a completely unused file "dump" in debugfs that never panned out to be useful.

Change-ID I12bb9e37b5a83299725dda815a8746157baf6562

---
Testing Hints: check debugfs, dump entry should be gone.

 drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 250 -------------------------
 1 file changed, 250 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +0 -250
index 34da53b..631c2d6 100644
@@ -72,248 +72,6 @@ static struct i40e_veb *i40e_dbg_find_veb(struct i40e_pf *pf, int seid)
 }
 
 /**************************************************************
- * dump
- * The dump entry in debugfs is for getting a data snapshow of
- * the driver's current configuration and runtime details.
- * When the filesystem entry is written, a snapshot is taken.
- * When the entry is read, the most recent snapshot data is dumped.
- **************************************************************/
-static char *i40e_dbg_dump_buf;
-static ssize_t i40e_dbg_dump_data_len;
-static ssize_t i40e_dbg_dump_buffer_len;
-
-/**
- * i40e_dbg_dump_read - read the dump data
- * @filp: the opened file
- * @buffer: where to write the data for the user to read
- * @count: the size of the user's buffer
- * @ppos: file position offset
- **/
-static ssize_t i40e_dbg_dump_read(struct file *filp, char __user *buffer,
-				  size_t count, loff_t *ppos)
-{
-	int bytes_not_copied;
-	int len;
-
-	/* is *ppos bigger than the available data? */
-	if (*ppos >= i40e_dbg_dump_data_len || !i40e_dbg_dump_buf)
-		return 0;
-
-	/* be sure to not read beyond the end of available data */
-	len = min_t(int, count, (i40e_dbg_dump_data_len - *ppos));
-
-	bytes_not_copied = copy_to_user(buffer, &i40e_dbg_dump_buf[*ppos], len);
-	if (bytes_not_copied)
-		return -EFAULT;
-
-	*ppos += len;
-	return len;
-}
-
-/**
- * i40e_dbg_prep_dump_buf
- * @pf: the PF we're working with
- * @buflen: the desired buffer length
- *
- * Return positive if success, 0 if failed
- **/
-static int i40e_dbg_prep_dump_buf(struct i40e_pf *pf, int buflen)
-{
-	/* if not already big enough, prep for re alloc */
-	if (i40e_dbg_dump_buffer_len && i40e_dbg_dump_buffer_len < buflen) {
-		kfree(i40e_dbg_dump_buf);
-		i40e_dbg_dump_buffer_len = 0;
-		i40e_dbg_dump_buf = NULL;
-	}
-
-	/* get a new buffer if needed */
-	if (!i40e_dbg_dump_buf) {
-		i40e_dbg_dump_buf = kzalloc(buflen, GFP_KERNEL);
-		if (i40e_dbg_dump_buf != NULL)
-			i40e_dbg_dump_buffer_len = buflen;
-	}
-
-	return i40e_dbg_dump_buffer_len;
-}
-
-/**
- * i40e_dbg_dump_write - trigger a datadump snapshot
- * @filp: the opened file
- * @buffer: where to find the user's data
- * @count: the length of the user's data
- * @ppos: file position offset
- *
- * Any write clears the stats
- **/
-static ssize_t i40e_dbg_dump_write(struct file *filp,
-				   const char __user *buffer,
-				   size_t count, loff_t *ppos)
-{
-	struct i40e_pf *pf = filp->private_data;
-	bool seid_found = false;
-	long seid = -1;
-	int buflen = 0;
-	int i, ret;
-	int len;
-	u8 *p;
-
-	/* don't allow partial writes */
-	if (*ppos != 0)
-		return 0;
-
-	/* decode the SEID given to be dumped */
-	ret = kstrtol_from_user(buffer, count, 0, &seid);
-
-	if (ret) {
-		dev_info(&pf->pdev->dev, "bad seid value\n");
-	} else if (seid == 0) {
-		seid_found = true;
-
-		kfree(i40e_dbg_dump_buf);
-		i40e_dbg_dump_buffer_len = 0;
-		i40e_dbg_dump_data_len = 0;
-		i40e_dbg_dump_buf = NULL;
-		dev_info(&pf->pdev->dev, "debug buffer freed\n");
-
-	} else if (seid == pf->pf_seid || seid == 1) {
-		seid_found = true;
-
-		buflen = sizeof(struct i40e_pf);
-		buflen += (sizeof(struct i40e_aq_desc)
-		     * (pf->hw.aq.num_arq_entries + pf->hw.aq.num_asq_entries));
-
-		if (i40e_dbg_prep_dump_buf(pf, buflen)) {
-			p = i40e_dbg_dump_buf;
-
-			/* avoid use of memcpy here due to sparse warning
-			 * about copy size.
-			 */
-			*((struct i40e_pf *)p) = *pf;
-			p += sizeof(struct i40e_pf);
-
-			len = (sizeof(struct i40e_aq_desc)
-					* pf->hw.aq.num_asq_entries);
-			memcpy(p, pf->hw.aq.asq.desc_buf.va, len);
-			p += len;
-
-			len = (sizeof(struct i40e_aq_desc)
-					* pf->hw.aq.num_arq_entries);
-			memcpy(p, pf->hw.aq.arq.desc_buf.va, len);
-			p += len;
-
-			i40e_dbg_dump_data_len = buflen;
-			dev_info(&pf->pdev->dev,
-				 "PF seid %ld dumped %d bytes\n",
-				 seid, (int)i40e_dbg_dump_data_len);
-		}
-	} else if (seid >= I40E_BASE_VSI_SEID) {
-		struct i40e_vsi *vsi = NULL;
-		struct i40e_mac_filter *f;
-		int filter_count = 0;
-
-		mutex_lock(&pf->switch_mutex);
-		vsi = i40e_dbg_find_vsi(pf, seid);
-		if (!vsi) {
-			mutex_unlock(&pf->switch_mutex);
-			goto write_exit;
-		}
-
-		buflen = sizeof(struct i40e_vsi);
-		buflen += sizeof(struct i40e_q_vector) * vsi->num_q_vectors;
-		buflen += sizeof(struct i40e_ring) * 2 * vsi->num_queue_pairs;
-		buflen += sizeof(struct i40e_tx_buffer) * vsi->num_queue_pairs;
-		buflen += sizeof(struct i40e_rx_buffer) * vsi->num_queue_pairs;
-		list_for_each_entry(f, &vsi->mac_filter_list, list)
-			filter_count++;
-		buflen += sizeof(struct i40e_mac_filter) * filter_count;
-
-		if (i40e_dbg_prep_dump_buf(pf, buflen)) {
-			p = i40e_dbg_dump_buf;
-			seid_found = true;
-
-			len = sizeof(struct i40e_vsi);
-			memcpy(p, vsi, len);
-			p += len;
-
-			if (vsi->num_q_vectors) {
-				len = (sizeof(struct i40e_q_vector)
-					* vsi->num_q_vectors);
-				memcpy(p, vsi->q_vectors, len);
-				p += len;
-			}
-
-			if (vsi->num_queue_pairs) {
-				len = (sizeof(struct i40e_ring) *
-				      vsi->num_queue_pairs);
-				memcpy(p, vsi->tx_rings, len);
-				p += len;
-				memcpy(p, vsi->rx_rings, len);
-				p += len;
-			}
-
-			if (vsi->tx_rings[0]) {
-				len = sizeof(struct i40e_tx_buffer);
-				for (i = 0; i < vsi->num_queue_pairs; i++) {
-					memcpy(p, vsi->tx_rings[i]->tx_bi, len);
-					p += len;
-				}
-				len = sizeof(struct i40e_rx_buffer);
-				for (i = 0; i < vsi->num_queue_pairs; i++) {
-					memcpy(p, vsi->rx_rings[i]->rx_bi, len);
-					p += len;
-				}
-			}
-
-			/* macvlan filter list */
-			len = sizeof(struct i40e_mac_filter);
-			list_for_each_entry(f, &vsi->mac_filter_list, list) {
-				memcpy(p, f, len);
-				p += len;
-			}
-
-			i40e_dbg_dump_data_len = buflen;
-			dev_info(&pf->pdev->dev,
-				 "VSI seid %ld dumped %d bytes\n",
-				 seid, (int)i40e_dbg_dump_data_len);
-		}
-		mutex_unlock(&pf->switch_mutex);
-	} else if (seid >= I40E_BASE_VEB_SEID) {
-		struct i40e_veb *veb = NULL;
-
-		mutex_lock(&pf->switch_mutex);
-		veb = i40e_dbg_find_veb(pf, seid);
-		if (!veb) {
-			mutex_unlock(&pf->switch_mutex);
-			goto write_exit;
-		}
-
-		buflen = sizeof(struct i40e_veb);
-		if (i40e_dbg_prep_dump_buf(pf, buflen)) {
-			seid_found = true;
-			memcpy(i40e_dbg_dump_buf, veb, buflen);
-			i40e_dbg_dump_data_len = buflen;
-			dev_info(&pf->pdev->dev,
-				 "VEB seid %ld dumped %d bytes\n",
-				 seid, (int)i40e_dbg_dump_data_len);
-		}
-		mutex_unlock(&pf->switch_mutex);
-	}
-
-write_exit:
-	if (!seid_found)
-		dev_info(&pf->pdev->dev, "unknown seid %ld\n", seid);
-
-	return count;
-}
-
-static const struct file_operations i40e_dbg_dump_fops = {
-	.owner = THIS_MODULE,
-	.open =  simple_open,
-	.read =  i40e_dbg_dump_read,
-	.write = i40e_dbg_dump_write,
-};
-
-/**************************************************************
  * command
  * The command entry in debugfs is for giving the driver commands
  * to be executed - these may be for changing the internal switch
@@ -2217,11 +1975,6 @@ void i40e_dbg_pf_init(struct i40e_pf *pf)
 	if (!pfile)
 		goto create_failed;
 
-	pfile = debugfs_create_file("dump", 0600, pf->i40e_dbg_pf, pf,
-				    &i40e_dbg_dump_fops);
-	if (!pfile)
-		goto create_failed;
-
 	pfile = debugfs_create_file("netdev_ops", 0600, pf->i40e_dbg_pf, pf,
 				    &i40e_dbg_netdev_ops_fops);
 	if (!pfile)
@@ -2242,9 +1995,6 @@ void i40e_dbg_pf_exit(struct i40e_pf *pf)
 {
 	debugfs_remove_recursive(pf->i40e_dbg_pf);
 	pf->i40e_dbg_pf = NULL;
-
-	kfree(i40e_dbg_dump_buf);
-	i40e_dbg_dump_buf = NULL;
 }
 
 /**
Signature · 1 line
2.1.0
#4 lore raw

PATCH 2/15 i40e: drop unused debugfs file "dump"

Quoted 13 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Joshua Hay
Sent: Friday, January 15, 2016 2:33 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S28 02/15] i40e: drop unused debugfs file "dump"

From: Jesse Brandeburg <[email protected]>

There was a completely unused file "dump" in debugfs that never panned out to be useful.

Quoted 7 lines
Change-ID I12bb9e37b5a83299725dda815a8746157baf6562

---
Testing Hints: check debugfs, dump entry should be gone.

 drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 250 -------------------------
 1 file changed, 250 deletions(-)

Patch code changes correctly applied, no file dump option in debugfs

author
#5 lore raw

PATCH 3/15 i40evf: support packet split receive

In reply to Joshua Hay

From: Mitch Williams <[email protected]>

Support packet split receive on VFs. This is off by default but can be enabled using ethtool private flags. Because we need to trigger a reset from outside of i40evf_main.c, create a new function to do so, and export it.

Also update copyright year in file headers.

Change-ID I721aa5d70113d3d6d94102e5f31526f6fc57cbbb

---
Testing Hints: Use ethtool --set-priv-flags to enable and disable packet split. Traffic should proceed as normal in either mode.

 drivers/net/ethernet/intel/i40evf/i40evf.h         |  6 +-
 drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 67 +++++++++++++++++++++-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c    | 64 +++++++++++----------
 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    |  4 ++
 4 files changed, 110 insertions(+), 31 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +5 -1
index 9e15f68..e657ecc 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
- * Copyright(c) 2013 - 2014 Intel Corporation.
+ * Copyright(c) 2013 - 2016 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,
@@ -274,6 +274,9 @@ struct i40evf_adapter {
 };
 
 
+/* Ethtool Private Flags */
+#define I40EVF_PRIV_FLAGS_PS		BIT(0)
+
 /* needed by i40evf_ethtool.c */
 extern char i40evf_driver_name[];
 extern const char i40evf_driver_version[];
@@ -281,6 +284,7 @@ extern const char i40evf_driver_version[];
 int i40evf_up(struct i40evf_adapter *adapter);
 void i40evf_down(struct i40evf_adapter *adapter);
 int i40evf_process_config(struct i40evf_adapter *adapter);
+void i40evf_schedule_reset(struct i40evf_adapter *adapter);
 void i40evf_reset(struct i40evf_adapter *adapter);
 void i40evf_set_ethtool_ops(struct net_device *netdev);
 void i40evf_update_stats(struct i40evf_adapter *adapter);
drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c +66 -1

109 lines not on this page · raw message

drivers/net/ethernet/intel/i40evf/i40evf_main.c +35 -29

100 lines not on this page · raw message

drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +4 -0
index d3739cc..488e738 100644
@@ -270,6 +270,10 @@ void i40evf_configure_queues(struct i40evf_adapter *adapter)
 		vqpi->rxq.max_pkt_size = adapter->netdev->mtu
 					+ ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN;
 		vqpi->rxq.databuffer_size = adapter->rx_rings[i].rx_buf_len;
+		if (adapter->flags & I40EVF_FLAG_RX_PS_ENABLED) {
+			vqpi->rxq.splithdr_enabled = true;
+			vqpi->rxq.hdr_size = I40E_RX_HDR_SIZE;
+		}
 		vqpi++;
 	}
 
Signature · 1 line
2.1.0
#6 lore raw

PATCH 3/15 i40evf: support packet split receive

Quoted 22 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Joshua Hay
Sent: Friday, January 15, 2016 2:33 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S28 03/15] i40evf: support packet split receive

From: Mitch Williams <[email protected]>

Support packet split receive on VFs. This is off by default but can be enabled using ethtool private flags. Because we need to trigger a reset from outside of i40evf_main.c, create a new function to do so, and export it.

Also update copyright year in file headers.

Change-ID I721aa5d70113d3d6d94102e5f31526f6fc57cbbb

---
Testing Hints: Use ethtool --set-priv-flags to enable and disable packet split. Traffic should proceed as normal in either mode.

Quoted 7 lines
 drivers/net/ethernet/intel/i40evf/i40evf.h         |  6 +-
 drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 67
+++++++++++++++++++++-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c    | 64 +++++++++++--------
--
 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    |  4 ++
 4 files changed, 110 insertions(+), 31 deletions(-)

Patch code changes correctly applied, receive works normally on VF with packet split enabled and disabled

author
#7 lore raw

PATCH 4/15 i40e: trivial: cleanup use of pf->hw

In reply to Joshua Hay

From: Jesse Brandeburg <[email protected]>

This patch makes use of a pointer called hw consistent in the i40e_remove function.

Change-ID Idacc7ff0a09a68289c57457a78618bf5497de077

---
Testing Hints: check remove works via rmmod,
mostly just a compile change.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +4 -4
index c46a9a1..8b04769 100644
@@ -11217,8 +11217,8 @@ static void i40e_remove(struct pci_dev *pdev)
 		i40e_vsi_release(pf->vsi[pf->lan_vsi]);
 
 	/* shutdown and destroy the HMC */
-	if (pf->hw.hmc.hmc_obj) {
-		ret_code = i40e_shutdown_lan_hmc(&pf->hw);
+	if (hw->hmc.hmc_obj) {
+		ret_code = i40e_shutdown_lan_hmc(hw);
 		if (ret_code)
 			dev_warn(&pdev->dev,
 				 "Failed to destroy the HMC resources: %d\n",
@@ -11226,7 +11226,7 @@ static void i40e_remove(struct pci_dev *pdev)
 	}
 
 	/* shutdown the adminq */
-	ret_code = i40e_shutdown_adminq(&pf->hw);
+	ret_code = i40e_shutdown_adminq(hw);
 	if (ret_code)
 		dev_warn(&pdev->dev,
 			 "Failed to destroy the Admin Queue resources: %d\n",
@@ -11254,7 +11254,7 @@ static void i40e_remove(struct pci_dev *pdev)
 	kfree(pf->qp_pile);
 	kfree(pf->vsi);
 
-	iounmap(pf->hw.hw_addr);
+	iounmap(hw->hw_addr);
 	kfree(pf);
 	pci_release_selected_regions(pdev,
 				     pci_select_bars(pdev, IORESOURCE_MEM));
Signature · 1 line
2.1.0
#8 lore raw

PATCH 4/15 i40e: trivial: cleanup use of pf->hw

Quoted 13 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Joshua Hay
Sent: Friday, January 15, 2016 2:33 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S28 04/15] i40e: trivial: cleanup use of pf->hw

From: Jesse Brandeburg <[email protected]>

This patch makes use of a pointer called hw consistent in the i40e_remove function.

Quoted 7 lines
Change-ID Idacc7ff0a09a68289c57457a78618bf5497de077

---
Testing Hints: check remove works via rmmod, mostly just a compile change.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Patch code changes correctly applied, rmmod works correctly

author
#9 lore raw

PATCH 5/15 i40e: Add a SW workaround for lost Interrupts

In reply to Joshua Hay

From: Anjali Singhai Jain <[email protected]>

This patch adds a workaround for cases where we might have interrupts that got lost but WB happened.
If that happens without this patch we will see a tx_timeout. To work around it, this patch goes ahead and reschedules napi in that situation, if napi is not already scheduled. We also add a counter in ethtool to keep track of when we detect a case of tx_lost_interrupt.

Note: napi_reschedule() can be safely called from process/service_task context and is done in other drivers as well without an issue.

Change-ID I00f98f1ce3774524d9421227652bef20fcbd0d20

---
Testing Hints: See if some more cases of tx_timeout go away from X722 and even fortville. Particulary the case where HWB=TAIL as seen in the dmesg logs when the tx_timeout happens.

 drivers/net/ethernet/intel/i40e/i40e.h         |  1 +
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c |  1 +
 drivers/net/ethernet/intel/i40e/i40e_main.c    | 32 ++++++++++++++++----------
 drivers/net/ethernet/intel/i40e/i40e_txrx.c    | 10 +++++---
 drivers/net/ethernet/intel/i40e/i40e_txrx.h    |  3 ++-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c  | 10 +++++---
 drivers/net/ethernet/intel/i40evf/i40e_txrx.h  |  3 ++-
 7 files changed, 40 insertions(+), 20 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
index 141c5c0..e37af29 100644
@@ -512,6 +512,7 @@ struct i40e_vsi {
 	u32 tx_busy;
 	u64 tx_linearize;
 	u64 tx_force_wb;
+	u64 tx_lost_interrupt;
 	u32 rx_buf_failed;
 	u32 rx_page_failed;
 
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1 -0
index 40a52b8..d2010290 100644
@@ -89,6 +89,7 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = {
 	I40E_VSI_STAT("rx_unknown_protocol", eth_stats.rx_unknown_protocol),
 	I40E_VSI_STAT("tx_linearize", tx_linearize),
 	I40E_VSI_STAT("tx_force_wb", tx_force_wb),
+	I40E_VSI_STAT("tx_lost_interrupt", tx_lost_interrupt),
 	I40E_VSI_STAT("rx_alloc_fail", rx_buf_failed),
 	I40E_VSI_STAT("rx_pg_alloc_fail", rx_page_failed),
 };
drivers/net/ethernet/intel/i40e/i40e_main.c +20 -12
index 8b04769..ac71ba2 100644
@@ -819,6 +819,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
 	struct i40e_eth_stats *oes;
 	struct i40e_eth_stats *es;     /* device's eth stats */
 	u32 tx_restart, tx_busy;
+	u64 tx_lost_interrupt;
 	struct i40e_ring *p;
 	u32 rx_page, rx_buf;
 	u64 bytes, packets;
@@ -844,6 +845,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
 	rx_b = rx_p = 0;
 	tx_b = tx_p = 0;
 	tx_restart = tx_busy = tx_linearize = tx_force_wb = 0;
+	tx_lost_interrupt = 0;
 	rx_page = 0;
 	rx_buf = 0;
 	rcu_read_lock();
@@ -862,6 +864,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
 		tx_busy += p->tx_stats.tx_busy;
 		tx_linearize += p->tx_stats.tx_linearize;
 		tx_force_wb += p->tx_stats.tx_force_wb;
+		tx_lost_interrupt += p->tx_stats.tx_lost_interrupt;
 
 		/* Rx queue is part of the same block as Tx queue */
 		p = &p[1];
@@ -880,6 +883,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
 	vsi->tx_busy = tx_busy;
 	vsi->tx_linearize = tx_linearize;
 	vsi->tx_force_wb = tx_force_wb;
+	vsi->tx_lost_interrupt = tx_lost_interrupt;
 	vsi->rx_page_failed = rx_page;
 	vsi->rx_buf_failed = rx_buf;
 
@@ -4349,7 +4353,7 @@ static void i40e_detect_recover_hung_queue(int q_idx, struct i40e_vsi *vsi)
 {
 	struct i40e_ring *tx_ring = NULL;
 	struct i40e_pf	*pf;
-	u32 head, val, tx_pending;
+	u32 head, val, tx_pending_hw;
 	int i;
 
 	pf = vsi->back;
@@ -4375,16 +4379,9 @@ static void i40e_detect_recover_hung_queue(int q_idx, struct i40e_vsi *vsi)
 	else
 		val = rd32(&pf->hw, I40E_PFINT_DYN_CTL0);
 
-	/* Bail out if interrupts are disabled because napi_poll
-	 * execution in-progress or will get scheduled soon.
-	 * napi_poll cleans TX and RX queues and updates 'next_to_clean'.
-	 */
-	if (!(val & I40E_PFINT_DYN_CTLN_INTENA_MASK))
-		return;
-
 	head = i40e_get_head(tx_ring);
 
-	tx_pending = i40e_get_tx_pending(tx_ring);
+	tx_pending_hw = i40e_get_tx_pending(tx_ring, false);
 
 	/* HW is done executing descriptors, updated HEAD write back,
 	 * but SW hasn't processed those descriptors. If interrupt is
@@ -4392,12 +4389,12 @@ static void i40e_detect_recover_hung_queue(int q_idx, struct i40e_vsi *vsi)
 	 * dev_watchdog detecting timeout on those netdev_queue,
 	 * hence proactively trigger SW interrupt.
 	 */
-	if (tx_pending) {
+	if (tx_pending_hw && (!(val & I40E_PFINT_DYN_CTLN_INTENA_MASK))) {
 		/* NAPI Poll didn't run and clear since it was set */
 		if (test_and_clear_bit(I40E_Q_VECTOR_HUNG_DETECT,
 				       &tx_ring->q_vector->hung_detected)) {
-			netdev_info(vsi->netdev, "VSI_seid %d, Hung TX queue %d, tx_pending: %d, NTC:0x%x, HWB: 0x%x, NTU: 0x%x, TAIL: 0x%x\n",
-				    vsi->seid, q_idx, tx_pending,
+			netdev_info(vsi->netdev, "VSI_seid %d, Hung TX queue %d, tx_pending_hw: %d, NTC:0x%x, HWB: 0x%x, NTU: 0x%x, TAIL: 0x%x\n",
+				    vsi->seid, q_idx, tx_pending_hw,
 				    tx_ring->next_to_clean, head,
 				    tx_ring->next_to_use,
 				    readl(tx_ring->tail));
@@ -4410,6 +4407,17 @@ static void i40e_detect_recover_hung_queue(int q_idx, struct i40e_vsi *vsi)
 				&tx_ring->q_vector->hung_detected);
 		}
 	}
+
+	/* This is the case where we have interrupts missing,
+	 * so the tx_pending in HW will most likely be 0, but we
+	 * will have tx_pending in sw since the WB happened but the
+	 * interrupt got lost.
+	 */
+	if ((!tx_pending_hw) && i40e_get_tx_pending(tx_ring, true) &&
+	    (!(val & I40E_PFINT_DYN_CTLN_INTENA_MASK))) {
+		if (napi_reschedule(&tx_ring->q_vector->napi))
+			tx_ring->tx_stats.tx_lost_interrupt++;
+	}
 }
 
 /**
drivers/net/ethernet/intel/i40e/i40e_txrx.c +7 -3
index 37104bf..60e993e 100644
@@ -610,15 +610,19 @@ void i40e_free_tx_resources(struct i40e_ring *tx_ring)
 /**
  * i40e_get_tx_pending - how many tx descriptors not processed
  * @tx_ring: the ring of descriptors
+ * @in_sw: is tx_pending being checked in SW or HW
  *
  * Since there is no access to the ring head register
  * in XL710, we need to use our local copies
  **/
-u32 i40e_get_tx_pending(struct i40e_ring *ring)
+u32 i40e_get_tx_pending(struct i40e_ring *ring, bool in_sw)
 {
 	u32 head, tail;
 
-	head = i40e_get_head(ring);
+	if (!in_sw)
+		head = i40e_get_head(ring);
+	else
+		head = ring->next_to_clean;
 	tail = readl(ring->tail);
 
 	if (head != tail)
@@ -741,7 +745,7 @@ static bool i40e_clean_tx_irq(struct i40e_ring *tx_ring, int budget)
 		 * them to be written back in case we stay in NAPI.
 		 * In this mode on X722 we do not enable Interrupt.
 		 */
-		j = i40e_get_tx_pending(tx_ring);
+		j = i40e_get_tx_pending(tx_ring, false);
 
 		if (budget &&
 		    ((j / (WB_STRIDE + 1)) == 0) && (j != 0) &&
drivers/net/ethernet/intel/i40e/i40e_txrx.h +2 -1
index fd72182..45496df 100644
@@ -203,6 +203,7 @@ struct i40e_tx_queue_stats {
 	u64 tx_done_old;
 	u64 tx_linearize;
 	u64 tx_force_wb;
+	u64 tx_lost_interrupt;
 };
 
 struct i40e_rx_queue_stats {
@@ -338,7 +339,7 @@ int i40e_tx_prepare_vlan_flags(struct sk_buff *skb,
 			       struct i40e_ring *tx_ring, u32 *flags);
 #endif
 void i40e_force_wb(struct i40e_vsi *vsi, struct i40e_q_vector *q_vector);
-u32 i40e_get_tx_pending(struct i40e_ring *ring);
+u32 i40e_get_tx_pending(struct i40e_ring *ring, bool in_sw);
 
 /**
  * i40e_get_head - Retrieve head from head writeback
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +7 -3
index 620cb97..c1ea819 100644
@@ -129,15 +129,19 @@ void i40evf_free_tx_resources(struct i40e_ring *tx_ring)
 /**
  * i40evf_get_tx_pending - how many Tx descriptors not processed
  * @tx_ring: the ring of descriptors
+ * @in_sw: is tx_pending being checked in SW or HW
  *
  * Since there is no access to the ring head register
  * in XL710, we need to use our local copies
  **/
-u32 i40evf_get_tx_pending(struct i40e_ring *ring)
+u32 i40evf_get_tx_pending(struct i40e_ring *ring, bool in_sw)
 {
 	u32 head, tail;
 
-	head = i40e_get_head(ring);
+	if (!in_sw)
+		head = i40e_get_head(ring);
+	else
+		head = ring->next_to_clean;
 	tail = readl(ring->tail);
 
 	if (head != tail)
@@ -259,7 +263,7 @@ static bool i40e_clean_tx_irq(struct i40e_ring *tx_ring, int budget)
 		 * them to be written back in case we stay in NAPI.
 		 * In this mode on X722 we do not enable Interrupt.
 		 */
-		j = i40evf_get_tx_pending(tx_ring);
+		j = i40evf_get_tx_pending(tx_ring, false);
 
 		if (budget &&
 		    ((j / (WB_STRIDE + 1)) == 0) && (j > 0) &&
drivers/net/ethernet/intel/i40evf/i40e_txrx.h +2 -1
index 062bd0c..bbd98b7 100644
@@ -202,6 +202,7 @@ struct i40e_tx_queue_stats {
 	u64 tx_done_old;
 	u64 tx_linearize;
 	u64 tx_force_wb;
+	u64 tx_lost_interrupt;
 };
 
 struct i40e_rx_queue_stats {
@@ -326,7 +327,7 @@ void i40evf_free_tx_resources(struct i40e_ring *tx_ring);
 void i40evf_free_rx_resources(struct i40e_ring *rx_ring);
 int i40evf_napi_poll(struct napi_struct *napi, int budget);
 void i40evf_force_wb(struct i40e_vsi *vsi, struct i40e_q_vector *q_vector);
-u32 i40evf_get_tx_pending(struct i40e_ring *ring);
+u32 i40evf_get_tx_pending(struct i40e_ring *ring, bool in_sw);
 
 /**
  * i40e_get_head - Retrieve head from head writeback
Signature · 1 line
2.1.0
#10 lore raw

PATCH 5/15 i40e: Add a SW workaround for lost Interrupts

Quoted 28 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Joshua Hay
Sent: Friday, January 15, 2016 2:33 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S28 05/15] i40e: Add a SW workaround for lost Interrupts

From: Anjali Singhai Jain <[email protected]>

This patch adds a workaround for cases where we might have interrupts that got lost but WB happened.
If that happens without this patch we will see a tx_timeout. To work around it, this patch goes ahead and reschedules napi in that situation, if napi is not already scheduled.
We also add a counter in ethtool to keep track of when we detect a case of tx_lost_interrupt.

Note: napi_reschedule() can be safely called from process/service_task context and is done in other drivers as well without an issue.

Change-ID I00f98f1ce3774524d9421227652bef20fcbd0d20

---
Testing Hints: See if some more cases of tx_timeout go away from X722 and even fortville. Particulary the case where HWB=TAIL as seen in the dmesg logs when the tx_timeout happens.

Quoted 9 lines
 drivers/net/ethernet/intel/i40e/i40e.h         |  1 +
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c |  1 +
 drivers/net/ethernet/intel/i40e/i40e_main.c    | 32 ++++++++++++++++-----
-----
 drivers/net/ethernet/intel/i40e/i40e_txrx.c    | 10 +++++---
 drivers/net/ethernet/intel/i40e/i40e_txrx.h    |  3 ++-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c  | 10 +++++---
drivers/net/ethernet/intel/i40evf/i40e_txrx.h  |  3 ++-
 7 files changed, 40 insertions(+), 20 deletions(-)

Patch code changes correctly applied, hammered cards with traffic, observed no tx_timout and a handful of lost_interrupts with ~1hr of traffic on fortville, no timeouts/lost interrupts on X722

#11 lore raw

PATCH 5/15 i40e: Add a SW workaround for lost Interrupts

In reply to Joshua Hay
Quoted 23 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Joshua Hay
Sent: Friday, January 15, 2016 2:33 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S28 05/15] i40e: Add a SW workaround for lost Interrupts

From: Anjali Singhai Jain <[email protected]>

This patch adds a workaround for cases where we might have interrupts that got lost but WB happened.
If that happens without this patch we will see a tx_timeout. To work around it, this patch goes ahead and reschedules napi in that situation, if napi is not already scheduled.
We also add a counter in ethtool to keep track of when we detect a case of tx_lost_interrupt.

Note: napi_reschedule() can be safely called from process/service_task context and is done in other drivers as well without an issue.

Change-ID I00f98f1ce3774524d9421227652bef20fcbd0d20
Quoted 8 lines

---
Testing Hints: See if some more cases of tx_timeout go away from X722 and even fortville. Particulary the case where HWB=TAIL as seen in the dmesg logs when the tx_timeout happens.

 drivers/net/ethernet/intel/i40e/i40e.h         |  1 +
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c |  1 +
 drivers/net/ethernet/intel/i40e/i40e_main.c    | 32 ++++++++++++++++-----

Patch code changes correctly applied, hammered cards with traffic, observed no tx_timout and a handful of lost_interrupts with ~1hr of traffic on fortville, no timeouts/lost interrupts on X722

author
#12 lore raw

PATCH 6/15 i40e: Fix PROMISC mode for Multi-function per port (MFP) devices

In reply to Joshua Hay

From: Anjali Singhai Jain <[email protected]>

This patch falls back to enabling unicast, multicast and broadcast promiscuous mode when the driver must disable it's use of "default port" aka defport mode (which is mornally used to provide a promiscuous mode), due to internal incompatibility with Multiple Function per Port (aka MFP).

The situation that requires this patch is when Physical Function 0 is the device being used, and it can support SR-IOV when MFP is enabled, via the driver creating a VEB on an MFP enabled adapter.

Change-ID Ie90b00d0d58782a5dfcf2c3c9725a2eb90bd63d8

---
Testing Hints:
With our driver defaulting to set_switch_config with Promisc except when L2 filters match, we do not expect to see any mirroring of VF traffic in the PF since the DCR doesn't make an exception for MFP case. If we see mirroring than we need to file a separate issue with the HW team.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -1
index ac71ba2..4f4262e 100644
@@ -2122,7 +2122,9 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
 		cur_promisc = (!!(vsi->current_netdev_flags & IFF_PROMISC) ||
 			       test_bit(__I40E_FILTER_OVERFLOW_PROMISC,
 					&vsi->state));
-		if (vsi->type == I40E_VSI_MAIN && pf->lan_veb != I40E_NO_VEB) {
+		if ((vsi->type == I40E_VSI_MAIN) &&
+		    (pf->lan_veb != I40E_NO_VEB) &&
+		    !(pf->flags & I40E_FLAG_MFP_ENABLED)) {
 			/* set defport ON for Main VSI instead of true promisc
 			 * this way we will get all unicast/multicast and VLAN
 			 * promisc behavior but will not get VF or VMDq traffic
Signature · 1 line
2.1.0
#13 lore raw

PATCH 6/15 i40e: Fix PROMISC mode for Multi-function per port (MFP) devices

Quoted 28 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Joshua Hay
Sent: Friday, January 15, 2016 2:33 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S28 06/15] i40e: Fix PROMISC mode for Multi-function per port (MFP) devices

From: Anjali Singhai Jain <[email protected]>

This patch falls back to enabling unicast, multicast and broadcast promiscuous mode when the driver must disable it's use of "default port" aka defport mode (which is mornally used to provide a promiscuous mode), due to internal incompatibility with Multiple Function per Port (aka MFP).

The situation that requires this patch is when Physical Function 0 is the device being used, and it can support SR-IOV when MFP is enabled, via the driver creating a VEB on an MFP enabled adapter.

Change-ID Ie90b00d0d58782a5dfcf2c3c9725a2eb90bd63d8

---
Testing Hints:
With our driver defaulting to set_switch_config with Promisc except when L2 filters match, we do not expect to see any mirroring of VF traffic in the PF since the DCR doesn't make an exception for MFP case. If we see mirroring than we need to file a separate issue with the HW team.

Quoted 2 lines
 drivers/net/ethernet/intel/i40e/i40e_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch code changes correctly applied, no mirroring of VF traffic in PF observed.

author
#14 lore raw

PATCH 7/15 i40e: Removal of code which relies on BASE VEB SEID

In reply to Joshua Hay

From: Kiran Patil <[email protected]>

Fixed mapping of SEID is removed from specification. Hence this patch removes code which was using hardcoded base VEB SEID.

Changed FCoE code to use "hw->pf_id" to obtain correct "idx" and verified.

Removed defines for BASE VSI/VEB SEID and BASE_PF_SEID since it is not used anymore.

Change-ID Id507cf4b1fae1c0145e3f08ae9ea5846ea5840de

---
Testing Hints:
Please test using debugfs hook for "dump veb <seid>".
echo "dump veb [seid]" > command
Here "seid" is VEB seid and it is optional argument. If "seid" is not specified, it dumps all VEBs.

After this patch, user shall see output in dmesg. Without this patch, if SEID is not in range, user will see error like
"<seid>: bad seid"

 drivers/net/ethernet/intel/i40e/i40e.h         |  3 ---
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 16 +++-------------
 drivers/net/ethernet/intel/i40e/i40e_main.c    |  2 +-
 3 files changed, 4 insertions(+), 17 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +0 -3
index e37af29..ceb72d8 100644
@@ -64,9 +64,6 @@
 #include "i40e_dcb.h"
 
 /* Useful i40e defaults */
-#define I40E_BASE_PF_SEID     16
-#define I40E_BASE_VSI_SEID    512
-#define I40E_BASE_VEB_SEID    288
 #define I40E_MAX_VEB          16
 
 #define I40E_MAX_NUM_DESCRIPTORS      4096
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +3 -13
index 631c2d6..2a44f2e 100644
@@ -61,13 +61,9 @@ static struct i40e_veb *i40e_dbg_find_veb(struct i40e_pf *pf, int seid)
 {
 	int i;
 
-	if ((seid < I40E_BASE_VEB_SEID) ||
-	    (seid > (I40E_BASE_VEB_SEID + I40E_MAX_VEB)))
-		dev_info(&pf->pdev->dev, "%d: bad seid\n", seid);
-	else
-		for (i = 0; i < I40E_MAX_VEB; i++)
-			if (pf->veb[i] && pf->veb[i]->seid == seid)
-				return pf->veb[i];
+	for (i = 0; i < I40E_MAX_VEB; i++)
+		if (pf->veb[i] && pf->veb[i]->seid == seid)
+			return pf->veb[i];
 	return NULL;
 }
 
@@ -691,12 +687,6 @@ static void i40e_dbg_dump_veb_seid(struct i40e_pf *pf, int seid)
 {
 	struct i40e_veb *veb;
 
-	if ((seid < I40E_BASE_VEB_SEID) ||
-	    (seid >= (I40E_MAX_VEB + I40E_BASE_VEB_SEID))) {
-		dev_info(&pf->pdev->dev, "%d: bad seid\n", seid);
-		return;
-	}
-
 	veb = i40e_dbg_find_veb(pf, seid);
 	if (!veb) {
 		dev_info(&pf->pdev->dev, "can't find veb %d\n", seid);
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
index 4f4262e..90e37f4 100644
@@ -768,7 +768,7 @@ static void i40e_update_fcoe_stats(struct i40e_vsi *vsi)
 	if (vsi->type != I40E_VSI_FCOE)
 		return;
 
-	idx = (pf->pf_seid - I40E_BASE_PF_SEID) + I40E_FCOE_PF_STAT_OFFSET;
+	idx = hw->pf_id + I40E_FCOE_PF_STAT_OFFSET;
 	fs = &vsi->fcoe_stats;
 	ofs = &vsi->fcoe_stats_offsets;
 
Signature · 1 line
2.1.0
#15 lore raw

PATCH 7/15 i40e: Removal of code which relies on BASE VEB SEID

Quoted 28 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Joshua Hay
Sent: Friday, January 15, 2016 2:33 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S28 07/15] i40e: Removal of code which relies on BASE VEB SEID

From: Kiran Patil <[email protected]>

Fixed mapping of SEID is removed from specification. Hence this patch removes code which was using hardcoded base VEB SEID.

Changed FCoE code to use "hw->pf_id" to obtain correct "idx" and verified.

Removed defines for BASE VSI/VEB SEID and BASE_PF_SEID since it is not used anymore.

Change-ID Id507cf4b1fae1c0145e3f08ae9ea5846ea5840de

---
Testing Hints:
Please test using debugfs hook for "dump veb <seid>".
echo "dump veb [seid]" > command
Here "seid" is VEB seid and it is optional argument. If "seid" is not specified, it dumps all VEBs.

Quoted 8 lines

After this patch, user shall see output in dmesg. Without this patch, if SEID is not in range, user will see error like
"<seid>: bad seid"

 drivers/net/ethernet/intel/i40e/i40e.h         |  3 ---
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 16 +++-------------
 drivers/net/ethernet/intel/i40e/i40e_main.c    |  2 +-
 3 files changed, 4 insertions(+), 17 deletions(-)

Patch code changes correctly applied, debugfs dump veb command works as expected per patch

author
#16 lore raw

PATCH 8/15 i40e/i40evf: avoid atomics

In reply to Joshua Hay

From: Mitch Williams <[email protected]>

In the case where we have a page fully used by receive data, we need to release the page fully to the stack. Instead of calling get_page (which increments the page count) followed by free_page (which decrements the page count), just donate our reference to the stack. Although this donation is not tax deductable, it does allow us to avoid two very expensive atomic operations that reverse each other.

Change-ID If70739792d5748995fc175ec92ac2171ed4ad8fc

---
Testing Hints: make sure receive traffic is stable under heavy load with packet split enabled, and that no data corruption is seen.

 drivers/net/ethernet/intel/i40e/i40e_txrx.c   | 21 +++++++++++++--------
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 21 +++++++++++++--------
 2 files changed, 26 insertions(+), 16 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +13 -8
index 60e993e..cd9bb7f 100644
@@ -1663,28 +1663,33 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, const int budget)
 					rx_bi->page_offset + copysize,
 					rx_packet_len, I40E_RXBUFFER_2048);
 
-			get_page(rx_bi->page);
-			/* switch to the other half-page here; the allocation
-			 * code programs the right addr into HW. If we haven't
-			 * used this half-page, the address won't be changed,
-			 * and HW can just use it next time through.
-			 */
-			rx_bi->page_offset ^= PAGE_SIZE / 2;
 			/* If the page count is more than 2, then both halves
 			 * of the page are used and we need to free it. Do it
 			 * here instead of in the alloc code. Otherwise one
 			 * of the half-pages might be released between now and
 			 * then, and we wouldn't know which one to use.
+			 * Don't call get_page and free_page since those are
+			 * both expensive atomic operations that just change
+			 * the refcount in opposite directions. Just give the
+			 * page to the stack; he can have our refcount.
 			 */
 			if (page_count(rx_bi->page) > 2) {
 				dma_unmap_page(rx_ring->dev,
 					       rx_bi->page_dma,
 					       PAGE_SIZE,
 					       DMA_FROM_DEVICE);
-				__free_page(rx_bi->page);
 				rx_bi->page = NULL;
 				rx_bi->page_dma = 0;
 				rx_ring->rx_stats.realloc_count++;
+			} else {
+				get_page(rx_bi->page);
+				/* switch to the other half-page here; the
+				 * allocation code programs the right addr
+				 * into HW. If we haven't used this half-page,
+				 * the address won't be changed, and HW can
+				 * just use it next time through.
+				 */
+				rx_bi->page_offset ^= PAGE_SIZE / 2;
 			}
 
 		}
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +13 -8
index c1ea819..ecd2df2 100644
@@ -1126,28 +1126,33 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, const int budget)
 					rx_bi->page_offset + copysize,
 					rx_packet_len, I40E_RXBUFFER_2048);
 
-			get_page(rx_bi->page);
-			/* switch to the other half-page here; the allocation
-			 * code programs the right addr into HW. If we haven't
-			 * used this half-page, the address won't be changed,
-			 * and HW can just use it next time through.
-			 */
-			rx_bi->page_offset ^= PAGE_SIZE / 2;
 			/* If the page count is more than 2, then both halves
 			 * of the page are used and we need to free it. Do it
 			 * here instead of in the alloc code. Otherwise one
 			 * of the half-pages might be released between now and
 			 * then, and we wouldn't know which one to use.
+			 * Don't call get_page and free_page since those are
+			 * both expensive atomic operations that just change
+			 * the refcount in opposite directions. Just give the
+			 * page to the stack; he can have our refcount.
 			 */
 			if (page_count(rx_bi->page) > 2) {
 				dma_unmap_page(rx_ring->dev,
 					       rx_bi->page_dma,
 					       PAGE_SIZE,
 					       DMA_FROM_DEVICE);
-				__free_page(rx_bi->page);
 				rx_bi->page = NULL;
 				rx_bi->page_dma = 0;
 				rx_ring->rx_stats.realloc_count++;
+			} else {
+				get_page(rx_bi->page);
+				/* switch to the other half-page here; the
+				 * allocation code programs the right addr
+				 * into HW. If we haven't used this half-page,
+				 * the address won't be changed, and HW can
+				 * just use it next time through.
+				 */
+				rx_bi->page_offset ^= PAGE_SIZE / 2;
 			}
 
 		}
Signature · 1 line
2.1.0
#17 lore raw

PATCH 8/15 i40e/i40evf: avoid atomics

Quoted 18 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Joshua Hay
Sent: Friday, January 15, 2016 2:33 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S28 08/15] i40e/i40evf: avoid atomics

From: Mitch Williams <[email protected]>

In the case where we have a page fully used by receive data, we need to release the page fully to the stack. Instead of calling get_page (which increments the page count) followed by free_page (which decrements the page count), just donate our reference to the stack. Although this donation is not tax deductable, it does allow us to avoid two very expensive atomic operations that reverse each other.

Change-ID If70739792d5748995fc175ec92ac2171ed4ad8fc
Quoted 7 lines

---
Testing Hints: make sure receive traffic is stable under heavy load with packet split enabled, and that no data corruption is seen.

 drivers/net/ethernet/intel/i40e/i40e_txrx.c   | 21 +++++++++++++--------
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 21 +++++++++++++--------
 2 files changed, 26 insertions(+), 16 deletions(-)

Patch code changes correctly applied, heavy load traffic stable, no corruption observed

author
#18 lore raw

PATCH 9/15 i40e: Do not disable queues in the Legacy/MSI Interrupt handler

In reply to Joshua Hay

From: Anjali Singhai Jain <[email protected]>

The queues should never be enabled/disabled in the interrupt handler, ICR0 interrupt enable should be the only thing that needs to be dynamically changed in the handler.

This patch fixes that. Without this patch X722 platforms were seeing weird ping timings when in Legacy mode since it takes a whole lot of time for the HW/FW to re-enable queues.

Change-ID If065afc45d81c5a19d4a94a00cd5b8f61cefc40c

---
Testing Hints (Required if no HSD): Test with legacy mode enabled.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 16 ++++++----------
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 13 -------------
 2 files changed, 6 insertions(+), 23 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +6 -10
index 90e37f4..5e7a7a1 100644
@@ -3462,16 +3462,12 @@ static irqreturn_t i40e_intr(int irq, void *data)
 		struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
 		struct i40e_q_vector *q_vector = vsi->q_vectors[0];
 
-		/* temporarily disable queue cause for NAPI processing */
-		u32 qval = rd32(hw, I40E_QINT_RQCTL(0));
-
-		qval &= ~I40E_QINT_RQCTL_CAUSE_ENA_MASK;
-		wr32(hw, I40E_QINT_RQCTL(0), qval);
-
-		qval = rd32(hw, I40E_QINT_TQCTL(0));
-		qval &= ~I40E_QINT_TQCTL_CAUSE_ENA_MASK;
-		wr32(hw, I40E_QINT_TQCTL(0), qval);
-
+		/* We do not have a way to disarm Queue causes while leaving
+		 * interrupt enabled for all other causes, ideally
+		 * interrupt should be disabled while we are in NAPI but
+		 * this is not a performance path and napi_schedule()
+		 * can deal with rescheduling.
+		 */
 		if (!test_bit(__I40E_DOWN, &pf->state))
 			napi_schedule_irqoff(&q_vector->napi);
 	}
drivers/net/ethernet/intel/i40e/i40e_txrx.c +0 -13
index cd9bb7f..61e98f5 100644
@@ -2051,19 +2051,6 @@ tx_only:
 	if (vsi->back->flags & I40E_FLAG_MSIX_ENABLED) {
 		i40e_update_enable_itr(vsi, q_vector);
 	} else { /* Legacy mode */
-		struct i40e_hw *hw = &vsi->back->hw;
-		/* We re-enable the queue 0 cause, but
-		 * don't worry about dynamic_enable
-		 * because we left it on for the other
-		 * possible interrupts during napi
-		 */
-		u32 qval = rd32(hw, I40E_QINT_RQCTL(0)) |
-			   I40E_QINT_RQCTL_CAUSE_ENA_MASK;
-
-		wr32(hw, I40E_QINT_RQCTL(0), qval);
-		qval = rd32(hw, I40E_QINT_TQCTL(0)) |
-		       I40E_QINT_TQCTL_CAUSE_ENA_MASK;
-		wr32(hw, I40E_QINT_TQCTL(0), qval);
 		i40e_irq_dynamic_enable_icr0(vsi->back, false);
 	}
 	return 0;
Signature · 1 line
2.1.0
#19 lore raw

PATCH 9/15 i40e: Do not disable queues in the Legacy/MSI Interrupt handler

Quoted 18 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Joshua Hay
Sent: Friday, January 15, 2016 2:33 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S28 09/15] i40e: Do not disable queues in the Legacy/MSI Interrupt handler

From: Anjali Singhai Jain <[email protected]>

The queues should never be enabled/disabled in the interrupt handler, ICR0 interrupt enable should be the only thing that needs to be dynamically changed in the handler.

This patch fixes that. Without this patch X722 platforms were seeing weird ping timings when in Legacy mode since it takes a whole lot of time for the HW/FW to re-enable queues.

Quoted 8 lines
Change-ID If065afc45d81c5a19d4a94a00cd5b8f61cefc40c

---
Testing Hints (Required if no HSD): Test with legacy mode enabled.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 16 ++++++----------
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 13 -------------
 2 files changed, 6 insertions(+), 23 deletions(-)

Patch code changes correctly applied, ping times normal/consistent on X722 in Legacy mode

author
#20 lore raw

PATCH 10/15 i40e: expand comment

In reply to Joshua Hay

From: Mitch Williams <[email protected]>

Explain why we cannot remove this code, even though it works differently than any of our other interrupt cause handling code.

Change-ID Ie66203bd037a466066036611c31d44f759ec5176

---
Testing Hints: Comment only. No code change.

 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +5 -1
index 597f209..5dcd198 100644
@@ -2037,7 +2037,11 @@ int i40e_vc_process_vflr_event(struct i40e_pf *pf)
 	if (!test_bit(__I40E_VFLR_EVENT_PENDING, &pf->state))
 		return 0;
 
-	/* re-enable vflr interrupt cause */
+	/* Re-enable the VFLR interrupt cause here, before looking for which
+	 * VF got reset. Otherwise, if another VF gets a reset while the
+	 * first one is being processed, that interrupt will be lost, and
+	 * that VF will be stuck in reset forever.
+	 */
 	reg = rd32(hw, I40E_PFINT_ICR0_ENA);
 	reg |= I40E_PFINT_ICR0_ENA_VFLR_MASK;
 	wr32(hw, I40E_PFINT_ICR0_ENA, reg);
Signature · 1 line
2.1.0
#21 lore raw

PATCH 10/15 i40e: expand comment

Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Joshua Hay
Sent: Friday, January 15, 2016 2:33 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S28 10/15] i40e: expand comment

From: Mitch Williams <[email protected]>

Explain why we cannot remove this code, even though it works differently than any of our other interrupt cause handling code.

Quoted 7 lines
Change-ID Ie66203bd037a466066036611c31d44f759ec5176

---
Testing Hints: Comment only. No code change.

 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch code changes correctly applied

author
#22 lore raw

PATCH 11/15 i40e: better error reporting for nvmupdate

In reply to Joshua Hay

From: Shannon Nelson <[email protected]>

Make sure we return EBUSY while finishing up a reset, and add a few bits for better debug messages.

Change-ID I23f6c28a8d96d7aa171abcc265737cec7826c292
---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 39 +++++++++++++-------------
 drivers/net/ethernet/intel/i40e/i40e_main.c    |  5 +++-
 2 files changed, 24 insertions(+), 20 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +20 -19
index d2010290..54d63a6 100644
@@ -1005,16 +1005,19 @@ static int i40e_get_eeprom(struct net_device *netdev,
 	/* check for NVMUpdate access method */
 	magic = hw->vendor_id | (hw->device_id << 16);
 	if (eeprom->magic && eeprom->magic != magic) {
-		struct i40e_nvm_access *cmd;
-		int errno;
+		struct i40e_nvm_access *cmd = (struct i40e_nvm_access *)eeprom;
+		int errno = 0;
 
 		/* make sure it is the right magic for NVMUpdate */
 		if ((eeprom->magic >> 16) != hw->device_id)
-			return -EINVAL;
+			errno = -EINVAL;
+		else if (test_bit(__I40E_RESET_RECOVERY_PENDING, &pf->state) ||
+			 test_bit(__I40E_RESET_INTR_RECEIVED, &pf->state))
+			errno = -EBUSY;
+		else
+			ret_val = i40e_nvmupd_command(hw, cmd, bytes, &errno);
 
-		cmd = (struct i40e_nvm_access *)eeprom;
-		ret_val = i40e_nvmupd_command(hw, cmd, bytes, &errno);
-		if (ret_val && (hw->debug_mask & I40E_DEBUG_NVM))
+		if ((errno || ret_val) && (hw->debug_mask & I40E_DEBUG_NVM))
 			dev_info(&pf->pdev->dev,
 				 "NVMUpdate read failed err=%d status=0x%x errno=%d module=%d offset=0x%x size=%d\n",
 				 ret_val, hw->aq.asq_last_status, errno,
@@ -1098,27 +1101,25 @@ static int i40e_set_eeprom(struct net_device *netdev,
 	struct i40e_netdev_priv *np = netdev_priv(netdev);
 	struct i40e_hw *hw = &np->vsi->back->hw;
 	struct i40e_pf *pf = np->vsi->back;
-	struct i40e_nvm_access *cmd;
+	struct i40e_nvm_access *cmd = (struct i40e_nvm_access *)eeprom;
 	int ret_val = 0;
-	int errno;
+	int errno = 0;
 	u32 magic;
 
 	/* normal ethtool set_eeprom is not supported */
 	magic = hw->vendor_id | (hw->device_id << 16);
 	if (eeprom->magic == magic)
-		return -EOPNOTSUPP;
-
+		errno = -EOPNOTSUPP;
 	/* check for NVMUpdate access method */
-	if (!eeprom->magic || (eeprom->magic >> 16) != hw->device_id)
-		return -EINVAL;
-
-	if (test_bit(__I40E_RESET_RECOVERY_PENDING, &pf->state) ||
-	    test_bit(__I40E_RESET_INTR_RECEIVED, &pf->state))
-		return -EBUSY;
+	else if (!eeprom->magic || (eeprom->magic >> 16) != hw->device_id)
+		errno = -EINVAL;
+	else if (test_bit(__I40E_RESET_RECOVERY_PENDING, &pf->state) ||
+		 test_bit(__I40E_RESET_INTR_RECEIVED, &pf->state))
+		errno = -EBUSY;
+	else
+		ret_val = i40e_nvmupd_command(hw, cmd, bytes, &errno);
 
-	cmd = (struct i40e_nvm_access *)eeprom;
-	ret_val = i40e_nvmupd_command(hw, cmd, bytes, &errno);
-	if (ret_val && (hw->debug_mask & I40E_DEBUG_NVM))
+	if ((errno || ret_val) && (hw->debug_mask & I40E_DEBUG_NVM))
 		dev_info(&pf->pdev->dev,
 			 "NVMUpdate write failed err=%d status=0x%x errno=%d module=%d offset=0x%x size=%d\n",
 			 ret_val, hw->aq.asq_last_status, errno,
drivers/net/ethernet/intel/i40e/i40e_main.c +4 -1
index 5e7a7a1..98cbc90 100644
@@ -3475,6 +3475,7 @@ static irqreturn_t i40e_intr(int irq, void *data)
 	if (icr0 & I40E_PFINT_ICR0_ADMINQ_MASK) {
 		ena_mask &= ~I40E_PFINT_ICR0_ENA_ADMINQ_MASK;
 		set_bit(__I40E_ADMINQ_EVENT_PENDING, &pf->state);
+		i40e_debug(&pf->hw, I40E_DEBUG_NVM, "AdminQ event\n");
 	}
 
 	if (icr0 & I40E_PFINT_ICR0_MAL_DETECT_MASK) {
@@ -6323,7 +6324,9 @@ static void i40e_clean_adminq_subtask(struct i40e_pf *pf)
 		case i40e_aqc_opc_nvm_erase:
 		case i40e_aqc_opc_nvm_update:
 		case i40e_aqc_opc_oem_post_update:
-			i40e_debug(&pf->hw, I40E_DEBUG_NVM, "ARQ NVM operation completed\n");
+			i40e_debug(&pf->hw, I40E_DEBUG_NVM,
+				   "ARQ NVM operation 0x%04x completed\n",
+				   opcode);
 			break;
 		default:
 			dev_info(&pf->pdev->dev,
Signature · 1 line
2.1.0
#23 lore raw

PATCH 11/15 i40e: better error reporting for nvmupdate

Quoted 13 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Joshua Hay
Sent: Friday, January 15, 2016 2:33 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S28 11/15] i40e: better error reporting for nvmupdate

From: Shannon Nelson <[email protected]>

Make sure we return EBUSY while finishing up a reset, and add a few bits for better debug messages.

Quoted 7 lines
Change-ID I23f6c28a8d96d7aa171abcc265737cec7826c292
---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 39 +++++++++++++---------
----
 drivers/net/ethernet/intel/i40e/i40e_main.c    |  5 +++-
 2 files changed, 24 insertions(+), 20 deletions(-)

Patch code changes correctly applied, errors updated as expected

author
#24 lore raw

PATCH 12/15 i40evf: set adapter state on reset failure

In reply to Joshua Hay

From: Mitch Williams <[email protected]>

If a reset fails to complete, the driver gets its affairs in order and awaits the cold solace of rmmod. Unfortunately, it was not properly setting the adapter state, which would cause a panic on rmmod, instead of the desired surcease.

Set the adapter state to DOWN in this case, and avoid a panic.

Change-ID I6fdd9906da52e023f8dc744f7da44b5d95278ca9

---
Testing Hints: Execute CORER on the PF and see if you can get into the state where the VF reset never completed. Then rmmod i40evf.

 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +1 -0
index 2b3c81b..6fcf9af 100644
@@ -1883,6 +1883,7 @@ static void i40evf_reset_task(struct work_struct *work)
 		adapter->netdev->flags &= ~IFF_UP;
 		clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);
 		adapter->flags &= ~I40EVF_FLAG_RESET_PENDING;
+		adapter->state = __I40EVF_DOWN;
 		dev_info(&adapter->pdev->dev, "Reset task did not complete, VF disabled\n");
 		return; /* Do not attempt to reinit. It's dead, Jim. */
 	}
Signature · 1 line
2.1.0
#25 lore raw

PATCH 12/15 i40evf: set adapter state on reset failure

Quoted 16 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Joshua Hay
Sent: Friday, January 15, 2016 2:33 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S28 12/15] i40evf: set adapter state on reset failure

From: Mitch Williams <[email protected]>

If a reset fails to complete, the driver gets its affairs in order and awaits the cold solace of rmmod. Unfortunately, it was not properly setting the adapter state, which would cause a panic on rmmod, instead of the desired surcease.

Set the adapter state to DOWN in this case, and avoid a panic.

Quoted 8 lines
Change-ID I6fdd9906da52e023f8dc744f7da44b5d95278ca9

---
Testing Hints: Execute CORER on the PF and see if you can get into the state where the VF reset never completed. Then rmmod i40evf.

 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 1 +
 1 file changed, 1 insertion(+)

Patch code changes correctly applied, no errors/panics detected after multiple resets

author
#26 lore raw

PATCH 13/15 i40e: clean event descriptor before use

In reply to Joshua Hay

From: Shannon Nelson <[email protected]>

In one obscure corner case, it was possible to clear the NVM update wait flag when no update_done message was actually received. This patch cleans the event descriptor before use, and moves the opcode check to where it won't get done if there was no event to clean.

Also update copyright year in file headers.

Change-ID I68bbc41965e93f4adf07cbe98b9dfd63d41509a4

---
Testing Hints:
Do an NVM update on that specific customer's platform.

 drivers/net/ethernet/intel/i40e/i40e_adminq.c   | 20 +++++++++++---------
 drivers/net/ethernet/intel/i40evf/i40e_adminq.c |  5 ++++-
 2 files changed, 15 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_adminq.c +11 -9
index 1fd5ea8..df8e2fd 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Intel Ethernet Controller XL710 Family Linux Driver
- * Copyright(c) 2013 - 2014 Intel Corporation.
+ * Copyright(c) 2013 - 2016 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,
@@ -953,6 +953,9 @@ i40e_status i40e_clean_arq_element(struct i40e_hw *hw,
 	u16 flags;
 	u16 ntu;
 
+	/* pre-clean the event info */
+	memset(&e->desc, 0, sizeof(e->desc));
+
 	/* take the lock before we start messing with the ring */
 	mutex_lock(&hw->aq.arq_mutex);
 
@@ -1020,14 +1023,6 @@ i40e_status i40e_clean_arq_element(struct i40e_hw *hw,
 	hw->aq.arq.next_to_clean = ntc;
 	hw->aq.arq.next_to_use = ntu;
 
-clean_arq_element_out:
-	/* Set pending if needed, unlock and return */
-	if (pending != NULL)
-		*pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc);
-
-clean_arq_element_err:
-	mutex_unlock(&hw->aq.arq_mutex);
-
 	if (i40e_is_nvm_update_op(&e->desc)) {
 		if (hw->aq.nvm_release_on_done) {
 			i40e_release_nvm(hw);
@@ -1048,6 +1043,13 @@ clean_arq_element_err:
 		}
 	}
 
+clean_arq_element_out:
+	/* Set pending if needed, unlock and return */
+	if (pending)
+		*pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc);
+clean_arq_element_err:
+	mutex_unlock(&hw->aq.arq_mutex);
+
 	return ret_code;
 }
 
drivers/net/ethernet/intel/i40evf/i40e_adminq.c +4 -1
index 3f65e39..44f7ed7 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
- * Copyright(c) 2013 - 2014 Intel Corporation.
+ * Copyright(c) 2013 - 2016 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,
@@ -887,6 +887,9 @@ i40e_status i40evf_clean_arq_element(struct i40e_hw *hw,
 	u16 flags;
 	u16 ntu;
 
+	/* pre-clean the event info */
+	memset(&e->desc, 0, sizeof(e->desc));
+
 	/* take the lock before we start messing with the ring */
 	mutex_lock(&hw->aq.arq_mutex);
 
Signature · 1 line
2.1.0
#27 lore raw

PATCH 13/15 i40e: clean event descriptor before use

Quoted 19 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Joshua Hay
Sent: Friday, January 15, 2016 2:33 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S28 13/15] i40e: clean event descriptor before use

From: Shannon Nelson <[email protected]>

In one obscure corner case, it was possible to clear the NVM update wait flag when no update_done message was actually received. This patch cleans the event descriptor before use, and moves the opcode check to where it won't get done if there was no event to clean.

Also update copyright year in file headers.

Change-ID I68bbc41965e93f4adf07cbe98b9dfd63d41509a4
Quoted 7 lines

---
Testing Hints:
Do an NVM update on that specific customer's platform.

 drivers/net/ethernet/intel/i40e/i40e_adminq.c   | 20 +++++++++++---------
 drivers/net/ethernet/intel/i40evf/i40e_adminq.c |  5 ++++-
 2 files changed, 15 insertions(+), 10 deletions(-)

Patch code changes correctly applied, updated successfully

author
#28 lore raw

PATCH 14/15 i40e: When in promisc mode apply promisc mode to Tx Traffic as well

In reply to Joshua Hay

From: Anjali Singhai Jain <[email protected]>

In MFP mode particularly when we were setting the PF VSI in limited promiscuous, the HW switch was still mirroring the outgoing packets from other VSIs (VF/VMdq) onto the PF VSI.

With this new bit set, the mirroring doesn't happen any more and so we are in limited promiscuous on the PF VSI in MFP which is similar to defport.

An API check is not required, since this bit is reserved for FW API version < 1.5

Also update copyright year in file headers.

Change-ID I9840cb95f11dde733d943cb03ce84f68b9611bc8
---
 drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h   | 3 ++-
 drivers/net/ethernet/intel/i40e/i40e_common.c       | 9 ++++++++-
 drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 3 ++-
 3 files changed, 12 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +2 -1
index 5699299..bb7ecbb 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Intel Ethernet Controller XL710 Family Linux Driver
- * Copyright(c) 2013 - 2014 Intel Corporation.
+ * Copyright(c) 2013 - 2016 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,
@@ -1087,6 +1087,7 @@ struct i40e_aqc_set_vsi_promiscuous_modes {
 #define I40E_AQC_SET_VSI_PROMISC_BROADCAST	0x04
 #define I40E_AQC_SET_VSI_DEFAULT		0x08
 #define I40E_AQC_SET_VSI_PROMISC_VLAN		0x10
+#define I40E_AQC_SET_VSI_PROMISC_TX		0x8000
 	__le16	seid;
 #define I40E_AQC_VSI_PROM_CMD_SEID_MASK		0x3FF
 	__le16	vlan_tag;
drivers/net/ethernet/intel/i40e/i40e_common.c +8 -1
index a9302d3..d86c7a3 100644
@@ -1952,12 +1952,19 @@ i40e_status i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,
 	i40e_fill_default_direct_cmd_desc(&desc,
 					i40e_aqc_opc_set_vsi_promiscuous_modes);
 
-	if (set)
+	if (set) {
 		flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
+		if (((hw->aq.api_maj_ver == 1) && (hw->aq.api_min_ver >= 5)) ||
+		    (hw->aq.api_maj_ver > 1))
+			flags |= I40E_AQC_SET_VSI_PROMISC_TX;
+	}
 
 	cmd->promiscuous_flags = cpu_to_le16(flags);
 
 	cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST);
+	if (((hw->aq.api_maj_ver >= 1) && (hw->aq.api_min_ver >= 5)) ||
+	    (hw->aq.api_maj_ver > 1))
+		cmd->valid_flags |= cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_TX);
 
 	cmd->seid = cpu_to_le16(seid);
 	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h +2 -1
index ed963bc..815e481 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
- * Copyright(c) 2013 - 2014 Intel Corporation.
+ * Copyright(c) 2013 - 2016 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,
@@ -1084,6 +1084,7 @@ struct i40e_aqc_set_vsi_promiscuous_modes {
 #define I40E_AQC_SET_VSI_PROMISC_BROADCAST	0x04
 #define I40E_AQC_SET_VSI_DEFAULT		0x08
 #define I40E_AQC_SET_VSI_PROMISC_VLAN		0x10
+#define I40E_AQC_SET_VSI_PROMISC_TX		0x8000
 	__le16	seid;
 #define I40E_AQC_VSI_PROM_CMD_SEID_MASK		0x3FF
 	__le16	vlan_tag;
Signature · 1 line
2.1.0
#29 lore raw

PATCH 14/15 i40e: When in promisc mode apply promisc mode to Tx Traffic as well

Quoted 22 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Joshua Hay
Sent: Friday, January 15, 2016 2:33 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S28 14/15] i40e: When in promisc mode apply promisc mode to Tx Traffic as well

From: Anjali Singhai Jain <[email protected]>

In MFP mode particularly when we were setting the PF VSI in limited promiscuous, the HW switch was still mirroring the outgoing packets from other VSIs (VF/VMdq) onto the PF VSI.

With this new bit set, the mirroring doesn't happen any more and so we are in limited promiscuous on the PF VSI in MFP which is similar to defport.

An API check is not required, since this bit is reserved for FW API version < 1.5

Also update copyright year in file headers.

Quoted 7 lines
Change-ID I9840cb95f11dde733d943cb03ce84f68b9611bc8
---
 drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h   | 3 ++-
 drivers/net/ethernet/intel/i40e/i40e_common.c       | 9 ++++++++-
 drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 3 ++-
 3 files changed, 12 insertions(+), 3 deletions(-)

Patch code changes correctly applied, no mirroring of VF traffic in PF observed.

author
#30 lore raw

PATCH 15/15 i40e/i40evf: Bump i40e to 1.4.15 and i40evf to 1.4.11.

In reply to Joshua Hay

From: Catherine Sullivan <[email protected]>

Bump.

Change-ID Ie280dc67e37a1cf667c3469499a4fb90f4177b75

---
Testing Hints: Check version.

 drivers/net/ethernet/intel/i40e/i40e_main.c     | 2 +-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
index 98cbc90..530572f 100644
@@ -46,7 +46,7 @@ static const char i40e_driver_string[] =
 
 #define DRV_VERSION_MAJOR 1
 #define DRV_VERSION_MINOR 4
-#define DRV_VERSION_BUILD 13
+#define DRV_VERSION_BUILD 15
 #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
 	     __stringify(DRV_VERSION_MINOR) "." \
 	     __stringify(DRV_VERSION_BUILD)    DRV_KERN
drivers/net/ethernet/intel/i40evf/i40evf_main.c +1 -1
index 6fcf9af..638262c 100644
@@ -38,7 +38,7 @@ static const char i40evf_driver_string[] =
 
 #define DRV_VERSION_MAJOR 1
 #define DRV_VERSION_MINOR 4
-#define DRV_VERSION_BUILD 9
+#define DRV_VERSION_BUILD 11
 #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
 	     __stringify(DRV_VERSION_MINOR) "." \
 	     __stringify(DRV_VERSION_BUILD) \
Signature · 1 line
2.1.0
#31 lore raw

PATCH 15/15 i40e/i40evf: Bump i40e to 1.4.15 and i40evf to 1.4.11.

Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Joshua Hay
Sent: Friday, January 15, 2016 2:33 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S28 15/15] i40e/i40evf: Bump i40e to 1.4.15 and i40evf to 1.4.11.

From: Catherine Sullivan <[email protected]>

Bump.

Quoted 8 lines
Change-ID Ie280dc67e37a1cf667c3469499a4fb90f4177b75

---
Testing Hints: Check version.

 drivers/net/ethernet/intel/i40e/i40e_main.c     | 2 +-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch code changes correctly applied, driver reports correct version information