Commit 6783f0a2 authored by Vu Pham's avatar Vu Pham Committed by Saeed Mahameed

net/mlx5e: Dynamic alloc vlan table for netdev when needed

Dynamic allocate vlan table in mlx5e_priv for EN netdev
when needed. Don't allocate it for representor netdev.
Signed-off-by: default avatarVu Pham <vuhuong@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent f6755b80
...@@ -49,18 +49,10 @@ struct mlx5e_promisc_table { ...@@ -49,18 +49,10 @@ struct mlx5e_promisc_table {
struct mlx5_flow_handle *rule; struct mlx5_flow_handle *rule;
}; };
struct mlx5e_vlan_table { /* Forward declaration and APIs to get private fields of vlan_table */
struct mlx5e_flow_table ft; struct mlx5e_vlan_table;
DECLARE_BITMAP(active_cvlans, VLAN_N_VID); unsigned long *mlx5e_vlan_get_active_svlans(struct mlx5e_vlan_table *vlan);
DECLARE_BITMAP(active_svlans, VLAN_N_VID); struct mlx5_flow_table *mlx5e_vlan_get_flowtable(struct mlx5e_vlan_table *vlan);
struct mlx5_flow_handle *active_cvlans_rule[VLAN_N_VID];
struct mlx5_flow_handle *active_svlans_rule[VLAN_N_VID];
struct mlx5_flow_handle *untagged_rule;
struct mlx5_flow_handle *any_cvlan_rule;
struct mlx5_flow_handle *any_svlan_rule;
struct mlx5_flow_handle *trap_rule;
bool cvlan_filter_disabled;
};
struct mlx5e_l2_table { struct mlx5e_l2_table {
struct mlx5e_flow_table ft; struct mlx5e_flow_table ft;
...@@ -231,7 +223,7 @@ struct mlx5e_flow_steering { ...@@ -231,7 +223,7 @@ struct mlx5e_flow_steering {
#endif #endif
struct mlx5e_tc_table tc; struct mlx5e_tc_table tc;
struct mlx5e_promisc_table promisc; struct mlx5e_promisc_table promisc;
struct mlx5e_vlan_table vlan; struct mlx5e_vlan_table *vlan;
struct mlx5e_l2_table l2; struct mlx5e_l2_table l2;
struct mlx5e_ttc_table ttc; struct mlx5e_ttc_table ttc;
struct mlx5e_ttc_table inner_ttc; struct mlx5e_ttc_table inner_ttc;
......
...@@ -3823,7 +3823,8 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev, ...@@ -3823,7 +3823,8 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev,
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
params = &priv->channels.params; params = &priv->channels.params;
if (!bitmap_empty(priv->fs.vlan.active_svlans, VLAN_N_VID)) { if (!priv->fs.vlan ||
!bitmap_empty(mlx5e_vlan_get_active_svlans(priv->fs.vlan), VLAN_N_VID)) {
/* HW strips the outer C-tag header, this is a problem /* HW strips the outer C-tag header, this is a problem
* for S-tag traffic. * for S-tag traffic.
*/ */
......
...@@ -906,7 +906,7 @@ mlx5e_add_offloaded_nic_rule(struct mlx5e_priv *priv, ...@@ -906,7 +906,7 @@ mlx5e_add_offloaded_nic_rule(struct mlx5e_priv *priv,
if (IS_ERR(dest[dest_ix].ft)) if (IS_ERR(dest[dest_ix].ft))
return ERR_CAST(dest[dest_ix].ft); return ERR_CAST(dest[dest_ix].ft);
} else { } else {
dest[dest_ix].ft = priv->fs.vlan.ft.t; dest[dest_ix].ft = mlx5e_vlan_get_flowtable(priv->fs.vlan);
} }
dest_ix++; dest_ix++;
} }
...@@ -4753,7 +4753,7 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv) ...@@ -4753,7 +4753,7 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv)
attr.ns = MLX5_FLOW_NAMESPACE_KERNEL; attr.ns = MLX5_FLOW_NAMESPACE_KERNEL;
attr.max_ft_sz = mlx5e_tc_nic_get_ft_size(dev); attr.max_ft_sz = mlx5e_tc_nic_get_ft_size(dev);
attr.max_grp_num = MLX5E_TC_TABLE_NUM_GROUPS; attr.max_grp_num = MLX5E_TC_TABLE_NUM_GROUPS;
attr.default_ft = priv->fs.vlan.ft.t; attr.default_ft = mlx5e_vlan_get_flowtable(priv->fs.vlan);
tc->chains = mlx5_chains_create(dev, &attr); tc->chains = mlx5_chains_create(dev, &attr);
if (IS_ERR(tc->chains)) { if (IS_ERR(tc->chains)) {
......
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