From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Yevgeny Kliteynik <kliteyn@nvidia.com>,
Alex Vesker <valex@nvidia.com>,
Saeed Mahameed <saeedm@nvidia.com>
Subject: [net-next 15/16] net/mlx5: DR, Ignore modify TTL if device doesn't support it
Date: Tue, 28 Dec 2021 22:25:01 -0800 [thread overview]
Message-ID: <20211229062502.24111-16-saeed@kernel.org> (raw)
In-Reply-To: <20211229062502.24111-1-saeed@kernel.org>
From: Yevgeny Kliteynik <kliteyn@nvidia.com>
When modifying TTL, packet's csum has to be recalculated.
Due to HW issue in ConnectX-5, csum recalculation for modify TTL
is supported through a work-around that is specifically enabled
by configuration.
If the work-around isn't enabled, ignore the modify TTL action
rather than adding an unsupported action.
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Alex Vesker <valex@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
.../mellanox/mlx5/core/steering/dr_action.c | 21 ++++++++++++++++---
include/linux/mlx5/mlx5_ifc.h | 2 +-
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
index f0faf04536d3..c61a5e83c78c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
@@ -1560,6 +1560,12 @@ dr_action_modify_check_is_ttl_modify(const void *sw_action)
return sw_field == MLX5_ACTION_IN_FIELD_OUT_IP_TTL;
}
+static bool dr_action_modify_ttl_ignore(struct mlx5dr_domain *dmn)
+{
+ return !mlx5dr_ste_supp_ttl_cs_recalc(&dmn->info.caps) &&
+ !MLX5_CAP_ESW_FLOWTABLE(dmn->mdev, fdb_ipv4_ttl_modify);
+}
+
static int dr_actions_convert_modify_header(struct mlx5dr_action *action,
u32 max_hw_actions,
u32 num_sw_actions,
@@ -1591,8 +1597,13 @@ static int dr_actions_convert_modify_header(struct mlx5dr_action *action,
if (ret)
return ret;
- if (!(*modify_ttl))
- *modify_ttl = dr_action_modify_check_is_ttl_modify(sw_action);
+ if (!(*modify_ttl) &&
+ dr_action_modify_check_is_ttl_modify(sw_action)) {
+ if (dr_action_modify_ttl_ignore(dmn))
+ continue;
+
+ *modify_ttl = true;
+ }
/* Convert SW action to HW action */
ret = dr_action_modify_sw_to_hw(dmn,
@@ -1631,7 +1642,7 @@ static int dr_actions_convert_modify_header(struct mlx5dr_action *action,
* modify actions doesn't exceeds the limit
*/
hw_idx++;
- if ((num_sw_actions + hw_idx - i) >= max_hw_actions) {
+ if (hw_idx >= max_hw_actions) {
mlx5dr_dbg(dmn, "Modify header action number exceeds HW limit\n");
return -EINVAL;
}
@@ -1642,6 +1653,10 @@ static int dr_actions_convert_modify_header(struct mlx5dr_action *action,
hw_idx++;
}
+ /* if the resulting HW actions list is empty, add NOP action */
+ if (!hw_idx)
+ hw_idx++;
+
*num_hw_actions = hw_idx;
return 0;
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index deaa0f71213f..598ac3bcc901 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -833,7 +833,7 @@ struct mlx5_ifc_flow_table_eswitch_cap_bits {
u8 fdb_to_vport_reg_c_id[0x8];
u8 reserved_at_8[0xd];
u8 fdb_modify_header_fwd_to_table[0x1];
- u8 reserved_at_16[0x1];
+ u8 fdb_ipv4_ttl_modify[0x1];
u8 flow_source[0x1];
u8 reserved_at_18[0x2];
u8 multi_fdb_encap[0x1];
--
2.33.1
next prev parent reply other threads:[~2021-12-29 6:25 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-29 6:24 [pull request][net-next 00/16] mlx5 updates 2021-12-28 Saeed Mahameed
2021-12-29 6:24 ` [net-next 01/16] net/mlx5: DR, Fix error flow in creating matcher Saeed Mahameed
2021-12-29 6:24 ` [net-next 02/16] net/mlx5: DR, Fix lower case macro prefix "mlx5_" to "MLX5_" Saeed Mahameed
2021-12-29 6:24 ` [net-next 03/16] net/mlx5: DR, Remove unused struct member in matcher Saeed Mahameed
2021-12-29 6:24 ` [net-next 04/16] net/mlx5: DR, Rename list field in matcher struct to list_node Saeed Mahameed
2021-12-29 6:24 ` [net-next 05/16] net/mlx5: DR, Add check for flex parser ID value Saeed Mahameed
2021-12-29 6:24 ` [net-next 06/16] net/mlx5: DR, Add missing reserved fields to dr_match_param Saeed Mahameed
2021-12-29 6:24 ` [net-next 07/16] net/mlx5: DR, Add support for dumping steering info Saeed Mahameed
2021-12-30 2:16 ` Jakub Kicinski
2021-12-31 1:49 ` Yevgeny Kliteynik
2021-12-31 2:09 ` Jakub Kicinski
2022-01-02 10:18 ` Yevgeny Kliteynik
2021-12-29 6:24 ` [net-next 08/16] net/mlx5: DR, Add support for UPLINK destination type Saeed Mahameed
2021-12-29 6:24 ` [net-next 09/16] net/mlx5: DR, Warn on failure to destroy objects due to refcount Saeed Mahameed
2021-12-29 6:24 ` [net-next 10/16] net/mlx5: Add misc5 flow table match parameters Saeed Mahameed
2021-12-29 6:24 ` [net-next 11/16] net/mlx5: DR, Add misc5 to match_param structs Saeed Mahameed
2021-12-29 6:24 ` [net-next 12/16] net/mlx5: DR, Support matching on tunnel headers 0 and 1 Saeed Mahameed
2021-12-29 6:24 ` [net-next 13/16] net/mlx5: DR, Add support for matching on geneve_tlv_option_0_exist field Saeed Mahameed
2021-12-29 6:25 ` [net-next 14/16] net/mlx5: DR, Improve steering for empty or RX/TX-only matchers Saeed Mahameed
2021-12-29 6:25 ` Saeed Mahameed [this message]
2021-12-29 6:25 ` [net-next 16/16] net/mlx5: Set SMFS as a default steering mode if device supports it Saeed Mahameed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211229062502.24111-16-saeed@kernel.org \
--to=saeed@kernel.org \
--cc=davem@davemloft.net \
--cc=kliteyn@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=saeedm@nvidia.com \
--cc=valex@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).