137 lines
5.6 KiB
Diff
137 lines
5.6 KiB
Diff
From 988625f598a4722c53b34743d5ddef5d48a46a20 Mon Sep 17 00:00:00 2001
|
|
From: Kamal Heib <kheib@redhat.com>
|
|
Date: Thu, 16 Apr 2026 17:42:02 -0400
|
|
Subject: [PATCH] net/mlx5: HWS, Fix IP version decision
|
|
|
|
JIRA: https://redhat.atlassian.net/browse/RHEL-169055
|
|
|
|
commit 5f2f8d8b6800e4fc760c2eccec9b2bd2cacf80cf
|
|
Author: Vlad Dogaru <vdogaru@nvidia.com>
|
|
Date: Tue Apr 22 12:25:38 2025 +0300
|
|
|
|
net/mlx5: HWS, Fix IP version decision
|
|
|
|
Unify the check for IP version when creating a definer. A given matcher
|
|
is deemed to match on IPv6 if any of the higher order (>31) bits of
|
|
source or destination address mask are set.
|
|
|
|
A single packet cannot mix IP versions between source and destination
|
|
addresses, so it makes no sense that they would be decided on
|
|
independently.
|
|
|
|
Signed-off-by: Vlad Dogaru <vdogaru@nvidia.com>
|
|
Reviewed-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
|
|
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
|
|
Link: https://patch.msgid.link/20250422092540.182091-2-mbloch@nvidia.com
|
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
|
|
|
Signed-off-by: Kamal Heib <kheib@redhat.com>
|
|
|
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/definer.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/definer.c
|
|
index c8cc0c8115f5..5257e706dde2 100644
|
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/definer.c
|
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/definer.c
|
|
@@ -509,9 +509,9 @@ static int
|
|
hws_definer_conv_outer(struct mlx5hws_definer_conv_data *cd,
|
|
u32 *match_param)
|
|
{
|
|
- bool is_s_ipv6, is_d_ipv6, smac_set, dmac_set;
|
|
struct mlx5hws_definer_fc *fc = cd->fc;
|
|
struct mlx5hws_definer_fc *curr_fc;
|
|
+ bool is_ipv6, smac_set, dmac_set;
|
|
u32 *s_ipv6, *d_ipv6;
|
|
|
|
if (HWS_IS_FLD_SET_SZ(match_param, outer_headers.l4_type, 0x2) ||
|
|
@@ -570,10 +570,10 @@ hws_definer_conv_outer(struct mlx5hws_definer_conv_data *cd,
|
|
outer_headers.dst_ipv4_dst_ipv6.ipv6_layout);
|
|
|
|
/* Assume IPv6 is used if ipv6 bits are set */
|
|
- is_s_ipv6 = s_ipv6[0] || s_ipv6[1] || s_ipv6[2];
|
|
- is_d_ipv6 = d_ipv6[0] || d_ipv6[1] || d_ipv6[2];
|
|
+ is_ipv6 = s_ipv6[0] || s_ipv6[1] || s_ipv6[2] ||
|
|
+ d_ipv6[0] || d_ipv6[1] || d_ipv6[2];
|
|
|
|
- if (is_s_ipv6) {
|
|
+ if (is_ipv6) {
|
|
/* Handle IPv6 source address */
|
|
HWS_SET_HDR(fc, match_param, IPV6_SRC_127_96_O,
|
|
outer_headers.src_ipv4_src_ipv6.ipv6_simple_layout.ipv6_127_96,
|
|
@@ -587,13 +587,6 @@ hws_definer_conv_outer(struct mlx5hws_definer_conv_data *cd,
|
|
HWS_SET_HDR(fc, match_param, IPV6_SRC_31_0_O,
|
|
outer_headers.src_ipv4_src_ipv6.ipv6_simple_layout.ipv6_31_0,
|
|
ipv6_src_outer.ipv6_address_31_0);
|
|
- } else {
|
|
- /* Handle IPv4 source address */
|
|
- HWS_SET_HDR(fc, match_param, IPV4_SRC_O,
|
|
- outer_headers.src_ipv4_src_ipv6.ipv6_simple_layout.ipv6_31_0,
|
|
- ipv4_src_dest_outer.source_address);
|
|
- }
|
|
- if (is_d_ipv6) {
|
|
/* Handle IPv6 destination address */
|
|
HWS_SET_HDR(fc, match_param, IPV6_DST_127_96_O,
|
|
outer_headers.dst_ipv4_dst_ipv6.ipv6_simple_layout.ipv6_127_96,
|
|
@@ -608,6 +601,10 @@ hws_definer_conv_outer(struct mlx5hws_definer_conv_data *cd,
|
|
outer_headers.dst_ipv4_dst_ipv6.ipv6_simple_layout.ipv6_31_0,
|
|
ipv6_dst_outer.ipv6_address_31_0);
|
|
} else {
|
|
+ /* Handle IPv4 source address */
|
|
+ HWS_SET_HDR(fc, match_param, IPV4_SRC_O,
|
|
+ outer_headers.src_ipv4_src_ipv6.ipv6_simple_layout.ipv6_31_0,
|
|
+ ipv4_src_dest_outer.source_address);
|
|
/* Handle IPv4 destination address */
|
|
HWS_SET_HDR(fc, match_param, IPV4_DST_O,
|
|
outer_headers.dst_ipv4_dst_ipv6.ipv6_simple_layout.ipv6_31_0,
|
|
@@ -665,9 +662,9 @@ static int
|
|
hws_definer_conv_inner(struct mlx5hws_definer_conv_data *cd,
|
|
u32 *match_param)
|
|
{
|
|
- bool is_s_ipv6, is_d_ipv6, smac_set, dmac_set;
|
|
struct mlx5hws_definer_fc *fc = cd->fc;
|
|
struct mlx5hws_definer_fc *curr_fc;
|
|
+ bool is_ipv6, smac_set, dmac_set;
|
|
u32 *s_ipv6, *d_ipv6;
|
|
|
|
if (HWS_IS_FLD_SET_SZ(match_param, inner_headers.l4_type, 0x2) ||
|
|
@@ -728,10 +725,10 @@ hws_definer_conv_inner(struct mlx5hws_definer_conv_data *cd,
|
|
inner_headers.dst_ipv4_dst_ipv6.ipv6_layout);
|
|
|
|
/* Assume IPv6 is used if ipv6 bits are set */
|
|
- is_s_ipv6 = s_ipv6[0] || s_ipv6[1] || s_ipv6[2];
|
|
- is_d_ipv6 = d_ipv6[0] || d_ipv6[1] || d_ipv6[2];
|
|
+ is_ipv6 = s_ipv6[0] || s_ipv6[1] || s_ipv6[2] ||
|
|
+ d_ipv6[0] || d_ipv6[1] || d_ipv6[2];
|
|
|
|
- if (is_s_ipv6) {
|
|
+ if (is_ipv6) {
|
|
/* Handle IPv6 source address */
|
|
HWS_SET_HDR(fc, match_param, IPV6_SRC_127_96_I,
|
|
inner_headers.src_ipv4_src_ipv6.ipv6_simple_layout.ipv6_127_96,
|
|
@@ -745,13 +742,6 @@ hws_definer_conv_inner(struct mlx5hws_definer_conv_data *cd,
|
|
HWS_SET_HDR(fc, match_param, IPV6_SRC_31_0_I,
|
|
inner_headers.src_ipv4_src_ipv6.ipv6_simple_layout.ipv6_31_0,
|
|
ipv6_src_inner.ipv6_address_31_0);
|
|
- } else {
|
|
- /* Handle IPv4 source address */
|
|
- HWS_SET_HDR(fc, match_param, IPV4_SRC_I,
|
|
- inner_headers.src_ipv4_src_ipv6.ipv6_simple_layout.ipv6_31_0,
|
|
- ipv4_src_dest_inner.source_address);
|
|
- }
|
|
- if (is_d_ipv6) {
|
|
/* Handle IPv6 destination address */
|
|
HWS_SET_HDR(fc, match_param, IPV6_DST_127_96_I,
|
|
inner_headers.dst_ipv4_dst_ipv6.ipv6_simple_layout.ipv6_127_96,
|
|
@@ -766,6 +756,10 @@ hws_definer_conv_inner(struct mlx5hws_definer_conv_data *cd,
|
|
inner_headers.dst_ipv4_dst_ipv6.ipv6_simple_layout.ipv6_31_0,
|
|
ipv6_dst_inner.ipv6_address_31_0);
|
|
} else {
|
|
+ /* Handle IPv4 source address */
|
|
+ HWS_SET_HDR(fc, match_param, IPV4_SRC_I,
|
|
+ inner_headers.src_ipv4_src_ipv6.ipv6_simple_layout.ipv6_31_0,
|
|
+ ipv4_src_dest_inner.source_address);
|
|
/* Handle IPv4 destination address */
|
|
HWS_SET_HDR(fc, match_param, IPV4_DST_I,
|
|
inner_headers.dst_ipv4_dst_ipv6.ipv6_simple_layout.ipv6_31_0,
|
|
--
|
|
2.50.1 (Apple Git-155)
|
|
|