Skip to contentSkip to conversation

Intel Wired LAN Driver Updates 2022-01-20

GIT PULL In review Tony Nguyen 3 participants 8 messages Jan 21, 2022

Subsystems (3)
lore
Share & tools
lore

Tony Nguyen

author maintainer
#0 lore raw

This series contains updates to i40e driver only.

Jedrzej increases delay for EMP reset and adds checks to ensure a VF request to change queues can be met.

Sylwester moves the placement of the Flow Director queue as to not fragment the queue pile which would cause later re-allocation issues.

Karen prevents VF reset being invoked while another is still occurring to avoid reading invalid data.

Joe Damato fixes some statistics fields to match the values of the fields they are based on.

The following are changes since commit 57afdc0aab094b4c811b3fe030b2567812a495f3:
Merge branch 'stmmac-fixes'
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 40GbE

Jedrzej Jagielski (2):
i40e: Increase delay to 1 s after global EMP reset
i40e: Fix issue when maximum queues is exceeded

Joe Damato (1):
i40e: fix unsigned stat widths

Karen Sornek (1):
i40e: Fix for failed to init adminq while VF reset

Sylwester Dziedziuch (1):
i40e: Fix queues reservation for XDP

 drivers/net/ethernet/intel/i40e/i40e.h        |   9 +-
 .../net/ethernet/intel/i40e/i40e_debugfs.c    |   2 +-
 drivers/net/ethernet/intel/i40e/i40e_main.c   |  44 ++++----
 .../net/ethernet/intel/i40e/i40e_register.h   |   3 +
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 103 +++++++++++++++++-
 .../ethernet/intel/i40e/i40e_virtchnl_pf.h    |   1 +
 6 files changed, 131 insertions(+), 31 deletions(-)
Signature · 1 line
2.31.1
author maintainer
#1 lore raw

PATCH 1/5 i40e: Increase delay to 1 s after global EMP reset

From: Jedrzej Jagielski <[email protected]>

Recently simplified i40e_rebuild causes that FW sometimes is not ready after NVM update, the ping does not return.

Increase the delay in case of EMP reset.
Old delay of 300 ms was introduced for specific cards for 710 series. Now it works for all the cards and delay was increased.

Fixes 1fa51a650e1d ("i40e: Add delay after EMP reset for firmware to recover")
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -9
index 2a3d8aef7f4e..1b0fd3eacd64 100644
@@ -10574,15 +10574,9 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)
 	}
 	i40e_get_oem_version(&pf->hw);
 
-	if (test_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state) &&
-	    ((hw->aq.fw_maj_ver == 4 && hw->aq.fw_min_ver <= 33) ||
-	     hw->aq.fw_maj_ver < 4) && hw->mac.type == I40E_MAC_XL710) {
-		/* The following delay is necessary for 4.33 firmware and older
-		 * to recover after EMP reset. 200 ms should suffice but we
-		 * put here 300 ms to be sure that FW is ready to operate
-		 * after reset.
-		 */
-		mdelay(300);
+	if (test_and_clear_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state)) {
+		/* The following delay is necessary for firmware update. */
+		mdelay(1000);
 	}
 
 	/* re-verify the eeprom if we just had an EMP reset */
Signature · 1 line
2.31.1
#2 lore raw

RE: [PATCH net 1/5] i40e: Increase delay to 1 s after global EMP reset

From: Tony Nguyen

Quoted 8 lines

Sent: 21 January 2022 00:03

Recently simplified i40e_rebuild causes that FW sometimes is not ready after NVM update, the ping does not return.

Increase the delay in case of EMP reset.
Old delay of 300 ms was introduced for specific cards for 710 series. Now it works for all the cards and delay was increased.

...

drivers/net/ethernet/intel/i40e/i40e_main.c static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired) · line 10580

Quoted 4 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -0
+	if (test_and_clear_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state)) {
+		/* The following delay is necessary for firmware update. */
+		mdelay(1000);
 	}

Spinning for a second isn't 'user friendly'.
If there are no locks held you can sleep.
If there are locks held then another cpu can spin waiting for the lock.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)

author maintainer
#3 lore raw

PATCH 2/5 i40e: Fix issue when maximum queues is exceeded

In reply to Tony Nguyen

From: Jedrzej Jagielski <[email protected]>

Before this patch VF interface vanished when maximum queue number was exceeded. Driver tried to add next queues even if there was not enough space. PF sent incorrect number of queues to
the VF when there were not enough of them.

Add an additional condition introduced to check available space in 'qp_pile' before proceeding. This condition makes it impossible to add queues if they number is greater than the number resulting from available space.
Also add the search for free space in PF queue pair piles.

