All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Roi Dayan <roid@nvidia.com>,
	Oz Shlomo <ozsh@nvidia.com>, Saeed Mahameed <saeedm@nvidia.com>
Subject: [net-next RESEND 08/17] net/mlx5e: TC, Reject rules with multiple CT actions
Date: Thu, 27 Jan 2022 12:39:58 -0800	[thread overview]
Message-ID: <20220127204007.146300-9-saeed@kernel.org> (raw)
In-Reply-To: <20220127204007.146300-1-saeed@kernel.org>

From: Roi Dayan <roid@nvidia.com>

The driver doesn't support multiple CT actions.
Multiple CT clear actions are ok as they are redundant also with
another CT actions.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Oz Shlomo <ozsh@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 .../net/ethernet/mellanox/mlx5/core/en/tc/act/act.h    |  1 +
 drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/ct.c | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h
index 04734e59bbc4..bfbc91c116a5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h
@@ -16,6 +16,7 @@ struct mlx5e_tc_act_parse_state {
 	unsigned int num_actions;
 	struct mlx5e_tc_flow *flow;
 	struct netlink_ext_ack *extack;
+	bool ct;
 	bool encap;
 	bool decap;
 	bool mpls_push;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/ct.c
index 0d08cc35ea6f..4a04e0a7a52e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/ct.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/ct.c
@@ -11,6 +11,7 @@ tc_act_can_offload_ct(struct mlx5e_tc_act_parse_state *parse_state,
 		      int act_index,
 		      struct mlx5_flow_attr *attr)
 {
+	bool clear_action = act->ct.action & TCA_CT_ACT_CLEAR;
 	struct netlink_ext_ack *extack = parse_state->extack;
 
 	if (flow_flag_test(parse_state->flow, SAMPLE)) {
@@ -19,6 +20,11 @@ tc_act_can_offload_ct(struct mlx5e_tc_act_parse_state *parse_state,
 		return false;
 	}
 
+	if (parse_state->ct && !clear_action) {
+		NL_SET_ERR_MSG_MOD(extack, "Multiple CT actions are not supoported");
+		return false;
+	}
+
 	return true;
 }
 
@@ -28,6 +34,7 @@ tc_act_parse_ct(struct mlx5e_tc_act_parse_state *parse_state,
 		struct mlx5e_priv *priv,
 		struct mlx5_flow_attr *attr)
 {
+	bool clear_action = act->ct.action & TCA_CT_ACT_CLEAR;
 	int err;
 
 	err = mlx5_tc_ct_parse_action(parse_state->ct_priv, attr,
@@ -41,6 +48,9 @@ tc_act_parse_ct(struct mlx5e_tc_act_parse_state *parse_state,
 	if (mlx5e_is_eswitch_flow(parse_state->flow))
 		attr->esw_attr->split_count = attr->esw_attr->out_count;
 
+	if (!clear_action)
+		parse_state->ct = true;
+
 	return 0;
 }
 
-- 
2.34.1


  parent reply	other threads:[~2022-01-27 20:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 20:39 [pull request][net-next RESEND 00/17] mlx5 updates 2022-01-27 Saeed Mahameed
2022-01-27 20:39 ` [net-next RESEND 01/17] net/mlx5e: Move code chunk setting encap dests into its own function Saeed Mahameed
2022-01-28  3:20   ` patchwork-bot+netdevbpf
2022-01-27 20:39 ` [net-next RESEND 02/17] net/mlx5e: Pass attr arg for attaching/detaching encaps Saeed Mahameed
2022-01-27 20:39 ` [net-next RESEND 03/17] net/mlx5e: Move counter creation call to alloc_flow_attr_counter() Saeed Mahameed
2022-01-27 20:39 ` [net-next RESEND 04/17] net/mlx5e: TC, Move pedit_headers_action to parse_attr Saeed Mahameed
2022-01-27 20:39 ` [net-next RESEND 05/17] net/mlx5e: TC, Split pedit offloads verify from alloc_tc_pedit_action() Saeed Mahameed
2022-01-27 20:39 ` [net-next RESEND 06/17] net/mlx5e: TC, Pass attr to tc_act can_offload() Saeed Mahameed
2022-01-27 20:39 ` [net-next RESEND 07/17] net/mlx5e: TC, Refactor mlx5e_tc_add_flow_mod_hdr() to get flow attr Saeed Mahameed
2022-01-27 20:39 ` Saeed Mahameed [this message]
2022-01-27 20:39 ` [net-next RESEND 09/17] net/mlx5e: TC, Hold sample_attr on stack instead of pointer Saeed Mahameed
2022-01-27 20:40 ` [net-next RESEND 10/17] net/mlx5e: CT, Don't set flow flag CT for ct clear flow Saeed Mahameed
2022-01-27 20:40 ` [net-next RESEND 11/17] net/mlx5e: Refactor eswitch attr flags to just attr flags Saeed Mahameed
2022-01-27 20:40 ` [net-next RESEND 12/17] net/mlx5e: Test CT and SAMPLE on flow attr Saeed Mahameed
2022-01-27 20:40 ` [net-next RESEND 13/17] net/mlx5e: TC, Store mapped tunnel id " Saeed Mahameed
2022-01-27 20:40 ` [net-next RESEND 14/17] net/mlx5e: CT, Remove redundant flow args from tc ct calls Saeed Mahameed
2022-01-27 20:40 ` [net-next RESEND 15/17] net/mlx5: Remove unused TIR modify bitmask enums Saeed Mahameed
2022-01-27 20:40 ` [net-next RESEND 16/17] net/mlx5: Introduce software defined steering capabilities Saeed Mahameed
2022-01-27 20:40 ` [net-next RESEND 17/17] net/mlx5: VLAN push on RX, pop on TX 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=20220127204007.146300-9-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ozsh@nvidia.com \
    --cc=roid@nvidia.com \
    --cc=saeedm@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.