net/mlx5: E-switch, Add helper to check egress ACL need
Currently only VF vports need egress ACL table. Add a generic helper to check whether a vport need egress ACL table or not. Signed-off-by: Parav Pandit <parav@nvidia.com> Reviewed-by: Roi Dayan <roid@nvidia.com> Reviewed-by: Vu Pham <vuhuong@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
7cd7becddd
commit
2c40db2f1d
@ -148,6 +148,11 @@ static void esw_acl_egress_ofld_groups_destroy(struct mlx5_vport *vport)
|
||||
esw_acl_egress_vlan_grp_destroy(vport);
|
||||
}
|
||||
|
||||
static bool esw_acl_egress_needed(const struct mlx5_eswitch *esw, u16 vport_num)
|
||||
{
|
||||
return mlx5_eswitch_is_vf_vport(esw, vport_num);
|
||||
}
|
||||
|
||||
int esw_acl_egress_ofld_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport)
|
||||
{
|
||||
int table_size = 0;
|
||||
@ -157,6 +162,9 @@ int esw_acl_egress_ofld_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport
|
||||
!MLX5_CAP_GEN(esw->dev, prio_tag_required))
|
||||
return 0;
|
||||
|
||||
if (!esw_acl_egress_needed(esw, vport->vport))
|
||||
return 0;
|
||||
|
||||
esw_acl_egress_ofld_rules_destroy(vport);
|
||||
|
||||
if (mlx5_esw_acl_egress_fwd2vport_supported(esw))
|
||||
|
@ -2108,11 +2108,9 @@ esw_vport_create_offloads_acl_tables(struct mlx5_eswitch *esw,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (mlx5_eswitch_is_vf_vport(esw, vport->vport)) {
|
||||
err = esw_acl_egress_ofld_setup(esw, vport);
|
||||
if (err)
|
||||
goto egress_err;
|
||||
}
|
||||
err = esw_acl_egress_ofld_setup(esw, vport);
|
||||
if (err)
|
||||
goto egress_err;
|
||||
|
||||
return 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user