All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Saeed Mahameed <saeed@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	Saeed Mahameed <saeedm@nvidia.com>, <netdev@vger.kernel.org>,
	Tariq Toukan <tariqt@nvidia.com>, Roi Dayan <roid@nvidia.com>,
	Maor Dickman <maord@nvidia.com>
Subject: Re: [net-next 01/15] net/mlx5: Lag, Let user configure multiport eswitch
Date: Wed, 15 Feb 2023 18:04:16 +0100	[thread overview]
Message-ID: <b8dbd338-e2d0-5173-3186-4f92d7d52f40@intel.com> (raw)
In-Reply-To: <Y+zGFVZPj2UzY0K2@unreal>

From: Leon Romanovsky <leon@kernel.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@kernel.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

  reply	other threads:[~2023-02-15 17:08 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10 22:18 [pull request][net-next 00/15] mlx5 updates 2023-02-10 Saeed Mahameed
2023-02-10 22:18 ` [net-next 01/15] net/mlx5: Lag, Let user configure multiport eswitch Saeed Mahameed
2023-02-11  4:03   ` Jakub Kicinski
2023-02-13 11:32     ` Jiri Pirko
2023-02-13 19:00     ` Mark Bloch
2023-02-14  2:02       ` Jakub Kicinski
2023-02-14  7:31         ` Mark Bloch
2023-02-14 20:40           ` Jakub Kicinski
2023-02-14 21:50             ` Saeed Mahameed
2023-02-14 13:38         ` Jiri Pirko
2023-02-14 17:07   ` Alexander Lobakin
2023-02-14 21:49     ` Saeed Mahameed
2023-02-15 11:46     ` Leon Romanovsky
2023-02-15 17:04       ` Alexander Lobakin [this message]
2023-02-15 19:41         ` Saeed Mahameed
2023-02-10 22:18 ` [net-next 02/15] net/mlx5e: TC, Add peer flow in mpesw mode Saeed Mahameed
2023-02-10 22:18 ` [net-next 03/15] net/mlx5: E-Switch, rename bond update function to be reused Saeed Mahameed
2023-02-10 22:18 ` [net-next 04/15] net/mlx5: Lag, set different uplink vport metadata in multiport eswitch mode Saeed Mahameed
2023-02-10 22:18 ` [net-next 05/15] net/mlx5: Lag, Add single RDMA device in multiport mode Saeed Mahameed
2023-02-10 22:18 ` [net-next 06/15] net/mlx5e: Use a simpler comparison for uplink rep Saeed Mahameed
2023-02-10 22:18 ` [net-next 07/15] net/mlx5e: TC, Remove redundant parse_attr argument Saeed Mahameed
2023-02-10 22:18 ` [net-next 08/15] net/mlx5: Remove outdated comment Saeed Mahameed
2023-02-10 22:18 ` [net-next 09/15] net/mlx5e: Pass mdev to mlx5e_devlink_port_register() Saeed Mahameed
2023-02-10 22:18 ` [net-next 10/15] net/mlx5e: Replace usage of mlx5e_devlink_get_dl_port() by netdev->devlink_port Saeed Mahameed
2023-02-10 22:18 ` [net-next 11/15] net/mlx5e: Move dl_port to struct mlx5e_dev Saeed Mahameed
2023-02-10 22:18 ` [net-next 12/15] net/mlx5e: Move devlink port registration to be done before netdev alloc Saeed Mahameed
2023-02-10 22:18 ` [net-next 13/15] net/mlx5e: Create auxdev devlink instance in the same ns as parent devlink Saeed Mahameed
2023-02-10 22:18 ` [net-next 14/15] net/mlx5: Remove "recovery" arg from mlx5_load_one() function Saeed Mahameed
2023-02-10 22:18 ` [net-next 15/15] net/mlx5: Suspend auxiliary devices only in case of PCI device suspend Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b8dbd338-e2d0-5173-3186-4f92d7d52f40@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=maord@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=roid@nvidia.com \
    --cc=saeed@kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.