Commit 8d6bd3c3 authored by Parav Pandit's avatar Parav Pandit Committed by Saeed Mahameed

net/mlx5: E-switch, Use eswitch total_vports

Currently steering table and rx group initialization helper
routines works on the total_vports passed as input parameter.

Both eswitch helpers work on the mlx5_eswitch and thereby have access
to esw->total_vports. Hence use it directly instead of passing it
via function input arguments.
Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
Reviewed-by: default avatarBodong Wang <bodong@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 0da3c12d
...@@ -1310,7 +1310,7 @@ static void esw_destroy_offloads_fdb_tables(struct mlx5_eswitch *esw) ...@@ -1310,7 +1310,7 @@ static void esw_destroy_offloads_fdb_tables(struct mlx5_eswitch *esw)
MLX5_FLOW_STEERING_MODE_DMFS); MLX5_FLOW_STEERING_MODE_DMFS);
} }
static int esw_create_offloads_table(struct mlx5_eswitch *esw, int nvports) static int esw_create_offloads_table(struct mlx5_eswitch *esw)
{ {
struct mlx5_flow_table_attr ft_attr = {}; struct mlx5_flow_table_attr ft_attr = {};
struct mlx5_core_dev *dev = esw->dev; struct mlx5_core_dev *dev = esw->dev;
...@@ -1324,7 +1324,7 @@ static int esw_create_offloads_table(struct mlx5_eswitch *esw, int nvports) ...@@ -1324,7 +1324,7 @@ static int esw_create_offloads_table(struct mlx5_eswitch *esw, int nvports)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
ft_attr.max_fte = nvports + MLX5_ESW_MISS_FLOWS; ft_attr.max_fte = esw->total_vports + MLX5_ESW_MISS_FLOWS;
ft_attr.prio = 1; ft_attr.prio = 1;
ft_offloads = mlx5_create_flow_table(ns, &ft_attr); ft_offloads = mlx5_create_flow_table(ns, &ft_attr);
...@@ -1345,14 +1345,15 @@ static void esw_destroy_offloads_table(struct mlx5_eswitch *esw) ...@@ -1345,14 +1345,15 @@ static void esw_destroy_offloads_table(struct mlx5_eswitch *esw)
mlx5_destroy_flow_table(offloads->ft_offloads); mlx5_destroy_flow_table(offloads->ft_offloads);
} }
static int esw_create_vport_rx_group(struct mlx5_eswitch *esw, int nvports) static int esw_create_vport_rx_group(struct mlx5_eswitch *esw)
{ {
int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in); int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in);
struct mlx5_flow_group *g; struct mlx5_flow_group *g;
u32 *flow_group_in; u32 *flow_group_in;
int nvports;
int err = 0; int err = 0;
nvports = nvports + MLX5_ESW_MISS_FLOWS; nvports = esw->total_vports + MLX5_ESW_MISS_FLOWS;
flow_group_in = kvzalloc(inlen, GFP_KERNEL); flow_group_in = kvzalloc(inlen, GFP_KERNEL);
if (!flow_group_in) if (!flow_group_in)
return -ENOMEM; return -ENOMEM;
...@@ -1985,7 +1986,6 @@ static void esw_destroy_uplink_offloads_acl_tables(struct mlx5_eswitch *esw) ...@@ -1985,7 +1986,6 @@ static void esw_destroy_uplink_offloads_acl_tables(struct mlx5_eswitch *esw)
static int esw_offloads_steering_init(struct mlx5_eswitch *esw) static int esw_offloads_steering_init(struct mlx5_eswitch *esw)
{ {
int total_vports = esw->total_vports;
int err; int err;
memset(&esw->fdb_table.offloads, 0, sizeof(struct offloads_fdb)); memset(&esw->fdb_table.offloads, 0, sizeof(struct offloads_fdb));
...@@ -1996,7 +1996,7 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw) ...@@ -1996,7 +1996,7 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw)
if (err) if (err)
goto create_acl_err; goto create_acl_err;
err = esw_create_offloads_table(esw, total_vports); err = esw_create_offloads_table(esw);
if (err) if (err)
goto create_offloads_err; goto create_offloads_err;
...@@ -2008,7 +2008,7 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw) ...@@ -2008,7 +2008,7 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw)
if (err) if (err)
goto create_fdb_err; goto create_fdb_err;
err = esw_create_vport_rx_group(esw, total_vports); err = esw_create_vport_rx_group(esw);
if (err) if (err)
goto create_fg_err; goto create_fg_err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment