All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Buslov <vladbu@nvidia.com>
To: <tianyu.yuan@corigine.com>
Cc: <jhs@mojatatu.com>, <simon.horman@corigine.com>,
	<netdev@vger.kernel.org>, <xiyou.wangcong@gmail.com>,
	<dcaratti@redhat.com>, <edward.cree@amd.com>,
	<echaudro@redhat.com>, <i.maximets@ovn.org>,
	<mleitner@redhat.com>, <ozsh@nvidia.com>, <paulb@nvidia.com>,
	<dev@openvswitch.org>, <oss-drivers@corigine.com>,
	<ziyang.chen@corigine.com>, <roid@nvidia.com>,
	Vlad Buslov <vladbu@nvidia.com>
Subject: [PATCH] tc: allow gact pipe action offload
Date: Fri, 25 Nov 2022 13:49:32 +0100	[thread overview]
Message-ID: <20221125124932.2877006-1-vladbu@nvidia.com> (raw)
In-Reply-To: <87y1rzqkgf.fsf@nvidia.com>

Flow action infrastructure and mlx5 only.

Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
---
 .../net/ethernet/mellanox/mlx5/core/Makefile  |  3 +-
 .../mellanox/mlx5/core/en/tc/act/act.c        |  2 ++
 .../mellanox/mlx5/core/en/tc/act/act.h        |  1 +
 .../mellanox/mlx5/core/en/tc/act/pipe.c       | 28 +++++++++++++++++++
 net/sched/act_gact.c                          |  7 +++--
 5 files changed, 37 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/pipe.c

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Makefile b/drivers/net/ethernet/mellanox/mlx5/core/Makefile
index a22c32aabf11..566a03e80cf8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/Makefile
+++ b/drivers/net/ethernet/mellanox/mlx5/core/Makefile
@@ -55,7 +55,8 @@ mlx5_core-$(CONFIG_MLX5_CLS_ACT)     += en/tc/act/act.o en/tc/act/drop.o en/tc/a
 					en/tc/act/vlan.o en/tc/act/vlan_mangle.o en/tc/act/mpls.o \
 					en/tc/act/mirred.o en/tc/act/mirred_nic.o \
 					en/tc/act/ct.o en/tc/act/sample.o en/tc/act/ptype.o \
-					en/tc/act/redirect_ingress.o en/tc/act/police.o
+					en/tc/act/redirect_ingress.o en/tc/act/police.o \
+					en/tc/act/pipe.o
 
 ifneq ($(CONFIG_MLX5_TC_CT),)
 	mlx5_core-y			     += en/tc_ct.o en/tc/ct_fs_dmfs.o
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c
index 3337241cfd84..e8fcc18c7074 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c
@@ -28,6 +28,7 @@ static struct mlx5e_tc_act *tc_acts_fdb[NUM_FLOW_ACTIONS] = {
 	[FLOW_ACTION_CT] = &mlx5e_tc_act_ct,
 	[FLOW_ACTION_MPLS_PUSH] = &mlx5e_tc_act_mpls_push,
 	[FLOW_ACTION_MPLS_POP] = &mlx5e_tc_act_mpls_pop,
+	[FLOW_ACTION_PIPE] = &mlx5e_tc_act_pipe,
 	[FLOW_ACTION_VLAN_PUSH_ETH] = &mlx5e_tc_act_vlan,
 	[FLOW_ACTION_VLAN_POP_ETH] = &mlx5e_tc_act_vlan,
 };
