Commit 8a8a1023 authored by Yevgeny Kliteynik's avatar Yevgeny Kliteynik Committed by Saeed Mahameed

net/mlx5: DR, Rename matcher functions to be more HW agnostic

Remove flex parser from the matcher function names since
the matcher should not be aware of such HW specific details.
Signed-off-by: default avatarAlex Vesker <valex@nvidia.com>
Signed-off-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent de1facaf
...@@ -93,12 +93,12 @@ int mlx5dr_cmd_query_device(struct mlx5_core_dev *mdev, ...@@ -93,12 +93,12 @@ int mlx5dr_cmd_query_device(struct mlx5_core_dev *mdev,
caps->gvmi = MLX5_CAP_GEN(mdev, vhca_id); caps->gvmi = MLX5_CAP_GEN(mdev, vhca_id);
caps->flex_protocols = MLX5_CAP_GEN(mdev, flex_parser_protocols); caps->flex_protocols = MLX5_CAP_GEN(mdev, flex_parser_protocols);
if (mlx5dr_matcher_supp_flex_parser_icmp_v4(caps)) { if (caps->flex_protocols & MLX5_FLEX_PARSER_ICMP_V4_ENABLED) {
caps->flex_parser_id_icmp_dw0 = MLX5_CAP_GEN(mdev, flex_parser_id_icmp_dw0); caps->flex_parser_id_icmp_dw0 = MLX5_CAP_GEN(mdev, flex_parser_id_icmp_dw0);
caps->flex_parser_id_icmp_dw1 = MLX5_CAP_GEN(mdev, flex_parser_id_icmp_dw1); caps->flex_parser_id_icmp_dw1 = MLX5_CAP_GEN(mdev, flex_parser_id_icmp_dw1);
} }
if (mlx5dr_matcher_supp_flex_parser_icmp_v6(caps)) { if (caps->flex_protocols & MLX5_FLEX_PARSER_ICMP_V6_ENABLED) {
caps->flex_parser_id_icmpv6_dw0 = caps->flex_parser_id_icmpv6_dw0 =
MLX5_CAP_GEN(mdev, flex_parser_id_icmpv6_dw0); MLX5_CAP_GEN(mdev, flex_parser_id_icmpv6_dw0);
caps->flex_parser_id_icmpv6_dw1 = caps->flex_parser_id_icmpv6_dw1 =
......
...@@ -103,7 +103,7 @@ static bool dr_mask_is_tnl_gre_set(struct mlx5dr_match_misc *misc) ...@@ -103,7 +103,7 @@ static bool dr_mask_is_tnl_gre_set(struct mlx5dr_match_misc *misc)
DR_MASK_IS_OUTER_MPLS_OVER_GRE_UDP_SET((_misc2), udp)) DR_MASK_IS_OUTER_MPLS_OVER_GRE_UDP_SET((_misc2), udp))
static bool static bool
dr_mask_is_misc3_vxlan_gpe_set(struct mlx5dr_match_misc3 *misc3) dr_mask_is_vxlan_gpe_set(struct mlx5dr_match_misc3 *misc3)
{ {
return (misc3->outer_vxlan_gpe_vni || return (misc3->outer_vxlan_gpe_vni ||
misc3->outer_vxlan_gpe_next_protocol || misc3->outer_vxlan_gpe_next_protocol ||
...@@ -111,21 +111,20 @@ dr_mask_is_misc3_vxlan_gpe_set(struct mlx5dr_match_misc3 *misc3) ...@@ -111,21 +111,20 @@ dr_mask_is_misc3_vxlan_gpe_set(struct mlx5dr_match_misc3 *misc3)
} }
static bool static bool
dr_matcher_supp_flex_parser_vxlan_gpe(struct mlx5dr_cmd_caps *caps) dr_matcher_supp_vxlan_gpe(struct mlx5dr_cmd_caps *caps)
{ {
return caps->flex_protocols & return caps->flex_protocols & MLX5_FLEX_PARSER_VXLAN_GPE_ENABLED;
MLX5_FLEX_PARSER_VXLAN_GPE_ENABLED;
} }
static bool static bool
dr_mask_is_flex_parser_tnl_vxlan_gpe_set(struct mlx5dr_match_param *mask, dr_mask_is_tnl_vxlan_gpe(struct mlx5dr_match_param *mask,
struct mlx5dr_domain *dmn) struct mlx5dr_domain *dmn)
{ {
return dr_mask_is_misc3_vxlan_gpe_set(&mask->misc3) && return dr_mask_is_vxlan_gpe_set(&mask->misc3) &&
dr_matcher_supp_flex_parser_vxlan_gpe(&dmn->info.caps); dr_matcher_supp_vxlan_gpe(&dmn->info.caps);
} }
static bool dr_mask_is_misc_geneve_set(struct mlx5dr_match_misc *misc) static bool dr_mask_is_tnl_geneve_set(struct mlx5dr_match_misc *misc)
{ {
return misc->geneve_vni || return misc->geneve_vni ||
misc->geneve_oam || misc->geneve_oam ||
...@@ -134,18 +133,27 @@ static bool dr_mask_is_misc_geneve_set(struct mlx5dr_match_misc *misc) ...@@ -134,18 +133,27 @@ static bool dr_mask_is_misc_geneve_set(struct mlx5dr_match_misc *misc)
} }
static bool static bool
dr_matcher_supp_flex_parser_geneve(struct mlx5dr_cmd_caps *caps) dr_matcher_supp_tnl_geneve(struct mlx5dr_cmd_caps *caps)
{ {
return caps->flex_protocols & return caps->flex_protocols & MLX5_FLEX_PARSER_GENEVE_ENABLED;
MLX5_FLEX_PARSER_GENEVE_ENABLED;
} }
static bool static bool
dr_mask_is_flex_parser_tnl_geneve_set(struct mlx5dr_match_param *mask, dr_mask_is_tnl_geneve(struct mlx5dr_match_param *mask,
struct mlx5dr_domain *dmn) struct mlx5dr_domain *dmn)
{ {
return dr_mask_is_misc_geneve_set(&mask->misc) && return dr_mask_is_tnl_geneve_set(&mask->misc) &&
dr_matcher_supp_flex_parser_geneve(&dmn->info.caps); dr_matcher_supp_tnl_geneve(&dmn->info.caps);
}
static int dr_matcher_supp_icmp_v4(struct mlx5dr_cmd_caps *caps)
{
return caps->flex_protocols & MLX5_FLEX_PARSER_ICMP_V4_ENABLED;
}
static int dr_matcher_supp_icmp_v6(struct mlx5dr_cmd_caps *caps)
{
return caps->flex_protocols & MLX5_FLEX_PARSER_ICMP_V6_ENABLED;
} }
static bool dr_mask_is_icmpv6_set(struct mlx5dr_match_misc3 *misc3) static bool dr_mask_is_icmpv6_set(struct mlx5dr_match_misc3 *misc3)
...@@ -154,13 +162,13 @@ static bool dr_mask_is_icmpv6_set(struct mlx5dr_match_misc3 *misc3) ...@@ -154,13 +162,13 @@ static bool dr_mask_is_icmpv6_set(struct mlx5dr_match_misc3 *misc3)
misc3->icmpv6_header_data); misc3->icmpv6_header_data);
} }
static bool dr_mask_is_flex_parser_icmp_set(struct mlx5dr_match_param *mask, static bool dr_mask_is_icmp(struct mlx5dr_match_param *mask,
struct mlx5dr_domain *dmn) struct mlx5dr_domain *dmn)
{ {
if (DR_MASK_IS_ICMPV4_SET(&mask->misc3)) if (DR_MASK_IS_ICMPV4_SET(&mask->misc3))
return mlx5dr_matcher_supp_flex_parser_icmp_v4(&dmn->info.caps); return dr_matcher_supp_icmp_v4(&dmn->info.caps);
else if (dr_mask_is_icmpv6_set(&mask->misc3)) else if (dr_mask_is_icmpv6_set(&mask->misc3))
return mlx5dr_matcher_supp_flex_parser_icmp_v6(&dmn->info.caps); return dr_matcher_supp_icmp_v6(&dmn->info.caps);
return false; return false;
} }
...@@ -300,10 +308,10 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher, ...@@ -300,10 +308,10 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher,
inner, rx); inner, rx);
} }
if (dr_mask_is_flex_parser_tnl_vxlan_gpe_set(&mask, dmn)) if (dr_mask_is_tnl_vxlan_gpe(&mask, dmn))
mlx5dr_ste_build_tnl_vxlan_gpe(&sb[idx++], &mask, mlx5dr_ste_build_tnl_vxlan_gpe(&sb[idx++], &mask,
inner, rx); inner, rx);
else if (dr_mask_is_flex_parser_tnl_geneve_set(&mask, dmn)) else if (dr_mask_is_tnl_geneve(&mask, dmn))
mlx5dr_ste_build_tnl_geneve(&sb[idx++], &mask, mlx5dr_ste_build_tnl_geneve(&sb[idx++], &mask,
inner, rx); inner, rx);
...@@ -316,7 +324,7 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher, ...@@ -316,7 +324,7 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher,
if (DR_MASK_IS_TNL_MPLS_SET(mask.misc2)) if (DR_MASK_IS_TNL_MPLS_SET(mask.misc2))
mlx5dr_ste_build_tnl_mpls(&sb[idx++], &mask, inner, rx); mlx5dr_ste_build_tnl_mpls(&sb[idx++], &mask, inner, rx);
if (dr_mask_is_flex_parser_icmp_set(&mask, dmn)) { if (dr_mask_is_icmp(&mask, dmn)) {
ret = mlx5dr_ste_build_icmp(&sb[idx++], ret = mlx5dr_ste_build_icmp(&sb[idx++],
&mask, &dmn->info.caps, &mask, &dmn->info.caps,
inner, rx); inner, rx);
......
...@@ -839,18 +839,6 @@ static inline void mlx5dr_domain_unlock(struct mlx5dr_domain *dmn) ...@@ -839,18 +839,6 @@ static inline void mlx5dr_domain_unlock(struct mlx5dr_domain *dmn)
mlx5dr_domain_nic_unlock(&dmn->info.rx); mlx5dr_domain_nic_unlock(&dmn->info.rx);
} }
static inline int
mlx5dr_matcher_supp_flex_parser_icmp_v4(struct mlx5dr_cmd_caps *caps)
{
return caps->flex_protocols & MLX5_FLEX_PARSER_ICMP_V4_ENABLED;
}
static inline int
mlx5dr_matcher_supp_flex_parser_icmp_v6(struct mlx5dr_cmd_caps *caps)
{
return caps->flex_protocols & MLX5_FLEX_PARSER_ICMP_V6_ENABLED;
}
int mlx5dr_matcher_select_builders(struct mlx5dr_matcher *matcher, int mlx5dr_matcher_select_builders(struct mlx5dr_matcher *matcher,
struct mlx5dr_matcher_rx_tx *nic_matcher, struct mlx5dr_matcher_rx_tx *nic_matcher,
enum mlx5dr_ipv outer_ipv, enum mlx5dr_ipv outer_ipv,
......
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