dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
* [dpdk-dev]  [PATCH] net/octeontx2: add PF and VF action support
@ 2019-07-08  3:36 kirankumark
  2019-07-08  4:55 ` Jerin Jacob Kollanukkaran
  0 siblings, 1 reply; 3+ messages in thread
From: kirankumark @ 2019-07-08  3:36 UTC (permalink / raw)
  To: dev; +Cc: Kiran Kumar K

From: Kiran Kumar K <kirankumark@marvell.com>

Adding PF and VF action support for octeontx2 Flow.
If RTE_FLOW_ACTION_TYPE_PF action is set from VF, then the packet
will be sent to the parent PF.
If RTE_FLOW_ACTION_TYPE_VF action is set and original is specified,
then the packet will be sent to the original VF, otherwise the packet
will be sent to the VF specified in the vf_id.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
---
 doc/guides/nics/octeontx2.rst           |  4 ++++
 drivers/net/octeontx2/otx2_flow.h       |  2 ++
 drivers/net/octeontx2/otx2_flow_parse.c | 32 ++++++++++++++++++++++---
 3 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/doc/guides/nics/octeontx2.rst b/doc/guides/nics/octeontx2.rst
index a8ed3838f..fbf4c4726 100644
--- a/doc/guides/nics/octeontx2.rst
+++ b/doc/guides/nics/octeontx2.rst
@@ -292,6 +292,10 @@ Actions:
    +----+--------------------------------+
    | 8  | RTE_FLOW_ACTION_TYPE_SECURITY  |
    +----+--------------------------------+
+   | 9  | RTE_FLOW_ACTION_TYPE_PF        |
+   +----+--------------------------------+
+   | 10 | RTE_FLOW_ACTION_TYPE_VF        |
+   +----+--------------------------------+
 
 .. _table_octeontx2_supported_egress_action_types:
 
diff --git a/drivers/net/octeontx2/otx2_flow.h b/drivers/net/octeontx2/otx2_flow.h
index f5cc3b983..a27ceeb1a 100644
--- a/drivers/net/octeontx2/otx2_flow.h
+++ b/drivers/net/octeontx2/otx2_flow.h
@@ -52,6 +52,8 @@ enum {
 #define OTX2_FLOW_ACT_DUP     (1 << 5)
 #define OTX2_FLOW_ACT_SEC     (1 << 6)
 #define OTX2_FLOW_ACT_COUNT   (1 << 7)
+#define OTX2_FLOW_ACT_PF      (1 << 8)
+#define OTX2_FLOW_ACT_VF      (1 << 9)
 
 /* terminating actions */
 #define OTX2_FLOW_ACT_TERM    (OTX2_FLOW_ACT_DROP  | \
diff --git a/drivers/net/octeontx2/otx2_flow_parse.c b/drivers/net/octeontx2/otx2_flow_parse.c
index 1940cc636..3e6f5b8df 100644
--- a/drivers/net/octeontx2/otx2_flow_parse.c
+++ b/drivers/net/octeontx2/otx2_flow_parse.c
@@ -751,15 +751,17 @@ otx2_flow_parse_actions(struct rte_eth_dev *dev,
 	const struct rte_flow_action_count *act_count;
 	const struct rte_flow_action_mark *act_mark;
 	const struct rte_flow_action_queue *act_q;
+	const struct rte_flow_action_vf *vf_act;
 	const char *errmsg = NULL;
 	int sel_act, req_act = 0;
-	uint16_t pf_func;
+	uint16_t pf_func, vf_id;
 	int errcode = 0;
 	int mark = 0;
 	int rq = 0;
 
 	/* Initialize actions */
 	flow->ctr_id = NPC_COUNTER_NONE;
+	pf_func = otx2_pfvf_func(hw->pf, hw->vf);
 
 	for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
 		otx2_npc_dbg("Action type = %d", actions->type);
@@ -807,6 +809,27 @@ otx2_flow_parse_actions(struct rte_eth_dev *dev,
 			req_act |= OTX2_FLOW_ACT_DROP;
 			break;
 
+		case RTE_FLOW_ACTION_TYPE_PF:
+			req_act |= OTX2_FLOW_ACT_PF;
+			pf_func &= (0xfc00);
+			break;
+
+		case RTE_FLOW_ACTION_TYPE_VF:
+			vf_act = (const struct rte_flow_action_vf *)
+				actions->conf;
+			req_act |= OTX2_FLOW_ACT_VF;
+			if (vf_act->original == 0) {
+				vf_id = (vf_act->id & RVU_PFVF_FUNC_MASK) + 1;
+				if (vf_id  >= hw->maxvf) {
+					errmsg = "invalid vf specified";
+					errcode = EINVAL;
+					goto err_exit;
+				}
+				pf_func &= (0xfc00);
+				pf_func = (pf_func | vf_id);
+			}
+			break;
+
 		case RTE_FLOW_ACTION_TYPE_QUEUE:
 			/* Applicable only to ingress flow */
 			act_q = (const struct rte_flow_action_queue *)
@@ -902,7 +925,11 @@ otx2_flow_parse_actions(struct rte_eth_dev *dev,
 	}
 
 	/* Set NIX_RX_ACTIONOP */
-	if (req_act & OTX2_FLOW_ACT_DROP) {
+	if (req_act & (OTX2_FLOW_ACT_PF | OTX2_FLOW_ACT_VF)) {
+		flow->npc_action = NIX_RX_ACTIONOP_UCAST;
+		if (req_act & OTX2_FLOW_ACT_QUEUE)
+			flow->npc_action |= (uint64_t)rq << 20;
+	} else if (req_act & OTX2_FLOW_ACT_DROP) {
 		flow->npc_action = NIX_RX_ACTIONOP_DROP;
 	} else if (req_act & OTX2_FLOW_ACT_QUEUE) {
 		flow->npc_action = NIX_RX_ACTIONOP_UCAST;
@@ -946,7 +973,6 @@ otx2_flow_parse_actions(struct rte_eth_dev *dev,
 
 set_pf_func:
 	/* Ideally AF must ensure that correct pf_func is set */
-	pf_func = otx2_pfvf_func(hw->pf, hw->vf);
 	flow->npc_action |= (uint64_t)pf_func << 4;
 
 	return 0;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/octeontx2: add PF and VF action support
  2019-07-08  3:36 [dpdk-dev] [PATCH] net/octeontx2: add PF and VF action support kirankumark
@ 2019-07-08  4:55 ` Jerin Jacob Kollanukkaran
  2019-07-09 11:01   ` Jerin Jacob Kollanukkaran
  0 siblings, 1 reply; 3+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-07-08  4:55 UTC (permalink / raw)
  To: Kiran Kumar Kokkilagadda, dev; +Cc: Kiran Kumar Kokkilagadda

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of
> kirankumark@marvell.com
> Sent: Monday, July 8, 2019 9:06 AM
> To: dev@dpdk.org
> Cc: Kiran Kumar Kokkilagadda <kirankumark@marvell.com>
> Subject: [dpdk-dev] [PATCH] net/octeontx2: add PF and VF action support
> 
> From: Kiran Kumar K <kirankumark@marvell.com>
> 
> Adding PF and VF action support for octeontx2 Flow.
> If RTE_FLOW_ACTION_TYPE_PF action is set from VF, then the packet will be
> sent to the parent PF.
> If RTE_FLOW_ACTION_TYPE_VF action is set and original is specified, then
> the packet will be sent to the original VF, otherwise the packet will be sent to
> the VF specified in the vf_id.
> 
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>

Acked-by: Jerin Jacob <jerinj@marvell.com>

> ---
>  doc/guides/nics/octeontx2.rst           |  4 ++++
>  drivers/net/octeontx2/otx2_flow.h       |  2 ++
>  drivers/net/octeontx2/otx2_flow_parse.c | 32
> ++++++++++++++++++++++---
>  3 files changed, 35 insertions(+), 3 deletions(-)
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/octeontx2: add PF and VF action support
  2019-07-08  4:55 ` Jerin Jacob Kollanukkaran
