All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Lobakin <alexandr.lobakin@intel.com>
To: Saeed Mahameed <saeed@kernel.org>
Cc: "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: Tue, 14 Feb 2023 18:07:54 +0100	[thread overview]
Message-ID: <23c46b99-1fbf-0155-b2d0-2ea3d1fe9d17@intel.com> (raw)
In-Reply-To: <20230210221821.271571-2-saeed@kernel.org>

From: Saeed Mahameed <saeed@kernel.org>
Date: Fri, 10 Feb 2023 14:18:07 -0800

> From: Roi Dayan <roid@nvidia.com>
> 
> Instead of activating multiport eswitch dynamically through
> adding a TC rule and meeting certain conditions, allow the user
> to activate it through devlink.
> This will remove the forced requirement of using TC.
> e.g. Bridge offload.
> 
> Example:
>     $ devlink dev param set pci/0000:00:0b.0 name esw_multiport value 1 \
>                   cmode runtime
> 
> Signed-off-by: Roi Dayan <roid@nvidia.com>
> Reviewed-by: Maor Dickman <maord@nvidia.com>
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> ---
>  Documentation/networking/devlink/mlx5.rst     |  4 ++
>  .../net/ethernet/mellanox/mlx5/core/devlink.c | 56 +++++++++++++++++++
>  .../net/ethernet/mellanox/mlx5/core/devlink.h |  1 +
>  .../mellanox/mlx5/core/en/tc/act/mirred.c     |  9 ---
>  .../net/ethernet/mellanox/mlx5/core/en_tc.c   | 22 +-------
>  .../net/ethernet/mellanox/mlx5/core/en_tc.h   |  6 --
>  .../net/ethernet/mellanox/mlx5/core/lag/lag.c |  4 +-
>  .../net/ethernet/mellanox/mlx5/core/lag/lag.h |  1 +
>  .../ethernet/mellanox/mlx5/core/lag/mpesw.c   | 46 +++++++--------
>  .../ethernet/mellanox/mlx5/core/lag/mpesw.h   | 12 +---
>  10 files changed, 87 insertions(+), 74 deletions(-)
> 
> diff --git a/Documentation/networking/devlink/mlx5.rst b/Documentation/networking/devlink/mlx5.rst
> index 29ad304e6fba..1d2ad2727da1 100644
> --- a/Documentation/networking/devlink/mlx5.rst
> +++ b/Documentation/networking/devlink/mlx5.rst
> @@ -54,6 +54,10 @@ parameters.
>       - Control the number of large groups (size > 1) in the FDB table.
>  
>         * The default value is 15, and the range is between 1 and 1024.
> +   * - ``esw_multiport``
> +     - Boolean
> +     - runtime
> +     - Set the E-Switch lag mode to multiport.
>  
>  The ``mlx5`` driver supports reloading via ``DEVLINK_CMD_RELOAD``
>  
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
> index b742e04deec1..49392870f695 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
> @@ -7,6 +7,7 @@
>  #include "fw_reset.h"
>  #include "fs_core.h"
>  #include "eswitch.h"
> +#include "lag/lag.h"
>  #include "esw/qos.h"
>  #include "sf/dev/dev.h"
>  #include "sf/sf.h"
> @@ -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;

?

> +}
> +
> +static int mlx5_devlink_esw_multiport_get(struct devlink *devlink, u32 id,
> +					  struct devlink_param_gset_ctx *ctx)
[...]

Thanks,
Olek

  parent reply	other threads:[~2023-02-14 17:09 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 [this message]
2023-02-14 21:49     ` Saeed Mahameed
2023-02-15 11:46     ` Leon Romanovsky
2023-02-15 17:04       ` Alexander Lobakin
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=23c46b99-1fbf-0155-b2d0-2ea3d1fe9d17@intel.com \
    --to=alexandr.lobakin@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@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.