From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Long Wu <long.wu@corigine.com>,
Chaoyong He <chaoyong.he@corigine.com>,
Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH 1/4] net/nfp: support MARK flow action
Date: Sat, 10 Feb 2024 18:42:10 +0800 [thread overview]
Message-ID: <20240210104214.1248772-2-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20240210104214.1248772-1-chaoyong.he@corigine.com>
From: Long Wu <long.wu@corigine.com>
Add the corresponding logics to support the offload of MARK action.
Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/nfp/flower/nfp_flower_cmsg.h | 16 ++++++++++++++
drivers/net/nfp/flower/nfp_flower_flow.c | 27 ++++++++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h
index 8fb55f44a2..c94ea706bb 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.h
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h
@@ -959,6 +959,22 @@ struct nfp_fl_act_meter {
rte_be32_t profile_id;
};
+/*
+ * Mark
+ * 3 2 1
+ * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | res | opcode | res | len_lw| reserved |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Mark |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+struct nfp_fl_act_mark {
+ struct nfp_fl_act_head head;
+ rte_be16_t reserved;
+ rte_be32_t mark;
+};
+
int nfp_flower_cmsg_mac_repr(struct nfp_app_fw_flower *app_fw_flower);
int nfp_flower_cmsg_repr_reify(struct nfp_app_fw_flower *app_fw_flower,
struct nfp_flower_representor *repr);
diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c
index e26be30d18..8667f8e901 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.c
+++ b/drivers/net/nfp/flower/nfp_flower_flow.c
@@ -83,6 +83,7 @@
#define NFP_FL_ACTION_OPCODE_METER 24
#define NFP_FL_ACTION_OPCODE_CT_NAT_EXT 25
#define NFP_FL_ACTION_OPCODE_PUSH_GENEVE 26
+#define NFP_FL_ACTION_OPCODE_SET_MARK 27
#define NFP_FL_ACTION_OPCODE_NUM 32
#define NFP_FL_OUT_FLAGS_LAST RTE_BIT32(15)
@@ -1138,6 +1139,10 @@ nfp_flow_key_layers_calculate_actions(const struct rte_flow_action actions[],
case RTE_FLOW_ACTION_TYPE_CONNTRACK:
PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_CONNTRACK detected");
break;
+ case RTE_FLOW_ACTION_TYPE_MARK:
+ key_ls->act_size += sizeof(struct nfp_fl_act_mark);
+ PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_MARK detected");
+ break;
default:
PMD_DRV_LOG(ERR, "Action type %d not supported.", action->type);
return -ENOTSUP;
@@ -3487,6 +3492,23 @@ nfp_flow_action_meter(struct nfp_flower_representor *representor,
return 0;
}
+static void
+nfp_flow_action_mark(char *act_data,
+ const struct rte_flow_action *action)
+{
+ struct nfp_fl_act_mark *fl_mark;
+ const struct rte_flow_action_mark *mark;
+ size_t act_size = sizeof(struct nfp_fl_act_mark);
+
+ mark = action->conf;
+
+ fl_mark = (struct nfp_fl_act_mark *)act_data;
+ fl_mark->head.jump_id = NFP_FL_ACTION_OPCODE_SET_MARK;
+ fl_mark->head.len_lw = act_size >> NFP_FL_LW_SIZ;
+ fl_mark->reserved = 0;
+ fl_mark->mark = rte_cpu_to_be_32(mark->id);
+}
+
static uint32_t
nfp_flow_count_output(const struct rte_flow_action actions[])
{
@@ -3734,6 +3756,11 @@ nfp_flow_compile_action(struct nfp_flower_representor *representor,
case RTE_FLOW_ACTION_TYPE_CONNTRACK:
PMD_DRV_LOG(DEBUG, "Process RTE_FLOW_ACTION_TYPE_CONNTRACK");
break;
+ case RTE_FLOW_ACTION_TYPE_MARK:
+ PMD_DRV_LOG(DEBUG, "Process RTE_FLOW_ACTION_TYPE_MARK");
+ nfp_flow_action_mark(position, action);
+ position += sizeof(struct nfp_fl_act_mark);
+ break;
default:
PMD_DRV_LOG(ERR, "Unsupported action type: %d", action->type);
return -ENOTSUP;
--
2.39.1
next prev parent reply other threads:[~2024-02-10 10:42 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-10 10:42 [PATCH 0/4] add support of partial offload Chaoyong He
2024-02-10 10:42 ` Chaoyong He [this message]
2024-02-10 10:42 ` [PATCH 2/4] net/nfp: add interface to check representor Chaoyong He
2024-02-12 16:24 ` Ferruh Yigit
2024-02-17 1:31 ` Chaoyong He
2024-02-10 10:42 ` [PATCH 3/4] net/nfp: representor adds RSS configuration Chaoyong He
2024-02-10 10:42 ` [PATCH 4/4] net/nfp: support RSS flow action Chaoyong He
2024-02-12 10:10 ` [PATCH 0/4] add support of partial offload David Marchand
2024-02-17 1:31 ` Chaoyong He
2024-02-23 2:42 ` [PATCH v2 0/4] add support of MARK and RSS flow action Chaoyong He
2024-02-23 2:42 ` [PATCH v2 1/4] ethdev: add function to check representor port Chaoyong He
2024-02-23 9:29 ` Ferruh Yigit
2024-02-23 2:42 ` [PATCH v2 2/4] net/nfp: support MARK flow action Chaoyong He
2024-02-23 2:42 ` [PATCH v2 3/4] net/nfp: add representor RSS configuration Chaoyong He
2024-02-23 2:42 ` [PATCH v2 4/4] net/nfp: support RSS flow action Chaoyong He
2024-02-26 1:44 ` [PATCH v3 0/4] add support of MARK and " Chaoyong He
2024-02-26 1:44 ` [PATCH v3 1/4] ethdev: add function to check representor port Chaoyong He
2024-02-26 14:31 ` Ferruh Yigit
2024-02-26 1:44 ` [PATCH v3 2/4] net/nfp: support MARK flow action Chaoyong He
2024-02-26 1:44 ` [PATCH v3 3/4] net/nfp: add representor RSS configuration Chaoyong He
2024-02-26 1:45 ` [PATCH v3 4/4] net/nfp: support RSS flow action Chaoyong He
2024-02-26 14:31 ` [PATCH v3 0/4] add support of MARK and " Ferruh Yigit
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=20240210104214.1248772-2-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--cc=long.wu@corigine.com \
--cc=oss-drivers@corigine.com \
--cc=peng.zhang@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 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).