Skip to contentSkip to conversation

ice: Check all ice_vsi_rebuild() errors in function

PATCH Superseded Karen Ostrowska 2 participants 2 messages Jun 14, 2024 – Jun 15, 2024

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ice: Check all ice_vsi_rebuild() errors in function

From: Eric Joyner <[email protected]>

Check the return value from ice_vsi_rebuild() and prevent the usage of incorrectly configured VSI.

---
On v1 there was no goto done line added after ice_vsi_open(vsi). It's needed to skip printing error message when is on success.

Original patch was introduced as implementation change not because of fixing something, so I will skip adding here Fixes tag.

---
 drivers/net/ethernet/intel/ice/ice_main.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +11 -2
index 7d9a4e856f61..1222e8a175d9 100644
@@ -4155,15 +4155,23 @@ int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx, bool locked)
 
 	/* set for the next time the netdev is started */
 	if (!netif_running(vsi->netdev)) {
-		ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT);
+		err = ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT);
+		if (err)
+			goto rebuild_err;
 		dev_dbg(ice_pf_to_dev(pf), "Link is down, queue count change happens when link is brought up\n");
 		goto done;
 	}
 
 	ice_vsi_close(vsi);
-	ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT);
+	err = ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT);
+	if (err)
+		goto rebuild_err;
+
 	ice_pf_dcb_recfg(pf, locked);
 	ice_vsi_open(vsi);
+       goto done;
+
+rebuild_err:
+	dev_err(ice_pf_to_dev(pf), "Error during VSI rebuild: %d. Unload and reload the driver.\n", err);
 done:
 	clear_bit(ICE_CFG_BUSY, pf->state);

return err;

Signature · 1 line
2.39.3
reviewer
#1 lore raw

drivers/net/ethernet/intel/ice/ice_main.c int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx, bool locked)

Quoted 24 lines · Karen Ostrowska

From: Eric Joyner <[email protected]>

Check the return value from ice_vsi_rebuild() and prevent the usage of incorrectly configured VSI.

---
On v1 there was no goto done line added after ice_vsi_open(vsi). It's needed to skip printing error message when is on success.

Original patch was introduced as implementation change not because of fixing something, so I will skip adding here Fixes tag.

---
 drivers/net/ethernet/intel/ice/ice_main.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +0 -0
index 7d9a4e856f61..1222e8a175d9 100644
@@ -4155,15 +4155,23 @@ int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx, bool locked)

Hi Karen,

This patch seems to be mangled.
The context above should be:

@@ -4155,15 +4155,24 @@ int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx, bool locked)

i.e. 23 -> 24

Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_main.c +3 -1
 	/* set for the next time the netdev is started */
 	if (!netif_running(vsi->netdev)) {
-		ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT);
+		err = ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT);
+		if (err)
+			goto rebuild_err;
 		dev_dbg(ice_pf_to_dev(pf), "Link is down, queue count change happens when link is brought up\n");
 		goto done;
 	}

drivers/net/ethernet/intel/ice/ice_main.c int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx, bool locked) · line 4172

Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_main.c +5 -1
 
 	ice_vsi_close(vsi);
-	ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT);
+	err = ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT);
+	if (err)
+		goto rebuild_err;
+
 	ice_pf_dcb_recfg(pf, locked);
 	ice_vsi_open(vsi);
+       goto done;

The line above should be indented using a tab.

Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_main.c +3 -0
+
+rebuild_err:
+	dev_err(ice_pf_to_dev(pf), "Error during VSI rebuild: %d. Unload and reload the driver.\n", err);
 done:
 	clear_bit(ICE_CFG_BUSY, pf->state);
 	return err;
Signature · 1 line
2.39.3