Without this patch VF interfaces are not seen
when available space for queues has been
exceeded and following logs appears permanently
in dmesg:
"Unable to get VF config (-32)".
"VF 62 failed opcode 3, retval: -5"
"Unable to get VF config due to PF error condition, not retrying"

Fixes 7daa6bf3294e ("i40e: driver core headers")
Fixes 41c445ff0f48 ("i40e: main driver core")
---
 drivers/net/ethernet/intel/i40e/i40e.h        |  1 -
 drivers/net/ethernet/intel/i40e/i40e_main.c   | 14 +----
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 59 +++++++++++++++++++
 3 files changed, 61 insertions(+), 13 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +0 -1
index 4d939af0a626..c8cfe62d5e05 100644
@@ -174,7 +174,6 @@ enum i40e_interrupt_policy {
 
 struct i40e_lump_tracking {
 	u16 num_entries;
-	u16 search_hint;
 	u16 list[0];
 #define I40E_PILE_VALID_BIT  0x8000
 #define I40E_IWARP_IRQ_PILE_ID  (I40E_PILE_VALID_BIT - 2)
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -12
index 1b0fd3eacd64..9456641cd24a 100644
@@ -196,10 +196,6 @@ int i40e_free_virt_mem_d(struct i40e_hw *hw, struct i40e_virt_mem *mem)
  * @id: an owner id to stick on the items assigned
  *
  * Returns the base item index of the lump, or negative for error
- *
- * The search_hint trick and lack of advanced fit-finding only work
- * because we're highly likely to have all the same size lump requests.
- * Linear search time and any fragmentation should be minimal.
  **/
 static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile,
 			 u16 needed, u16 id)
@@ -214,8 +210,7 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile,
 		return -EINVAL;
 	}
 
-	/* start the linear search with an imperfect hint */
-	i = pile->search_hint;
+	i = 0;
 	while (i < pile->num_entries) {
 		/* skip already allocated entries */
 		if (pile->list[i] & I40E_PILE_VALID_BIT) {
@@ -234,7 +229,6 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile,
 			for (j = 0; j < needed; j++)
 				pile->list[i+j] = id | I40E_PILE_VALID_BIT;
 			ret = i;
-			pile->search_hint = i + j;
 			break;
 		}
 
@@ -257,7 +251,7 @@ static int i40e_put_lump(struct i40e_lump_tracking *pile, u16 index, u16 id)
 {
 	int valid_id = (id | I40E_PILE_VALID_BIT);
 	int count = 0;
-	int i;
+	u16 i;
 
 	if (!pile || index >= pile->num_entries)
 		return -EINVAL;
@@ -269,8 +263,6 @@ static int i40e_put_lump(struct i40e_lump_tracking *pile, u16 index, u16 id)
 		count++;
 	}
 
-	if (count && index < pile->search_hint)
-		pile->search_hint = index;
 
 	return count;
 }
@@ -11786,7 +11778,6 @@ static int i40e_init_interrupt_scheme(struct i40e_pf *pf)
 		return -ENOMEM;
 
 	pf->irq_pile->num_entries = vectors;
-	pf->irq_pile->search_hint = 0;
 
 	/* track first vector for misc interrupts, ignore return */
 	(void)i40e_get_lump(pf, pf->irq_pile, 1, I40E_PILE_VALID_BIT - 1);
@@ -12589,7 +12580,6 @@ static int i40e_sw_init(struct i40e_pf *pf)
 		goto sw_init_done;
 	}
 	pf->qp_pile->num_entries = pf->hw.func_caps.num_tx_qp;
-	pf->qp_pile->search_hint = 0;
 
 	pf->tx_timeout_recovery_level = 1;
 
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +59 -0

71 lines not on this page · raw message

Signature · 1 line
2.31.1
author maintainer
#4 lore raw

PATCH 3/5 i40e: Fix queues reservation for XDP

In reply to Tony Nguyen

From: Sylwester Dziedziuch <[email protected]>

When XDP was configured on a system with large number of CPUs and X722 NIC there was a call trace with NULL pointer dereference.

i40e 0000:87:00.0: failed to get tracking for 256 queues for VSI 0 err -12 i40e 0000:87:00.0: setup of MAIN VSI failed

