You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
6.3 KiB
170 lines
6.3 KiB
4 years ago
|
From 4470dc0119dc1193bdced8bedfacca93bcc8d92b Mon Sep 17 00:00:00 2001
|
||
|
From: Alaa Hleihel <ahleihel@redhat.com>
|
||
|
Date: Sun, 10 May 2020 15:04:34 -0400
|
||
|
Subject: [PATCH 110/312] [netdrv] net/mlx5: DR, Add support for Geneve packets
|
||
|
SW steering
|
||
|
|
||
|
Message-id: <20200510150452.10307-70-ahleihel@redhat.com>
|
||
|
Patchwork-id: 306693
|
||
|
Patchwork-instance: patchwork
|
||
|
O-Subject: [RHEL8.3 BZ 1789380 v2 69/87] net/mlx5: DR, Add support for Geneve packets SW steering
|
||
|
Bugzilla: 1789380
|
||
|
RH-Acked-by: Kamal Heib <kheib@redhat.com>
|
||
|
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
||
|
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
|
||
|
RH-Acked-by: Jonathan Toppins <jtoppins@redhat.com>
|
||
|
|
||
|
Bugzilla: http://bugzilla.redhat.com/1789380
|
||
|
Upstream: v5.5-rc1
|
||
|
|
||
|
commit b6d12238459d2f3c1140689c8fbb1bf1e0fe1927
|
||
|
Author: Yevgeny Kliteynik <kliteyn@mellanox.com>
|
||
|
Date: Mon Oct 28 17:22:06 2019 +0200
|
||
|
|
||
|
net/mlx5: DR, Add support for Geneve packets SW steering
|
||
|
|
||
|
Add support for SW steering matching on Geneve header fields:
|
||
|
- VNI
|
||
|
- OAM
|
||
|
- protocol type
|
||
|
- options length
|
||
|
|
||
|
Signed-off-by: Yevgeny Kliteynik <kliteyn@mellanox.com>
|
||
|
Reviewed-by: Alex Vesker <valex@mellanox.com>
|
||
|
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
|
||
|
|
||
|
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
|
||
|
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
|
||
|
---
|
||
|
.../mellanox/mlx5/core/steering/dr_matcher.c | 27 +++++++++++
|
||
|
.../ethernet/mellanox/mlx5/core/steering/dr_ste.c | 53 ++++++++++++++++++++++
|
||
|
.../mellanox/mlx5/core/steering/dr_types.h | 3 ++
|
||
|
3 files changed, 83 insertions(+)
|
||
|
|
||
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c
|
||
|
index f177c468b740..c6dbd856df94 100644
|
||
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c
|
||
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c
|
||
|
@@ -125,6 +125,29 @@ dr_mask_is_flex_parser_tnl_vxlan_gpe_set(struct mlx5dr_match_param *mask,
|
||
|
dr_matcher_supp_flex_parser_vxlan_gpe(&dmn->info.caps);
|
||
|
}
|
||
|
|
||
|
+static bool dr_mask_is_misc_geneve_set(struct mlx5dr_match_misc *misc)
|
||
|
+{
|
||
|
+ return misc->geneve_vni ||
|
||
|
+ misc->geneve_oam ||
|
||
|
+ misc->geneve_protocol_type ||
|
||
|
+ misc->geneve_opt_len;
|
||
|
+}
|
||
|
+
|
||
|
+static bool
|
||
|
+dr_matcher_supp_flex_parser_geneve(struct mlx5dr_cmd_caps *caps)
|
||
|
+{
|
||
|
+ return caps->flex_protocols &
|
||
|
+ MLX5_FLEX_PARSER_GENEVE_ENABLED;
|
||
|
+}
|
||
|
+
|
||
|
+static bool
|
||
|
+dr_mask_is_flex_parser_tnl_geneve_set(struct mlx5dr_match_param *mask,
|
||
|
+ struct mlx5dr_domain *dmn)
|
||
|
+{
|
||
|
+ return dr_mask_is_misc_geneve_set(&mask->misc) &&
|
||
|
+ dr_matcher_supp_flex_parser_geneve(&dmn->info.caps);
|
||
|
+}
|
||
|
+
|
||
|
static bool dr_mask_is_flex_parser_icmpv6_set(struct mlx5dr_match_misc3 *misc3)
|
||
|
{
|
||
|
return (misc3->icmpv6_type || misc3->icmpv6_code ||
|
||
|
@@ -275,6 +298,10 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher,
|
||
|
mlx5dr_ste_build_flex_parser_tnl_vxlan_gpe(&sb[idx++],
|
||
|
&mask,
|
||
|
inner, rx);
|
||
|
+ else if (dr_mask_is_flex_parser_tnl_geneve_set(&mask, dmn))
|
||
|
+ mlx5dr_ste_build_flex_parser_tnl_geneve(&sb[idx++],
|
||
|
+ &mask,
|
||
|
+ inner, rx);
|
||
|
|
||
|
if (DR_MASK_IS_ETH_L4_MISC_SET(mask.misc3, outer))
|
||
|
mlx5dr_ste_build_eth_l4_misc(&sb[idx++], &mask, inner, rx);
|
||
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c
|
||
|
index 496e680e0fd9..aade62a9ee5c 100644
|
||
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c
|
||
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c
|
||
|
@@ -2136,6 +2136,59 @@ void mlx5dr_ste_build_flex_parser_tnl_vxlan_gpe(struct mlx5dr_ste_build *sb,
|
||
|
sb->ste_build_tag_func = &dr_ste_build_flex_parser_tnl_vxlan_gpe_tag;
|
||
|
}
|
||
|
|
||
|
+static void
|
||
|
+dr_ste_build_flex_parser_tnl_geneve_bit_mask(struct mlx5dr_match_param *value,
|
||
|
+ u8 *bit_mask)
|
||
|
+{
|
||
|
+ struct mlx5dr_match_misc *misc_mask = &value->misc;
|
||
|
+
|
||
|
+ DR_STE_SET_MASK_V(flex_parser_tnl_geneve, bit_mask,
|
||
|
+ geneve_protocol_type,
|
||
|
+ misc_mask, geneve_protocol_type);
|
||
|
+ DR_STE_SET_MASK_V(flex_parser_tnl_geneve, bit_mask,
|
||
|
+ geneve_oam,
|
||
|
+ misc_mask, geneve_oam);
|
||
|
+ DR_STE_SET_MASK_V(flex_parser_tnl_geneve, bit_mask,
|
||
|
+ geneve_opt_len,
|
||
|
+ misc_mask, geneve_opt_len);
|
||
|
+ DR_STE_SET_MASK_V(flex_parser_tnl_geneve, bit_mask,
|
||
|
+ geneve_vni,
|
||
|
+ misc_mask, geneve_vni);
|
||
|
+}
|
||
|
+
|
||
|
+static int
|
||
|
+dr_ste_build_flex_parser_tnl_geneve_tag(struct mlx5dr_match_param *value,
|
||
|
+ struct mlx5dr_ste_build *sb,
|
||
|
+ u8 *hw_ste_p)
|
||
|
+{
|
||
|
+ struct dr_hw_ste_format *hw_ste = (struct dr_hw_ste_format *)hw_ste_p;
|
||
|
+ struct mlx5dr_match_misc *misc = &value->misc;
|
||
|
+ u8 *tag = hw_ste->tag;
|
||
|
+
|
||
|
+ DR_STE_SET_TAG(flex_parser_tnl_geneve, tag,
|
||
|
+ geneve_protocol_type, misc, geneve_protocol_type);
|
||
|
+ DR_STE_SET_TAG(flex_parser_tnl_geneve, tag,
|
||
|
+ geneve_oam, misc, geneve_oam);
|
||
|
+ DR_STE_SET_TAG(flex_parser_tnl_geneve, tag,
|
||
|
+ geneve_opt_len, misc, geneve_opt_len);
|
||
|
+ DR_STE_SET_TAG(flex_parser_tnl_geneve, tag,
|
||
|
+ geneve_vni, misc, geneve_vni);
|
||
|
+
|
||
|
+ return 0;
|
||
|
+}
|
||
|
+
|
||
|
+void mlx5dr_ste_build_flex_parser_tnl_geneve(struct mlx5dr_ste_build *sb,
|
||
|
+ struct mlx5dr_match_param *mask,
|
||
|
+ bool inner, bool rx)
|
||
|
+{
|
||
|
+ dr_ste_build_flex_parser_tnl_geneve_bit_mask(mask, sb->bit_mask);
|
||
|
+ sb->rx = rx;
|
||
|
+ sb->inner = inner;
|
||
|
+ sb->lu_type = MLX5DR_STE_LU_TYPE_FLEX_PARSER_TNL_HEADER;
|
||
|
+ sb->byte_mask = dr_ste_conv_bit_to_byte_mask(sb->bit_mask);
|
||
|
+ sb->ste_build_tag_func = &dr_ste_build_flex_parser_tnl_geneve_tag;
|
||
|
+}
|
||
|
+
|
||
|
static void dr_ste_build_register_0_bit_mask(struct mlx5dr_match_param *value,
|
||
|
u8 *bit_mask)
|
||
|
{
|
||
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
|
||
|
index 9dedc162756c..dffe35145d19 100644
|
||
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
|
||
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
|
||
|
@@ -330,6 +330,9 @@ int mlx5dr_ste_build_flex_parser_1(struct mlx5dr_ste_build *sb,
|
||
|
void mlx5dr_ste_build_flex_parser_tnl_vxlan_gpe(struct mlx5dr_ste_build *sb,
|
||
|
struct mlx5dr_match_param *mask,
|
||
|
bool inner, bool rx);
|
||
|
+void mlx5dr_ste_build_flex_parser_tnl_geneve(struct mlx5dr_ste_build *sb,
|
||
|
+ struct mlx5dr_match_param *mask,
|
||
|
+ bool inner, bool rx);
|
||
|
void mlx5dr_ste_build_general_purpose(struct mlx5dr_ste_build *sb,
|
||
|
struct mlx5dr_match_param *mask,
|
||
|
bool inner, bool rx);
|
||
|
--
|
||
|
2.13.6
|
||
|
|