All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH net-next 01/15] iavf: correctly track whether the interface is running during resets
@ 2021-06-04 16:53 Tony Nguyen
  2021-06-04 16:53 ` [Intel-wired-lan] [PATCH net-next 02/15] iavf: obtain the crit_section lock in iavf_open() immediately Tony Nguyen
                   ` (13 more replies)
  0 siblings, 14 replies; 24+ messages in thread
From: Tony Nguyen @ 2021-06-04 16:53 UTC (permalink / raw)
  To: intel-wired-lan

From: Nicholas Nunley <nicholas.d.nunley@intel.com>

During a hardware reset the driver needs to know if the interface is
running so it can appropriately shut down and restore itself to the
previous state. However, as described in commit 44b034b40621 ("i40evf:
don't rely on netif_running() outside rtnl_lock()") the driver can't simply
grab rtnl_lock() in the reset path when it needs to check netif_running().

The previous fix for this was to have the driver use the __IAVF_RUNNING
state to stand in for netif_running(). This turns out to be incorrect,
since although __IAVF_RUNNING does tell is if the interface is running,
there are other states the driver could be in, and they don't accurately
indicate whether the interface is actually running or not.

Although adapter->state can't be used to reliably determine if the
interface is running, adapter->vsi.state can, so use this instead.

This patch also replaces the use of netif_running() in
iavf_reinit_interrupt_scheme() which was presumably overlooked earlier.

Signed-off-by: Nicholas Nunley <nicholas.d.nunley@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
index 1323778f461d..bf96a9dab962 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_main.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
@@ -1486,7 +1486,7 @@ static int iavf_reinit_interrupt_scheme(struct iavf_adapter *adapter)
 	struct net_device *netdev = adapter->netdev;
 	int err;
 
-	if (netif_running(netdev))
+	if (!test_bit(__IAVF_VSI_DOWN, adapter->vsi.state))
 		iavf_free_traffic_irqs(adapter);
 	iavf_free_misc_irq(adapter);
 	iavf_reset_interrupt_capability(adapter);
@@ -2029,7 +2029,7 @@ static void iavf_disable_vf(struct iavf_adapter *adapter)
 	 * ndo_open() returning, so we can't assume it means all our open
 	 * tasks have finished, since we're not holding the rtnl_lock here.
 	 */
-	if (adapter->state == __IAVF_RUNNING) {
+	if (!test_bit(__IAVF_VSI_DOWN, adapter->vsi.state)) {
 		set_bit(__IAVF_VSI_DOWN, adapter->vsi.state);
 		netif_carrier_off(adapter->netdev);
 		netif_tx_disable(adapter->netdev);
@@ -2169,9 +2169,7 @@ static void iavf_reset_task(struct work_struct *work)
 	 * ndo_open() returning, so we can't assume it means all our open
 	 * tasks have finished, since we're not holding the rtnl_lock here.
 	 */
-	running = ((adapter->state == __IAVF_RUNNING) ||
-		   (adapter->state == __IAVF_RESETTING));
-
+	running = !test_bit(__IAVF_VSI_DOWN, adapter->vsi.state);
 	if (running) {
 		netif_carrier_off(netdev);
 		netif_tx_stop_all_queues(netdev);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2021-11-17 10:27 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04 16:53 [Intel-wired-lan] [PATCH net-next 01/15] iavf: correctly track whether the interface is running during resets Tony Nguyen
2021-06-04 16:53 ` [Intel-wired-lan] [PATCH net-next 02/15] iavf: obtain the crit_section lock in iavf_open() immediately Tony Nguyen
2021-06-04 16:53 ` [Intel-wired-lan] [PATCH net-next 03/15] iavf: obtain crit_section lock in iavf_close() immediately Tony Nguyen
2021-06-04 16:53 ` [Intel-wired-lan] [PATCH net-next 04/15] iavf: wrap driver state change in crit_section lock Tony Nguyen
2021-06-04 16:53 ` [Intel-wired-lan] [PATCH net-next 05/15] iavf: untangle any pending iavf_open() operations from iavf_close() Tony Nguyen
2021-06-10  6:14   ` Stefan Assmann
2021-06-04 16:53 ` [Intel-wired-lan] [PATCH net-next 06/15] iavf: disable interrupts before disabling napi Tony Nguyen
2021-06-04 16:53 ` [Intel-wired-lan] [PATCH net-next 07/15] iavf: Restore non MAC filters after link down Tony Nguyen
2021-11-02 16:36   ` Kuruvinakunnel, George
2021-06-04 16:53 ` [Intel-wired-lan] [PATCH net-next 08/15] iavf: restore MSI state on reset Tony Nguyen
2021-11-03 19:41   ` Kuruvinakunnel, George
2021-06-04 16:53 ` [Intel-wired-lan] [PATCH net-next 09/15] iavf: Fix carrier on state Tony Nguyen
2021-06-04 16:53 ` [Intel-wired-lan] [PATCH net-next 10/15] iavf: Add change MTU message Tony Nguyen
2021-11-02  0:34   ` Kuruvinakunnel, George
2021-06-04 16:53 ` [Intel-wired-lan] [PATCH net-next 11/15] iavf: Prevent changing static ITR values if adaptive moderation is on Tony Nguyen
2021-11-02  0:21   ` Kuruvinakunnel, George
2021-06-04 16:53 ` [Intel-wired-lan] [PATCH net-next 12/15] iavf: Log info when VF is entering and leaving Allmulti mode Tony Nguyen
2021-11-02  0:47   ` Kuruvinakunnel, George
2021-06-04 16:53 ` [Intel-wired-lan] [PATCH net-next 13/15] iavf: Set RSS LUT and key in reset handle path Tony Nguyen
2021-08-06  7:26   ` Jankowski, Konrad0
2021-06-04 16:53 ` [Intel-wired-lan] [PATCH net-next 14/15] iavf: return errno code instead of status code Tony Nguyen
2021-11-17 10:27   ` Jankowski, Konrad0
2021-06-04 16:53 ` [Intel-wired-lan] [PATCH net-next 15/15] iavf: don't be so alarming Tony Nguyen
2021-11-03 19:45   ` Kuruvinakunnel, George

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.