Skip to contentSkip to conversation

iavf: cleanup, improvements in init and

PATCH In review Michal Schmidt 4 participants 21 messages Oct 10, 2023 – Oct 18, 2023

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

cover iavf: cleanup, improvements in init and

Here are a couple of iavf cleanups and then improvements for the initialization flow (waiting for the VF reset) and driver removal.

Michal Schmidt (5):
iavf: fix comments about old bit locks
iavf: simplify mutex_trylock+sleep loops
iavf: in iavf_down, don't queue watchdog_task if comms failed
iavf: in iavf_down, disable queues when removing the driver
iavf: fix the waiting time for initial reset

 drivers/net/ethernet/intel/iavf/iavf_main.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
Signature · 6 lines
2.41.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
#4 lore raw

PATCH 2/5 iavf: simplify mutex_trylock+sleep loops

This pattern appears in two places in the iavf source code:
while (!mutex_trylock(...))

      usleep_range(...);

That's just mutex_lock with extra steps.
The pattern is a leftover from when iavf used bit flags instead of mutexes for locking. Commit 5ac49f3c2702 ("iavf: use mutexes for locking of critical sections") replaced test_and_set_bit with !mutex_trylock, preserving the pattern.

Simplify it to mutex_lock.

---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +2 -4
index 98ecf5d5a2f2..03156ca523fe 100644
@@ -3016,8 +3016,7 @@ static void iavf_reset_task(struct work_struct *work)
 		return;
 	}
 
