From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1088CA00E6 for ; Mon, 8 Jul 2019 05:36:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EB107397D; Mon, 8 Jul 2019 05:36:27 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 6A3E0325F for ; Mon, 8 Jul 2019 05:36:26 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x683ZVv0027190 for ; Sun, 7 Jul 2019 20:36:25 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=CEye+N+oRLif9OAL9BBJ/FkWVMe0cfVS9Y2nf0c7MHA=; b=XRhyqxqOcPDSsSQvokSZrngY3l2rUz7m1IgPytomti0jWPfnN2dsJuJYV7eE9MjDY4kR SzrzDlDvOszPCvpNQnSM2vFpuARC1eaoNnxSs2wbgeE6gF7s3YB2b4Rswvowo4A9VOuj /pYfqTWU5+6bqPNdgn4fW985zrzrKAjz3h8rnfj7sbBHQfFXxkpzLhL5uPHPbnLCfpnf 1Cv6A1IJ2mwMy4wkpf4C2jWhseqxJLKbGefHPTCyTKCkW166M555vR6ghWuWQFIYdz45 jOEukTB1sBV4mafHupfdI89HGGHd3jjE8M+YJ4CvgSMH9d6CTDB4CnFRl1iW+PTv1Hzo eA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2tjs0nx0dq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sun, 07 Jul 2019 20:36:25 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 7 Jul 2019 20:36:24 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Sun, 7 Jul 2019 20:36:24 -0700 Received: from localhost.localdomain (unknown [10.28.34.15]) by maili.marvell.com (Postfix) with ESMTP id 4C4453F703F; Sun, 7 Jul 2019 20:36:23 -0700 (PDT) From: To: CC: Kiran Kumar K Date: Mon, 8 Jul 2019 09:06:15 +0530 Message-ID: <20190708033615.26373-1-kirankumark@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-08_01:, , signatures=0 Subject: [dpdk-dev] [PATCH] net/octeontx2: add PF and VF action support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Kiran Kumar K 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 --- 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