Skip to contentSkip to conversation

iavf: Fix not to overload flags

PATCH New Karen Sornek 2 participants 2 messages Sep 1, 2021

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

PATCH 1/1 iavf: Fix not to overload flags

The IAVF_FLAG_REINIT_ITR_NEEDED flag was being used for two different purposes. As originally written, it indicates to the ITR mechanism to update the interrupt registers to a new setting. Sometime later, it was overloaded to indicate that interrupts need to be completely reinitialized during reset. This causes problems when ethtool -C is used while a reset is in progress, and can lead to RTNL deadlocks.

To fix this, add a new flag with a new name and use that to trigger MSI-X reinit.

Fixes 5b36e8d04b44 ("i40evf: Enable VF to request an alternate queue allocation")
---
 drivers/net/ethernet/intel/iavf/iavf.h      | 1 +
 drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf.h +1 -0
index 21c957755..5a36af8b9 100644
@@ -272,6 +272,7 @@ struct iavf_adapter {
 #define IAVF_FLAG_LEGACY_RX			BIT(15)
 #define IAVF_FLAG_REINIT_ITR_NEEDED		BIT(16)
 #define IAVF_FLAG_QUEUES_DISABLED		BIT(17)
+#define IAVF_FLAG_REINIT_MSIX_NEEDED		BIT(20)
 /* duplicates for common code */
 #define IAVF_FLAG_DCB_ENABLED			0
 	/* flags for admin queue service task */
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
index 80437ef26..4b7a670de 100644
@@ -3556,7 +3556,7 @@ int iavf_process_config(struct iavf_adapter *adapter)
 			"Requested %d queues, but PF only gave us %d.\n",
 			num_req_queues,
 			adapter->vsi_res->num_queue_pairs);
-		adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED;
+		adapter->flags |= IAVF_FLAG_REINIT_MSIX_NEEDED;
 		adapter->num_req_queues = adapter->vsi_res->num_queue_pairs;
 		iavf_schedule_reset(adapter);
 		return -ENODEV;
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/1 iavf: Fix not to overload flags

Dear Karen,

Am 01.09.21 um 10:27 schrieb Karen Sornek:

Quoted 9 lines

The IAVF_FLAG_REINIT_ITR_NEEDED flag was being used for two different purposes. As originally written, it indicates to the ITR mechanism to update the interrupt registers to a new setting. Sometime later, it was overloaded to indicate that interrupts need to be completely reinitialized during reset. This causes problems when ethtool -C is used while a reset is in progress, and can lead to RTNL deadlocks.

To fix this, add a new flag with a new name and use that to trigger MSI-X reinit.

Please mention the macro name in the commit message.

For the summary, please use a statement (with a verb in imperative mood). Maybe:

iavf: Fix RTNL deadlock with new flag IAVF_FLAG_REINIT_MSIX_NEEDED

Quoted 26 lines
Fixes 5b36e8d04b44 ("i40evf: Enable VF to request an alternate queue allocation")
---
  drivers/net/ethernet/intel/iavf/iavf.h      | 1 +
  drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +-
  2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf.h +1 -0
index 21c957755..5a36af8b9 100644
@@ -272,6 +272,7 @@ struct iavf_adapter {
  #define IAVF_FLAG_LEGACY_RX			BIT(15)
  #define IAVF_FLAG_REINIT_ITR_NEEDED		BIT(16)
  #define IAVF_FLAG_QUEUES_DISABLED		BIT(17)
+#define IAVF_FLAG_REINIT_MSIX_NEEDED		BIT(20)
  /* duplicates for common code */
  #define IAVF_FLAG_DCB_ENABLED			0
  	/* flags for admin queue service task */
drivers/net/ethernet/intel/iavf/iavf_main.c +0 -0
index 80437ef26..4b7a670de 100644

drivers/net/ethernet/intel/iavf/iavf_main.c int iavf_process_config(struct iavf_adapter *adapter) · line 3562

Quoted 8 lines
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
@@ -3556,7 +3556,7 @@ int iavf_process_config(struct iavf_adapter *adapter)
  			"Requested %d queues, but PF only gave us %d.\n",
  			num_req_queues,
  			adapter->vsi_res->num_queue_pairs);
-		adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED;
+		adapter->flags |= IAVF_FLAG_REINIT_MSIX_NEEDED;
  		adapter->num_req_queues = adapter->vsi_res->num_queue_pairs;
  		iavf_schedule_reset(adapter);
  		return -ENODEV;

The diff looks good to me.

Kind regards,

Paul