-	while (!mutex_trylock(&adapter->client_lock))
-		usleep_range(500, 1000);
+	mutex_lock(&adapter->client_lock);
 	if (CLIENT_ENABLED(adapter)) {
 		adapter->flags &= ~(IAVF_FLAG_CLIENT_NEEDS_OPEN |
 				    IAVF_FLAG_CLIENT_NEEDS_CLOSE |
@@ -5069,8 +5068,7 @@ static int __maybe_unused iavf_suspend(struct device *dev_d)
 
 	netif_device_detach(netdev);
 
-	while (!mutex_trylock(&adapter->crit_lock))
-		usleep_range(500, 1000);
+	mutex_lock(&adapter->crit_lock);
 
 	if (netif_running(netdev)) {
 		rtnl_lock();
Signature · 6 lines
2.41.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
#9 lore raw

PATCH 3/5 iavf: in iavf_down, don't queue watchdog_task if comms failed

In reply to Michal Schmidt

The reason for queueing watchdog_task is to have it process the aq_required flags that are being set here. If comms failed, there's nothing to do, so return early.

---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +4 -2
index 03156ca523fe..0b808fa34801 100644
@@ -1420,8 +1420,10 @@ void iavf_down(struct iavf_adapter *adapter)
 	iavf_clear_fdir_filters(adapter);
 	iavf_clear_adv_rss_conf(adapter);
 
-	if (!(adapter->flags & IAVF_FLAG_PF_COMMS_FAILED) &&
-	    !(test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section))) {
+	if (adapter->flags & IAVF_FLAG_PF_COMMS_FAILED)
+		return;
+
+	if (!test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) {
 		/* cancel any current operation */
 		adapter->current_op = VIRTCHNL_OP_UNKNOWN;
 		/* Schedule operations to close down the HW. Don't wait
Signature · 6 lines
2.41.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
#1 lore raw

PATCH 1/5 iavf: fix comments about old bit locks

In reply to Michal Schmidt

Bit lock __IAVF_IN_CRITICAL_TASK does not exist anymore since commit 5ac49f3c2702 ("iavf: use mutexes for locking of critical sections"). Adjust the comments accordingly.

---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +2 -2
index 43c47c633162..98ecf5d5a2f2 100644
@@ -1276,7 +1276,7 @@ static void iavf_configure(struct iavf_adapter *adapter)
  * iavf_up_complete - Finish the last steps of bringing up a connection
  * @adapter: board private structure
  *
- * Expects to be called while holding the __IAVF_IN_CRITICAL_TASK bit lock.
+ * Expects to be called while holding crit_lock.
  **/
 static void iavf_up_complete(struct iavf_adapter *adapter)
 {
@@ -1400,7 +1400,7 @@ static void iavf_clear_adv_rss_conf(struct iavf_adapter *adapter)
  * iavf_down - Shutdown the connection processing
  * @adapter: board private structure
  *
- * Expects to be called while holding the __IAVF_IN_CRITICAL_TASK bit lock.
+ * Expects to be called while holding crit_lock.
  **/
 void iavf_down(struct iavf_adapter *adapter)
 {
Signature · 6 lines
2.41.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
#12 lore raw

PATCH 4/5 iavf: in iavf_down, disable queues when removing the driver

In reply to Michal Schmidt

In iavf_down, we're skipping the scheduling of certain operations if the driver is being removed. However, the IAVF_FLAG_AQ_DISABLE_QUEUES request must not be skipped in this case, because iavf_close waits for the transition to the __IAVF_DOWN state, which happens in iavf_virtchnl_completion after the queues are released.

Without this fix, "rmmod iavf" takes half a second per interface that's up and prints the "Device resources not yet released" warning.

Fixes c8de44b577eb ("iavf: do not process adminq tasks when __IAVF_IN_REMOVE_TASK is set")
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
index 0b808fa34801..2ab08b015b85 100644
@@ -1440,9 +1440,9 @@ void iavf_down(struct iavf_adapter *adapter)
 			adapter->aq_required |= IAVF_FLAG_AQ_DEL_FDIR_FILTER;
 		if (!list_empty(&adapter->adv_rss_list_head))
 			adapter->aq_required |= IAVF_FLAG_AQ_DEL_ADV_RSS_CFG;
-		adapter->aq_required |= IAVF_FLAG_AQ_DISABLE_QUEUES;
 	}
 
+	adapter->aq_required |= IAVF_FLAG_AQ_DISABLE_QUEUES;
 	mod_delayed_work(adapter->wq, &adapter->watchdog_task, 0);
 }
 
Signature · 6 lines
2.41.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
#17 lore raw

PATCH 5/5 iavf: fix the waiting time for initial reset

In reply to Michal Schmidt

Every time I create VFs on ice, I receive at least one "Device is still in reset (-16), retrying" message per VF. It recovers fine, but typical usecases should not trigger scary-looking messages.

The waiting for reset is too short. It makes no sense to check every 10 microseconds. Typical reset waiting times are at least tens of milliseconds and can be several seconds. I suspect the polling interval was meant to be 10 milliseconds all along.

IAVF_RESET_WAIT_COMPLETE_COUNT is defined as 2000, so the total waiting time could be over 20 seconds. I have seen resets take 5 seconds (with 128 VFs on ice).

The added benefit of not triggering the "Device is still in reset" path is that we avoid going through the __IAVF_INIT_FAILED state, which would take a full second before retrying.

---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
index 2ab08b015b85..f35d74566faa 100644
@@ -4791,7 +4791,7 @@ static int iavf_check_reset_complete(struct iavf_hw *hw)
 		if ((rstat == VIRTCHNL_VFR_VFACTIVE) ||
 		    (rstat == VIRTCHNL_VFR_COMPLETED))
 			return 0;
-		usleep_range(10, 20);
+		msleep(IAVF_RESET_WAIT_MS);
 	}
 	return -EBUSY;
 }
Signature · 6 lines
2.41.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Reviewed-by on v1 1/5
#2 lore raw

Re: [Intel-wired-lan] [PATCH net-next 1/5] iavf: fix comments about old bit locks

In reply to Michal Schmidt
Quoted 10 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Tuesday, October 10, 2023 2:25 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next 1/5] iavf: fix comments about old bit locks

Quoted 5 lines

Bit lock __IAVF_IN_CRITICAL_TASK does not exist anymore since commit 5ac49f3c2702 ("iavf: use mutexes for locking of critical sections"). Adjust the comments accordingly.

Thanks for your contribution, Michal!

Quoted 32 lines
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
index 43c47c633162..98ecf5d5a2f2 100644
@@ -1276,7 +1276,7 @@ static void iavf_configure(struct iavf_adapter
 *adapter)
  * iavf_up_complete - Finish the last steps of bringing up a connection
  * @adapter: board private structure
  *
- * Expects to be called while holding the __IAVF_IN_CRITICAL_TASK bit lock.
+ * Expects to be called while holding crit_lock.
  **/
 static void iavf_up_complete(struct iavf_adapter *adapter)

{

drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
@@ -1400,7 +1400,7 @@ static void iavf_clear_adv_rss_conf(struct
 iavf_adapter *adapter)
  * iavf_down - Shutdown the connection processing
  * @adapter: board private structure
  *
- * Expects to be called while holding the __IAVF_IN_CRITICAL_TASK bit lock.
+ * Expects to be called while holding crit_lock.
  **/
 void iavf_down(struct iavf_adapter *adapter)

{
--
2.41.0

Quoted 4 lines

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#5 lore raw

Re: [Intel-wired-lan] [PATCH net-next 2/5] iavf: simplify mutex_trylock+sleep loops

In reply to Michal Schmidt
Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Tuesday, October 10, 2023 2:25 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next 2/5] iavf: simplify mutex_trylock+sleep loops

Quoted 3 lines

This pattern appears in two places in the iavf source code:
while (!mutex_trylock(...))

      usleep_range(...);

I found a few other places with similar pattern (iavf_configure_clsflower e.g). Do you think we can fix them as well?

Quoted 44 lines

That's just mutex_lock with extra steps.
The pattern is a leftover from when iavf used bit flags instead of mutexes for locking. Commit 5ac49f3c2702 ("iavf: use mutexes for locking of critical sections") replaced test_and_set_bit with !mutex_trylock, preserving the pattern.

Simplify it to mutex_lock.

---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -2
index 98ecf5d5a2f2..03156ca523fe 100644
@@ -3016,8 +3016,7 @@ static void iavf_reset_task(struct work_struct
 *work)
 		return;
 	}
 
-	while (!mutex_trylock(&adapter->client_lock))
-		usleep_range(500, 1000);
+	mutex_lock(&adapter->client_lock);
 	if (CLIENT_ENABLED(adapter)) {
 		adapter->flags &= ~(IAVF_FLAG_CLIENT_NEEDS_OPEN |
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -2
 				    IAVF_FLAG_CLIENT_NEEDS_CLOSE |
@@ -5069,8 +5068,7 @@ static int __maybe_unused iavf_suspend(struct
 device *dev_d)
 
 	netif_device_detach(netdev);
 
-	while (!mutex_trylock(&adapter->crit_lock))
-		usleep_range(500, 1000);
+	mutex_lock(&adapter->crit_lock);
 
 	if (netif_running(netdev)) {

rtnl_lock();
--
2.41.0

Quoted 4 lines

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Reviewed-by on v1 3/5
#10 lore raw

Re: [Intel-wired-lan] [PATCH net-next 3/5] iavf: in iavf_down, don't queue watchdog_task if comms failed

In reply to Michal Schmidt
Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Tuesday, October 10, 2023 2:25 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next 3/5] iavf: in iavf_down, don't queue watchdog_task if comms failed

Quoted 5 lines

The reason for queueing watchdog_task is to have it process the aq_required flags that are being set here. If comms failed, there's nothing to do, so return early.

Quoted 25 lines
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +4 -3
index 03156ca523fe..0b808fa34801 100644
@@ -1420,8 +1420,10 @@ void iavf_down(struct iavf_adapter *adapter)
 	iavf_clear_fdir_filters(adapter);
 	iavf_clear_adv_rss_conf(adapter);
 
-	if (!(adapter->flags & IAVF_FLAG_PF_COMMS_FAILED) &&
-	    !(test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section))) {
+	if (adapter->flags & IAVF_FLAG_PF_COMMS_FAILED)
+		return;
+
+	if (!test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) {
 		/* cancel any current operation */
 		adapter->current_op = VIRTCHNL_OP_UNKNOWN;
 		/* Schedule operations to close down the HW. Don't wait
--

2.41.0

Quoted 4 lines

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

maintainer Reviewed-by on the v1 series
#20 lore raw
In reply to Michal Schmidt
Quoted 10 lines · Michal Schmidt

Here are a couple of iavf cleanups and then improvements for the initialization flow (waiting for the VF reset) and driver removal.

Michal Schmidt (5):
iavf: fix comments about old bit locks
iavf: simplify mutex_trylock+sleep loops
iavf: in iavf_down, don't queue watchdog_task if comms failed
iavf: in iavf_down, disable queues when removing the driver
iavf: fix the waiting time for initial reset

Quoted 3 lines
  drivers/net/ethernet/intel/iavf/iavf_main.c | 20 ++++++++++----------
  1 file changed, 10 insertions(+), 10 deletions(-)

Very nice series, thanks a lot!

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Reviewed-by on v1 4/5
#13 lore raw

Re: [Intel-wired-lan] [PATCH net-next 4/5] iavf: in iavf_down, disable queues when removing the driver

In reply to Michal Schmidt
Quoted 18 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Tuesday, October 10, 2023 2:25 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next 4/5] iavf: in iavf_down, disable queues when removing the driver

In iavf_down, we're skipping the scheduling of certain operations if the driver is being removed. However, the IAVF_FLAG_AQ_DISABLE_QUEUES request must not be skipped in this case, because iavf_close waits for the transition to the __IAVF_DOWN state, which happens in iavf_virtchnl_completion after the queues are released.

Quoted 6 lines

Without this fix, "rmmod iavf" takes half a second per interface that's up and prints the "Device resources not yet released" warning.

Fixes c8de44b577eb ("iavf: do not process adminq tasks when

__IAVF_IN_REMOVE_TASK is set")

Looks like a fix, could be a separate patch with net as a target.

Quoted 22 lines
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
index 0b808fa34801..2ab08b015b85 100644
@@ -1440,9 +1440,9 @@ void iavf_down(struct iavf_adapter *adapter)
 			adapter->aq_required |=
 IAVF_FLAG_AQ_DEL_FDIR_FILTER;
 		if (!list_empty(&adapter->adv_rss_list_head))
 			adapter->aq_required |=
 IAVF_FLAG_AQ_DEL_ADV_RSS_CFG;
-		adapter->aq_required |= IAVF_FLAG_AQ_DISABLE_QUEUES;
 	}
 
+	adapter->aq_required |= IAVF_FLAG_AQ_DISABLE_QUEUES;
 	mod_delayed_work(adapter->wq, &adapter->watchdog_task, 0);

}

Quoted 7 lines

--
2.41.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Reviewed-by on v1 5/5
#18 lore raw

Re: [Intel-wired-lan] [PATCH net-next 5/5] iavf: fix the waiting time for initial reset

In reply to Michal Schmidt
Quoted 25 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Tuesday, October 10, 2023 2:25 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next 5/5] iavf: fix the waiting time for initial reset

Every time I create VFs on ice, I receive at least one "Device is still in reset (-16), retrying" message per VF. It recovers fine, but typical usecases should not trigger scary-looking messages.

The waiting for reset is too short. It makes no sense to check every 10 microseconds. Typical reset waiting times are at least tens of milliseconds and can be several seconds. I suspect the polling interval was meant to be 10 milliseconds all along.

IAVF_RESET_WAIT_COMPLETE_COUNT is defined as 2000, so the total waiting time could be over 20 seconds. I have seen resets take 5 seconds (with 128 VFs on ice).

Quoted 5 lines

The added benefit of not triggering the "Device is still in reset" path is that we avoid going through the __IAVF_INIT_FAILED state, which would take a full second before retrying.

Quoted 22 lines
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
index 2ab08b015b85..f35d74566faa 100644
@@ -4791,7 +4791,7 @@ static int iavf_check_reset_complete(struct
 iavf_hw *hw)
 		if ((rstat == VIRTCHNL_VFR_VFACTIVE) ||
 		    (rstat == VIRTCHNL_VFR_COMPLETED))
 			return 0;
-		usleep_range(10, 20);
+		msleep(IAVF_RESET_WAIT_MS);
 	}
 	return -EBUSY;

}
--
2.41.0

Quoted 4 lines

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#6 lore raw

Re: [Intel-wired-lan] [PATCH net-next 2/5] iavf: simplify mutex_trylock+sleep loops

In reply to Drewek, Wojciech

Dne 10. 10. 23 v 13:30 Drewek, Wojciech napsal:

Quoted 10 lines
Quoted 10 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Tuesday, October 10, 2023 2:25 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next 2/5] iavf: simplify mutex_trylock+sleep loops

Quoted 6 lines
Quoted 3 lines

This pattern appears in two places in the iavf source code:

   while (!mutex_trylock(...))
       usleep_range(...);

I found a few other places with similar pattern (iavf_configure_clsflower e.g). Do you think we can fix them as well?

I think so. But those are with some sort of a timeout, so replacing them would be slightly less obviously correct than these here. Later. Michal

Quoted 43 lines
Quoted 43 lines

That's just mutex_lock with extra steps.
The pattern is a leftover from when iavf used bit flags instead of mutexes for locking. Commit 5ac49f3c2702 ("iavf: use mutexes for locking of critical sections") replaced test_and_set_bit with !mutex_trylock, preserving the pattern.

Simplify it to mutex_lock.

---
  drivers/net/ethernet/intel/iavf/iavf_main.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -2
index 98ecf5d5a2f2..03156ca523fe 100644
@@ -3016,8 +3016,7 @@ static void iavf_reset_task(struct work_struct
 *work)
  		return;
  	}
 
-	while (!mutex_trylock(&adapter->client_lock))
-		usleep_range(500, 1000);
+	mutex_lock(&adapter->client_lock);
  	if (CLIENT_ENABLED(adapter)) {
  		adapter->flags &= ~(IAVF_FLAG_CLIENT_NEEDS_OPEN |

IAVF_FLAG_CLIENT_NEEDS_CLOSE |

drivers/net/ethernet/intel/iavf/iavf_main.c +1 -2
@@ -5069,8 +5068,7 @@ static int __maybe_unused iavf_suspend(struct
 device *dev_d)
 
  	netif_device_detach(netdev);
 
-	while (!mutex_trylock(&adapter->crit_lock))
-		usleep_range(500, 1000);
+	mutex_lock(&adapter->crit_lock);
 
  	if (netif_running(netdev)) {

rtnl_lock();
--
2.41.0

Quoted 5 lines
Quoted 4 lines

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Reviewed-by
#7 lore raw

Re: [Intel-wired-lan] [PATCH net-next 2/5] iavf: simplify mutex_trylock+sleep loops

Quoted 28 lines

-----Original Message-----
From: Michal Schmidt <[email protected]>
Sent: Tuesday, October 10, 2023 1:57 PM
To: Drewek, Wojciech <[email protected]>; intel-wired- [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH net-next 2/5] iavf: simplify mutex_trylock+sleep loops

Dne 10. 10. 23 v 13:30 Drewek, Wojciech napsal:

Quoted 7 lines
Quoted 7 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Tuesday, October 10, 2023 2:25 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse

<[email protected]>

Quoted 7 lines
Quoted 6 lines

Subject: [Intel-wired-lan] [PATCH net-next 2/5] iavf: simplify mutex_trylock+sleep loops

This pattern appears in two places in the iavf source code:

   while (!mutex_trylock(...))
       usleep_range(...);
Quoted 6 lines
Quoted 2 lines

I found a few other places with similar pattern (iavf_configure_clsflower e.g). Do you think we can fix them as well?

I think so. But those are with some sort of a timeout, so replacing them would be slightly less obviously correct than these here. Later. Michal

Makes sense.

Quoted 44 lines
Quoted 44 lines
Quoted 44 lines

That's just mutex_lock with extra steps.
The pattern is a leftover from when iavf used bit flags instead of mutexes for locking. Commit 5ac49f3c2702 ("iavf: use mutexes for locking of critical sections") replaced test_and_set_bit with !mutex_trylock, preserving the pattern.

Simplify it to mutex_lock.

---
  drivers/net/ethernet/intel/iavf/iavf_main.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -2
index 98ecf5d5a2f2..03156ca523fe 100644
@@ -3016,8 +3016,7 @@ static void iavf_reset_task(struct work_struct
 *work)
  		return;
  	}
 
-	while (!mutex_trylock(&adapter->client_lock))
-		usleep_range(500, 1000);
+	mutex_lock(&adapter->client_lock);
  	if (CLIENT_ENABLED(adapter)) {
  		adapter->flags &= ~(IAVF_FLAG_CLIENT_NEEDS_OPEN |

IAVF_FLAG_CLIENT_NEEDS_CLOSE |

drivers/net/ethernet/intel/iavf/iavf_main.c +1 -2
@@ -5069,8 +5068,7 @@ static int __maybe_unused iavf_suspend(struct
 device *dev_d)
 
  	netif_device_detach(netdev);
 
-	while (!mutex_trylock(&adapter->crit_lock))
-		usleep_range(500, 1000);
+	mutex_lock(&adapter->crit_lock);
 
  	if (netif_running(netdev)) {

rtnl_lock();
--
2.41.0

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#14 lore raw

Re: [Intel-wired-lan] [PATCH net-next 4/5] iavf: in iavf_down, disable queues when removing the driver

In reply to Drewek, Wojciech

Dne 10. 10. 23 v 13:39 Drewek, Wojciech napsal:

Quoted 18 lines
Quoted 18 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Tuesday, October 10, 2023 2:25 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next 4/5] iavf: in iavf_down, disable queues when removing the driver

In iavf_down, we're skipping the scheduling of certain operations if the driver is being removed. However, the IAVF_FLAG_AQ_DISABLE_QUEUES request must not be skipped in this case, because iavf_close waits for the transition to the __IAVF_DOWN state, which happens in iavf_virtchnl_completion after the queues are released.

Quoted 8 lines
Quoted 6 lines

Without this fix, "rmmod iavf" takes half a second per interface that's up and prints the "Device resources not yet released" warning.

Fixes c8de44b577eb ("iavf: do not process adminq tasks when

__IAVF_IN_REMOVE_TASK is set")

Looks like a fix, could be a separate patch with net as a target.

I did not want to separate it from patch 3/5, because it changes the logic when IAVF_FLAG_PF_COMMS_FAILED is set. But on second thought, it should still work fine in that case too. aq_required would just get reset to zero in iavf_watchdog_task in the __IAVF_COMM_FAILED state.

Michal

Quoted 24 lines
Quoted 22 lines
---
  drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
index 0b808fa34801..2ab08b015b85 100644
@@ -1440,9 +1440,9 @@ void iavf_down(struct iavf_adapter *adapter)
  			adapter->aq_required |=
 IAVF_FLAG_AQ_DEL_FDIR_FILTER;
  		if (!list_empty(&adapter->adv_rss_list_head))
  			adapter->aq_required |=
 IAVF_FLAG_AQ_DEL_ADV_RSS_CFG;
-		adapter->aq_required |= IAVF_FLAG_AQ_DISABLE_QUEUES;
  	}
 
+	adapter->aq_required |= IAVF_FLAG_AQ_DISABLE_QUEUES;
  	mod_delayed_work(adapter->wq, &adapter->watchdog_task, 0);
  }
Quoted 8 lines
Quoted 7 lines

--
2.41.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#15 lore raw

Re: [Intel-wired-lan] [PATCH net-next 4/5] iavf: in iavf_down, disable queues when removing the driver

Quoted 40 lines

-----Original Message-----
From: Michal Schmidt <[email protected]>
Sent: Tuesday, October 10, 2023 2:22 PM
To: Drewek, Wojciech <[email protected]>; intel-wired- [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH net-next 4/5] iavf: in iavf_down, disable queues when removing the driver

Dne 10. 10. 23 v 13:39 Drewek, Wojciech napsal:

Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Tuesday, October 10, 2023 2:25 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse

<[email protected]>

Quoted 5 lines
Quoted 5 lines

Subject: [Intel-wired-lan] [PATCH net-next 4/5] iavf: in iavf_down, disable queues when removing the driver

In iavf_down, we're skipping the scheduling of certain operations if the driver is being removed. However, the

IAVF_FLAG_AQ_DISABLE_QUEUES

Quoted 11 lines
Quoted 10 lines

request must not be skipped in this case, because iavf_close waits for the transition to the __IAVF_DOWN state, which happens in iavf_virtchnl_completion after the queues are released.

Without this fix, "rmmod iavf" takes half a second per interface that's up and prints the "Device resources not yet released" warning.

Fixes c8de44b577eb ("iavf: do not process adminq tasks when

__IAVF_IN_REMOVE_TASK is set")

Quoted 6 lines
Quoted 1 line

Looks like a fix, could be a separate patch with net as a target.

I did not want to separate it from patch 3/5, because it changes the logic when IAVF_FLAG_PF_COMMS_FAILED is set. But on second thought, it should still work fine in that case too. aq_required would just get reset to zero in iavf_watchdog_task in the __IAVF_COMM_FAILED state.

I see, so it's up to you :)

Quoted 35 lines

Michal

Quoted 32 lines
Quoted 29 lines
---
  drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
index 0b808fa34801..2ab08b015b85 100644
@@ -1440,9 +1440,9 @@ void iavf_down(struct iavf_adapter *adapter)
  			adapter->aq_required |=
 IAVF_FLAG_AQ_DEL_FDIR_FILTER;
  		if (!list_empty(&adapter->adv_rss_list_head))
  			adapter->aq_required |=
 IAVF_FLAG_AQ_DEL_ADV_RSS_CFG;
-		adapter->aq_required |= IAVF_FLAG_AQ_DISABLE_QUEUES;
  	}
 
+	adapter->aq_required |= IAVF_FLAG_AQ_DISABLE_QUEUES;
  	mod_delayed_work(adapter->wq, &adapter->watchdog_task, 0);
  }

--
2.41.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#3 lore raw

Re: [Intel-wired-lan] [PATCH net-next 1/5] iavf: fix comments about old bit locks

In reply to Drewek, Wojciech
Quoted 61 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Drewek, Wojciech
Sent: Tuesday, October 10, 2023 1:24 PM
To: mschmidt <[email protected]>; [email protected]
Cc: Radoslaw Tyl <[email protected]>; Nguyen, Anthony L <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH net-next 1/5] iavf: fix comments about old bit locks

Quoted 11 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Tuesday, October 10, 2023 2:25 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next 1/5] iavf: fix comments about old bit locks

Quoted 5 lines

Bit lock __IAVF_IN_CRITICAL_TASK does not exist anymore since commit 5ac49f3c2702 ("iavf: use mutexes for locking of critical sections"). Adjust the comments accordingly.

Thanks for your contribution, Michal!

Quoted 30 lines
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -2
index 43c47c633162..98ecf5d5a2f2 100644
@@ -1276,7 +1276,7 @@ static void iavf_configure(struct iavf_adapter
 *adapter)
  * iavf_up_complete - Finish the last steps of bringing up a connection
  * @adapter: board private structure
  *
- * Expects to be called while holding the __IAVF_IN_CRITICAL_TASK bit lock.
+ * Expects to be called while holding crit_lock.
  **/
 static void iavf_up_complete(struct iavf_adapter *adapter)  { @@
-1400,7 +1400,7 @@ static void iavf_clear_adv_rss_conf(struct

iavf_adapter *adapter)
* iavf_down - Shutdown the connection processing
* @adapter: board private structure
*
- * Expects to be called while holding the __IAVF_IN_CRITICAL_TASK bit lock.
+ * Expects to be called while holding crit_lock.
**/
void iavf_down(struct iavf_adapter *adapter) {
--
2.41.0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#8 lore raw

Re: [Intel-wired-lan] [PATCH net-next 2/5] iavf: simplify mutex_trylock+sleep loops

In reply to Drewek, Wojciech
Quoted 102 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Drewek, Wojciech
Sent: Tuesday, October 10, 2023 2:08 PM
To: mschmidt <[email protected]>; [email protected]
Cc: Radoslaw Tyl <[email protected]>; Nguyen, Anthony L <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH net-next 2/5] iavf: simplify mutex_trylock+sleep loops

Quoted 12 lines

-----Original Message-----
From: Michal Schmidt <[email protected]>
Sent: Tuesday, October 10, 2023 1:57 PM
To: Drewek, Wojciech <[email protected]>; intel-wired- [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH net-next 2/5] iavf: simplify mutex_trylock+sleep loops

Dne 10. 10. 23 v 13:30 Drewek, Wojciech napsal:

Quoted 16 lines
Quoted 7 lines
Quoted 7 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Tuesday, October 10, 2023 2:25 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse

<[email protected]>

Quoted 8 lines
Quoted 6 lines

Subject: [Intel-wired-lan] [PATCH net-next 2/5] iavf: simplify mutex_trylock+sleep loops

This pattern appears in two places in the iavf source code:

   while (!mutex_trylock(...))
       usleep_range(...);

I found a few other places with similar pattern (iavf_configure_clsflower

e.g).

Quoted 5 lines
Quoted 1 line

Do you think we can fix them as well?

I think so. But those are with some sort of a timeout, so replacing them would be slightly less obviously correct than these here. Later. Michal

Makes sense.

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines

That's just mutex_lock with extra steps.
The pattern is a leftover from when iavf used bit flags instead of mutexes for locking. Commit 5ac49f3c2702 ("iavf: use mutexes for locking of critical sections") replaced test_and_set_bit with !mutex_trylock, preserving the pattern.

Simplify it to mutex_lock.

---
  drivers/net/ethernet/intel/iavf/iavf_main.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +0 -0
index 98ecf5d5a2f2..03156ca523fe 100644
@@ -3016,8 +3016,7 @@ static void iavf_reset_task(struct

work_struct
*work)
return;
}

Quoted 6 lines
Quoted 6 lines

drivers/net/ethernet/intel/iavf/iavf_main.c static void iavf_reset_task(struct work_struct *work)

Quoted 6 lines
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -2
-	while (!mutex_trylock(&adapter->client_lock))
-		usleep_range(500, 1000);
+	mutex_lock(&adapter->client_lock);
  	if (CLIENT_ENABLED(adapter)) {
  		adapter->flags &= ~(IAVF_FLAG_CLIENT_NEEDS_OPEN |
  				    IAVF_FLAG_CLIENT_NEEDS_CLOSE | @@ -

5069,8 +5068,7 @@

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

static int __maybe_unused iavf_suspend(struct device *dev_d)

  	netif_device_detach(netdev);
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -3
-	while (!mutex_trylock(&adapter->crit_lock))
-		usleep_range(500, 1000);
+	mutex_lock(&adapter->crit_lock);
 
  	if (netif_running(netdev)) {
  		rtnl_lock();
--

2.41.0

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Quoted 4 lines

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#11 lore raw

Re: [Intel-wired-lan] [PATCH net-next 3/5] iavf: in iavf_down, don't queue watchdog_task if comms failed

In reply to Drewek, Wojciech
Quoted 57 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Drewek, Wojciech
Sent: Tuesday, October 10, 2023 1:34 PM
To: mschmidt <[email protected]>; [email protected]
Cc: Radoslaw Tyl <[email protected]>; Nguyen, Anthony L <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH net-next 3/5] iavf: in iavf_down, don't queue watchdog_task if comms failed

Quoted 11 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Tuesday, October 10, 2023 2:25 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next 3/5] iavf: in iavf_down, don't queue watchdog_task if comms failed

Quoted 5 lines

The reason for queueing watchdog_task is to have it process the aq_required flags that are being set here. If comms failed, there's nothing to do, so return early.

Quoted 25 lines
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +4 -3
index 03156ca523fe..0b808fa34801 100644
@@ -1420,8 +1420,10 @@ void iavf_down(struct iavf_adapter *adapter)
 	iavf_clear_fdir_filters(adapter);
 	iavf_clear_adv_rss_conf(adapter);
 
-	if (!(adapter->flags & IAVF_FLAG_PF_COMMS_FAILED) &&
-	    !(test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section))) {
+	if (adapter->flags & IAVF_FLAG_PF_COMMS_FAILED)
+		return;
+
+	if (!test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) {
 		/* cancel any current operation */
 		adapter->current_op = VIRTCHNL_OP_UNKNOWN;
 		/* Schedule operations to close down the HW. Don't wait
--

2.41.0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#16 lore raw

Re: [Intel-wired-lan] [PATCH net-next 4/5] iavf: in iavf_down, disable queues when removing the driver

In reply to Drewek, Wojciech
Quoted 97 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Drewek, Wojciech
Sent: Tuesday, October 10, 2023 3:56 PM
To: mschmidt <[email protected]>; [email protected]
Cc: Radoslaw Tyl <[email protected]>; Nguyen, Anthony L <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH net-next 4/5] iavf: in iavf_down, disable queues when removing the driver

Quoted 39 lines

-----Original Message-----
From: Michal Schmidt <[email protected]>
Sent: Tuesday, October 10, 2023 2:22 PM
To: Drewek, Wojciech <[email protected]>; intel-wired- [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH net-next 4/5] iavf: in iavf_down, disable queues when removing the driver

Dne 10. 10. 23 v 13:39 Drewek, Wojciech napsal:

Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Tuesday, October 10, 2023 2:25 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse

<[email protected]>

Quoted 5 lines
Quoted 5 lines

Subject: [Intel-wired-lan] [PATCH net-next 4/5] iavf: in iavf_down, disable queues when removing the driver

In iavf_down, we're skipping the scheduling of certain operations if the driver is being removed. However, the

IAVF_FLAG_AQ_DISABLE_QUEUES

Quoted 11 lines
Quoted 10 lines

request must not be skipped in this case, because iavf_close waits for the transition to the __IAVF_DOWN state, which happens in iavf_virtchnl_completion after the queues are released.

Without this fix, "rmmod iavf" takes half a second per interface that's up and prints the "Device resources not yet released" warning.

Fixes c8de44b577eb ("iavf: do not process adminq tasks when

__IAVF_IN_REMOVE_TASK is set")

Quoted 6 lines
Quoted 1 line

Looks like a fix, could be a separate patch with net as a target.

I did not want to separate it from patch 3/5, because it changes the logic when IAVF_FLAG_PF_COMMS_FAILED is set. But on second thought, it should still work fine in that case too. aq_required would just get reset to zero in iavf_watchdog_task in the __IAVF_COMM_FAILED state.

I see, so it's up to you :)

Quoted 35 lines

Michal

Quoted 32 lines
Quoted 29 lines
---
  drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
index 0b808fa34801..2ab08b015b85 100644
@@ -1440,9 +1440,9 @@ void iavf_down(struct iavf_adapter *adapter)
  			adapter->aq_required |=
 IAVF_FLAG_AQ_DEL_FDIR_FILTER;
  		if (!list_empty(&adapter->adv_rss_list_head))
  			adapter->aq_required |=
 IAVF_FLAG_AQ_DEL_ADV_RSS_CFG;
-		adapter->aq_required |= IAVF_FLAG_AQ_DISABLE_QUEUES;
  	}
 
+	adapter->aq_required |= IAVF_FLAG_AQ_DISABLE_QUEUES;
  	mod_delayed_work(adapter->wq, &adapter->watchdog_task, 0);
  }

--
2.41.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Quoted 4 lines

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#19 lore raw

Re: [Intel-wired-lan] [PATCH net-next 5/5] iavf: fix the waiting time for initial reset

In reply to Drewek, Wojciech
Quoted 68 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Drewek, Wojciech
Sent: Tuesday, October 10, 2023 1:43 PM
To: mschmidt <[email protected]>; [email protected]
Cc: Radoslaw Tyl <[email protected]>; Nguyen, Anthony L <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH net-next 5/5] iavf: fix the waiting time for initial reset

Quoted 25 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Tuesday, October 10, 2023 2:25 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Radoslaw Tyl <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next 5/5] iavf: fix the waiting time for initial reset

Every time I create VFs on ice, I receive at least one "Device is still in reset (-16), retrying" message per VF. It recovers fine, but typical usecases should not trigger scary-looking messages.

The waiting for reset is too short. It makes no sense to check every 10 microseconds. Typical reset waiting times are at least tens of milliseconds and can be several seconds. I suspect the polling interval was meant to be 10 milliseconds all along.

IAVF_RESET_WAIT_COMPLETE_COUNT is defined as 2000, so the total waiting time could be over 20 seconds. I have seen resets take 5 seconds (with
128 VFs on ice).

Quoted 5 lines

The added benefit of not triggering the "Device is still in reset" path is that we avoid going through the __IAVF_INIT_FAILED state, which would take a full second before retrying.

Quoted 22 lines
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
index 2ab08b015b85..f35d74566faa 100644
@@ -4791,7 +4791,7 @@ static int iavf_check_reset_complete(struct
 iavf_hw *hw)
 		if ((rstat == VIRTCHNL_VFR_VFACTIVE) ||
 		    (rstat == VIRTCHNL_VFR_COMPLETED))
 			return 0;
-		usleep_range(10, 20);
+		msleep(IAVF_RESET_WAIT_MS);
 	}
 	return -EBUSY;

}
--
2.41.0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan