Skip to content

Commit 66cb64e

Browse files
dickmanmaorSaeed Mahameed
authored andcommitted
net/mlx5e: TC NIC mode, fix tc chains miss table
The cited commit changed promisc table to be created on demand with the highest priority in the NIC table replacing the vlan table, this caused tc NIC tables miss flow to skip the prmoisc table because it use vlan table as miss table. OVS offload in NIC mode use promisc by default so any unicast packet which will be handled by tc NIC tables miss flow will skip the promisc rule and will be dropped. Fix this by adding new empty table in new tc level with low priority and point the nic tc chain miss to it, the new table is managed so it will point to vlan table if promisc is disabled and to promisc table if enabled. Fixes: 1c46d74 ("net/mlx5e: Optimize promiscuous mode") Signed-off-by: Maor Dickman <[email protected]> Reviewed-by: Paul Blakey <[email protected]> Reviewed-by: Ariel Levkovich <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 80b2bd7 commit 66cb64e

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/fs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ struct mlx5e_post_act;
1212
enum {
1313
MLX5E_TC_FT_LEVEL = 0,
1414
MLX5E_TC_TTC_FT_LEVEL,
15+
MLX5E_TC_MISS_LEVEL,
1516
};
1617

1718
struct mlx5e_tc_table {
@@ -20,6 +21,7 @@ struct mlx5e_tc_table {
2021
*/
2122
struct mutex t_lock;
2223
struct mlx5_flow_table *t;
24+
struct mlx5_flow_table *miss_t;
2325
struct mlx5_fs_chains *chains;
2426
struct mlx5e_post_act *post_act;
2527

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4714,6 +4714,33 @@ static int mlx5e_tc_nic_get_ft_size(struct mlx5_core_dev *dev)
47144714
return tc_tbl_size;
47154715
}
47164716

4717+
static int mlx5e_tc_nic_create_miss_table(struct mlx5e_priv *priv)
4718+
{
4719+
struct mlx5_flow_table **ft = &priv->fs.tc.miss_t;
4720+
struct mlx5_flow_table_attr ft_attr = {};
4721+
struct mlx5_flow_namespace *ns;
4722+
int err = 0;
4723+
4724+
ft_attr.max_fte = 1;
4725+
ft_attr.autogroup.max_num_groups = 1;
4726+
ft_attr.level = MLX5E_TC_MISS_LEVEL;
4727+
ft_attr.prio = 0;
4728+
ns = mlx5_get_flow_namespace(priv->mdev, MLX5_FLOW_NAMESPACE_KERNEL);
4729+
4730+
*ft = mlx5_create_auto_grouped_flow_table(ns, &ft_attr);
4731+
if (IS_ERR(*ft)) {
4732+
err = PTR_ERR(*ft);
4733+
netdev_err(priv->netdev, "failed to create tc nic miss table err=%d\n", err);
4734+
}
4735+
4736+
return err;
4737+
}
4738+
4739+
static void mlx5e_tc_nic_destroy_miss_table(struct mlx5e_priv *priv)
4740+
{
4741+
mlx5_destroy_flow_table(priv->fs.tc.miss_t);
4742+
}
4743+
47174744
int mlx5e_tc_nic_init(struct mlx5e_priv *priv)
47184745
{
47194746
struct mlx5e_tc_table *tc = &priv->fs.tc;
@@ -4746,19 +4773,23 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv)
47464773
}
47474774
tc->mapping = chains_mapping;
47484775

4776+
err = mlx5e_tc_nic_create_miss_table(priv);
4777+
if (err)
4778+
goto err_chains;
4779+
47494780
if (MLX5_CAP_FLOWTABLE_NIC_RX(priv->mdev, ignore_flow_level))
47504781
attr.flags = MLX5_CHAINS_AND_PRIOS_SUPPORTED |
47514782
MLX5_CHAINS_IGNORE_FLOW_LEVEL_SUPPORTED;
47524783
attr.ns = MLX5_FLOW_NAMESPACE_KERNEL;
47534784
attr.max_ft_sz = mlx5e_tc_nic_get_ft_size(dev);
47544785
attr.max_grp_num = MLX5E_TC_TABLE_NUM_GROUPS;
4755-
attr.default_ft = mlx5e_vlan_get_flowtable(priv->fs.vlan);
4786+
attr.default_ft = priv->fs.tc.miss_t;
47564787
attr.mapping = chains_mapping;
47574788

47584789
tc->chains = mlx5_chains_create(dev, &attr);
47594790
if (IS_ERR(tc->chains)) {
47604791
err = PTR_ERR(tc->chains);
4761-
goto err_chains;
4792+
goto err_miss;
47624793
}
47634794

47644795
tc->post_act = mlx5e_tc_post_act_init(priv, tc->chains, MLX5_FLOW_NAMESPACE_KERNEL);
@@ -4781,6 +4812,8 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv)
47814812
mlx5_tc_ct_clean(tc->ct);
47824813
mlx5e_tc_post_act_destroy(tc->post_act);
47834814
mlx5_chains_destroy(tc->chains);
4815+
err_miss:
4816+
mlx5e_tc_nic_destroy_miss_table(priv);
47844817
err_chains:
47854818
mapping_destroy(chains_mapping);
47864819
err_mapping:
@@ -4821,6 +4854,7 @@ void mlx5e_tc_nic_cleanup(struct mlx5e_priv *priv)
48214854
mlx5e_tc_post_act_destroy(tc->post_act);
48224855
mapping_destroy(tc->mapping);
48234856
mlx5_chains_destroy(tc->chains);
4857+
mlx5e_tc_nic_destroy_miss_table(priv);
48244858
}
48254859

48264860
int mlx5e_tc_ht_init(struct rhashtable *tc_ht)

drivers/net/ethernet/mellanox/mlx5/core/fs_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
#define KERNEL_MIN_LEVEL (KERNEL_NIC_PRIO_NUM_LEVELS + 1)
115115

116116
#define KERNEL_NIC_TC_NUM_PRIOS 1
117-
#define KERNEL_NIC_TC_NUM_LEVELS 2
117+
#define KERNEL_NIC_TC_NUM_LEVELS 3
118118

119119
#define ANCHOR_NUM_LEVELS 1
120120
#define ANCHOR_NUM_PRIOS 1

0 commit comments

Comments
 (0)