diff mbox series

[iwl-next,v1] ice: Check all ice_vsi_rebuild() errors in function

Message ID 20240528090140.221964-1-karen.ostrowska@intel.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [iwl-next,v1] ice: Check all ice_vsi_rebuild() errors in function | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 902 this patch: 902
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 5 maintainers not CCed: pabeni@redhat.com kuba@kernel.org edumazet@google.com anthony.l.nguyen@intel.com jesse.brandeburg@intel.com
netdev/build_clang success Errors and warnings before: 906 this patch: 906
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 906 this patch: 906
netdev/checkpatch warning WARNING: line length of 105 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 116 this patch: 116
netdev/source_inline success Was 0 now: 0

Commit Message

Karen Ostrowska May 28, 2024, 9:01 a.m. UTC
From: Eric Joyner <eric.joyner@intel.com>

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

Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Eric Joyner <eric.joyner@intel.com>
Signed-off-by: Karen Ostrowska <karen.ostrowska@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Pucha, HimasekharX Reddy May 29, 2024, 5:09 p.m. UTC | #1
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Karen Ostrowska
> Sent: Tuesday, May 28, 2024 2:32 PM
> To: intel-wired-lan@lists.osuosl.org
> Cc: Joyner, Eric <eric.joyner@intel.com>; netdev@vger.kernel.org; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>; Ostrowska, Karen <karen.ostrowska@intel.com>; Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Subject: [Intel-wired-lan] [iwl-next v1] ice: Check all ice_vsi_rebuild() errors in function
>
> From: Eric Joyner <eric.joyner@intel.com>
>
> Check the return value from ice_vsi_rebuild() and prevent the usage of incorrectly configured VSI.
>
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Eric Joyner <eric.joyner@intel.com>
> Signed-off-by: Karen Ostrowska <karen.ostrowska@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>

Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Simon Horman June 4, 2024, 2:47 p.m. UTC | #2
On Tue, May 28, 2024 at 11:01:40AM +0200, Karen Ostrowska wrote:
> From: Eric Joyner <eric.joyner@intel.com>
> 
> Check the return value from ice_vsi_rebuild() and prevent the usage of
> incorrectly configured VSI.
> 
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Eric Joyner <eric.joyner@intel.com>
> Signed-off-by: Karen Ostrowska <karen.ostrowska@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> index f60c022f7960..e8c30b1730a6 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -4135,15 +4135,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);

Hi Karen,

This seems to be a good improvement to me, thanks.
But I do winder if we can go a bit further:

* Should the return value of ice_vsi_open() also be checked?
* Should the return value of ice_vsi_recfg_qs() be checked?

Also, I think the following is appropriate here:

	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;
> -- 
> 2.31.1
> 
>
Karen Ostrowska June 5, 2024, 1:51 p.m. UTC | #3
-----Original Message-----
From: Simon Horman <horms@kernel.org> 
Sent: Tuesday, June 4, 2024 4:47 PM
To: Ostrowska, Karen <karen.ostrowska@intel.com>
Cc: intel-wired-lan@lists.osuosl.org; Joyner, Eric <eric.joyner@intel.com>; netdev@vger.kernel.org; Michal Swiatkowski <michal.swiatkowski@linux.intel.com>; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>
Subject: Re: [iwl-next v1] ice: Check all ice_vsi_rebuild() errors in function

On Tue, May 28, 2024 at 11:01:40AM +0200, Karen Ostrowska wrote:
> From: Eric Joyner <eric.joyner@intel.com>
> 
> Check the return value from ice_vsi_rebuild() and prevent the usage of 
> incorrectly configured VSI.
> 
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Eric Joyner <eric.joyner@intel.com>
> Signed-off-by: Karen Ostrowska <karen.ostrowska@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c 
> b/drivers/net/ethernet/intel/ice/ice_main.c
> index f60c022f7960..e8c30b1730a6 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -4135,15 +4135,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);
>
> Hi Karen,
>
> This seems to be a good improvement to me, thanks.
> But I do winder if we can go a bit further:
>
> * Should the return value of ice_vsi_open() also be checked?
> * Should the return value of ice_vsi_recfg_qs() be checked?
>
> Also, I think the following is appropriate here:
>
>	goto done;

	Yes, definitely. Thanks for remarks!
