Skip to contentSkip to conversation

i40e: Fix incorrect netdev's real number of RX/TX queues

PATCH Superseded Jedrzej Jagielski 3 participants 3 messages Dec 15, 2021 – Dec 17, 2021

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 i40e: Fix incorrect netdev's real number of RX/TX queues

There was a wrong queues representation in sysfs during driver's reinitialization in case of online cpus number is less than combined queues. It was caused by stopped NetworkManager, which is responsible for calling vsi_open function during driver's initialization.
In specific situation (ex. 12 cpus online) there were 16 queues in /sys/class/net/<iface>/queues. In case of modifying queues with value higher, than number of online cpus, then it caused write errors and other errors.
Add updating of sysfs's queues representation during driver initialization.

Fixes 41c445ff0f48 ("i40e: main driver core")

---
v2:Fix "CHECK: Lines should not end with a '('" warning

---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +19 -0
index 4ff1c9b9217b..1b6f03cc41da 100644
@@ -14074,6 +14074,22 @@ static struct i40e_vsi *i40e_vsi_reinit_setup(struct i40e_vsi *vsi)
 	return NULL;
 }
 
+/**
+ * i40e_netif_set_realnum_tx_rx_queues - Update number of tx/rx queues
+ * @vsi: vsi structure
+ *
+ * This updates netdev's number of tx/rx queues
+ *
+ * Returns status of setting tx/rx queues
+ **/
+static int i40e_netif_set_realnum_tx_rx_queues(struct i40e_vsi *vsi)
+{
+	netif_set_real_num_rx_queues(vsi->netdev, vsi->num_queue_pairs);
+
+	return netif_set_real_num_tx_queues(vsi->netdev,
+					    vsi->num_queue_pairs);
+}
+
 /**
  * i40e_vsi_setup - Set up a VSI by a given type
  * @pf: board private structure
@@ -14203,6 +14219,9 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,
 	case I40E_VSI_MAIN:
 	case I40E_VSI_VMDQ2:
 		ret = i40e_config_netdev(vsi);
+		if (ret)
+			goto err_netdev;
+		ret = i40e_netif_set_realnum_tx_rx_queues(vsi);
 		if (ret)
 			goto err_netdev;
 		ret = register_netdev(vsi->netdev);
Signature · 1 line
2.27.0
#1 lore raw

PATCH v2 1/1 i40e: Fix incorrect netdev's real number of RX/TX queues

Quoted 11 lines · Jedrzej Jagielski

There was a wrong queues representation in sysfs during driver's reinitialization in case of online cpus number is less than combined queues. It was caused by stopped NetworkManager, which is responsible for calling vsi_open function during driver's initialization.
In specific situation (ex. 12 cpus online) there were 16 queues in /sys/class/net/<iface>/queues. In case of modifying queues with value higher, than number of online cpus, then it caused write errors and other errors.
Add updating of sysfs's queues representation during driver initialization.

Description is not very clear to me - how did you get the value of 16 queues? Do you have 16 cpu system and then modified the count of cpus being online?

Quoted 19 lines
Fixes 41c445ff0f48 ("i40e: main driver core")

---
v2:Fix "CHECK: Lines should not end with a '('" warning

---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -0
index 4ff1c9b9217b..1b6f03cc41da 100644
@@ -14074,6 +14074,22 @@ static struct i40e_vsi *i40e_vsi_reinit_setup(struct i40e_vsi *vsi)
 	return NULL;
 }
 
+/**

drivers/net/ethernet/intel/i40e/i40e_main.c static struct i40e_vsi *i40e_vsi_reinit_setup(struct i40e_vsi *vsi) · line 14087

Quoted 10 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +10 -0
+ * i40e_netif_set_realnum_tx_rx_queues - Update number of tx/rx queues
+ * @vsi: vsi structure
+ *
+ * This updates netdev's number of tx/rx queues
+ *
+ * Returns status of setting tx/rx queues
+ **/
+static int i40e_netif_set_realnum_tx_rx_queues(struct i40e_vsi *vsi)
+{
+	netif_set_real_num_rx_queues(vsi->netdev, vsi->num_queue_pairs);

Why return value of above is not checked?

Also would be good to convert the i40e_vsi_open() to make use of this function you're introducing, I guess.

Quoted 25 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +8 -0
+
+	return netif_set_real_num_tx_queues(vsi->netdev,
+					    vsi->num_queue_pairs);
+}
+
 /**
  * i40e_vsi_setup - Set up a VSI by a given type
  * @pf: board private structure
@@ -14203,6 +14219,9 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,
 	case I40E_VSI_MAIN:
 	case I40E_VSI_VMDQ2:
 		ret = i40e_config_netdev(vsi);
+		if (ret)
+			goto err_netdev;
+		ret = i40e_netif_set_realnum_tx_rx_queues(vsi);
 		if (ret)
 			goto err_netdev;
 		ret = register_netdev(vsi->netdev);
Signature · 6 lines
2.27.0

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
#2 lore raw

PATCH v2 1/1 i40e: Fix incorrect netdev's real number of RX/TX queues

Quoted 12 lines
Quoted 11 lines

There was a wrong queues representation in sysfs during driver's reinitialization in case of online cpus number is less than combined queues. It was caused by stopped NetworkManager, which is responsible for calling vsi_open function during driver's initialization.
In specific situation (ex. 12 cpus online) there were 16 queues in /sys/class/net/<iface>/queues. In case of modifying queues with value higher, than number of online cpus, then it caused write errors and other errors.
Add updating of sysfs's queues representation during driver initialization.

Quoted 4 lines

Description is not very clear to me - how did you get the value of 16 queues? Do you have 16 cpu system and then modified the count of cpus being online?

When You have less than 16 available/online cpus and network manager is disabled, the maximum preset number of combined queues of the interface goes to 16. So you can set combined queues up to 16. Then there is sysfs representation of TX/RX queues index greater than available/online cpus. Then trying to write some value to (for example) /sys/class/net/ethx/queues/tx-15/xps_cpus causes Invalid argument error.

Quoted 32 lines
Quoted 19 lines
Fixes 41c445ff0f48 ("i40e: main driver core")

---
v2:Fix "CHECK: Lines should not end with a '('" warning

---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -0
index 4ff1c9b9217b..1b6f03cc41da 100644
@@ -14074,6 +14074,22 @@ static struct i40e_vsi *i40e_vsi_reinit_setup(struct i40e_vsi *vsi)
 	return NULL;
 }
 
+/**

drivers/net/ethernet/intel/i40e/i40e_main.c static struct i40e_vsi *i40e_vsi_reinit_setup(struct i40e_vsi *vsi) · line 14087

Quoted 10 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +10 -0
+ * i40e_netif_set_realnum_tx_rx_queues - Update number of tx/rx queues
+ * @vsi: vsi structure
+ *
+ * This updates netdev's number of tx/rx queues
+ *
+ * Returns status of setting tx/rx queues
+ **/
+static int i40e_netif_set_realnum_tx_rx_queues(struct i40e_vsi *vsi)
+{
+	netif_set_real_num_rx_queues(vsi->netdev, vsi->num_queue_pairs);

Why return value of above is not checked?

Quoted 3 lines

Also would be good to convert the i40e_vsi_open() to make use of this function you're introducing, I guess.

Sure, good point.

Quoted 12 lines
Quoted 12 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +5 -0
+
+	return netif_set_real_num_tx_queues(vsi->netdev,
+					    vsi->num_queue_pairs);
+}
+
 /**
  * i40e_vsi_setup - Set up a VSI by a given type
  * @pf: board private structure
@@ -14203,6 +14219,9 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,
 	case I40E_VSI_MAIN:
 	case I40E_VSI_VMDQ2:
 		ret = i40e_config_netdev(vsi);
Quoted 8 lines
Quoted 8 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -0
+		if (ret)
+			goto err_netdev;
+		ret = i40e_netif_set_realnum_tx_rx_queues(vsi);
 		if (ret)
 			goto err_netdev;
 		ret = register_netdev(vsi->netdev);
Signature · 1 line
2.27.0

Thanks for your suggestions,
Jedrzej

-----Original Message-----
From: Fijalkowski, Maciej <[email protected]>
Sent: ?roda, 15 grudnia 2021 11:58
To: Jagielski, Jedrzej <[email protected]>
Cc: intel-wired-lan at lists.osuosl.org; Cieplicki, LukaszX <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH net v2] i40e: Fix incorrect netdev's real number of RX/TX queues

Quoted 11 lines · Jedrzej Jagielski

There was a wrong queues representation in sysfs during driver's reinitialization in case of online cpus number is less than combined queues. It was caused by stopped NetworkManager, which is responsible for calling vsi_open function during driver's initialization.
In specific situation (ex. 12 cpus online) there were 16 queues in /sys/class/net/<iface>/queues. In case of modifying queues with value higher, than number of online cpus, then it caused write errors and other errors.
Add updating of sysfs's queues representation during driver initialization.

Description is not very clear to me - how did you get the value of 16 queues? Do you have 16 cpu system and then modified the count of cpus being online?

Quoted 19 lines
Fixes 41c445ff0f48 ("i40e: main driver core")

---
v2:Fix "CHECK: Lines should not end with a '('" warning

---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -0
index 4ff1c9b9217b..1b6f03cc41da 100644
@@ -14074,6 +14074,22 @@ static struct i40e_vsi *i40e_vsi_reinit_setup(struct i40e_vsi *vsi)
 	return NULL;
 }
 
+/**

drivers/net/ethernet/intel/i40e/i40e_main.c static struct i40e_vsi *i40e_vsi_reinit_setup(struct i40e_vsi *vsi) · line 14087

Quoted 10 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +10 -0
+ * i40e_netif_set_realnum_tx_rx_queues - Update number of tx/rx queues
+ * @vsi: vsi structure
+ *
+ * This updates netdev's number of tx/rx queues
+ *
+ * Returns status of setting tx/rx queues
+ **/
+static int i40e_netif_set_realnum_tx_rx_queues(struct i40e_vsi *vsi)
+{
+	netif_set_real_num_rx_queues(vsi->netdev, vsi->num_queue_pairs);

Why return value of above is not checked?

Also would be good to convert the i40e_vsi_open() to make use of this function you're introducing, I guess.

Quoted 25 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +8 -0
+
+	return netif_set_real_num_tx_queues(vsi->netdev,
+					    vsi->num_queue_pairs);
+}
+
 /**
  * i40e_vsi_setup - Set up a VSI by a given type
  * @pf: board private structure
@@ -14203,6 +14219,9 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,
 	case I40E_VSI_MAIN:
 	case I40E_VSI_VMDQ2:
 		ret = i40e_config_netdev(vsi);
+		if (ret)
+			goto err_netdev;
+		ret = i40e_netif_set_realnum_tx_rx_queues(vsi);
 		if (ret)
 			goto err_netdev;
 		ret = register_netdev(vsi->netdev);
Signature · 6 lines
2.27.0

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan