netdev.vger.kernel.org archive mirror
 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 v0 16/16] net/mlx5e: Move goto action checks into tc_action goto post parse op
Date: Tue, 14 Dec 2021 21:33:00 -0800	[thread overview]
Message-ID: <20211215053300.130679-17-saeed@kernel.org> (raw)
In-Reply-To: <20211215053300.130679-1-saeed@kernel.org>

From: Roi Dayan <roid@nvidia.com>

Move goto action checks from parse nic/fdb funcs into the tc action
infra goto post parse op.
While moving this part also use NL_SET_ERR_MSG_MOD() instead of
NL_SET_ERR_MSG().

Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Oz Shlomo <ozsh@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 .../mellanox/mlx5/core/en/tc/act/goto.c       | 35 +++++++++++++++++++
 .../net/ethernet/mellanox/mlx5/core/en_tc.c   | 19 ----------
 2 files changed, 35 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/goto.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/goto.c
index d713cf8e92a5..f44515061228 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/goto.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/goto.c
@@ -81,7 +81,42 @@ tc_act_parse_goto(struct mlx5e_tc_act_parse_state *parse_state,
 	return 0;
 }
 
+static int
+tc_act_post_parse_goto(struct mlx5e_tc_act_parse_state *parse_state,
+		       struct mlx5e_priv *priv,
+		       struct mlx5_flow_attr *attr)
+{
+	struct mlx5e_tc_flow_parse_attr *parse_attr = attr->parse_attr;
+	struct netlink_ext_ack *extack = parse_state->extack;
+	struct mlx5e_tc_flow *flow = parse_state->flow;
+
+	if (!attr->dest_chain)
+		return 0;
+
+	if (parse_state->decap) {
+		/* It can be supported if we'll create a mapping for
+		 * the tunnel device only (without tunnel), and set
+		 * this tunnel id with this decap flow.
+		 *
+		 * On restore (miss), we'll just set this saved tunnel
+		 * device.
+		 */
+
+		NL_SET_ERR_MSG_MOD(extack, "Decap with goto isn't supported");
+		netdev_warn(priv->netdev, "Decap with goto isn't supported");
+		return -EOPNOTSUPP;
+	}
+
+	if (!mlx5e_is_eswitch_flow(flow) && parse_attr->mirred_ifindex[0]) {
+		NL_SET_ERR_MSG_MOD(extack, "Mirroring goto chain rules isn't supported");
+		return -EOPNOTSUPP;
+	}
+
+	return 0;
+}
+
 struct mlx5e_tc_act mlx5e_tc_act_goto = {
 	.can_offload = tc_act_can_offload_goto,
 	.parse_action = tc_act_parse_goto,
+	.post_parse = tc_act_post_parse_goto,
 };
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 28a8db85994c..eec919f1b476 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -3241,11 +3241,6 @@ parse_tc_nic_actions(struct mlx5e_priv *priv,
 	if (err)
 		return err;
 
-	if (attr->dest_chain && parse_attr->mirred_ifindex[0]) {
-		NL_SET_ERR_MSG(extack, "Mirroring goto chain rules isn't supported");
-		return -EOPNOTSUPP;
-	}
-
 	err = actions_prepare_mod_hdr_actions(priv, flow, attr, hdrs, extack);
 	if (err)
 		return err;
@@ -3384,20 +3379,6 @@ parse_tc_fdb_actions(struct mlx5e_priv *priv,
 	if (!actions_match_supported(priv, flow_action, parse_attr, flow, extack))
 		return -EOPNOTSUPP;
 
-	if (attr->dest_chain && parse_state->decap) {
-		/* It can be supported if we'll create a mapping for
-		 * the tunnel device only (without tunnel), and set
-		 * this tunnel id with this decap flow.
-		 *
-		 * On restore (miss), we'll just set this saved tunnel
-		 * device.
-		 */
-
-		NL_SET_ERR_MSG(extack, "Decap with goto isn't supported");
-		netdev_warn(priv->netdev, "Decap with goto isn't supported");
-		return -EOPNOTSUPP;
-	}
-
 	return 0;
 }
 
-- 
2.31.1


      parent reply	other threads:[~2021-12-15  5:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-15  5:32 [pull request][net-next v0 00/16] mlx5 updates 2021-12-14 Saeed Mahameed
2021-12-15  5:32 ` [net-next v0 01/16] net/mlx5e: Add tc action infrastructure Saeed Mahameed
2021-12-15 14:50   ` patchwork-bot+netdevbpf
2021-12-15  5:32 ` [net-next v0 02/16] net/mlx5e: Add goto to tc action infra Saeed Mahameed
2021-12-15  5:32 ` [net-next v0 03/16] net/mlx5e: Add tunnel encap/decap " Saeed Mahameed
2021-12-15  5:32 ` [net-next v0 04/16] net/mlx5e: Add csum " Saeed Mahameed
2021-12-15  5:32 ` [net-next v0 05/16] net/mlx5e: Add pedit " Saeed Mahameed
2021-12-15  5:32 ` [net-next v0 06/16] net/mlx5e: Add vlan push/pop/mangle " Saeed Mahameed
2021-12-15  5:32 ` [net-next v0 07/16] net/mlx5e: Add mpls push/pop " Saeed Mahameed
2021-12-15  5:32 ` [net-next v0 08/16] net/mlx5e: Add mirred/redirect " Saeed Mahameed
2021-12-15  5:32 ` [net-next v0 09/16] net/mlx5e: Add ct " Saeed Mahameed
2021-12-15  5:32 ` [net-next v0 10/16] net/mlx5e: Add sample and ptype to tc_action infra Saeed Mahameed
2021-12-15  5:32 ` [net-next v0 11/16] net/mlx5e: Add redirect ingress to tc action infra Saeed Mahameed
2021-12-15  5:32 ` [net-next v0 12/16] net/mlx5e: TC action parsing loop Saeed Mahameed
2021-12-15  5:32 ` [net-next v0 13/16] net/mlx5e: Move sample attr allocation to tc_action sample parse op Saeed Mahameed
2021-12-15  5:32 ` [net-next v0 14/16] net/mlx5e: Add post_parse() op to tc action infrastructure Saeed Mahameed
2021-12-15  5:32 ` [net-next v0 15/16] net/mlx5e: Move vlan action chunk into tc action vlan post parse op Saeed Mahameed
2021-12-15  5:33 ` Saeed Mahameed [this message]

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=20211215053300.130679-17-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 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).