@@ -42,6 +43,7 @@ static struct mlx5e_tc_act *tc_acts_nic[NUM_FLOW_ACTIONS] = {
 	[FLOW_ACTION_CSUM] = &mlx5e_tc_act_csum,
 	[FLOW_ACTION_MARK] = &mlx5e_tc_act_mark,
 	[FLOW_ACTION_CT] = &mlx5e_tc_act_ct,
+	[FLOW_ACTION_PIPE] = &mlx5e_tc_act_pipe,
 };
 
 /**
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 e1570ff056ae..dd863e84a925 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
@@ -87,6 +87,7 @@ extern struct mlx5e_tc_act mlx5e_tc_act_sample;
 extern struct mlx5e_tc_act mlx5e_tc_act_ptype;
 extern struct mlx5e_tc_act mlx5e_tc_act_redirect_ingress;
 extern struct mlx5e_tc_act mlx5e_tc_act_police;
+extern struct mlx5e_tc_act mlx5e_tc_act_pipe;
 
 struct mlx5e_tc_act *
 mlx5e_tc_act_get(enum flow_action_id act_id,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/pipe.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/pipe.c
new file mode 100644
index 000000000000..75207b57bec2
--- /dev/null
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/pipe.c
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
+// Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+
+#include "act.h"
+#include "en/tc_priv.h"
+
+static bool
+tc_act_can_offload_pipe(struct mlx5e_tc_act_parse_state *parse_state,
+			const struct flow_action_entry *act,
+			int act_index,
+			struct mlx5_flow_attr *attr)
+{
+	return true;
+}
+
+static int
+tc_act_parse_pipe(struct mlx5e_tc_act_parse_state *parse_state,
+		  const struct flow_action_entry *act,
+		  struct mlx5e_priv *priv,
+		  struct mlx5_flow_attr *attr)
+{
+	return 0;
+}
+
+struct mlx5e_tc_act mlx5e_tc_act_pipe = {
+	.can_offload = tc_act_can_offload_pipe,
+	.parse_action = tc_act_parse_pipe,
+};
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index 62d682b96b88..82d1371e251e 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -250,15 +250,14 @@ static int tcf_gact_offload_act_setup(struct tc_action *act, void *entry_data,
 		} else if (is_tcf_gact_goto_chain(act)) {
 			entry->id = FLOW_ACTION_GOTO;
 			entry->chain_index = tcf_gact_goto_chain_index(act);
+		} else if (is_tcf_gact_pipe(act)) {
+			entry->id = FLOW_ACTION_PIPE;
 		} else if (is_tcf_gact_continue(act)) {
 			NL_SET_ERR_MSG_MOD(extack, "Offload of \"continue\" action is not supported");
 			return -EOPNOTSUPP;
 		} else if (is_tcf_gact_reclassify(act)) {
 			NL_SET_ERR_MSG_MOD(extack, "Offload of \"reclassify\" action is not supported");
 			return -EOPNOTSUPP;
-		} else if (is_tcf_gact_pipe(act)) {
-			NL_SET_ERR_MSG_MOD(extack, "Offload of \"pipe\" action is not supported");
-			return -EOPNOTSUPP;
 		} else {
 			NL_SET_ERR_MSG_MOD(extack, "Unsupported generic action offload");
 			return -EOPNOTSUPP;
@@ -275,6 +274,8 @@ static int tcf_gact_offload_act_setup(struct tc_action *act, void *entry_data,
 			fl_action->id = FLOW_ACTION_TRAP;
 		else if (is_tcf_gact_goto_chain(act))
 			fl_action->id = FLOW_ACTION_GOTO;
+		else if (is_tcf_gact_pipe(act))
+			fl_action->id = FLOW_ACTION_PIPE;
 		else
 			return -EOPNOTSUPP;
 	}
-- 
2.37.2


  reply	other threads:[~2022-11-25 12:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 11:20 [PATCH/RFC net-next] tc: allow drivers to accept gact with PIPE when offloading Simon Horman
2022-11-24 23:45 ` Jamal Hadi Salim
2022-11-25  3:10   ` Tianyu Yuan
2022-11-25 12:31     ` Vlad Buslov
2022-11-25 12:49       ` Vlad Buslov [this message]
2022-11-25 14:19     ` Marcelo Leitner
2022-11-25 14:32       ` Eelco Chaudron
2022-11-28  7:18         ` Tianyu Yuan
2022-11-28  9:11           ` Eelco Chaudron
2022-11-28  7:11       ` Tianyu Yuan
2022-11-28 13:11         ` Marcelo Leitner
2022-11-28 13:17           ` Eelco Chaudron
2022-11-28 13:33             ` Marcelo Leitner
2022-11-29 12:35               ` Eelco Chaudron
2022-11-30  3:36                 ` Tianyu Yuan
2022-11-30 18:05                   ` Marcelo Leitner
2022-12-01  3:52                     ` Tianyu Yuan
2022-12-02 12:17                   ` Eelco Chaudron
2022-12-02 12:33                     ` Tianyu Yuan
2022-12-02 12:39                       ` Eelco Chaudron
2023-01-29  8:16                         ` Tianyu Yuan
2022-11-29  8:43           ` Edward Cree
     [not found]     ` <CAM0EoMnw57gVb+niRzZ-QYefey4TuhFZwnVs3P53_jo60d8Efg@mail.gmail.com>
     [not found]       ` <PH0PR13MB47931C1CBABDD4113275A2A994139@PH0PR13MB4793.namprd13.prod.outlook.com>
2022-11-28 11:35         ` Jamal Hadi Salim
2022-11-29  7:32           ` Tianyu Yuan

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=20221125124932.2877006-1-vladbu@nvidia.com \
    --to=vladbu@nvidia.com \
    --cc=dcaratti@redhat.com \
    --cc=dev@openvswitch.org \
    --cc=echaudro@redhat.com \
    --cc=edward.cree@amd.com \
    --cc=i.maximets@ovn.org \
    --cc=jhs@mojatatu.com \
    --cc=mleitner@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@corigine.com \
    --cc=ozsh@nvidia.com \
    --cc=paulb@nvidia.com \
    --cc=roid@nvidia.com \
    --cc=simon.horman@corigine.com \
    --cc=tianyu.yuan@corigine.com \
    --cc=xiyou.wangcong@gmail.com \
    --cc=ziyang.chen@corigine.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.