BUG: kernel NULL pointer dereference, address: 0000000000000000
RIP: 0010:i40e_xdp+0xea/0x1b0 [i40e]
Call Trace:
? i40e_reconfig_rss_queues+0x130/0x130 [i40e]
dev_xdp_install+0x61/0xe0
dev_xdp_attach+0x18a/0x4c0
dev_change_xdp_fd+0x1e6/0x220
do_setlink+0x616/0x1030
? ahci_port_stop+0x80/0x80
? ata_qc_issue+0x107/0x1e0
? lock_timer_base+0x61/0x80
? __mod_timer+0x202/0x380
rtnl_setlink+0xe5/0x170
? bpf_lsm_binder_transaction+0x10/0x10
? security_capable+0x36/0x50
rtnetlink_rcv_msg+0x121/0x350
? rtnl_calcit.isra.0+0x100/0x100
netlink_rcv_skb+0x50/0xf0
netlink_unicast+0x1d3/0x2a0
netlink_sendmsg+0x22a/0x440
sock_sendmsg+0x5e/0x60
__sys_sendto+0xf0/0x160
? __sys_getsockname+0x7e/0xc0
? _copy_from_user+0x3c/0x80
? __sys_setsockopt+0xc8/0x1a0
__x64_sys_sendto+0x20/0x30
do_syscall_64+0x33/0x40
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f83fa7a39e0

This was caused by PF queue pile fragmentation due to flow director VSI queue being placed right after main VSI. Because of this main VSI was not able to resize its queue allocation for XDP resulting in no queues allocated for main VSI when XDP was turned on.

Fix this by always allocating last queue in PF queue pile for a flow director VSI.

Fixes 41c445ff0f48 ("i40e: main driver core")
Fixes 74608d17fe29 ("i40e: add support for XDP_TX action")
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +14 -0
index 9456641cd24a..9b65cb50282c 100644
@@ -210,6 +210,20 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile,
 		return -EINVAL;
 	}
 
