diff mbox series

[iwl-next] ice: use ice_down_up() where applicable

Message ID 20230612141730.331674-1-maciej.fijalkowski@intel.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [iwl-next] ice: use ice_down_up() where applicable | 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/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: 8 this patch: 8
netdev/cc_maintainers warning 5 maintainers not CCed: kuba@kernel.org jesse.brandeburg@intel.com davem@davemloft.net pabeni@redhat.com edumazet@google.com
netdev/build_clang success Errors and warnings before: 8 this patch: 8
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: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 19 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Maciej Fijalkowski June 12, 2023, 2:17 p.m. UTC
ice_change_mtu() is currently using a separate ice_down() and ice_up()
calls to reflect changed MTU. ice_down_up() serves this purpose, so do
the refactoring here.

Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

Comments

Przemek Kitszel June 13, 2023, 10:25 a.m. UTC | #1
On 6/12/23 16:17, Maciej Fijalkowski wrote:
> ice_change_mtu() is currently using a separate ice_down() and ice_up()
> calls to reflect changed MTU. ice_down_up() serves this purpose, so do
> the refactoring here.
> 
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> ---
>   drivers/net/ethernet/intel/ice/ice_main.c | 12 ++----------
>   1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> index a1f7c8edc22f..609df077c314 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -7634,17 +7634,9 @@ static int ice_change_mtu(struct net_device *netdev, int new_mtu)
>   
>   	/* if VSI is up, bring it down and then back up */
>   	if (!test_and_set_bit(ICE_VSI_DOWN, vsi->state)) {

I would remove the above if(), as ice_down_up() starts with:
	if (test_and_set_bit(ICE_VSI_DOWN, vsi->state))
		return 0;

which, with your change applied would just return 0.


> -		err = ice_down(vsi);
> -		if (err) {
> -			netdev_err(netdev, "change MTU if_down err %d\n", err);
> -			return err;
> -		}
> -
> -		err = ice_up(vsi);
> -		if (err) {
> -			netdev_err(netdev, "change MTU if_up err %d\n", err);
> +		err = ice_down_up(vsi);
> +		if (err)
>   			return err;
> -		}
>   	}
>   
>   	netdev_dbg(netdev, "changed MTU to %d\n", new_mtu);
Maciej Fijalkowski June 13, 2023, 10:43 a.m. UTC | #2
On Tue, Jun 13, 2023 at 12:25:08PM +0200, Przemek Kitszel wrote:
> On 6/12/23 16:17, Maciej Fijalkowski wrote:
> > ice_change_mtu() is currently using a separate ice_down() and ice_up()
> > calls to reflect changed MTU. ice_down_up() serves this purpose, so do
> > the refactoring here.
> > 
> > Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> > ---
> >   drivers/net/ethernet/intel/ice/ice_main.c | 12 ++----------
> >   1 file changed, 2 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> > index a1f7c8edc22f..609df077c314 100644
> > --- a/drivers/net/ethernet/intel/ice/ice_main.c
> > +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> > @@ -7634,17 +7634,9 @@ static int ice_change_mtu(struct net_device *netdev, int new_mtu)
> >   	/* if VSI is up, bring it down and then back up */
> >   	if (!test_and_set_bit(ICE_VSI_DOWN, vsi->state)) {
> 
> I would remove the above if(), as ice_down_up() starts with:
> 	if (test_and_set_bit(ICE_VSI_DOWN, vsi->state))
> 		return 0;
> 
> which, with your change applied would just return 0.

Yes, thanks a lot for paying attention, sending v2 shortly.

> 
> 
> > -		err = ice_down(vsi);
> > -		if (err) {
> > -			netdev_err(netdev, "change MTU if_down err %d\n", err);
> > -			return err;
> > -		}
> > -
> > -		err = ice_up(vsi);
> > -		if (err) {
> > -			netdev_err(netdev, "change MTU if_up err %d\n", err);
> > +		err = ice_down_up(vsi);
> > +		if (err)
> >   			return err;
> > -		}
> >   	}
> >   	netdev_dbg(netdev, "changed MTU to %d\n", new_mtu);
>
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 a1f7c8edc22f..609df077c314 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -7634,17 +7634,9 @@  static int ice_change_mtu(struct net_device *netdev, int new_mtu)
 
 	/* if VSI is up, bring it down and then back up */
 	if (!test_and_set_bit(ICE_VSI_DOWN, vsi->state)) {
-		err = ice_down(vsi);
-		if (err) {
-			netdev_err(netdev, "change MTU if_down err %d\n", err);
-			return err;
-		}
-
-		err = ice_up(vsi);
-		if (err) {
-			netdev_err(netdev, "change MTU if_up err %d\n", err);
+		err = ice_down_up(vsi);
+		if (err)
 			return err;
-		}
 	}
 
 	netdev_dbg(netdev, "changed MTU to %d\n", new_mtu);