[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b8dbd338-e2d0-5173-3186-4f92d7d52f40@intel.com>
Date: Wed, 15 Feb 2023 18:04:16 +0100
From: Alexander Lobakin <aleksander.lobakin@...el.com>
To: Leon Romanovsky <leon@...nel.org>
CC: Saeed Mahameed <saeed@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Eric Dumazet <edumazet@...gle.com>,
Saeed Mahameed <saeedm@...dia.com>, <netdev@...r.kernel.org>,
Tariq Toukan <tariqt@...dia.com>, Roi Dayan <roid@...dia.com>,
Maor Dickman <maord@...dia.com>
Subject: Re: [net-next 01/15] net/mlx5: Lag, Let user configure multiport
eswitch
From: Leon Romanovsky <leon@...nel.org>
Date: Wed, 15 Feb 2023 13:46:29 +0200
> On Tue, Feb 14, 2023 at 06:07:54PM +0100, Alexander Lobakin wrote:
>> From: Saeed Mahameed <saeed@...nel.org>
>> Date: Fri, 10 Feb 2023 14:18:07 -0800
[...]
>>> @@ -437,6 +438,55 @@ static int mlx5_devlink_large_group_num_validate(struct devlink *devlink, u32 id
>>> return 0;
>>> }
>>>
>>> +static int mlx5_devlink_esw_multiport_set(struct devlink *devlink, u32 id,
>>> + struct devlink_param_gset_ctx *ctx)
>>> +{
>>> + struct mlx5_core_dev *dev = devlink_priv(devlink);
>>> + int err = 0;
>>> +
>>> + if (!MLX5_ESWITCH_MANAGER(dev))
>>> + return -EOPNOTSUPP;
>>> +
>>> + if (ctx->val.vbool)
>>> + err = mlx5_lag_mpesw_enable(dev);
>>> + else
>>> + mlx5_lag_mpesw_disable(dev);
>>> +
>>> + return err;
>>
>> How about
>>
>> if (ctx->val.vbool)
>> return mlx5_lag_mpesw_enable(dev);
>> else
>> mlx5_lag_mpesw_disable(dev);
>>
>> return 0;
>
> If such construction is used, there won't need in "else".
>
> if (ctx->val.vbool)
> return mlx5_lag_mpesw_enable(dev);
>
> mlx5_lag_mpesw_disable(dev);
> return 0;
Correct, I just thought that if-else would look more intuitive here
since it's a simple "if enabled enable else disable".
[...]
Thanks,
Olek
Powered by blists - more mailing lists