From patchwork Thu Oct 21 05:11:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satheesh Paul Antonysamy X-Patchwork-Id: 102518 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C40B9A0C4B; Thu, 21 Oct 2021 07:11:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AD6AC410E2; Thu, 21 Oct 2021 07:11:32 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 0778E40142 for ; Thu, 21 Oct 2021 07:11:30 +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 19KMsQIx002523; Wed, 20 Oct 2021 22:11:27 -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=bd12pRPdaT9ExKlH2eT71crvkGVNfgtZzMs03Y4+/0E=; b=Rdz3LbpoctVc7hLSGE7S6SZobUT7Aflid+3yaAkdInzohYVhn2p4FG9IA8NtNzeBmYfa vmmO02tPEg+NDx6bqhkOI9FEIqJTClv+REYZQAxKDdreult0DdFXF0vu3+vkBIYyAEvL xjeUFQlFBK5u84UUOykgfVFn+HvBrS0Nn0l/5ekCrsU7tT+Dn/xNqtO7uM35Q/vhrytI yCBGDGbqM7UPzq96YUnkGRHV+6rI9wifjHZWsG2tbeY5UPwsErdwXYAmri5NyX11Iios 1mPtT9LqruQdWsWCYT2JCjayOWw4RJYOhj8JRZfxKYzsIKWt21faJ0maRJgayRYA+1lC Tg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 3btjwdm6a7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 20 Oct 2021 22:11:27 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 20 Oct 2021 22:11:25 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Wed, 20 Oct 2021 22:11:25 -0700 Received: from localhost.localdomain (unknown [10.28.34.33]) by maili.marvell.com (Postfix) with ESMTP id 8A2AA3F7059; Wed, 20 Oct 2021 22:11:23 -0700 (PDT) From: To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Ray Kinsella CC: , Satheesh Paul Date: Thu, 21 Oct 2021 10:41:14 +0530 Message-ID: <20211021051115.1473189-1-psatheesh@marvell.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20211005033026.4180257-1-psatheesh@marvell.com> References: <20211005033026.4180257-1-psatheesh@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 4kZ5FLQSA5MvAtosoTIJPNaDY-Gx611Z X-Proofpoint-ORIG-GUID: 4kZ5FLQSA5MvAtosoTIJPNaDY-Gx611Z 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 1/2] common/cnxk: add support for rte flow port ID action type 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 ROC API to support rte flow port ID action type. Signed-off-by: Satheesh Paul --- 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;