+	/* Allocate last queue in the pile for FDIR VSI queue
+	 * so it doesn't fragment the qp_pile
+	 */
+	if (pile == pf->qp_pile && pf->vsi[id]->type == I40E_VSI_FDIR) {
+		if (pile->list[pile->num_entries - 1] & I40E_PILE_VALID_BIT) {
+			dev_err(&pf->pdev->dev,
+				"Cannot allocate queue %d for I40E_VSI_FDIR\n",
+				pile->num_entries - 1);
+			return -ENOMEM;
+		}
+		pile->list[pile->num_entries - 1] = id | I40E_PILE_VALID_BIT;
+		return pile->num_entries - 1;
+	}
+
 	i = 0;
 	while (i < pile->num_entries) {
 		/* skip already allocated entries */
Signature · 1 line
2.31.1
author maintainer
#5 lore raw

PATCH 4/5 i40e: Fix for failed to init adminq while VF reset

In reply to Tony Nguyen

From: Karen Sornek <[email protected]>

Fix for failed to init adminq: -53 while VF is resetting via MAC address changing procedure.
Added sync module to avoid reading deadbeef value in reinit adminq during software reset.
Without this patch it is possible to trigger VF reset procedure during reinit adminq. This resulted in an incorrect reading of value from the AQP registers and generated the -53 error.

Fixes 5c3c48ac6bf5 ("i40e: implement virtual device interface")
---
 .../net/ethernet/intel/i40e/i40e_register.h   |  3 ++
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 44 ++++++++++++++++++-
 .../ethernet/intel/i40e/i40e_virtchnl_pf.h    |  1 +
 3 files changed, 46 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_register.h +3 -0
index 8d0588a27a05..1908eed4fa5e 100644
@@ -413,6 +413,9 @@
 #define I40E_VFINT_DYN_CTLN(_INTVF) (0x00024800 + ((_INTVF) * 4)) /* _i=0...511 */ /* Reset: VFR */
 #define I40E_VFINT_DYN_CTLN_CLEARPBA_SHIFT 1
 #define I40E_VFINT_DYN_CTLN_CLEARPBA_MASK I40E_MASK(0x1, I40E_VFINT_DYN_CTLN_CLEARPBA_SHIFT)
+#define I40E_VFINT_ICR0_ADMINQ_SHIFT 30
+#define I40E_VFINT_ICR0_ADMINQ_MASK I40E_MASK(0x1, I40E_VFINT_ICR0_ADMINQ_SHIFT)
+#define I40E_VFINT_ICR0_ENA(_VF) (0x0002C000 + ((_VF) * 4)) /* _i=0...127 */ /* Reset: CORER */
 #define I40E_VPINT_AEQCTL(_VF) (0x0002B800 + ((_VF) * 4)) /* _i=0...127 */ /* Reset: CORER */
 #define I40E_VPINT_AEQCTL_MSIX_INDX_SHIFT 0
 #define I40E_VPINT_AEQCTL_ITR_INDX_SHIFT 11
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +42 -2

64 lines not on this page · raw message

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +1 -0
index 49575a640a84..03c42fd0fea1 100644
@@ -19,6 +19,7 @@
 #define I40E_MAX_VF_PROMISC_FLAGS	3
 
 #define I40E_VF_STATE_WAIT_COUNT	20
+#define I40E_VFR_WAIT_COUNT		100
 
 /* Various queue ctrls */
 enum i40e_queue_ctrl {
Signature · 1 line
2.31.1
author maintainer
#6 lore raw

PATCH 5/5 i40e: fix unsigned stat widths

In reply to Tony Nguyen

From: Joe Damato <[email protected]>

Change i40e_update_vsi_stats and struct i40e_vsi to use u64 fields to match the width of the stats counters in struct i40e_rx_queue_stats.

Update debugfs code to use the correct format specifier for u64.

Fixes 41c445ff0f48 ("i40e: main driver core")
---
 drivers/net/ethernet/intel/i40e/i40e.h         | 8 ++++----
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 2 +-
 drivers/net/ethernet/intel/i40e/i40e_main.c    | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +4 -4
index c8cfe62d5e05..2e02cc68cd3f 100644
@@ -847,12 +847,12 @@ struct i40e_vsi {
 	struct rtnl_link_stats64 net_stats_offsets;
 	struct i40e_eth_stats eth_stats;
 	struct i40e_eth_stats eth_stats_offsets;
-	u32 tx_restart;
-	u32 tx_busy;
+	u64 tx_restart;
+	u64 tx_busy;
 	u64 tx_linearize;
 	u64 tx_force_wb;
-	u32 rx_buf_failed;
-	u32 rx_page_failed;
+	u64 rx_buf_failed;
+	u64 rx_page_failed;
 
 	/* These are containers of ring pointers, allocated at run-time */
 	struct i40e_ring **rx_rings;
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +1 -1
index 2c1b1da1220e..1e57cc8c47d7 100644
@@ -240,7 +240,7 @@ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid)
 		 (unsigned long int)vsi->net_stats_offsets.rx_compressed,
 		 (unsigned long int)vsi->net_stats_offsets.tx_compressed);
 	dev_info(&pf->pdev->dev,
-		 "    tx_restart = %d, tx_busy = %d, rx_buf_failed = %d, rx_page_failed = %d\n",
+		 "    tx_restart = %llu, tx_busy = %llu, rx_buf_failed = %llu, rx_page_failed = %llu\n",
 		 vsi->tx_restart, vsi->tx_busy,
 		 vsi->rx_buf_failed, vsi->rx_page_failed);
 	rcu_read_lock();
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -2
index 9b65cb50282c..f70c478dafdb 100644
@@ -778,9 +778,9 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
 	struct rtnl_link_stats64 *ns;   /* netdev stats */
 	struct i40e_eth_stats *oes;
 	struct i40e_eth_stats *es;     /* device's eth stats */
-	u32 tx_restart, tx_busy;
+	u64 tx_restart, tx_busy;
 	struct i40e_ring *p;
-	u32 rx_page, rx_buf;
+	u64 rx_page, rx_buf;
 	u64 bytes, packets;
 	unsigned int start;
 	u64 tx_linearize;
Signature · 1 line
2.31.1
#7 lore raw
In reply to Tony Nguyen
This series was applied to netdev/net.git (master) by Tony Nguyen <[email protected]>:

Hello:

This series was applied to netdev/net.git (master) by Tony Nguyen <[email protected]>:

Quoted 9 lines · On Thu, 20 Jan 2022 16:03:00 -0800 you wrote:

This series contains updates to i40e driver only.

Jedrzej increases delay for EMP reset and adds checks to ensure a VF request to change queues can be met.

Sylwester moves the placement of the Flow Director queue as to not fragment the queue pile which would cause later re-allocation issues.

[...]

Here is the summary with links:
- [net,1/5] i40e: Increase delay to 1 s after global EMP reset

    https://git.kernel.org/netdev/net/c/9b13bd53134c
  - [net,2/5] i40e: Fix issue when maximum queues is exceeded
    https://git.kernel.org/netdev/net/c/d701658a50a4
  - [net,3/5] i40e: Fix queues reservation for XDP
    https://git.kernel.org/netdev/net/c/92947844b8be
  - [net,4/5] i40e: Fix for failed to init adminq while VF reset
    https://git.kernel.org/netdev/net/c/0f344c8129a5
  - [net,5/5] i40e: fix unsigned stat widths
    https://git.kernel.org/netdev/net/c/3b8428b84539

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html