From: <psatheesh@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>
Cc: <dev@dpdk.org>, Satheesh Paul <psatheesh@marvell.com>
Subject: [dpdk-dev] [PATCH v2 2/2] net/cnxk: support rte flow action type port ID
Date: Thu, 21 Oct 2021 10:41:15 +0530 [thread overview]
Message-ID: <20211021051115.1473189-2-psatheesh@marvell.com> (raw)
In-Reply-To: <20211021051115.1473189-1-psatheesh@marvell.com>
From: Satheesh Paul <psatheesh@marvell.com>
This patch adds support for rte flow action type port_id to
enable directing packets from an input port PF to an output
port which is a VF of the input port PF.
Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
---
doc/guides/nics/cnxk.rst | 5 +++++
doc/guides/nics/features/cnxk.ini | 1 +
drivers/net/cnxk/cnxk_rte_flow.c | 36 +++++++++++++++++++++++++++++++
3 files changed, 42 insertions(+)
diff --git a/doc/guides/nics/cnxk.rst b/doc/guides/nics/cnxk.rst
index d3d9682501..05c66d94b1 100644
--- a/doc/guides/nics/cnxk.rst
+++ b/doc/guides/nics/cnxk.rst
@@ -305,6 +305,11 @@ RTE flow GRE support
- ``RTE_FLOW_ITEM_TYPE_GRE_KEY`` works only when checksum and routing
bits in the GRE header are equal to 0.
+RTE flow action port_id support
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- ``RTE_FLOW_ACTION_TYPE_PORT_ID`` is only supported between PF and its VFs.
+
Custom protocols supported in RTE Flow
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/guides/nics/features/cnxk.ini b/doc/guides/nics/features/cnxk.ini
index f0586457ca..03af0da302 100644
--- a/doc/guides/nics/features/cnxk.ini
+++ b/doc/guides/nics/features/cnxk.ini
@@ -85,6 +85,7 @@ of_push_vlan = Y
of_set_vlan_pcp = Y
of_set_vlan_vid = Y
pf = Y
+port_id = Y
queue = Y
rss = Y
security = Y
diff --git a/drivers/net/cnxk/cnxk_rte_flow.c b/drivers/net/cnxk/cnxk_rte_flow.c
index ad89a2e105..dfc33ba865 100644
--- a/drivers/net/cnxk/cnxk_rte_flow.c
+++ b/drivers/net/cnxk/cnxk_rte_flow.c
@@ -110,7 +110,13 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
struct roc_npc_action in_actions[], uint32_t *flowkey_cfg)
{
struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+ const struct rte_flow_action_port_id *port_act;
const struct rte_flow_action_queue *act_q;
+ struct roc_npc *roc_npc_src = &dev->npc;
+ struct rte_eth_dev *portid_eth_dev;
+ char if_name[RTE_ETH_NAME_MAX_LEN];
+ struct cnxk_eth_dev *hw_dst;
+ struct roc_npc *roc_npc_dst;
int i = 0, rc = 0;
int rq;
@@ -146,6 +152,36 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
in_actions[i].conf = actions->conf;
break;
+ case RTE_FLOW_ACTION_TYPE_PORT_ID:
+ in_actions[i].type = ROC_NPC_ACTION_TYPE_PORT_ID;
+ in_actions[i].conf = actions->conf;
+ port_act = (const struct rte_flow_action_port_id *)
+ actions->conf;
+ if (rte_eth_dev_get_name_by_port(port_act->id,
+ if_name)) {
+ plt_err("Name not found for output port id");
+ goto err_exit;
+ }
+ portid_eth_dev = rte_eth_dev_allocated(if_name);
+ if (!portid_eth_dev) {
+ plt_err("eth_dev not found for output port id");
+ goto err_exit;
+ }
+ if (strcmp(portid_eth_dev->device->driver->name,
+ eth_dev->device->driver->name) != 0) {
+ plt_err("Output port not under same driver");
+ goto err_exit;
+ }
+ hw_dst = portid_eth_dev->data->dev_private;
+ roc_npc_dst = &hw_dst->npc;
+
+ rc = roc_npc_validate_portid_action(roc_npc_src,
+ roc_npc_dst);
+
+ if (rc)
+ goto err_exit;
+ break;
+
case RTE_FLOW_ACTION_TYPE_QUEUE:
act_q = (const struct rte_flow_action_queue *)
actions->conf;
--
2.25.4
next prev parent reply other threads:[~2021-10-21 5:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-05 3:30 [dpdk-dev] [PATCH 1/2] common/cnxk: add support for rte flow port ID action type psatheesh
2021-10-05 3:30 ` [dpdk-dev] [PATCH 2/2] net/cnxk: support rte flow action type port ID psatheesh
2021-10-20 18:33 ` [dpdk-dev] [PATCH 1/2] common/cnxk: add support for rte flow port ID action type Jerin Jacob
2021-10-21 5:11 ` [dpdk-dev] [PATCH v2 " psatheesh
2021-10-21 5:11 ` psatheesh [this message]
2021-10-21 17:03 ` [dpdk-dev] [PATCH v2 2/2] net/cnxk: support rte flow action type port ID Jerin Jacob
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=20211021051115.1473189-2-psatheesh@marvell.com \
--to=psatheesh@marvell.com \
--cc=dev@dpdk.org \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.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).