mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
net/mlx5: Treat host PF vport as other (non eswitch manager) vport
When eswitch manager is running on ECPF, host PF should be treated as non eswitch manager port, similar to other VF vports. Fail to do so, results in firmware treating PF's vport as ECPF vport for eswitch ACL tables. Non zero check to figure out if a given vport is other vport or not is not sufficient becase PF vport number = 0 on ECPF. Hence, create esw acl tables with an attribute of other vport. Signed-off-by: Parav Pandit <parav@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
5bef709d76
commit
617b860c18
@ -8,6 +8,7 @@
|
||||
struct mlx5_flow_table *
|
||||
esw_acl_table_create(struct mlx5_eswitch *esw, u16 vport_num, int ns, int size)
|
||||
{
|
||||
struct mlx5_flow_table_attr ft_attr = {};
|
||||
struct mlx5_core_dev *dev = esw->dev;
|
||||
struct mlx5_flow_namespace *root_ns;
|
||||
struct mlx5_flow_table *acl;
|
||||
@ -33,7 +34,9 @@ esw_acl_table_create(struct mlx5_eswitch *esw, u16 vport_num, int ns, int size)
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
}
|
||||
|
||||
acl = mlx5_create_vport_flow_table(root_ns, 0, size, 0, vport_num);
|
||||
ft_attr.max_fte = size;
|
||||
ft_attr.flags = MLX5_FLOW_TABLE_OTHER_VPORT;
|
||||
acl = mlx5_create_vport_flow_table(root_ns, &ft_attr, vport_num);
|
||||
if (IS_ERR(acl)) {
|
||||
err = PTR_ERR(acl);
|
||||
esw_warn(dev, "vport[%d] create %s ACL table, err(%d)\n", vport_num,
|
||||
|
@ -172,10 +172,9 @@ static int mlx5_cmd_update_root_ft(struct mlx5_flow_root_namespace *ns,
|
||||
MLX5_SET(set_flow_table_root_in, in, table_id, ft->id);
|
||||
|
||||
MLX5_SET(set_flow_table_root_in, in, underlay_qpn, underlay_qpn);
|
||||
if (ft->vport) {
|
||||
MLX5_SET(set_flow_table_root_in, in, vport_number, ft->vport);
|
||||
MLX5_SET(set_flow_table_root_in, in, other_vport, 1);
|
||||
}
|
||||
MLX5_SET(set_flow_table_root_in, in, vport_number, ft->vport);
|
||||
MLX5_SET(set_flow_table_root_in, in, other_vport,
|
||||
!!(ft->flags & MLX5_FLOW_TABLE_OTHER_VPORT));
|
||||
|
||||
return mlx5_cmd_exec_in(dev, set_flow_table_root, in);
|
||||
}
|
||||
@ -199,10 +198,9 @@ static int mlx5_cmd_create_flow_table(struct mlx5_flow_root_namespace *ns,
|
||||
MLX5_SET(create_flow_table_in, in, table_type, ft->type);
|
||||
MLX5_SET(create_flow_table_in, in, flow_table_context.level, ft->level);
|
||||
MLX5_SET(create_flow_table_in, in, flow_table_context.log_size, log_size);
|
||||
if (ft->vport) {
|
||||
MLX5_SET(create_flow_table_in, in, vport_number, ft->vport);
|
||||
MLX5_SET(create_flow_table_in, in, other_vport, 1);
|
||||
}
|
||||
MLX5_SET(create_flow_table_in, in, vport_number, ft->vport);
|
||||
MLX5_SET(create_flow_table_in, in, other_vport,
|
||||
!!(ft->flags & MLX5_FLOW_TABLE_OTHER_VPORT));
|
||||
|
||||
MLX5_SET(create_flow_table_in, in, flow_table_context.decap_en,
|
||||
en_decap);
|
||||
@ -252,10 +250,9 @@ static int mlx5_cmd_destroy_flow_table(struct mlx5_flow_root_namespace *ns,
|
||||
MLX5_CMD_OP_DESTROY_FLOW_TABLE);
|
||||
MLX5_SET(destroy_flow_table_in, in, table_type, ft->type);
|
||||
MLX5_SET(destroy_flow_table_in, in, table_id, ft->id);
|
||||
if (ft->vport) {
|
||||
MLX5_SET(destroy_flow_table_in, in, vport_number, ft->vport);
|
||||
MLX5_SET(destroy_flow_table_in, in, other_vport, 1);
|
||||
}
|
||||
MLX5_SET(destroy_flow_table_in, in, vport_number, ft->vport);
|
||||
MLX5_SET(destroy_flow_table_in, in, other_vport,
|
||||
!!(ft->flags & MLX5_FLOW_TABLE_OTHER_VPORT));
|
||||
|
||||
return mlx5_cmd_exec_in(dev, destroy_flow_table, in);
|
||||
}
|
||||
@ -283,11 +280,9 @@ static int mlx5_cmd_modify_flow_table(struct mlx5_flow_root_namespace *ns,
|
||||
flow_table_context.lag_master_next_table_id, 0);
|
||||
}
|
||||
} else {
|
||||
if (ft->vport) {
|
||||
MLX5_SET(modify_flow_table_in, in, vport_number,
|
||||
ft->vport);
|
||||
MLX5_SET(modify_flow_table_in, in, other_vport, 1);
|
||||
}
|
||||
MLX5_SET(modify_flow_table_in, in, vport_number, ft->vport);
|
||||
MLX5_SET(modify_flow_table_in, in, other_vport,
|
||||
!!(ft->flags & MLX5_FLOW_TABLE_OTHER_VPORT));
|
||||
MLX5_SET(modify_flow_table_in, in, modify_field_select,
|
||||
MLX5_MODIFY_FLOW_TABLE_MISS_TABLE_ID);
|
||||
if (next_ft) {
|
||||
@ -325,6 +320,9 @@ static int mlx5_cmd_create_flow_group(struct mlx5_flow_root_namespace *ns,
|
||||
MLX5_SET(create_flow_group_in, in, other_vport, 1);
|
||||
}
|
||||
|
||||
MLX5_SET(create_flow_group_in, in, vport_number, ft->vport);
|
||||
MLX5_SET(create_flow_group_in, in, other_vport,
|
||||
!!(ft->flags & MLX5_FLOW_TABLE_OTHER_VPORT));
|
||||
err = mlx5_cmd_exec_inout(dev, create_flow_group, in, out);
|
||||
if (!err)
|
||||
fg->id = MLX5_GET(create_flow_group_out, out,
|
||||
@ -344,11 +342,9 @@ static int mlx5_cmd_destroy_flow_group(struct mlx5_flow_root_namespace *ns,
|
||||
MLX5_SET(destroy_flow_group_in, in, table_type, ft->type);
|
||||
MLX5_SET(destroy_flow_group_in, in, table_id, ft->id);
|
||||
MLX5_SET(destroy_flow_group_in, in, group_id, fg->id);
|
||||
if (ft->vport) {
|
||||
MLX5_SET(destroy_flow_group_in, in, vport_number, ft->vport);
|
||||
MLX5_SET(destroy_flow_group_in, in, other_vport, 1);
|
||||
}
|
||||
|
||||
MLX5_SET(destroy_flow_group_in, in, vport_number, ft->vport);
|
||||
MLX5_SET(destroy_flow_group_in, in, other_vport,
|
||||
!!(ft->flags & MLX5_FLOW_TABLE_OTHER_VPORT));
|
||||
return mlx5_cmd_exec_in(dev, destroy_flow_group, in);
|
||||
}
|
||||
|
||||
@ -427,10 +423,9 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
|
||||
MLX5_SET(set_fte_in, in, ignore_flow_level,
|
||||
!!(fte->action.flags & FLOW_ACT_IGNORE_FLOW_LEVEL));
|
||||
|
||||
if (ft->vport) {
|
||||
MLX5_SET(set_fte_in, in, vport_number, ft->vport);
|
||||
MLX5_SET(set_fte_in, in, other_vport, 1);
|
||||
}
|
||||
MLX5_SET(set_fte_in, in, vport_number, ft->vport);
|
||||
MLX5_SET(set_fte_in, in, other_vport,
|
||||
!!(ft->flags & MLX5_FLOW_TABLE_OTHER_VPORT));
|
||||
|
||||
in_flow_context = MLX5_ADDR_OF(set_fte_in, in, flow_context);
|
||||
MLX5_SET(flow_context, in_flow_context, group_id, group_id);
|
||||
@ -604,10 +599,9 @@ static int mlx5_cmd_delete_fte(struct mlx5_flow_root_namespace *ns,
|
||||
MLX5_SET(delete_fte_in, in, table_type, ft->type);
|
||||
MLX5_SET(delete_fte_in, in, table_id, ft->id);
|
||||
MLX5_SET(delete_fte_in, in, flow_index, fte->index);
|
||||
if (ft->vport) {
|
||||
MLX5_SET(delete_fte_in, in, vport_number, ft->vport);
|
||||
MLX5_SET(delete_fte_in, in, other_vport, 1);
|
||||
}
|
||||
MLX5_SET(delete_fte_in, in, vport_number, ft->vport);
|
||||
MLX5_SET(delete_fte_in, in, other_vport,
|
||||
!!(ft->flags & MLX5_FLOW_TABLE_OTHER_VPORT));
|
||||
|
||||
return mlx5_cmd_exec_in(dev, delete_fte, in);
|
||||
}
|
||||
|
@ -1147,17 +1147,11 @@ struct mlx5_flow_table *mlx5_create_flow_table(struct mlx5_flow_namespace *ns,
|
||||
}
|
||||
EXPORT_SYMBOL(mlx5_create_flow_table);
|
||||
|
||||
struct mlx5_flow_table *mlx5_create_vport_flow_table(struct mlx5_flow_namespace *ns,
|
||||
int prio, int max_fte,
|
||||
u32 level, u16 vport)
|
||||
struct mlx5_flow_table *
|
||||
mlx5_create_vport_flow_table(struct mlx5_flow_namespace *ns,
|
||||
struct mlx5_flow_table_attr *ft_attr, u16 vport)
|
||||
{
|
||||
struct mlx5_flow_table_attr ft_attr = {};
|
||||
|
||||
ft_attr.max_fte = max_fte;
|
||||
ft_attr.level = level;
|
||||
ft_attr.prio = prio;
|
||||
|
||||
return __mlx5_create_flow_table(ns, &ft_attr, FS_FT_OP_MOD_NORMAL, vport);
|
||||
return __mlx5_create_flow_table(ns, ft_attr, FS_FT_OP_MOD_NORMAL, vport);
|
||||
}
|
||||
|
||||
struct mlx5_flow_table*
|
||||
|
@ -50,6 +50,7 @@ enum {
|
||||
MLX5_FLOW_TABLE_TUNNEL_EN_DECAP = BIT(1),
|
||||
MLX5_FLOW_TABLE_TERMINATION = BIT(2),
|
||||
MLX5_FLOW_TABLE_UNMANAGED = BIT(3),
|
||||
MLX5_FLOW_TABLE_OTHER_VPORT = BIT(4),
|
||||
};
|
||||
|
||||
#define LEFTOVERS_RULE_NUM 2
|
||||
@ -174,9 +175,7 @@ mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns,
|
||||
|
||||
struct mlx5_flow_table *
|
||||
mlx5_create_vport_flow_table(struct mlx5_flow_namespace *ns,
|
||||
int prio,
|
||||
int num_flow_table_entries,
|
||||
u32 level, u16 vport);
|
||||
struct mlx5_flow_table_attr *ft_attr, u16 vport);
|
||||
struct mlx5_flow_table *mlx5_create_lag_demux_flow_table(
|
||||
struct mlx5_flow_namespace *ns,
|
||||
int prio, u32 level);
|
||||
|
Loading…
Reference in New Issue
Block a user