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 436C345B96; Mon, 21 Oct 2024 23:08:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC98540E4C; Mon, 21 Oct 2024 23:06:19 +0200 (CEST) Received: from egress-ip42a.ess.de.barracuda.com (egress-ip42a.ess.de.barracuda.com [18.185.115.201]) by mails.dpdk.org (Postfix) with ESMTP id 92FF740C35 for ; Mon, 21 Oct 2024 23:05:58 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2169.outbound.protection.outlook.com [104.47.17.169]) by mx-outbound46-162.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 21 Oct 2024 21:05:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mpAc2YOQnW0e7M6NyNuYQ9vTBrT927Q56iBeSp/dVai7WshVfCk4FFN6xz04nCCl3aWeBjIiTMzggXQXu38XTuY8/3GwGAOyNU412TJ1t9x7OXx2fvzMGYv71gdYqISsS37mwI4WZxKUqJunXqDzS6XCmOgGgjhSPU8UHNsMa83/xevUQC5UDXkT5ABlD1sXtVyaQm+aCjWO0d95bxeS4l6gk3J67u1lsmmxYEutg9gSrrv8fy5S0Fe66W1Wfa/2SNGVBPSfsYrLqaRP6DOoA0OslFVsnwuKG0w8P4Q/Db9Ryz7s4OkMV+FP9o48pJRsUHrHqxxK8f/KKfRPNYHp+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2CPMwvvnNEvI35dzw5upLwJTc0zf4/SjKEBrt+AZKHQ=; b=NokU0vMm9o0CvdeGlSBte/pqnaVRIu2qP0RMut455t7glD2iM99NvX2D6TnD5kwT7RjDWL8aKoUS3w5CEC1t3tsA+NOI+F4xMUlEgumJNT2VYy9QLQYTgpZCDJKlk2gacMtlL0SwDTbBSHelZICHRCH/tmkJmE5sG86y/uOanG+/Fx4jM8QCcV69riAn1cEz15iJtNGcpzWsn/3cQBiC2QIrzL/timDa8SJRWvyTiK7YKUHYP6cRY49RoGAQhfGNrqqbyGav0mtBLcg02ixhLo0Gpph7bBpqK5QZ+nzlCk1q1Is2fTIUgGd+CnB+P2ohO3qOOBp7NxkgW+jk0D+geg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 178.72.21.4) smtp.rcpttodomain=dpdk.org smtp.mailfrom=napatech.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=napatech.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=napatech.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2CPMwvvnNEvI35dzw5upLwJTc0zf4/SjKEBrt+AZKHQ=; b=Pr2d/DUfvfKFIidk3RbCb7Dtpo6WzbfhnP3sEVjWQ+m+ymFGx+vtOvGLwXqOHyBtTz+czL1cYAddWnFx/UYHrDhfsCj4k14L/oUYnmfRFZyCjVX9ypNisjXuGYPaJF7mch3HjureZgtx8Qbddhzcixjbce/hzwjGsgn8QBeFFxI= Received: from AS9PR04CA0138.eurprd04.prod.outlook.com (2603:10a6:20b:48a::18) by AM9P190MB1284.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:270::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.23; Mon, 21 Oct 2024 21:05:53 +0000 Received: from AMS0EPF000001A8.eurprd05.prod.outlook.com (2603:10a6:20b:48a:cafe::7c) by AS9PR04CA0138.outlook.office365.com (2603:10a6:20b:48a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28 via Frontend Transport; Mon, 21 Oct 2024 21:05:53 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 178.72.21.4) smtp.mailfrom=napatech.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=napatech.com; Received-SPF: Fail (protection.outlook.com: domain of napatech.com does not designate 178.72.21.4 as permitted sender) receiver=protection.outlook.com; client-ip=178.72.21.4; helo=localhost.localdomain; Received: from localhost.localdomain (178.72.21.4) by AMS0EPF000001A8.mail.protection.outlook.com (10.167.16.148) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 21:05:52 +0000 From: Serhii Iliushyk To: dev@dpdk.org Cc: mko-plv@napatech.com, sil-plv@napatech.com, ckm@napatech.com, andrew.rybchenko@oktetlabs.ru, ferruh.yigit@amd.com, Danylo Vodopianov Subject: [PATCH v1 28/73] net/ntnic: add PDB module Date: Mon, 21 Oct 2024 23:04:30 +0200 Message-ID: <20241021210527.2075431-29-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241021210527.2075431-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001A8:EE_|AM9P190MB1284:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 99f834d1-1546-4d4f-1632-08dcf21425f8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?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ArwcNdrOU9BVJK?= =?us-ascii?Q?JQrWCL8inx2qCmVuFVjrJVws75NgQbHm1JCTK5PePVYGrt8NCbDf7HCJ8tnW?= =?us-ascii?Q?e25UvtvYQfQ1/g2Av6m3JCx4/BJEyBDIO7myAYPnjCHbEEbGG6g295/XSxVT?= =?us-ascii?Q?wZHgfWFqmIG5AtimvxZHbMermEm628iVWvxeBEHZufTbUHg2xP7EdYDQj7P+?= =?us-ascii?Q?RFxSZf594TSh07yVaYO+Jb7JFZSjGS5e3QFkJ8HZLroSNauPoy+x5EWdUjj+?= =?us-ascii?Q?9wxC0bbfF3Z+CFVhZsAE55jCKksn8fDagsPw51ngp8Tsb+jNz6tvwMtcGRoP?= =?us-ascii?Q?XB6kZTVe4JtjaRqbqvIRt+gTv80noFmBd9SMgTmkyn72Rj0x88zx3t+kO3yM?= =?us-ascii?Q?B8FgclO4ZYJkJhFF8GC6aew+NMczhE3Jlpyxqok4riTs91zCD65tP3i/ziAl?= =?us-ascii?Q?UPRerri7qI56xe+Z/vzu69wxxGzuRSWJW8j/l/No+/mwEY6S0F3vWaHCfYbv?= =?us-ascii?Q?WO+myFdlABTxNj37U9L5rKGdTsp1y8S6l347DEhE1TzLl3eLuw=3D=3D?= X-Forefront-Antispam-Report: CIP:178.72.21.4; CTRY:DK; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:localhost.localdomain; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(82310400026)(36860700013)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 4wXXEXLe53/+Errk3lElnBOi7p8BNf/ts66qBqCLhiXGjSNchHpl8JlXnFSLRZ2C6BQAnDjGAzF2WLEpaHSaW0SQaTb9yQzf7RlRXVWow6JS7av7a6v6/LPK/vc8CVaHTnwVaP2Yr7ivVVgHJSirtxpxw9rHFL0NUlnL6Rdrk23xc1rMyAHaTF3uGVBvrKSWsvtunBtFnDsYA8SSDw3Zi43WhK9b9vYexxVsPlAbBY/oCNTNVQtvxC0BbPSUjNy80XrRjzjB7uc8jQIykxSBxtu4vbEK1pfHXjSjJk6z5zXK8md3z046mq8qBHgMzIqC4QMUL5E0eIUhvJQdaoyFkI/wFIWtbux8BEcJT8eMKcDZ7mUavtPz+oI+yPsjKKoaFYmPatXMM/hrCiNANYLjIlIv1V73qkxQF0wSe4X1RQMgms7khUjQ2J1DbQcsaUJTyFiQugRxovDRY8WQED1wba4veiRRof4eohVTS3ld4LVPzb6H0CmoTEOzw5Wt+Rxe+lSg4hVWVMNhzHxegrZHhKktrIH4kYPGubGDa5+kVfaoeJslERh6ylA0B9Y34Fl2K/yzgIdLh3NFMhEmDHKwOyTCgq92GGsTu6OFhYe9W7r8aRC+r0A9m3ShfsdTVjbcHpzKXXM5etxBRaKLgs7GntsXKbATC5TBc4T6m/GmBpU= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 21:05:52.8488 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 99f834d1-1546-4d4f-1632-08dcf21425f8 X-MS-Exchange-CrossTenant-Id: c4540d0b-728a-4233-9da5-9ea30c7ec3ed X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c4540d0b-728a-4233-9da5-9ea30c7ec3ed; Ip=[178.72.21.4]; Helo=[localhost.localdomain] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF000001A8.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9P190MB1284 X-BESS-ID: 1729544754-311938-597-22880-2 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.169 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmYmZoZAVgZQ0MIoxcAkydzS3N QwxcLcwjjF1MLA2NDIKCnZ3MQkKS1FqTYWANGc7GJBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259883 [from cloudscan8-241.eu-central-1a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 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 From: Danylo Vodopianov The Packet Description Builder module creates packet meta-data for example virtio-net headers. Signed-off-by: Danylo Vodopianov --- drivers/net/ntnic/include/hw_mod_backend.h | 3 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_pdb.c | 144 ++++++++++++++++++ .../profile_inline/flow_api_profile_inline.c | 17 +++ 3 files changed, 164 insertions(+) diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index 2711f44083..7f1449d8ee 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -740,6 +740,9 @@ int hw_mod_pdb_alloc(struct flow_api_backend_s *be); void hw_mod_pdb_free(struct flow_api_backend_s *be); int hw_mod_pdb_reset(struct flow_api_backend_s *be); int hw_mod_pdb_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_pdb_rcp_set(struct flow_api_backend_s *be, enum hw_pdb_e field, uint32_t index, + uint32_t value); + int hw_mod_pdb_config_flush(struct flow_api_backend_s *be); struct tpe_func_s { diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_pdb.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_pdb.c index c3facacb08..59285405ba 100644 --- a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_pdb.c +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_pdb.c @@ -85,6 +85,150 @@ int hw_mod_pdb_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count return be->iface->pdb_rcp_flush(be->be_dev, &be->pdb, start_idx, count); } +static int hw_mod_pdb_rcp_mod(struct flow_api_backend_s *be, enum hw_pdb_e field, uint32_t index, + uint32_t *value, int get) +{ + if (index >= be->pdb.nb_pdb_rcp_categories) { + INDEX_TOO_LARGE_LOG; + return INDEX_TOO_LARGE; + } + + switch (_VER_) { + case 9: + switch (field) { + case HW_PDB_RCP_PRESET_ALL: + if (get) { + UNSUP_FIELD_LOG; + return UNSUP_FIELD; + } + + memset(&be->pdb.v9.rcp[index], (uint8_t)*value, + sizeof(struct pdb_v9_rcp_s)); + break; + + case HW_PDB_RCP_FIND: + if (!get) { + UNSUP_FIELD_LOG; + return UNSUP_FIELD; + } + + if (*value >= be->pdb.nb_pdb_rcp_categories) { + INDEX_TOO_LARGE_LOG; + return INDEX_TOO_LARGE; + } + + FIND_EQUAL_INDEX(be->pdb.v9.rcp, struct pdb_v9_rcp_s, index, *value, + be->pdb.nb_pdb_rcp_categories); + break; + + case HW_PDB_RCP_COMPARE: + if (!get) { + UNSUP_FIELD_LOG; + return UNSUP_FIELD; + } + + if (*value >= be->pdb.nb_pdb_rcp_categories) { + INDEX_TOO_LARGE_LOG; + return INDEX_TOO_LARGE; + } + + DO_COMPARE_INDEXS(be->pdb.v9.rcp, struct pdb_v9_rcp_s, index, *value); + break; + + case HW_PDB_RCP_DESCRIPTOR: + GET_SET(be->pdb.v9.rcp[index].descriptor, value); + break; + + case HW_PDB_RCP_DESC_LEN: + GET_SET(be->pdb.v9.rcp[index].desc_len, value); + break; + + case HW_PDB_RCP_TX_PORT: + GET_SET(be->pdb.v9.rcp[index].tx_port, value); + break; + + case HW_PDB_RCP_TX_IGNORE: + GET_SET(be->pdb.v9.rcp[index].tx_ignore, value); + break; + + case HW_PDB_RCP_TX_NOW: + GET_SET(be->pdb.v9.rcp[index].tx_now, value); + break; + + case HW_PDB_RCP_CRC_OVERWRITE: + GET_SET(be->pdb.v9.rcp[index].crc_overwrite, value); + break; + + case HW_PDB_RCP_ALIGN: + GET_SET(be->pdb.v9.rcp[index].align, value); + break; + + case HW_PDB_RCP_OFS0_DYN: + GET_SET(be->pdb.v9.rcp[index].ofs0_dyn, value); + break; + + case HW_PDB_RCP_OFS0_REL: + GET_SET_SIGNED(be->pdb.v9.rcp[index].ofs0_rel, value); + break; + + case HW_PDB_RCP_OFS1_DYN: + GET_SET(be->pdb.v9.rcp[index].ofs1_dyn, value); + break; + + case HW_PDB_RCP_OFS1_REL: + GET_SET_SIGNED(be->pdb.v9.rcp[index].ofs1_rel, value); + break; + + case HW_PDB_RCP_OFS2_DYN: + GET_SET(be->pdb.v9.rcp[index].ofs2_dyn, value); + break; + + case HW_PDB_RCP_OFS2_REL: + GET_SET_SIGNED(be->pdb.v9.rcp[index].ofs2_rel, value); + break; + + case HW_PDB_RCP_IP_PROT_TNL: + GET_SET(be->pdb.v9.rcp[index].ip_prot_tnl, value); + break; + + case HW_PDB_RCP_PPC_HSH: + GET_SET(be->pdb.v9.rcp[index].ppc_hsh, value); + break; + + case HW_PDB_RCP_DUPLICATE_EN: + GET_SET(be->pdb.v9.rcp[index].duplicate_en, value); + break; + + case HW_PDB_RCP_DUPLICATE_BIT: + GET_SET(be->pdb.v9.rcp[index].duplicate_bit, value); + break; + + case HW_PDB_RCP_PCAP_KEEP_FCS: + GET_SET(be->pdb.v9.rcp[index].pcap_keep_fcs, value); + break; + + default: + UNSUP_FIELD_LOG; + return UNSUP_FIELD; + } + + break; + + /* end case 9 */ + default: + UNSUP_VER_LOG; + return UNSUP_VER; + } + + return 0; +} + +int hw_mod_pdb_rcp_set(struct flow_api_backend_s *be, enum hw_pdb_e field, uint32_t index, + uint32_t value) +{ + return hw_mod_pdb_rcp_mod(be, field, index, &value, 0); +} + int hw_mod_pdb_config_flush(struct flow_api_backend_s *be) { return be->iface->pdb_config_flush(be->be_dev, &be->pdb); diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c index c2a0273aa2..fe5f82b3bd 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c @@ -2492,6 +2492,19 @@ int initialize_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev) /* SLC LR index 0 is reserved */ flow_nic_mark_resource_used(ndev, RES_SLC_LR_RCP, 0); + /* PDB setup Direct Virtio Scatter-Gather descriptor of 12 bytes for its recipe 0 + */ + if (hw_mod_pdb_rcp_set(&ndev->be, HW_PDB_RCP_DESCRIPTOR, 0, 7) < 0) + goto err_exit0; + + if (hw_mod_pdb_rcp_set(&ndev->be, HW_PDB_RCP_DESC_LEN, 0, 6) < 0) + goto err_exit0; + + if (hw_mod_pdb_rcp_flush(&ndev->be, 0, 1) < 0) + goto err_exit0; + + flow_nic_mark_resource_used(ndev, RES_PDB_RCP, 0); + /* Setup filter using matching all packets violating traffic policing parameters */ flow_nic_mark_resource_used(ndev, RES_CAT_CFN, NT_VIOLATING_MBR_CFN); @@ -2549,6 +2562,10 @@ int done_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev) flow_nic_free_resource(ndev, RES_TPE_EXT, 0); flow_nic_free_resource(ndev, RES_TPE_RPL, 0); + hw_mod_pdb_rcp_set(&ndev->be, HW_PDB_RCP_PRESET_ALL, 0, 0); + hw_mod_pdb_rcp_flush(&ndev->be, 0, 1); + flow_nic_free_resource(ndev, RES_PDB_RCP, 0); + hw_db_inline_destroy(ndev->hw_db_handle); #ifdef FLOW_DEBUG -- 2.45.0