Flow action infrastructure and mlx5 only.

Signed-off-by: Vlad Buslov <[email protected]>
---
 .../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

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to