From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DBD0EA0C4B; Thu, 21 Oct 2021 07:11:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AD45841124; Thu, 21 Oct 2021 07:11:37 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 1147141173 for ; Thu, 21 Oct 2021 07:11:32 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19KMa78X028540 for ; Wed, 20 Oct 2021 22:11:32 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=7pODh1JCKzkLTv2Q8hqJaoKJPt1F9VMu9uCqEHcPF8w=; b=O7pl+b3aywn5ZOInjL0fJGR1mZv/6s5Do8IfUysuDL1PIPSoLj76ciBaNC35eSrEwR8v 4UYEZ4iEJ0m2eDw9aKB2T4WOZgVinjdCfzNKpm2buTv+ek9dhoJXeSiIXfniZ2Ks6uDc ne93pfcNkCuq2LLbpXrxm5JgiaMwlmG9kdD01Mz5pCYwB2mRbTUIv4vyYmYfH2KTBM2C chBK/WN83RiJcolGL6M6aLWfLRPl8StPEwZgK3E9uK1z6g/MJgPg4yJZnrO/Lj0iVCmT MmfhLEyK/LJFqCXLp9l28Z0xUnYXY2jXnY/vszkiq40USEkXxq0ey8AILo3oruRSBBGK DA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com with ESMTP id 3btjwdm6ac-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 20 Oct 2021 22:11:32 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 20 Oct 2021 22:11:30 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Wed, 20 Oct 2021 22:11:30 -0700 Received: from localhost.localdomain (unknown [10.28.34.33]) by maili.marvell.com (Postfix) with ESMTP id 661FE3F706A; Wed, 20 Oct 2021 22:11:28 -0700 (PDT) From: To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Satheesh Paul Date: Thu, 21 Oct 2021 10:41:15 +0530 Message-ID: <20211021051115.1473189-2-psatheesh@marvell.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20211021051115.1473189-1-psatheesh@marvell.com> References: <20211005033026.4180257-1-psatheesh@marvell.com> <20211021051115.1473189-1-psatheesh@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: RLfiZtj7j25wdfheI90_EsX0GBnc6Mdk X-Proofpoint-ORIG-GUID: RLfiZtj7j25wdfheI90_EsX0GBnc6Mdk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-21_01,2021-10-20_02,2020-04-07_01 Subject: [dpdk-dev] [PATCH v2 2/2] net/cnxk: support rte flow action type port ID X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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: Satheesh Paul 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 --- 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