[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <301091f2-97f4-4781-92dd-d9cfb33eedcf@intel.com>
Date: Tue, 7 Jan 2025 12:27:52 +0100
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Tariq Toukan <tariqt@...dia.com>, Moshe Shemesh <moshe@...dia.com>
CC: <netdev@...r.kernel.org>, Saeed Mahameed <saeedm@...dia.com>, Gal Pressman
<gal@...dia.com>, Leon Romanovsky <leonro@...dia.com>, Mark Bloch
<mbloch@...dia.com>, Yevgeny Kliteynik <kliteyn@...dia.com>, "David S.
Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Eric Dumazet <edumazet@...gle.com>, Andrew Lunn
<andrew+netdev@...n.ch>
Subject: Re: [PATCH net-next 01/13] net/mlx5: fs, add HWS root namespace
functions
On 1/7/25 07:06, Tariq Toukan wrote:
> From: Moshe Shemesh <moshe@...dia.com>
>
> Add flow steering commands structure for HW steering. Implement create,
> destroy and set peer HW steering root namespace functions.
>
> Signed-off-by: Moshe Shemesh <moshe@...dia.com>
> Reviewed-by: Yevgeny Kliteynik <kliteyn@...dia.com>
> Reviewed-by: Mark Bloch <mbloch@...dia.com>
> Signed-off-by: Tariq Toukan <tariqt@...dia.com>
> ---
> .../net/ethernet/mellanox/mlx5/core/Makefile | 4 +-
> .../net/ethernet/mellanox/mlx5/core/fs_core.h | 9 ++-
> .../mellanox/mlx5/core/steering/hws/fs_hws.c | 56 +++++++++++++++++++
> .../mellanox/mlx5/core/steering/hws/fs_hws.h | 25 +++++++++
> 4 files changed, 90 insertions(+), 4 deletions(-)
> create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
> create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Makefile b/drivers/net/ethernet/mellanox/mlx5/core/Makefile
> index 10a763e668ed..0008b22417c8 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/Makefile
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/Makefile
> @@ -151,8 +151,8 @@ mlx5_core-$(CONFIG_MLX5_HW_STEERING) += steering/hws/cmd.o \
> steering/hws/bwc.o \
> steering/hws/debug.o \
> steering/hws/vport.o \
> - steering/hws/bwc_complex.o
> -
> + steering/hws/bwc_complex.o \
> + steering/hws/fs_hws.o
>
> #
> # SF device
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
> index bad2df0715ec..545fdfce7b52 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
> @@ -38,6 +38,7 @@
> #include <linux/rhashtable.h>
> #include <linux/llist.h>
> #include <steering/sws/fs_dr.h>
> +#include <steering/hws/fs_hws.h>
>
> #define FDB_TC_MAX_CHAIN 3
> #define FDB_FT_CHAIN (FDB_TC_MAX_CHAIN + 1)
> @@ -126,7 +127,8 @@ enum fs_fte_status {
>
> enum mlx5_flow_steering_mode {
> MLX5_FLOW_STEERING_MODE_DMFS,
> - MLX5_FLOW_STEERING_MODE_SMFS
> + MLX5_FLOW_STEERING_MODE_SMFS,
> + MLX5_FLOW_STEERING_MODE_HMFS
add comma here, to avoid git-blame churn when the next mode will be
added
> };
>
> enum mlx5_flow_steering_capabilty {
> @@ -293,7 +295,10 @@ struct mlx5_flow_group {
> struct mlx5_flow_root_namespace {
> struct mlx5_flow_namespace ns;
> enum mlx5_flow_steering_mode mode;
> - struct mlx5_fs_dr_domain fs_dr_domain;
> + union {
> + struct mlx5_fs_dr_domain fs_dr_domain;
> + struct mlx5_fs_hws_context fs_hws_context;
> + };
> enum fs_flow_table_type table_type;
> struct mlx5_core_dev *dev;
> struct mlx5_flow_table *root_ft;
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
> new file mode 100644
> index 000000000000..7a3c84b18d1e
> --- /dev/null
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
> @@ -0,0 +1,56 @@
> +// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
> +/* Copyright (c) 2024 NVIDIA Corporation & Affiliates */
you have submited it on 2025 ;)
> +
> +#include <mlx5_core.h>
> +#include <fs_core.h>
> +#include <fs_cmd.h>
> +#include "mlx5hws.h"
> +
> +#define MLX5HWS_CTX_MAX_NUM_OF_QUEUES 16
> +#define MLX5HWS_CTX_QUEUE_SIZE 256
> +
> +static int mlx5_cmd_hws_create_ns(struct mlx5_flow_root_namespace *ns)
> +{
> + struct mlx5hws_context_attr hws_ctx_attr = {};
> +
> + hws_ctx_attr.queues = min_t(int, num_online_cpus(),
> + MLX5HWS_CTX_MAX_NUM_OF_QUEUES);
> + hws_ctx_attr.queue_size = MLX5HWS_CTX_QUEUE_SIZE;
> +
> + ns->fs_hws_context.hws_ctx =
> + mlx5hws_context_open(ns->dev, &hws_ctx_attr);
> + if (!ns->fs_hws_context.hws_ctx) {
> + mlx5_core_err(ns->dev, "Failed to create hws flow namespace\n");
> + return -EOPNOTSUPP;
I would expect -EOPNOTSUPP to be returned only when there was no action
attempted
> + }
> + return 0;
> +}
Powered by blists - more mailing lists