> +
> +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;
> --
> 2.31.1
> 
>
Paul Menzel June 11, 2024, 9:01 a.m. UTC | #4
Dear Eric, dear Karen,


Thank you for the patch.


Am 28.05.24 um 11:01 schrieb Karen Ostrowska:
> From: Eric Joyner <eric.joyner@intel.com>
> 
> Check the return value from ice_vsi_rebuild() and prevent the usage of
> incorrectly configured VSI.

Was this found during code review, or is this seen in practice? If the 
latter, please document the test system and test case.

> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Eric Joyner <eric.joyner@intel.com>
> Signed-off-by: Karen Ostrowska <karen.ostrowska@intel.com>

Should there be a Fixes: tag?


Kind regards,

Paul


> ---
>   drivers/net/ethernet/intel/ice/ice_main.c | 12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> index f60c022f7960..e8c30b1730a6 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -4135,15 +4135,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);
> +
> +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;
Larysa Zaremba June 14, 2024, 7:33 a.m. UTC | #5
On Tue, Jun 11, 2024 at 11:01:55AM +0200, Paul Menzel wrote:
> Dear Eric, dear Karen,
> 
> 
> Thank you for the patch.
> 
> 
> Am 28.05.24 um 11:01 schrieb Karen Ostrowska:
> > From: Eric Joyner <eric.joyner@intel.com>
> > 
> > Check the return value from ice_vsi_rebuild() and prevent the usage of
> > incorrectly configured VSI.
> 
> Was this found during code review, or is this seen in practice? If the
> latter, please document the test system and test case.
> 
> > Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> > Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> > Signed-off-by: Eric Joyner <eric.joyner@intel.com>
> > Signed-off-by: Karen Ostrowska <karen.ostrowska@intel.com>
> 
> Should there be a Fixes: tag?
>

There MUST be a goto here. Patch results in an error message without an error 
[43788.733637] ice 0000:18:00.0: Error during VSI rebuild: 0. Unload and reload the driver.

> 
> Kind regards,
> 
> Paul
> 
> 
> > ---
> >   drivers/net/ethernet/intel/ice/ice_main.c | 12 ++++++++++--
> >   1 file changed, 10 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> > index f60c022f7960..e8c30b1730a6 100644
> > --- a/drivers/net/ethernet/intel/ice/ice_main.c
> > +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> > @@ -4135,15 +4135,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);
> > +
> > +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;
>
Larysa Zaremba June 14, 2024, 7:37 a.m. UTC | #6
On Wed, May 29, 2024 at 05:09:52PM +0000, Pucha, HimasekharX Reddy wrote:
> > -----Original Message-----
> > From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Karen Ostrowska
> > Sent: Tuesday, May 28, 2024 2:32 PM
> > To: intel-wired-lan@lists.osuosl.org
> > Cc: Joyner, Eric <eric.joyner@intel.com>; netdev@vger.kernel.org; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>; Ostrowska, Karen <karen.ostrowska@intel.com>; Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> > Subject: [Intel-wired-lan] [iwl-next v1] ice: Check all ice_vsi_rebuild() errors in function
> >
> > From: Eric Joyner <eric.joyner@intel.com>
> >
> > Check the return value from ice_vsi_rebuild() and prevent the usage of incorrectly configured VSI.
> >
> > Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> > Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> > Signed-off-by: Eric Joyner <eric.joyner@intel.com>
> > Signed-off-by: Karen Ostrowska <karen.ostrowska@intel.com>
> > ---
> >  drivers/net/ethernet/intel/ice/ice_main.c | 12 ++++++++++--
> >  1 file changed, 10 insertions(+), 2 deletions(-)
> >
> 
> Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
> 

Do not apply this tag, Reddy has found a regression that causes unneeded error 
messages.

[43788.733637] ice 0000:18:00.0: Error during VSI rebuild: 0. Unload and reload the driver.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index f60c022f7960..e8c30b1730a6 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -4135,15 +4135,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);
+
+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;