|
|
d8f823 |
From de7ecc45d9cd3da13c9d9b7816abb7d9713b531f Mon Sep 17 00:00:00 2001
|
|
|
d8f823 |
From: Alaa Hleihel <ahleihel@redhat.com>
|
|
|
d8f823 |
Date: Sun, 10 May 2020 15:04:32 -0400
|
|
|
d8f823 |
Subject: [PATCH 108/312] [netdrv] net/mlx5: DR, Refactor VXLAN GPE flex parser
|
|
|
d8f823 |
tunnel code for SW steering
|
|
|
d8f823 |
|
|
|
d8f823 |
Message-id: <20200510150452.10307-68-ahleihel@redhat.com>
|
|
|
d8f823 |
Patchwork-id: 306691
|
|
|
d8f823 |
Patchwork-instance: patchwork
|
|
|
d8f823 |
O-Subject: [RHEL8.3 BZ 1789380 v2 67/87] net/mlx5: DR, Refactor VXLAN GPE flex parser tunnel code for SW steering
|
|
|
d8f823 |
Bugzilla: 1789380
|
|
|
d8f823 |
RH-Acked-by: Kamal Heib <kheib@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Jonathan Toppins <jtoppins@redhat.com>
|
|
|
d8f823 |
|
|
|
d8f823 |
Bugzilla: http://bugzilla.redhat.com/1789380
|
|
|
d8f823 |
Upstream: v5.5-rc1
|
|
|
d8f823 |
|
|
|
d8f823 |
commit 6e9e286e4ad53311b51b28fdc4b952ab7d2520c4
|
|
|
d8f823 |
Author: Yevgeny Kliteynik <kliteyn@mellanox.com>
|
|
|
d8f823 |
Date: Mon Oct 28 16:30:27 2019 +0200
|
|
|
d8f823 |
|
|
|
d8f823 |
net/mlx5: DR, Refactor VXLAN GPE flex parser tunnel code for SW steering
|
|
|
d8f823 |
|
|
|
d8f823 |
Refactor flex parser tunnel code:
|
|
|
d8f823 |
- Add definition for flex parser tunneling header for VXLAN-GPE
|
|
|
d8f823 |
- Use macros for VXLAN-GPE SW steering when building STE
|
|
|
d8f823 |
- Refactor the code to reflect that this is a VXLAN GPE
|
|
|
d8f823 |
only code and not a general flex parser code.
|
|
|
d8f823 |
This also significantly simplifies addition of more
|
|
|
d8f823 |
flex parser protocols, such as Geneve.
|
|
|
d8f823 |
|
|
|
d8f823 |
Signed-off-by: Yevgeny Kliteynik <kliteyn@mellanox.com>
|
|
|
d8f823 |
Reviewed-by: Alex Vesker <valex@mellanox.com>
|
|
|
d8f823 |
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
|
|
|
d8f823 |
|
|
|
d8f823 |
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
|
|
|
d8f823 |
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
|
|
|
d8f823 |
---
|
|
|
d8f823 |
.../mellanox/mlx5/core/steering/dr_matcher.c | 33 ++++++----
|
|
|
d8f823 |
.../ethernet/mellanox/mlx5/core/steering/dr_ste.c | 73 +++++++++-------------
|
|
|
d8f823 |
.../mellanox/mlx5/core/steering/dr_types.h | 6 +-
|
|
|
d8f823 |
.../mellanox/mlx5/core/steering/mlx5_ifc_dr.h | 11 ++++
|
|
|
d8f823 |
4 files changed, 66 insertions(+), 57 deletions(-)
|
|
|
d8f823 |
|
|
|
d8f823 |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c
|
|
|
d8f823 |
index c6548980daf0..f177c468b740 100644
|
|
|
d8f823 |
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c
|
|
|
d8f823 |
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c
|
|
|
d8f823 |
@@ -102,13 +102,29 @@ static bool dr_mask_is_gre_set(struct mlx5dr_match_misc *misc)
|
|
|
d8f823 |
DR_MASK_IS_OUTER_MPLS_OVER_GRE_UDP_SET((_misc2), gre) || \
|
|
|
d8f823 |
DR_MASK_IS_OUTER_MPLS_OVER_GRE_UDP_SET((_misc2), udp))
|
|
|
d8f823 |
|
|
|
d8f823 |
-static bool dr_mask_is_flex_parser_tnl_set(struct mlx5dr_match_misc3 *misc3)
|
|
|
d8f823 |
+static bool
|
|
|
d8f823 |
+dr_mask_is_misc3_vxlan_gpe_set(struct mlx5dr_match_misc3 *misc3)
|
|
|
d8f823 |
{
|
|
|
d8f823 |
return (misc3->outer_vxlan_gpe_vni ||
|
|
|
d8f823 |
misc3->outer_vxlan_gpe_next_protocol ||
|
|
|
d8f823 |
misc3->outer_vxlan_gpe_flags);
|
|
|
d8f823 |
}
|
|
|
d8f823 |
|
|
|
d8f823 |
+static bool
|
|
|
d8f823 |
+dr_matcher_supp_flex_parser_vxlan_gpe(struct mlx5dr_cmd_caps *caps)
|
|
|
d8f823 |
+{
|
|
|
d8f823 |
+ return caps->flex_protocols &
|
|
|
d8f823 |
+ MLX5_FLEX_PARSER_VXLAN_GPE_ENABLED;
|
|
|
d8f823 |
+}
|
|
|
d8f823 |
+
|
|
|
d8f823 |
+static bool
|
|
|
d8f823 |
+dr_mask_is_flex_parser_tnl_vxlan_gpe_set(struct mlx5dr_match_param *mask,
|
|
|
d8f823 |
+ struct mlx5dr_domain *dmn)
|
|
|
d8f823 |
+{
|
|
|
d8f823 |
+ return dr_mask_is_misc3_vxlan_gpe_set(&mask->misc3) &&
|
|
|
d8f823 |
+ dr_matcher_supp_flex_parser_vxlan_gpe(&dmn->info.caps);
|
|
|
d8f823 |
+}
|
|
|
d8f823 |
+
|
|
|
d8f823 |
static bool dr_mask_is_flex_parser_icmpv6_set(struct mlx5dr_match_misc3 *misc3)
|
|
|
d8f823 |
{
|
|
|
d8f823 |
return (misc3->icmpv6_type || misc3->icmpv6_code ||
|
|
|
d8f823 |
@@ -137,13 +153,6 @@ static bool dr_mask_is_gvmi_or_qpn_set(struct mlx5dr_match_misc *misc)
|
|
|
d8f823 |
return (misc->source_sqn || misc->source_port);
|
|
|
d8f823 |
}
|
|
|
d8f823 |
|
|
|
d8f823 |
-static bool
|
|
|
d8f823 |
-dr_matcher_supp_flex_parser_vxlan_gpe(struct mlx5dr_domain *dmn)
|
|
|
d8f823 |
-{
|
|
|
d8f823 |
- return dmn->info.caps.flex_protocols &
|
|
|
d8f823 |
- MLX5_FLEX_PARSER_VXLAN_GPE_ENABLED;
|
|
|
d8f823 |
-}
|
|
|
d8f823 |
-
|
|
|
d8f823 |
int mlx5dr_matcher_select_builders(struct mlx5dr_matcher *matcher,
|
|
|
d8f823 |
struct mlx5dr_matcher_rx_tx *nic_matcher,
|
|
|
d8f823 |
enum mlx5dr_ipv outer_ipv,
|
|
|
d8f823 |
@@ -262,10 +271,10 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher,
|
|
|
d8f823 |
inner, rx);
|
|
|
d8f823 |
}
|
|
|
d8f823 |
|
|
|
d8f823 |
- if (dr_mask_is_flex_parser_tnl_set(&mask.misc3) &&
|
|
|
d8f823 |
- dr_matcher_supp_flex_parser_vxlan_gpe(dmn))
|
|
|
d8f823 |
- mlx5dr_ste_build_flex_parser_tnl(&sb[idx++], &mask,
|
|
|
d8f823 |
- inner, rx);
|
|
|
d8f823 |
+ if (dr_mask_is_flex_parser_tnl_vxlan_gpe_set(&mask, dmn))
|
|
|
d8f823 |
+ mlx5dr_ste_build_flex_parser_tnl_vxlan_gpe(&sb[idx++],
|
|
|
d8f823 |
+ &mask,
|
|
|
d8f823 |
+ inner, rx);
|
|
|
d8f823 |
|
|
|
d8f823 |
if (DR_MASK_IS_ETH_L4_MISC_SET(mask.misc3, outer))
|
|
|
d8f823 |
mlx5dr_ste_build_eth_l4_misc(&sb[idx++], &mask, inner, rx);
|
|
|
d8f823 |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c
|
|
|
d8f823 |
index 813e256a599e..496e680e0fd9 100644
|
|
|
d8f823 |
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c
|
|
|
d8f823 |
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c
|
|
|
d8f823 |
@@ -2083,68 +2083,57 @@ void mlx5dr_ste_build_eth_l4_misc(struct mlx5dr_ste_build *sb,
|
|
|
d8f823 |
sb->ste_build_tag_func = &dr_ste_build_eth_l4_misc_tag;
|
|
|
d8f823 |
}
|
|
|
d8f823 |
|
|
|
d8f823 |
-static void dr_ste_build_flex_parser_tnl_bit_mask(struct mlx5dr_match_param *value,
|
|
|
d8f823 |
- bool inner, u8 *bit_mask)
|
|
|
d8f823 |
+static void
|
|
|
d8f823 |
+dr_ste_build_flex_parser_tnl_vxlan_gpe_bit_mask(struct mlx5dr_match_param *value,
|
|
|
d8f823 |
+ bool inner, u8 *bit_mask)
|
|
|
d8f823 |
{
|
|
|
d8f823 |
struct mlx5dr_match_misc3 *misc_3_mask = &value->misc3;
|
|
|
d8f823 |
|
|
|
d8f823 |
- if (misc_3_mask->outer_vxlan_gpe_flags ||
|
|
|
d8f823 |
- misc_3_mask->outer_vxlan_gpe_next_protocol) {
|
|
|
d8f823 |
- MLX5_SET(ste_flex_parser_tnl, bit_mask,
|
|
|
d8f823 |
- flex_parser_tunneling_header_63_32,
|
|
|
d8f823 |
- (misc_3_mask->outer_vxlan_gpe_flags << 24) |
|
|
|
d8f823 |
- (misc_3_mask->outer_vxlan_gpe_next_protocol));
|
|
|
d8f823 |
- misc_3_mask->outer_vxlan_gpe_flags = 0;
|
|
|
d8f823 |
- misc_3_mask->outer_vxlan_gpe_next_protocol = 0;
|
|
|
d8f823 |
- }
|
|
|
d8f823 |
-
|
|
|
d8f823 |
- if (misc_3_mask->outer_vxlan_gpe_vni) {
|
|
|
d8f823 |
- MLX5_SET(ste_flex_parser_tnl, bit_mask,
|
|
|
d8f823 |
- flex_parser_tunneling_header_31_0,
|
|
|
d8f823 |
- misc_3_mask->outer_vxlan_gpe_vni << 8);
|
|
|
d8f823 |
- misc_3_mask->outer_vxlan_gpe_vni = 0;
|
|
|
d8f823 |
- }
|
|
|
d8f823 |
+ DR_STE_SET_MASK_V(flex_parser_tnl_vxlan_gpe, bit_mask,
|
|
|
d8f823 |
+ outer_vxlan_gpe_flags,
|
|
|
d8f823 |
+ misc_3_mask, outer_vxlan_gpe_flags);
|
|
|
d8f823 |
+ DR_STE_SET_MASK_V(flex_parser_tnl_vxlan_gpe, bit_mask,
|
|
|
d8f823 |
+ outer_vxlan_gpe_next_protocol,
|
|
|
d8f823 |
+ misc_3_mask, outer_vxlan_gpe_next_protocol);
|
|
|
d8f823 |
+ DR_STE_SET_MASK_V(flex_parser_tnl_vxlan_gpe, bit_mask,
|
|
|
d8f823 |
+ outer_vxlan_gpe_vni,
|
|
|
d8f823 |
+ misc_3_mask, outer_vxlan_gpe_vni);
|
|
|
d8f823 |
}
|
|
|
d8f823 |
|
|
|
d8f823 |
-static int dr_ste_build_flex_parser_tnl_tag(struct mlx5dr_match_param *value,
|
|
|
d8f823 |
- struct mlx5dr_ste_build *sb,
|
|
|
d8f823 |
- u8 *hw_ste_p)
|
|
|
d8f823 |
+static int
|
|
|
d8f823 |
+dr_ste_build_flex_parser_tnl_vxlan_gpe_tag(struct mlx5dr_match_param *value,
|
|
|
d8f823 |
+ struct mlx5dr_ste_build *sb,
|
|
|
d8f823 |
+ u8 *hw_ste_p)
|
|
|
d8f823 |
{
|
|
|
d8f823 |
struct dr_hw_ste_format *hw_ste = (struct dr_hw_ste_format *)hw_ste_p;
|
|
|
d8f823 |
struct mlx5dr_match_misc3 *misc3 = &value->misc3;
|
|
|
d8f823 |
u8 *tag = hw_ste->tag;
|
|
|
d8f823 |
|
|
|
d8f823 |
- if (misc3->outer_vxlan_gpe_flags ||
|
|
|
d8f823 |
- misc3->outer_vxlan_gpe_next_protocol) {
|
|
|
d8f823 |
- MLX5_SET(ste_flex_parser_tnl, tag,
|
|
|
d8f823 |
- flex_parser_tunneling_header_63_32,
|
|
|
d8f823 |
- (misc3->outer_vxlan_gpe_flags << 24) |
|
|
|
d8f823 |
- (misc3->outer_vxlan_gpe_next_protocol));
|
|
|
d8f823 |
- misc3->outer_vxlan_gpe_flags = 0;
|
|
|
d8f823 |
- misc3->outer_vxlan_gpe_next_protocol = 0;
|
|
|
d8f823 |
- }
|
|
|
d8f823 |
-
|
|
|
d8f823 |
- if (misc3->outer_vxlan_gpe_vni) {
|
|
|
d8f823 |
- MLX5_SET(ste_flex_parser_tnl, tag,
|
|
|
d8f823 |
- flex_parser_tunneling_header_31_0,
|
|
|
d8f823 |
- misc3->outer_vxlan_gpe_vni << 8);
|
|
|
d8f823 |
- misc3->outer_vxlan_gpe_vni = 0;
|
|
|
d8f823 |
- }
|
|
|
d8f823 |
+ DR_STE_SET_TAG(flex_parser_tnl_vxlan_gpe, tag,
|
|
|
d8f823 |
+ outer_vxlan_gpe_flags, misc3,
|
|
|
d8f823 |
+ outer_vxlan_gpe_flags);
|
|
|
d8f823 |
+ DR_STE_SET_TAG(flex_parser_tnl_vxlan_gpe, tag,
|
|
|
d8f823 |
+ outer_vxlan_gpe_next_protocol, misc3,
|
|
|
d8f823 |
+ outer_vxlan_gpe_next_protocol);
|
|
|
d8f823 |
+ DR_STE_SET_TAG(flex_parser_tnl_vxlan_gpe, tag,
|
|
|
d8f823 |
+ outer_vxlan_gpe_vni, misc3,
|
|
|
d8f823 |
+ outer_vxlan_gpe_vni);
|
|
|
d8f823 |
|
|
|
d8f823 |
return 0;
|
|
|
d8f823 |
}
|
|
|
d8f823 |
|
|
|
d8f823 |
-void mlx5dr_ste_build_flex_parser_tnl(struct mlx5dr_ste_build *sb,
|
|
|
d8f823 |
- struct mlx5dr_match_param *mask,
|
|
|
d8f823 |
- bool inner, bool rx)
|
|
|
d8f823 |
+void mlx5dr_ste_build_flex_parser_tnl_vxlan_gpe(struct mlx5dr_ste_build *sb,
|
|
|
d8f823 |
+ struct mlx5dr_match_param *mask,
|
|
|
d8f823 |
+ bool inner, bool rx)
|
|
|
d8f823 |
{
|
|
|
d8f823 |
- dr_ste_build_flex_parser_tnl_bit_mask(mask, inner, sb->bit_mask);
|
|
|
d8f823 |
+ dr_ste_build_flex_parser_tnl_vxlan_gpe_bit_mask(mask, inner,
|
|
|
d8f823 |
+ sb->bit_mask);
|
|
|
d8f823 |
|
|
|
d8f823 |
sb->rx = rx;
|
|
|
d8f823 |
sb->inner = inner;
|
|
|
d8f823 |
sb->lu_type = MLX5DR_STE_LU_TYPE_FLEX_PARSER_TNL_HEADER;
|
|
|
d8f823 |
sb->byte_mask = dr_ste_conv_bit_to_byte_mask(sb->bit_mask);
|
|
|
d8f823 |
- sb->ste_build_tag_func = &dr_ste_build_flex_parser_tnl_tag;
|
|
|
d8f823 |
+ sb->ste_build_tag_func = &dr_ste_build_flex_parser_tnl_vxlan_gpe_tag;
|
|
|
d8f823 |
}
|
|
|
d8f823 |
|
|
|
d8f823 |
static void dr_ste_build_register_0_bit_mask(struct mlx5dr_match_param *value,
|
|
|
d8f823 |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
|
|
|
d8f823 |
index b18720707255..9dedc162756c 100644
|
|
|
d8f823 |
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
|
|
|
d8f823 |
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
|
|
|
d8f823 |
@@ -327,9 +327,9 @@ int mlx5dr_ste_build_flex_parser_1(struct mlx5dr_ste_build *sb,
|
|
|
d8f823 |
struct mlx5dr_match_param *mask,
|
|
|
d8f823 |
struct mlx5dr_cmd_caps *caps,
|
|
|
d8f823 |
bool inner, bool rx);
|
|
|
d8f823 |
-void mlx5dr_ste_build_flex_parser_tnl(struct mlx5dr_ste_build *sb,
|
|
|
d8f823 |
- struct mlx5dr_match_param *mask,
|
|
|
d8f823 |
- bool inner, bool rx);
|
|
|
d8f823 |
+void mlx5dr_ste_build_flex_parser_tnl_vxlan_gpe(struct mlx5dr_ste_build *sb,
|
|
|
d8f823 |
+ struct mlx5dr_match_param *mask,
|
|
|
d8f823 |
+ bool inner, bool rx);
|
|
|
d8f823 |
void mlx5dr_ste_build_general_purpose(struct mlx5dr_ste_build *sb,
|
|
|
d8f823 |
struct mlx5dr_match_param *mask,
|
|
|
d8f823 |
bool inner, bool rx);
|
|
|
d8f823 |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5_ifc_dr.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5_ifc_dr.h
|
|
|
d8f823 |
index 596c927220d9..6d78b027fe56 100644
|
|
|
d8f823 |
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5_ifc_dr.h
|
|
|
d8f823 |
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5_ifc_dr.h
|
|
|
d8f823 |
@@ -548,6 +548,17 @@ struct mlx5_ifc_ste_flex_parser_tnl_bits {
|
|
|
d8f823 |
u8 reserved_at_40[0x40];
|
|
|
d8f823 |
};
|
|
|
d8f823 |
|
|
|
d8f823 |
+struct mlx5_ifc_ste_flex_parser_tnl_vxlan_gpe_bits {
|
|
|
d8f823 |
+ u8 outer_vxlan_gpe_flags[0x8];
|
|
|
d8f823 |
+ u8 reserved_at_8[0x10];
|
|
|
d8f823 |
+ u8 outer_vxlan_gpe_next_protocol[0x8];
|
|
|
d8f823 |
+
|
|
|
d8f823 |
+ u8 outer_vxlan_gpe_vni[0x18];
|
|
|
d8f823 |
+ u8 reserved_at_38[0x8];
|
|
|
d8f823 |
+
|
|
|
d8f823 |
+ u8 reserved_at_40[0x40];
|
|
|
d8f823 |
+};
|
|
|
d8f823 |
+
|
|
|
d8f823 |
struct mlx5_ifc_ste_general_purpose_bits {
|
|
|
d8f823 |
u8 general_purpose_lookup_field[0x20];
|
|
|
d8f823 |
|
|
|
d8f823 |
--
|
|
|
d8f823 |
2.13.6
|
|
|
d8f823 |
|