@ 2019-07-09 11:01   ` Jerin Jacob Kollanukkaran
  0 siblings, 0 replies; 3+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-07-09 11:01 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran, Kiran Kumar Kokkilagadda, dev
  Cc: Kiran Kumar Kokkilagadda, ferruh.yigit

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Jerin Jacob Kollanukkaran
> Sent: Monday, July 8, 2019 10:26 AM
> To: Kiran Kumar Kokkilagadda <kirankumark@marvell.com>; dev@dpdk.org
> Cc: Kiran Kumar Kokkilagadda <kirankumark@marvell.com>
> Subject: Re: [dpdk-dev] [PATCH] net/octeontx2: add PF and VF action
> support
> 
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of
> kirankumark@marvell.com
> > Sent: Monday, July 8, 2019 9:06 AM
> > To: dev@dpdk.org
> > Cc: Kiran Kumar Kokkilagadda <kirankumark@marvell.com>
> > Subject: [dpdk-dev] [PATCH] net/octeontx2: add PF and VF action
> > support
> >
> > From: Kiran Kumar K <kirankumark@marvell.com>
> >
> > Adding PF and VF action support for octeontx2 Flow.
> > If RTE_FLOW_ACTION_TYPE_PF action is set from VF, then the packet will
> > be sent to the parent PF.
> > If RTE_FLOW_ACTION_TYPE_VF action is set and original is specified,
> > then the packet will be sent to the original VF, otherwise the packet
> > will be sent to the VF specified in the vf_id.
> >
> > Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> 
> Acked-by: Jerin Jacob <jerinj@marvell.com>

Applied to dpdk-next-net-mrvl/master. Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-09 11:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-08  3:36 [dpdk-dev] [PATCH] net/octeontx2: add PF and VF action support kirankumark
2019-07-08  4:55 ` Jerin Jacob Kollanukkaran
2019-07-09 11:01   ` Jerin Jacob Kollanukkaran

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).