Skip to contentSkip to conversation

i40e: Handle admin Q timeout when releasing NVM

PATCH New Stillwell Jr 1 participant 3 messages Jun 14, 2017 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

Stillwell Jr

#2 lore raw

PATCH 3/9 i40e: Handle admin Q timeout when releasing NVM

ACK

Paul

-----Original Message-----
From: Michael, Alice
Sent: Wednesday, June 14, 2017 1:18 AM
To: Michael, Alice <[email protected]>; intel-wired-lan at lists.osuosl.org
Cc: Stillwell Jr, Paul M <[email protected]>
Subject: [next PATCH S73-V2 3/9] i40e: Handle admin Q timeout when releasing NVM

From: Paul M Stillwell Jr <[email protected]>

There are some rare cases where the release resource call will return an admin Q timeout. In these cases the code needs to try to release the resource again until it succeeds or it times out.

---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_nvm.c +20 -3
index 800bd55..17607a2 100644
@@ -134,8 +134,25 @@ i40e_status i40e_acquire_nvm(struct i40e_hw *hw,
  **/
 void i40e_release_nvm(struct i40e_hw *hw)  {
-	if (!hw->nvm.blank_nvm_mode)
-		i40e_aq_release_resource(hw, I40E_NVM_RESOURCE_ID, 0, NULL);
+	i40e_status ret_code = I40E_SUCCESS;
+	u32 total_delay = 0;
+
+	if (hw->nvm.blank_nvm_mode)
+		return;
+
+	ret_code = i40e_aq_release_resource(hw, I40E_NVM_RESOURCE_ID, 0, 
+NULL);
+
+	/* there are some rare cases when trying to release the resource
+	 * results in an admin Q timeout, so handle them correctly
+	 */
+	while ((ret_code == I40E_ERR_ADMIN_QUEUE_TIMEOUT) &&
+	       (total_delay < hw->aq.asq_cmd_timeout)) {
+		usleep_range(1000, 2000);
+		ret_code = i40e_aq_release_resource(hw,
+						    I40E_NVM_RESOURCE_ID,
+						    0, NULL);
+			total_delay++;
+	}
 }
 
 /**
--

2.9.3

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

PATCH 8/9 i40e: display correct UDP tunnel type name

ACK

Quoted 79 lines

-----Original Message-----
From: Michael, Alice
Sent: Wednesday, June 14, 2017 1:18 AM
To: Michael, Alice <[email protected]>; intel-wired-lan at lists.osuosl.org
Cc: Keller, Jacob E <[email protected]>
Subject: [next PATCH S73-V2 8/9] i40e: display correct UDP tunnel type name

From: Jacob Keller <[email protected]>

The i40e driver attempts to display the UDP tunnel name by doing a check against the type, where for non-zero types we use "vxlan" and for zero type we use "geneve". This is not future proof, because if new tunnel types get added, we'll incorrectly label them. It also depends on the value of UDP_TUNNEL_TYPE_GENEVE == 0, which is brittle.

Instead, replace this with a function that can return a constant string depending on the type. For now we'll use "unknown" for types we don't know about, and we can expand this in the future if new types get added.

---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 28 ++++++++++++++++++++------
--
 1 file changed, 20 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +12 -0
index 1f05ce3..21705d5 100644
@@ -7520,6 +7520,18 @@ static void i40e_handle_mdd_event(struct i40e_pf
 *pf)
 	i40e_flush(hw);
 }
 
+static const char *i40e_tunnel_name(struct i40e_udp_port_config *port)
+{
+	switch (port->type) {
+	case UDP_TUNNEL_TYPE_VXLAN:
+		return "vxlan";
+	case UDP_TUNNEL_TYPE_GENEVE:
+		return "geneve";
+	default:
+		return "unknown";
+	}
+}
+
 /**
  * i40e_sync_udp_filters - Trigger a sync event for existing UDP filters

* @pf: board private structure

drivers/net/ethernet/intel/i40e/i40e_main.c +2 -8
@@ -7565,14 +7577,14 @@ static void i40e_sync_udp_filters_subtask(struct
 i40e_pf *pf)
 				ret = i40e_aq_del_udp_tunnel(hw, i, NULL);
 
 			if (ret) {
-				dev_dbg(&pf->pdev->dev,
-					"%s %s port %d, index %d failed, err %s
 aq_err %s\n",
-					pf->udp_ports[i].type ? "vxlan" :
 "geneve",
-					port ? "add" : "delete",
-					port, i,
-					i40e_stat_str(&pf->hw, ret),
-					i40e_aq_str(&pf->hw,
-						    pf->hw.aq.asq_last_status));
+				dev_info(&pf->pdev->dev,
+					 "%s %s port %d, index %d failed, err %s

aq_err %s\n",

drivers/net/ethernet/intel/i40e/i40e_main.c +6 -1
+					 i40e_tunnel_name(&pf->udp_ports[i]),
+					 port ? "add" : "delete",
+					 port, i,
+					 i40e_stat_str(&pf->hw, ret),
+					 i40e_aq_str(&pf->hw,
+						     pf->hw.aq.asq_last_status));
 				pf->udp_ports[i].port = 0;
 			}
 		}
--

2.9.3

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

PATCH 2/9 i40e: remove WQ_UNBOUND and the task limit of our workqueue

ACK

Quoted 53 lines

-----Original Message-----
From: Michael, Alice
Sent: Wednesday, June 14, 2017 1:18 AM
To: Michael, Alice <[email protected]>; intel-wired-lan at lists.osuosl.org
Cc: Keller, Jacob E <[email protected]>
Subject: [next PATCH S73-V2 2/9] i40e: remove WQ_UNBOUND and the task limit of our workqueue

From: Jacob Keller <[email protected]>

During certain events such as a CORER, multiple devices will run a work task to handle some cleanup. This can cause issues due to
a single-threaded workqueue which can mean that a device doesn't cleanup in time. Prevent this by removing the single-threaded restriction on the module workqueue. This avoids the need to add more complex yielding logic in our service task routine. This is also similar to what other drivers such as fm10k do.

---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +4 -3
index 4490264..c794e27 100644
@@ -12180,12 +12180,14 @@ static int __init i40e_init_module(void)
 		i40e_driver_string, i40e_driver_version_str);
 	pr_info("%s: %s\n", i40e_driver_name, i40e_copyright);
 
-	/* we will see if single thread per module is enough for now,
-	 * it can't be any worse than using the system workqueue which
-	 * was already single threaded
+	/* There is no need to throttle the number of active tasks because
+	 * each device limits its own task using a state bit for scheduling
+	 * the service task, and the device tasks do not interfere with each
+	 * other, so we don't set a max task limit. We must set

WQ_MEM_RECLAIM

drivers/net/ethernet/intel/i40e/i40e_main.c +2 -1
+	 * since we need to be able to guarantee forward progress even under
+	 * memory pressure.
 	 */
-	i40e_wq = alloc_workqueue("%s", WQ_UNBOUND |

WQ_MEM_RECLAIM, 1,

drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
-				  i40e_driver_name);
+	i40e_wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0,

i40e_driver_name);

drivers/net/ethernet/intel/i40e/i40e_main.c +0 -1
 	if (!i40e_wq) {
 		pr_err("%s: Failed to create workqueue\n", i40e_driver_name);
 		return -ENOMEM;
--

2.9.3