|
|
d8f823 |
From 4db35731707a40fdf2915135cee66e4aaf1f2e5a Mon Sep 17 00:00:00 2001
|
|
|
d8f823 |
From: Alaa Hleihel <ahleihel@redhat.com>
|
|
|
d8f823 |
Date: Tue, 19 May 2020 07:48:47 -0400
|
|
|
d8f823 |
Subject: [PATCH 225/312] [netdrv] net/mlx5e: Add devlink fdb_large_groups
|
|
|
d8f823 |
parameter
|
|
|
d8f823 |
|
|
|
d8f823 |
Message-id: <20200519074934.6303-17-ahleihel@redhat.com>
|
|
|
d8f823 |
Patchwork-id: 310513
|
|
|
d8f823 |
Patchwork-instance: patchwork
|
|
|
d8f823 |
O-Subject: [RHEL8.3 BZ 1663246 16/63] net/mlx5e: Add devlink fdb_large_groups parameter
|
|
|
d8f823 |
Bugzilla: 1790203 1663246
|
|
|
d8f823 |
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: John Linville <linville@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Ivan Vecera <ivecera@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Kamal Heib <kheib@redhat.com>
|
|
|
d8f823 |
|
|
|
d8f823 |
Bugzilla: http://bugzilla.redhat.com/1663246
|
|
|
d8f823 |
Bugzilla: http://bugzilla.redhat.com/1790203
|
|
|
d8f823 |
Upstream: v5.7-rc1
|
|
|
d8f823 |
Conflicts:
|
|
|
d8f823 |
- Documentation/networking/devlink/mlx5.rst
|
|
|
d8f823 |
Drop changes to missing doc file.
|
|
|
d8f823 |
|
|
|
d8f823 |
commit 87dac697a05a730d878f703a3c3dd78ac6c5bff4
|
|
|
d8f823 |
Author: Jianbo Liu <jianbol@mellanox.com>
|
|
|
d8f823 |
Date: Fri Dec 27 06:37:07 2019 +0000
|
|
|
d8f823 |
|
|
|
d8f823 |
net/mlx5e: Add devlink fdb_large_groups parameter
|
|
|
d8f823 |
|
|
|
d8f823 |
Add a devlink parameter to control the number of large groups in a
|
|
|
d8f823 |
autogrouped flow table. The default value is 15, and the range is between 1
|
|
|
d8f823 |
and 1024.
|
|
|
d8f823 |
|
|
|
d8f823 |
The size of each large group can be calculated according to the following
|
|
|
d8f823 |
formula: size = 4M / (fdb_large_groups + 1).
|
|
|
d8f823 |
|
|
|
d8f823 |
Examples:
|
|
|
d8f823 |
- Set the number of large groups to 20.
|
|
|
d8f823 |
$ devlink dev param set pci/0000:82:00.0 name fdb_large_groups \
|
|
|
d8f823 |
cmode driverinit value 20
|
|
|
d8f823 |
|
|
|
d8f823 |
Then run devlink reload command to apply the new value.
|
|
|
d8f823 |
$ devlink dev reload pci/0000:82:00.0
|
|
|
d8f823 |
|
|
|
d8f823 |
- Read the number of large groups in flow table.
|
|
|
d8f823 |
$ devlink dev param show pci/0000:82:00.0 name fdb_large_groups
|
|
|
d8f823 |
pci/0000:82:00.0:
|
|
|
d8f823 |
name fdb_large_groups type driver-specific
|
|
|
d8f823 |
values:
|
|
|
d8f823 |
cmode driverinit value 20
|
|
|
d8f823 |
|
|
|
d8f823 |
Signed-off-by: Jianbo Liu <jianbol@mellanox.com>
|
|
|
d8f823 |
Reviewed-by: Vlad Buslov <vladbu@mellanox.com>
|
|
|
d8f823 |
Reviewed-by: Roi Dayan <roid@mellanox.com>
|
|
|
d8f823 |
Acked-by: Jiri Pirko <jiri@mellanox.com>
|
|
|
d8f823 |
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
|
|
|
d8f823 |
|
|
|
d8f823 |
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
|
|
|
d8f823 |
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
|
|
|
d8f823 |
---
|
|
|
d8f823 |
drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 34 +++++++++++++++++++---
|
|
|
d8f823 |
drivers/net/ethernet/mellanox/mlx5/core/devlink.h | 6 ++++
|
|
|
d8f823 |
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 22 ++++++++++++++
|
|
|
d8f823 |
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 8 ++++-
|
|
|
d8f823 |
.../ethernet/mellanox/mlx5/core/eswitch_offloads.c | 4 ++-
|
|
|
d8f823 |
.../mellanox/mlx5/core/eswitch_offloads_chains.c | 4 +--
|
|
|
d8f823 |
6 files changed, 70 insertions(+), 8 deletions(-)
|
|
|
d8f823 |
|
|
|
d8f823 |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
|
|
|
d8f823 |
index a9e9027422d4..757e7b91a394 100644
|
|
|
d8f823 |
--- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
|
|
|
d8f823 |
+++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
|
|
|
d8f823 |
@@ -175,10 +175,22 @@ static int mlx5_devlink_fs_mode_get(struct devlink *devlink, u32 id,
|
|
|
d8f823 |
return 0;
|
|
|
d8f823 |
}
|
|
|
d8f823 |
|
|
|
d8f823 |
-enum mlx5_devlink_param_id {
|
|
|
d8f823 |
- MLX5_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX,
|
|
|
d8f823 |
- MLX5_DEVLINK_PARAM_ID_FLOW_STEERING_MODE,
|
|
|
d8f823 |
-};
|
|
|
d8f823 |
+#ifdef CONFIG_MLX5_ESWITCH
|
|
|
d8f823 |
+static int mlx5_devlink_large_group_num_validate(struct devlink *devlink, u32 id,
|
|
|
d8f823 |
+ union devlink_param_value val,
|
|
|
d8f823 |
+ struct netlink_ext_ack *extack)
|
|
|
d8f823 |
+{
|
|
|
d8f823 |
+ int group_num = val.vu32;
|
|
|
d8f823 |
+
|
|
|
d8f823 |
+ if (group_num < 1 || group_num > 1024) {
|
|
|
d8f823 |
+ NL_SET_ERR_MSG_MOD(extack,
|
|
|
d8f823 |
+ "Unsupported group number, supported range is 1-1024");
|
|
|
d8f823 |
+ return -EOPNOTSUPP;
|
|
|
d8f823 |
+ }
|
|
|
d8f823 |
+
|
|
|
d8f823 |
+ return 0;
|
|
|
d8f823 |
+}
|
|
|
d8f823 |
+#endif
|
|
|
d8f823 |
|
|
|
d8f823 |
static const struct devlink_param mlx5_devlink_params[] = {
|
|
|
d8f823 |
DEVLINK_PARAM_DRIVER(MLX5_DEVLINK_PARAM_ID_FLOW_STEERING_MODE,
|
|
|
d8f823 |
@@ -186,6 +198,13 @@ static const struct devlink_param mlx5_devlink_params[] = {
|
|
|
d8f823 |
BIT(DEVLINK_PARAM_CMODE_RUNTIME),
|
|
|
d8f823 |
mlx5_devlink_fs_mode_get, mlx5_devlink_fs_mode_set,
|
|
|
d8f823 |
mlx5_devlink_fs_mode_validate),
|
|
|
d8f823 |
+#ifdef CONFIG_MLX5_ESWITCH
|
|
|
d8f823 |
+ DEVLINK_PARAM_DRIVER(MLX5_DEVLINK_PARAM_ID_ESW_LARGE_GROUP_NUM,
|
|
|
d8f823 |
+ "fdb_large_groups", DEVLINK_PARAM_TYPE_U32,
|
|
|
d8f823 |
+ BIT(DEVLINK_PARAM_CMODE_DRIVERINIT),
|
|
|
d8f823 |
+ NULL, NULL,
|
|
|
d8f823 |
+ mlx5_devlink_large_group_num_validate),
|
|
|
d8f823 |
+#endif
|
|
|
d8f823 |
};
|
|
|
d8f823 |
|
|
|
d8f823 |
static void mlx5_devlink_set_params_init_values(struct devlink *devlink)
|
|
|
d8f823 |
@@ -200,6 +219,13 @@ static void mlx5_devlink_set_params_init_values(struct devlink *devlink)
|
|
|
d8f823 |
devlink_param_driverinit_value_set(devlink,
|
|
|
d8f823 |
MLX5_DEVLINK_PARAM_ID_FLOW_STEERING_MODE,
|
|
|
d8f823 |
value);
|
|
|
d8f823 |
+
|
|
|
d8f823 |
+#ifdef CONFIG_MLX5_ESWITCH
|
|
|
d8f823 |
+ value.vu32 = ESW_OFFLOADS_DEFAULT_NUM_GROUPS;
|
|
|
d8f823 |
+ devlink_param_driverinit_value_set(devlink,
|
|
|
d8f823 |
+ MLX5_DEVLINK_PARAM_ID_ESW_LARGE_GROUP_NUM,
|
|
|
d8f823 |
+ value);
|
|
|
d8f823 |
+#endif
|
|
|
d8f823 |
}
|
|
|
d8f823 |
|
|
|
d8f823 |
int mlx5_devlink_register(struct devlink *devlink, struct device *dev)
|
|
|
d8f823 |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.h b/drivers/net/ethernet/mellanox/mlx5/core/devlink.h
|
|
|
d8f823 |
index d0ba03774ddf..f0de327a59be 100644
|
|
|
d8f823 |
--- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.h
|
|
|
d8f823 |
+++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.h
|
|
|
d8f823 |
@@ -6,6 +6,12 @@
|
|
|
d8f823 |
|
|
|
d8f823 |
#include <net/devlink.h>
|
|
|
d8f823 |
|
|
|
d8f823 |
+enum mlx5_devlink_param_id {
|
|
|
d8f823 |
+ MLX5_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX,
|
|
|
d8f823 |
+ MLX5_DEVLINK_PARAM_ID_FLOW_STEERING_MODE,
|
|
|
d8f823 |
+ MLX5_DEVLINK_PARAM_ID_ESW_LARGE_GROUP_NUM,
|
|
|
d8f823 |
+};
|
|
|
d8f823 |
+
|
|
|
d8f823 |
struct devlink *mlx5_devlink_alloc(void);
|
|
|
d8f823 |
void mlx5_devlink_free(struct devlink *devlink);
|
|
|
d8f823 |
int mlx5_devlink_register(struct devlink *devlink, struct device *dev);
|
|
|
d8f823 |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
|
|
|
d8f823 |
index 1541cdf877d2..6ae084b0e612 100644
|
|
|
d8f823 |
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
|
|
|
d8f823 |
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
|
|
|
d8f823 |
@@ -39,6 +39,7 @@
|
|
|
d8f823 |
#include "lib/eq.h"
|
|
|
d8f823 |
#include "eswitch.h"
|
|
|
d8f823 |
#include "fs_core.h"
|
|
|
d8f823 |
+#include "devlink.h"
|
|
|
d8f823 |
#include "ecpf.h"
|
|
|
d8f823 |
|
|
|
d8f823 |
enum {
|
|
|
d8f823 |
@@ -2006,6 +2007,25 @@ void mlx5_eswitch_disable_pf_vf_vports(struct mlx5_eswitch *esw)
|
|
|
d8f823 |
esw_disable_vport(esw, vport);
|
|
|
d8f823 |
}
|
|
|
d8f823 |
|
|
|
d8f823 |
+static void mlx5_eswitch_get_devlink_param(struct mlx5_eswitch *esw)
|
|
|
d8f823 |
+{
|
|
|
d8f823 |
+ struct devlink *devlink = priv_to_devlink(esw->dev);
|
|
|
d8f823 |
+ union devlink_param_value val;
|
|
|
d8f823 |
+ int err;
|
|
|
d8f823 |
+
|
|
|
d8f823 |
+ err = devlink_param_driverinit_value_get(devlink,
|
|
|
d8f823 |
+ MLX5_DEVLINK_PARAM_ID_ESW_LARGE_GROUP_NUM,
|
|
|
d8f823 |
+ &val;;
|
|
|
d8f823 |
+ if (!err) {
|
|
|
d8f823 |
+ esw->params.large_group_num = val.vu32;
|
|
|
d8f823 |
+ } else {
|
|
|
d8f823 |
+ esw_warn(esw->dev,
|
|
|
d8f823 |
+ "Devlink can't get param fdb_large_groups, uses default (%d).\n",
|
|
|
d8f823 |
+ ESW_OFFLOADS_DEFAULT_NUM_GROUPS);
|
|
|
d8f823 |
+ esw->params.large_group_num = ESW_OFFLOADS_DEFAULT_NUM_GROUPS;
|
|
|
d8f823 |
+ }
|
|
|
d8f823 |
+}
|
|
|
d8f823 |
+
|
|
|
d8f823 |
int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int mode)
|
|
|
d8f823 |
{
|
|
|
d8f823 |
int err;
|
|
|
d8f823 |
@@ -2022,6 +2042,8 @@ int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int mode)
|
|
|
d8f823 |
if (!MLX5_CAP_ESW_EGRESS_ACL(esw->dev, ft_support))
|
|
|
d8f823 |
esw_warn(esw->dev, "engress ACL is not supported by FW\n");
|
|
|
d8f823 |
|
|
|
d8f823 |
+ mlx5_eswitch_get_devlink_param(esw);
|
|
|
d8f823 |
+
|
|
|
d8f823 |
esw_create_tsar(esw);
|
|
|
d8f823 |
|
|
|
d8f823 |
esw->mode = mode;
|
|
|
d8f823 |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
|
|
|
d8f823 |
index 255838c9ae5d..bd229bda630e 100644
|
|
|
d8f823 |
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
|
|
|
d8f823 |
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
|
|
|
d8f823 |
@@ -49,13 +49,14 @@
|
|
|
d8f823 |
|
|
|
d8f823 |
/* The index of the last real chain (FT) + 1 as chain zero is valid as well */
|
|
|
d8f823 |
#define FDB_NUM_CHAINS (FDB_FT_CHAIN + 1)
|
|
|
d8f823 |
-#define ESW_OFFLOADS_NUM_GROUPS 4
|
|
|
d8f823 |
|
|
|
d8f823 |
#define FDB_TC_MAX_PRIO 16
|
|
|
d8f823 |
#define FDB_TC_LEVELS_PER_PRIO 2
|
|
|
d8f823 |
|
|
|
d8f823 |
#ifdef CONFIG_MLX5_ESWITCH
|
|
|
d8f823 |
|
|
|
d8f823 |
+#define ESW_OFFLOADS_DEFAULT_NUM_GROUPS 15
|
|
|
d8f823 |
+
|
|
|
d8f823 |
#define MLX5_MAX_UC_PER_VPORT(dev) \
|
|
|
d8f823 |
(1 << MLX5_CAP_GEN(dev, log_max_current_uc_list))
|
|
|
d8f823 |
|
|
|
d8f823 |
@@ -295,6 +296,11 @@ struct mlx5_eswitch {
|
|
|
d8f823 |
u16 manager_vport;
|
|
|
d8f823 |
u16 first_host_vport;
|
|
|
d8f823 |
struct mlx5_esw_functions esw_funcs;
|
|
|
d8f823 |
+#ifndef __GENKSYMS__
|
|
|
d8f823 |
+ struct {
|
|
|
d8f823 |
+ u32 large_group_num;
|
|
|
d8f823 |
+ } params;
|
|
|
d8f823 |
+#endif
|
|
|
d8f823 |
};
|
|
|
d8f823 |
|
|
|
d8f823 |
void esw_offloads_disable(struct mlx5_eswitch *esw);
|
|
|
d8f823 |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
|
|
|
d8f823 |
index 25665ff7e9c5..4cb90c865ff7 100644
|
|
|
d8f823 |
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
|
|
|
d8f823 |
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
|
|
|
d8f823 |
@@ -71,13 +71,15 @@ struct mlx5_vport_table {
|
|
|
d8f823 |
struct mlx5_vport_key key;
|
|
|
d8f823 |
};
|
|
|
d8f823 |
|
|
|
d8f823 |
+#define MLX5_ESW_VPORT_TBL_NUM_GROUPS 4
|
|
|
d8f823 |
+
|
|
|
d8f823 |
static struct mlx5_flow_table *
|
|
|
d8f823 |
esw_vport_tbl_create(struct mlx5_eswitch *esw, struct mlx5_flow_namespace *ns)
|
|
|
d8f823 |
{
|
|
|
d8f823 |
struct mlx5_flow_table_attr ft_attr = {};
|
|
|
d8f823 |
struct mlx5_flow_table *fdb;
|
|
|
d8f823 |
|
|
|
d8f823 |
- ft_attr.autogroup.max_num_groups = ESW_OFFLOADS_NUM_GROUPS;
|
|
|
d8f823 |
+ ft_attr.autogroup.max_num_groups = MLX5_ESW_VPORT_TBL_NUM_GROUPS;
|
|
|
d8f823 |
ft_attr.max_fte = MLX5_ESW_VPORT_TABLE_SIZE;
|
|
|
d8f823 |
ft_attr.prio = FDB_PER_VPORT;
|
|
|
d8f823 |
fdb = mlx5_create_auto_grouped_flow_table_attr_(ns, &ft_attr);
|
|
|
d8f823 |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
|
|
|
d8f823 |
index 726d28ff0a65..6ffc4f041b6c 100644
|
|
|
d8f823 |
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
|
|
|
d8f823 |
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
|
|
|
d8f823 |
@@ -237,7 +237,7 @@ mlx5_esw_chains_create_fdb_table(struct mlx5_eswitch *esw,
|
|
|
d8f823 |
}
|
|
|
d8f823 |
|
|
|
d8f823 |
ft_attr.autogroup.num_reserved_entries = 2;
|
|
|
d8f823 |
- ft_attr.autogroup.max_num_groups = ESW_OFFLOADS_NUM_GROUPS;
|
|
|
d8f823 |
+ ft_attr.autogroup.max_num_groups = esw->params.large_group_num;
|
|
|
d8f823 |
fdb = mlx5_create_auto_grouped_flow_table_attr_(ns, &ft_attr);
|
|
|
d8f823 |
if (IS_ERR(fdb)) {
|
|
|
d8f823 |
esw_warn(esw->dev,
|
|
|
d8f823 |
@@ -640,7 +640,7 @@ mlx5_esw_chains_init(struct mlx5_eswitch *esw)
|
|
|
d8f823 |
|
|
|
d8f823 |
esw_debug(dev,
|
|
|
d8f823 |
"Init esw offloads chains, max counters(%d), groups(%d), max flow table size(%d)\n",
|
|
|
d8f823 |
- max_flow_counter, ESW_OFFLOADS_NUM_GROUPS, fdb_max);
|
|
|
d8f823 |
+ max_flow_counter, esw->params.large_group_num, fdb_max);
|
|
|
d8f823 |
|
|
|
d8f823 |
mlx5_esw_chains_init_sz_pool(esw);
|
|
|
d8f823 |
|
|
|
d8f823 |
--
|
|
|
d8f823 |
2.13.6
|
|
|
d8f823 |
|