DPDK patches and discussions
 help / color / mirror / Atom feed
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>, Ray Kinsella <mdr@ashroe.eu>
Cc: <dev@dpdk.org>, Satheesh Paul <psatheesh@marvell.com>
Subject: [dpdk-dev] [PATCH v2 1/2] common/cnxk: add support for rte flow port ID action type
Date: Thu, 21 Oct 2021 10:41:14 +0530	[thread overview]
Message-ID: <20211021051115.1473189-1-psatheesh@marvell.com> (raw)
In-Reply-To: <20211005033026.4180257-1-psatheesh@marvell.com>

From: Satheesh Paul <psatheesh@marvell.com>

This patch adds ROC API to support rte flow port ID action type.

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
---
 drivers/common/cnxk/roc_npc.c   | 35 +++++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_npc.h   |  9 +++++++++
 drivers/common/cnxk/version.map |  1 +
 3 files changed, 45 insertions(+)

diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
index 3ab8daa7ed..0a7966b52e 100644
--- a/drivers/common/cnxk/roc_npc.c
+++ b/drivers/common/cnxk/roc_npc.c
@@ -261,11 +261,38 @@ roc_npc_fini(struct roc_npc *roc_npc)
 	return 0;
 }
 
+int
+roc_npc_validate_portid_action(struct roc_npc *roc_npc_src,
+			       struct roc_npc *roc_npc_dst)
+{
+	struct roc_nix *roc_nix_src = roc_npc_src->roc_nix;
+	struct nix *nix_src = roc_nix_to_nix_priv(roc_nix_src);
+	struct roc_nix *roc_nix_dst = roc_npc_dst->roc_nix;
+	struct nix *nix_dst = roc_nix_to_nix_priv(roc_nix_dst);
+
+	if (roc_nix_is_pf(roc_npc_dst->roc_nix)) {
+		plt_err("Output port should be VF");
+		return -EINVAL;
+	}
+
+	if (nix_dst->dev.vf >= nix_src->dev.maxvf) {
+		plt_err("Invalid VF for output port");
+		return -EINVAL;
+	}
+
+	if (nix_src->dev.pf != nix_dst->dev.pf) {
+		plt_err("Output port should be VF of ingress PF");
+		return -EINVAL;
+	}
+	return 0;
+}
+
 static int
 npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 		  const struct roc_npc_action actions[],
 		  struct roc_npc_flow *flow)
 {
+	const struct roc_npc_action_port_id *act_portid;
 	struct npc *npc = roc_npc_to_npc_priv(roc_npc);
 	const struct roc_npc_action_mark *act_mark;
 	const struct roc_npc_action_meter *act_mtr;
@@ -328,6 +355,14 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 			pf_func = (pf_func | (vf_id + 1));
 			break;
 
+		case ROC_NPC_ACTION_TYPE_PORT_ID:
+			act_portid = (const struct roc_npc_action_port_id *)
+					     actions->conf;
+			pf_func &= (0xfc00);
+			pf_func = (pf_func | (act_portid->id + 1));
+			req_act |= ROC_NPC_ACTION_TYPE_VF;
+			break;
+
 		case ROC_NPC_ACTION_TYPE_QUEUE:
 			act_q = (const struct roc_npc_action_queue *)
 					actions->conf;
diff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h
index 10d1ac82a4..ef85073b17 100644
--- a/drivers/common/cnxk/roc_npc.h
+++ b/drivers/common/cnxk/roc_npc.h
@@ -77,6 +77,7 @@ enum roc_npc_action_type {
 	ROC_NPC_ACTION_TYPE_VLAN_INSERT = (1 << 13),
 	ROC_NPC_ACTION_TYPE_VLAN_ETHTYPE_INSERT = (1 << 14),
 	ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT = (1 << 15),
+	ROC_NPC_ACTION_TYPE_PORT_ID = (1 << 16),
 	ROC_NPC_ACTION_TYPE_METER = (1 << 17),
 };
 
@@ -95,6 +96,12 @@ struct roc_npc_action_vf {
 	uint32_t id;		/**< VF ID. */
 };
 
+struct roc_npc_action_port_id {
+	uint32_t original : 1;	/**< Use original DPDK port ID if possible. */
+	uint32_t reserved : 31; /**< Reserved, must be zero. */
+	uint32_t id;		/**< port ID. */
+};
+
 struct roc_npc_action_queue {
 	uint16_t index; /**< Queue index to use. */
 };
@@ -240,4 +247,6 @@ int __roc_api roc_npc_vtag_actions_sub_return(struct roc_npc *roc_npc,
 					      uint32_t count);
 int __roc_api roc_npc_mcam_merge_base_steering_rule(struct roc_npc *roc_npc,
 						    struct roc_npc_flow *flow);
+int __roc_api roc_npc_validate_portid_action(struct roc_npc *roc_npc_src,
+					     struct roc_npc *roc_npc_dst);
 #endif /* _ROC_NPC_H_ */
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index f5de985224..8d4d42f476 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -302,6 +302,7 @@ INTERNAL {
 	roc_npc_mcam_write_entry;
 	roc_npc_mcam_read_counter;
 	roc_npc_profile_name_get;
+	roc_npc_validate_portid_action;
 	roc_plt_init;
 	roc_plt_init_cb_register;
 	roc_sso_dev_fini;
-- 
2.25.4


  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 " 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 ` psatheesh [this message]
2021-10-21  5:11   ` [dpdk-dev] [PATCH v2 2/2] net/cnxk: support rte flow action type port ID psatheesh
2021-10-21 17:03     ` 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-1-psatheesh@marvell.com \
    --to=psatheesh@marvell.com \
    --cc=dev@dpdk.org \
    --cc=kirankumark@marvell.com \
    --cc=mdr@ashroe.eu \
    --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).