From patchwork Fri Oct 4 15:34:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145108 X-Patchwork-Delegate: ferruh.yigit@amd.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 C099745AAF; Fri, 4 Oct 2024 17:54:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6F40442E9B; Fri, 4 Oct 2024 17:51:27 +0200 (CEST) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id 1E2D142DD4 for ; Fri, 4 Oct 2024 17:51:22 +0200 (CEST) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03lp2173.outbound.protection.outlook.com [104.47.51.173]) by mx-outbound22-159.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:51:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Sm0AJMq+Xap16mj92P1TcoQtHDd9q+nRSPUJwV1ev36cHSVBopdbPIcEUVsXnWech9qAk6it197moJBvzYZLXihP1fn4LqoyKlj+uU8ra16ux1579wbYLJweLEWOcT4W+Eobfpi5ZCv7xd78DASK/I7WFZEKaRPWnZklH9/hEczaUOwiV0MXwsT14dCbLJJrtgSTZB2eqNhSdxj4ZRwitTOlw9DbUKvUFjpxQ1xRwTgJWSERN9h1o/KDaTmPgQe17vdWvp82rfgppTeFt4UIfnLbQWiVBNZQWlL1Ah8bzBlaE2F2JuQsmx0aWA+IQBRZPc28aqXlxHFutxvzOcVcJg== 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=He3S6m7kJ3Xag+jT56h7FD4ba2B4AVdH+Ae48QI0E/I=; b=TEUw1HqxgoWtdtL2/le2T5fPZZ5/fqnzLQc+aVE6YQVMuP6Fo0fqAxsm73A+qq2f/QRCLXn6C7pEea3dXMhreTuhufTOpwBLi1azZMH2uigY/hbkOAztS4dvdizB74jcy7VVxmArR/aje/GPAdGb/NNFcsz0srIORASFHIvKeYdE+iVGwpMMm2vz13kmdCJrwZSpLFeORHmRDQgh+LPugPA1eSL0NGYX6wqKBq9DgUsLts3pT/aJLK8PstCVV7/3unJIajfLqSGT/5w0iQEZ23qKUv4ZHxsFQ8V+OUHj9+JRrjGu3rXRNtsu8BjTd8yNCqDZubnoi0hho4G5XIKb4Q== 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=He3S6m7kJ3Xag+jT56h7FD4ba2B4AVdH+Ae48QI0E/I=; b=Takzfid3OTaIGSmN9wd51Bqbr8PlIC4u2QscSvW5eheP4HJVajuDWHDkv4aYnwwcfw4h8j34/NRaejSqZpoJgU+SBFeOtt0KStsvGY+x+TLkZkjOh81jtRtrlZSorvikicLVlVb+jDQliIsLoynt9qFeIn/SFkWNnp4Xe8FRJyI= Received: from AM0PR10CA0107.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::24) by AM9P190MB1281.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:268::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 15:36:01 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::76) by AM0PR10CA0107.outlook.office365.com (2603:10a6:208:e6::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:01 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:01 +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, Oleksandr Kolomeiets Subject: [PATCH v1 1/5] net/ntnic: update NT NiC PMD driver with FPGA version Date: Fri, 4 Oct 2024 17:34:19 +0200 Message-ID: <20241004153551.267935-2-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|AM9P190MB1281:EE_ X-MS-Office365-Filtering-Correlation-Id: eed4192b-aa38-4c12-1d11-08dce48a4041 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: wDlJRcuZX957LkQtpvDimUep0sJmI7sw8aOIUc6ti6/gGQYAtbjL7/E/k9AQBluRS43LldLD69LWZAsx8UuK9M/D3++k/pPcs7CIl5uN+HHGtoNijQyQv+za9+fqiL3vPzTK3LMa1rAkiujghvsyI1zL2m93mG2ynYDYz9bc1qTb+xFc9F9DG1EHNc5McmXacfY+ixxhnoXi6WWSbnS66xEjtVL8LFBlb26G3hjCwuBff6KGFVApjwthBsh/cMk9uEBlQFXbPtdoFJQjb21UIBiag3UXd0GGWwrORN20BOSy94wWaf9fYlYhrlt1eh+jaht+iROLh8iE5+Mc0tS+z6Uz98AFsHhbzc9oes+hTm3egc1r/wu5iCig1xbgWEMG2Hfuh/bNaluk1Eqo+LZAbHkvCQr/EYHRoj1SJefnidtJ+k7Z7awPDuh0V3AXhiRx9KTdNauApKAGqG/1hxdiw6js16uASmDpxP6olhCniBdUKB5UzAkmceO36XwBGu1AT8u1Ds93VSBo4tpcto6d7p0vAKlLkIZoqdwAgZ61hGiMIB4RVakb/r4IhdhEjj8tZgdnsK62h3aI0jU3e5XeMAyAM4CBZmj5K/ZHUwUJaadZZsX4Kkz/Sd1QEgF8YKcJTaEO6mYxwkXAcVjyq7dAwuZBwtVdOJyImnC/BYs2Uad5Yo6pFLnAXj9OdbObkViRDGlE9IYG7AEzB8QG5PYqKRcu6vWQ1Okl9gC0hr+6OOsAsNU+UWESpTwDkmaZ9fGN44pn0tgba9Mjm1qzcjESJmRUYsw7PrIKyEm8abZTZrClOg/2h6uz6h6wY09q8CNp/ZJNxT89CyXHdazD172CwPAhBZQQQCBH7YKyh3dS/bTIJN/nkNJkP7UgLN8o2wn4x5ahNv166/Mdb7lONqanBfFyCkyn1OFDNRyayrVBxIaSQ/Yyg4NaKv9wf13bNUw5kCLJjIfGO7bO8tnolEZ1t2f4dyVjeaMLdHorvhp6Kf5TYxpKTrqQdJgyGeneHEPSVxXSt4fpAidlkLz5fG9auftaVChgzEl9ZwDmv/7PboD+I5c7xTJrQvOaUK1207meLAzmtC64GHS97fhC5bGkKXEdm+pkhQZcj1oPM4VQe/q7VwS2O78ueQ82GMzJOG4VUj4gA75ReLuZgv5TxDniXHlEwIhZVL8n+0/sMmfSIJQB8KHnz0OkCC5PaEkcFj/cLDabInQWK517+hnt9TggUCzguo2eSfqUKoXhtMzcjkMUQfbRefwPAHO4mLA+SKRxlUL2O/V65zOlV3p0nxQBGaK1sbjH00gHEQ0tSqNA8s7KKrh2/R71gfWwJU2N+CEWqFhahA3hHGfkyoCCyqsHm0MQ9LEvtNNPnHVOP3ueppc5s3RheyBnkBivdaW2MbrI 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)(82310400026)(1800799024)(36860700013)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 1VYEBpVrp1MThkREM/YqCSYDZfU4PTVBGkvLTc3UfyLUmkbxjp7hd072W8OZscr+wjB9Wvw7MkwLRdz7HdX9mftGrekSbnx0PszSWei5uBxCemm9Yub2CtC4eet5/UmZ5ORGtyPjAOOxnNl1fa6PpsxPJ3oUC+2Bzh8dE+GsIG+XKFeZ2ZGBdA7HNrnOIHeqs3WSwG/PgOK9JYrrn2aUmwnlDNlzQYwnpzE0W03yPOCmN0Qpp2Nqfhv0r/9tNreHu/CiFs4quLd3uv+I+gkEJ9NGMHViugvV3eN6aW8fO/+YSJ+R2SWcBYI4yWm05SotEUTRwiI5Qqst9+Jz6MHc6LjNnQQU126W1tZP1axEHkuzjXQ4IBzDDchNVaxglmMpvecGek5YYcY61SMFQVSXaYXecRMqVn4a4WMAQYM2GDDIUyHppI0+DQTsdHTkwYX7clTRRl6K5IyYMlyIRlLdbL4To1VDPMqycciKvnWDqPWKwa0jribzh6ZeY/dvTS9buzSU5FTIPUOzkSH//SBnkpKDle0SiDJV88b+g9QKK5ARILai+MrPPCRZlkfEiLJNDi9ZE+1Ze6liwNbrI+cK3QH15Up18St3ySqJw//DWTM1e0Cb0XIt7QQQVogGEdYI/JHK6beSv0UGY9za9xhpHg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:01.2521 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eed4192b-aa38-4c12-1d11-08dce48a4041 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9P190MB1281 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057081-305791-12643-36029-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.51.173 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVhamRmZAVgZQ0CjVJNXM1DzVOM XEMjEx1cLI0NDUJCXRwCLJzNzIyMxEqTYWADW0IdZBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan11-98.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: Oleksandr Kolomeiets Update base FPGA files to the new version(39->49) Fix code style problems Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/meson.build | 2 +- .../net/ntnic/nthw/model/nthw_fpga_model.c | 11 +++--- ...9_0000.c => nthw_fpga_9563_055_049_0000.c} | 34 +++++++++---------- .../nthw/supported/nthw_fpga_instances.c | 2 +- .../nthw/supported/nthw_fpga_instances.h | 2 +- 5 files changed, 25 insertions(+), 26 deletions(-) rename drivers/net/ntnic/nthw/supported/{nthw_fpga_9563_055_039_0000.c => nthw_fpga_9563_055_049_0000.c} (98%) diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 9df2378f7c..e9f2110b8f 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -26,7 +26,7 @@ sources = files( 'link_mgmt/link_100g/nt4ga_link_100g.c', 'link_mgmt/nt4ga_link.c', 'nim/i2c_nim.c', - 'nthw/supported/nthw_fpga_9563_055_039_0000.c', + 'nthw/supported/nthw_fpga_9563_055_049_0000.c', 'nthw/supported/nthw_fpga_instances.c', 'nthw/supported/nthw_fpga_mod_str_map.c', 'nthw/core/nt200a0x/clock_profiles/nthw_fpga_clk9563.c', diff --git a/drivers/net/ntnic/nthw/model/nthw_fpga_model.c b/drivers/net/ntnic/nthw/model/nthw_fpga_model.c index 8ed00248ea..f8e6da2d7f 100644 --- a/drivers/net/ntnic/nthw/model/nthw_fpga_model.c +++ b/drivers/net/ntnic/nthw/model/nthw_fpga_model.c @@ -31,8 +31,7 @@ static const char *get_bus_name(int n_bus_type_id) if (n_bus_type_id >= 1 && n_bus_type_id <= (int)ARRAY_SIZE(sa_nthw_fpga_bus_type_str)) return sa_nthw_fpga_bus_type_str[n_bus_type_id]; - else - return "ERR"; + return "ERR"; } /* @@ -1146,16 +1145,16 @@ static int nthw_field_wait_cond32(const nthw_field_t *p, enum nthw_field_match e while (true) { uint32_t val = nthw_field_get_updated(p); - if (e_match == NTHW_FIELD_MATCH_SET_ANY && val != 0) { + if (e_match == NTHW_FIELD_MATCH_SET_ANY && val != 0) return 0; - } else if (e_match == NTHW_FIELD_MATCH_SET_ALL && val == n_mask) { + if (e_match == NTHW_FIELD_MATCH_SET_ALL && val == n_mask) return 0; - } else if (e_match == NTHW_FIELD_MATCH_CLR_ALL && val == 0) { + if (e_match == NTHW_FIELD_MATCH_CLR_ALL && val == 0) return 0; - } else if (e_match == NTHW_FIELD_MATCH_CLR_ANY) { + if (e_match == NTHW_FIELD_MATCH_CLR_ANY) { uint32_t mask = nthw_field_get_mask(p); if (val != mask) diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_039_0000.c b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c similarity index 98% rename from drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_039_0000.c rename to drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c index e26a275958..cbebcff541 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_039_0000.c +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c @@ -179,7 +179,7 @@ static nthw_fpga_register_init_s gpio_phy_registers[] = { }; static nthw_fpga_field_init_s hif_build_time_fields[] = { - { HIF_BUILD_TIME_TIME, 32, 0, 1713859545 }, + { HIF_BUILD_TIME_TIME, 32, 0, 1726740521 }, }; static nthw_fpga_field_init_s hif_config_fields[] = { @@ -202,7 +202,7 @@ static nthw_fpga_field_init_s hif_prod_id_ex_fields[] = { static nthw_fpga_field_init_s hif_prod_id_lsb_fields[] = { { HIF_PROD_ID_LSB_GROUP_ID, 16, 16, 9563 }, - { HIF_PROD_ID_LSB_REV_ID, 8, 0, 39 }, + { HIF_PROD_ID_LSB_REV_ID, 8, 0, 49 }, { HIF_PROD_ID_LSB_VER_ID, 8, 8, 55 }, }; @@ -247,27 +247,27 @@ static nthw_fpga_field_init_s hif_test1_fields[] = { }; static nthw_fpga_field_init_s hif_uuid0_fields[] = { - { HIF_UUID0_UUID0, 32, 0, 1237800326 }, + { HIF_UUID0_UUID0, 32, 0, 1021928912 }, }; static nthw_fpga_field_init_s hif_uuid1_fields[] = { - { HIF_UUID1_UUID1, 32, 0, 3057550372 }, + { HIF_UUID1_UUID1, 32, 0, 2998983545 }, }; static nthw_fpga_field_init_s hif_uuid2_fields[] = { - { HIF_UUID2_UUID2, 32, 0, 2445752330 }, + { HIF_UUID2_UUID2, 32, 0, 827210969 }, }; static nthw_fpga_field_init_s hif_uuid3_fields[] = { - { HIF_UUID3_UUID3, 32, 0, 1864147557 }, + { HIF_UUID3_UUID3, 32, 0, 462142918 }, }; static nthw_fpga_register_init_s hif_registers[] = { - { HIF_BUILD_TIME, 16, 32, NTHW_FPGA_REG_TYPE_RO, 1713859545, 1, hif_build_time_fields }, + { HIF_BUILD_TIME, 16, 32, NTHW_FPGA_REG_TYPE_RO, 1726740521, 1, hif_build_time_fields }, { HIF_CONFIG, 24, 7, NTHW_FPGA_REG_TYPE_RW, 0, 3, hif_config_fields }, { HIF_CONTROL, 40, 13, NTHW_FPGA_REG_TYPE_MIXED, 4097, 3, hif_control_fields }, { HIF_PROD_ID_EX, 112, 32, NTHW_FPGA_REG_TYPE_RO, 1, 3, hif_prod_id_ex_fields }, - { HIF_PROD_ID_LSB, 0, 32, NTHW_FPGA_REG_TYPE_RO, 626734887, 3, hif_prod_id_lsb_fields }, + { HIF_PROD_ID_LSB, 0, 32, NTHW_FPGA_REG_TYPE_RO, 626734897, 3, hif_prod_id_lsb_fields }, { HIF_PROD_ID_MSB, 8, 22, NTHW_FPGA_REG_TYPE_RO, 200, 2, hif_prod_id_msb_fields }, { HIF_SAMPLE_TIME, 96, 1, NTHW_FPGA_REG_TYPE_WO, 0, 1, hif_sample_time_fields }, { HIF_STATUS, 32, 10, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, hif_status_fields }, @@ -277,10 +277,10 @@ static nthw_fpga_register_init_s hif_registers[] = { { HIF_STAT_TX, 80, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, hif_stat_tx_fields }, { HIF_TEST0, 48, 32, NTHW_FPGA_REG_TYPE_RW, 287454020, 1, hif_test0_fields }, { HIF_TEST1, 56, 32, NTHW_FPGA_REG_TYPE_RW, 2864434397, 1, hif_test1_fields }, - { HIF_UUID0, 128, 32, NTHW_FPGA_REG_TYPE_RO, 1237800326, 1, hif_uuid0_fields }, - { HIF_UUID1, 144, 32, NTHW_FPGA_REG_TYPE_RO, 3057550372, 1, hif_uuid1_fields }, - { HIF_UUID2, 160, 32, NTHW_FPGA_REG_TYPE_RO, 2445752330, 1, hif_uuid2_fields }, - { HIF_UUID3, 176, 32, NTHW_FPGA_REG_TYPE_RO, 1864147557, 1, hif_uuid3_fields }, + { HIF_UUID0, 128, 32, NTHW_FPGA_REG_TYPE_RO, 1021928912, 1, hif_uuid0_fields }, + { HIF_UUID1, 144, 32, NTHW_FPGA_REG_TYPE_RO, 2998983545, 1, hif_uuid1_fields }, + { HIF_UUID2, 160, 32, NTHW_FPGA_REG_TYPE_RO, 827210969, 1, hif_uuid2_fields }, + { HIF_UUID3, 176, 32, NTHW_FPGA_REG_TYPE_RO, 462142918, 1, hif_uuid3_fields }, }; static nthw_fpga_field_init_s iic_adr_fields[] = { @@ -1071,7 +1071,7 @@ static nthw_fpga_module_init_s fpga_modules[] = { static nthw_fpga_prod_param_s product_parameters[] = { { NT_BUILD_NUMBER, 0 }, - { NT_BUILD_TIME, 1713859545 }, + { NT_BUILD_TIME, 1726740521 }, { NT_CATEGORIES, 64 }, { NT_CAT_DCT_PRESENT, 0 }, { NT_CAT_END_OFS_SUPPORT, 0 }, @@ -1101,7 +1101,7 @@ static nthw_fpga_prod_param_s product_parameters[] = { { NT_FLM_CACHE, 1 }, { NT_FLM_CATEGORIES, 32 }, { NT_FLM_ENTRY_SIZE, 64 }, - { NT_FLM_LOAD_APS_MAX, 260000000 }, + { NT_FLM_LOAD_APS_MAX, 270000000 }, { NT_FLM_LOAD_LPS_MAX, 300000000 }, { NT_FLM_PRESENT, 1 }, { NT_FLM_PRIOS, 4 }, @@ -1176,7 +1176,7 @@ static nthw_fpga_prod_param_s product_parameters[] = { { NT_QUEUES, 128 }, { NT_RAC_RAB_INTERFACES, 3 }, { NT_RAC_RAB_OB_UPDATE, 0 }, - { NT_REVISION_ID, 39 }, + { NT_REVISION_ID, 49 }, { NT_RMC_LAG_GROUPS, 1 }, { NT_RMC_PRESENT, 1 }, { NT_ROA_CATEGORIES, 1024 }, @@ -1225,6 +1225,6 @@ static nthw_fpga_prod_param_s product_parameters[] = { { 0, -1 }, /* END */ }; -nthw_fpga_prod_init_s nthw_fpga_9563_055_039_0000 = { - 200, 9563, 55, 39, 0, 0, 1713859545, 152, product_parameters, 15, fpga_modules, +nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { + 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 15, fpga_modules, }; diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_instances.c b/drivers/net/ntnic/nthw/supported/nthw_fpga_instances.c index 4fe7f7ea94..c8a310c415 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_instances.c +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_instances.c @@ -5,4 +5,4 @@ #include "nthw_fpga_instances.h" -nthw_fpga_prod_init_s *nthw_fpga_instances[] = { &nthw_fpga_9563_055_039_0000, NULL }; +nthw_fpga_prod_init_s *nthw_fpga_instances[] = { &nthw_fpga_9563_055_049_0000, NULL }; diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_instances.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_instances.h index d0e6f7b429..3e5983f763 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_instances.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_instances.h @@ -6,4 +6,4 @@ #include "fpga_model.h" extern nthw_fpga_prod_init_s *nthw_fpga_instances[]; -extern nthw_fpga_prod_init_s nthw_fpga_9563_055_039_0000; +extern nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000; From patchwork Fri Oct 4 15:34:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145093 X-Patchwork-Delegate: ferruh.yigit@amd.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 7948C45AAF; Fri, 4 Oct 2024 17:51:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4602942DC7; Fri, 4 Oct 2024 17:50:53 +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 10A83427DC for ; Fri, 4 Oct 2024 17:50:48 +0200 (CEST) Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02lp2233.outbound.protection.outlook.com [104.47.11.233]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:50:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kEDazPojMFNh9OTOBQrKe0xlbzPcajyysGJpprZPZoRWRkDGGhNNI0CPBj8DLMdJeNYwwAyimENavNPFR7umdYg8nwWOLNTmD6kdcc6s6xXlimbyykfp26gxRn3rnSrWpBcUO/8ZFBpJzz/9bD0PUqJtK4GLDUHaB3u2L5KcCVP8iNSBRqcy4pbjXcic3m5IpnpmRc6oKKMysol/Cr+f2vRIUar83sIRcqHqdzvItRSWP/lzCLB5ddVCS4/6/o41oqsEClzvifE8Az/6ZTx503eV1AWZsbO92z3Ifi1nbEizsXbOTO1eeTSCjcSL2qKIM41Qu4p7OLRbFl2vozs/nw== 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=Km3MJ0ivD7e2wMllWaqaSmWaiFu46zmRBAushnn+WPU=; b=qLBJ7OxulIzI+ptj1idJkuWbyIuDKdzPi6JU8Bi8SrQlXsk71ZFIJ85rWQQ5z7PZlH5zNgzfq4pNMUkevbjd0fyLoUiHa1WPPFyz7q5hkcDo3ixTkIfrgwZQRlezQiuF6Bgx8Jk2gpWlkkfFuBKMoUkI7k6VHlf8HJHtb2Wy0oCev/5WE6265U1+2uHtx/Thw7Y8l7QAEaLg+sKDvb2wRcpsKlzVItis0KLnlKlgKv31AERn5EHeS2e3qSCQiEz0F7j+ustT/9DKu8SzPjFG49Q/gzM3VqurF9vkb6hw1pJQTJO9ai0ofeAvhpqw9LxmLe3PcoTlik9nKCCe8yit6w== 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=Km3MJ0ivD7e2wMllWaqaSmWaiFu46zmRBAushnn+WPU=; b=pUFgebIHwex1VyX78uG41b2yfxT0x4/dN7ygxuC0496VvzZy7VA1pNjkB2ygOKNJKmBMRyx0kLZEYpbRzI4RnR3/xLUWqKbFfdVu3PW42wj+qjDEWf0EPxS3C+/HY2aGtAGVciLlTl1qV0ybyeONM+ZtrStPBgMsGiHiGMoyxMQ= Received: from AM0PR10CA0132.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::49) by AM9P190MB1107.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:271::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.22; Fri, 4 Oct 2024 15:36:31 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::6b) by AM0PR10CA0132.outlook.office365.com (2603:10a6:208:e6::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:31 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:31 +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 02/14] net/ntnic: enhance Ethernet device configuration Date: Fri, 4 Oct 2024 17:34:56 +0200 Message-ID: <20241004153551.267935-39-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|AM9P190MB1107:EE_ X-MS-Office365-Filtering-Correlation-Id: e9dbf493-3289-42bb-1041-08dce48a5250 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: xRFBmJp5kAZ8Jk8bHUmYss9DnYtUxWcF8EtnjOFxzZrAi9LzmJWD5SdLiKLoQua1XggUhY5wkYMheDRDMxUH5YlAN4G16E+Vs0TQpA6/ktsp8RSnd8PXySt2Wv5r01Hsm67j80rbF27ozYIGH/2CIrnBVVzszF4X9mKLmfsJq5BfUOnxJalcy8Nl4Cs2MN9C5QA9FnL4uaD8b7atMKNW9egHFmEB1jIRdp2qVy6K2d/tHUEGT8BhP05wfKHoS0KKo2bNfWyrldFTPdUkbXkyW0zSnC1LX393hB46JwjcJ6ZfooaztyzKJjO+4yiWsZmdD5nc7lTcmQlm6GiIl3MMLORRZZX3p100BsV+gybqrKLR9QhhOQH73VZ5fLgM4O2EPSjzjrNuOOKYZeQMXFFaqbf/jMvAIVrw/6IwncYmBgP/Tj7rq/G1jAvP1QMBAeP9RuBuxZQ2HF2LxH5G71j39nahyrPMoJaLvu2gH8zOu7Md4nXvl+T/mh4NeKZlApVC8dWedDjl/MfwIK7SY19CTxN6riGbiuCljLkv9iKIRx0Ce42XKog6u+pAw0wkQ3F9rYzSKWT/u4CtUYkafngnQSub7tT9M+VAnf6sHL8yNtt3iTMTlnYKONQU0KDLnNW5Uvwe5G2Hhs8UM8fyqHxUy68laYmWYwSn1uviM0gOu7nfACjPRr0MNiWKezjC6C3+OfEW4uLy42KAsJNDXPm8//XSAoNTvgGZGFzzau2ZzVJ0Ip/TF/w6HUnHi36eU1vu/of6I3U76vKGwdRqGfVoIbjCjPENTJy/fegWlcZI7317ZCwvhDoWxKTanZepfWRmjCnRLQS9ZBI0bTHkqvTpPMgn5jymkUBTpmRP8+A8FBgrAtAw1ASsVytYSc6C0K9skm50hzLtAo+Suj8R0uTITaS9vW8csKGMRkI7BGCbDssdT0uoAQmX9SbVliXOdrqfUGNoS9ylt5GF9CeENVQEz8lhKjw0hEhOjHmoHVFWtd/OoA9Bb9krYUBNDHaydhPjvgh/4eqYcLf9szII7dFkThpNEp2ojcmNPQZKr6tX8IXORgWu027A6Rj66PdCZ0lvhcV0fAZprifXWJCPAtzLE4VZYqcAvNYT1RvzIMsl0SfmrTJHfpVsPZSG7QlSxUlRVB9hVk1eCsnGsZs+Gwy9Kr5DWEhNG0dCXSHJdr8ElxDKe601xHySldwnkdroQ/9ntSpsu0wM8RXkRT6+aXy30Rysf7POV2N6DdZEKahJNA1yIahJWptkCVdcDlRIGXMI5Bnxd7WNPZP93/z7bz7iE2AB0G5MErLuDBWWJ6lVvRaXUdSn+jQcVmuHIYBX0Nd6PmBT8ItL8XdQbGt4G1OTsW163pArYh6+nnlA+IyeRfspLubTYXftwC+IGVHzbK9y 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)(36860700013)(376014)(82310400026)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: jHgceese/PMy/xDMGjnBuM0TUs//fLLbVB65qtwSnKVXMX8T7o7KZFyYDiKuvCZbH6wNPD+bQ1eadPdWmG7T5XVjVDNIsE3t9WQYj0jmp+rVYQlntTpTA6kwb19TjH3IyQxqr7zVe8Z4f+JcSAMHrMuK+0S4DtlKAtoWZwiA9c/X71Mz4op6YMc6xc3gqp/JmkaxRZq++H+OTU12Z5NWyfxn4uRsRZImaqHiSIRDHizGvJM01wopzKCl4sMQBpOLSFtAOjZygEsoqIfe4RP3o5xijfIuUf0GZdP4Q6+WSHIHSf2i01eRyHWW/owzp2GPAdvX1e2X47uJvx5YrOZdWkkgwKonEOOX8UNthPWynIBoQZAlvXlFwdw+lJPtnVTrCm174bu06mAxvnd+mw+5m0upr+9ckagvNU2tRtMMLVHJM5qg+fHq4ki1DhA9Ef+tRQwNeinGjQP/1379dlHZNDFzPWorWSwMHa2Jogxz6tDp2Apy9IGdqyChkToxjlDkVqICU73qRL/QA5315m4H8yLTIs7mRp0BCrHB5RSKf6t7CG8Dg6o7rB5yFgmXXQD3hrRNiFpJ6NpZYNGEgpbLsKTHL1x1j6k+a17dTpI0B33NYKtQUaVLY3g+UqHs0mdgAnm0v2MraMr1VDRvK0ZCyA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:31.5491 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9dbf493-3289-42bb-1041-08dce48a5250 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9P190MB1107 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057047-311388-12692-32508-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.11.233 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYGpuYmQGYGUNQsxdjIICnZ0t I40dwoxcIUyLRITk60TDM3MzM3MjJRqo0FAKisg95CAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan20-43.eu-central-1b.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 Added eth_dev_close function to handle closing of Ethernet devices. It releases managed RX/TX virtual queues. Initialized scatter-gather queue system. Defined constants and macros for hardware RX/TX descriptors and packet buffer sizes. Defined structures for RX and TX packet headers including fields for packet length, descriptors, and color types. Signed-off-by: Danylo Vodopianov --- drivers/net/ntnic/include/ntnic_dbs.h | 19 ++++ drivers/net/ntnic/include/ntnic_virt_queue.h | 22 +++++ drivers/net/ntnic/include/ntos_drv.h | 15 ++++ drivers/net/ntnic/nthw/nthw_drv.h | 1 + drivers/net/ntnic/ntnic_ethdev.c | 67 ++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.c | 5 ++ drivers/net/ntnic/ntnic_mod_reg.h | 93 ++++++++++++++++++++ 7 files changed, 222 insertions(+) create mode 100644 drivers/net/ntnic/include/ntnic_dbs.h create mode 100644 drivers/net/ntnic/include/ntnic_virt_queue.h diff --git a/drivers/net/ntnic/include/ntnic_dbs.h b/drivers/net/ntnic/include/ntnic_dbs.h new file mode 100644 index 0000000000..551c6ade43 --- /dev/null +++ b/drivers/net/ntnic/include/ntnic_dbs.h @@ -0,0 +1,19 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef _NTNIC_DBS_H_ +#define _NTNIC_DBS_H_ + +#include "nthw_fpga_model.h" + +/* + * Struct for implementation of memory bank shadows + */ + +struct nthw_dbs_s; + +typedef struct nthw_dbs_s nthw_dbs_t; + +#endif /* _NTNIC_DBS_H_ */ diff --git a/drivers/net/ntnic/include/ntnic_virt_queue.h b/drivers/net/ntnic/include/ntnic_virt_queue.h new file mode 100644 index 0000000000..422ac3b950 --- /dev/null +++ b/drivers/net/ntnic/include/ntnic_virt_queue.h @@ -0,0 +1,22 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef __NTOSS_VIRT_QUEUE_H__ +#define __NTOSS_VIRT_QUEUE_H__ + +#include +#include + +#include + +struct nthw_virt_queue; + +struct nthw_virtq_desc_buf; + +struct nthw_cvirtq_desc; + +struct nthw_received_packets; + +#endif /* __NTOSS_VIRT_QUEUE_H__ */ diff --git a/drivers/net/ntnic/include/ntos_drv.h b/drivers/net/ntnic/include/ntos_drv.h index a77e6a0247..191686a07a 100644 --- a/drivers/net/ntnic/include/ntos_drv.h +++ b/drivers/net/ntnic/include/ntos_drv.h @@ -27,12 +27,25 @@ #define MAX_QUEUES 125 /* Structs: */ +struct nthw_memory_descriptor { + void *virt_addr; + uint32_t len; +}; + +struct hwq_s { + int vf_num; + struct nthw_memory_descriptor virt_queues_ctrl; + struct nthw_memory_descriptor *pkt_buffers; +}; + struct __rte_cache_aligned ntnic_rx_queue { struct flow_queue_id_s queue; /* queue info - user id and hw queue index */ struct rte_mempool *mb_pool; /* mbuf memory pool */ uint16_t buf_size; /* Size of data area in mbuf */ int enabled; /* Enabling/disabling of this queue */ + struct hwq_s hwq; + struct nthw_virt_queue *vq; nt_meta_port_type_t type; uint32_t port; /* Rx port for this queue */ enum fpga_info_profile profile; /* Inline / Capture */ @@ -41,6 +54,8 @@ struct __rte_cache_aligned ntnic_rx_queue { struct __rte_cache_aligned ntnic_tx_queue { struct flow_queue_id_s queue; /* queue info - user id and hw queue index */ + struct hwq_s hwq; + struct nthw_virt_queue *vq; nt_meta_port_type_t type; uint32_t port; /* Tx port for this queue */ diff --git a/drivers/net/ntnic/nthw/nthw_drv.h b/drivers/net/ntnic/nthw/nthw_drv.h index 41500f49dd..eaa2b19015 100644 --- a/drivers/net/ntnic/nthw/nthw_drv.h +++ b/drivers/net/ntnic/nthw/nthw_drv.h @@ -7,6 +7,7 @@ #define __NTHW_DRV_H__ #include "nthw_core.h" +#include "ntnic_dbs.h" typedef enum nt_meta_port_type_e { PORT_TYPE_PHYSICAL, diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c index 967e989575..79b5ae4d60 100644 --- a/drivers/net/ntnic/ntnic_ethdev.c +++ b/drivers/net/ntnic/ntnic_ethdev.c @@ -53,6 +53,8 @@ static const struct rte_pci_id nthw_pci_id_map[] = { }, /* sentinel */ }; +static const struct sg_ops_s *sg_ops; + static rte_spinlock_t hwlock = RTE_SPINLOCK_INITIALIZER; /* @@ -183,6 +185,14 @@ eth_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_info return 0; } +static void release_hw_virtio_queues(struct hwq_s *hwq) +{ + if (!hwq || hwq->vf_num == 0) + return; + + hwq->vf_num = 0; +} + static void eth_tx_queue_release(struct rte_eth_dev *eth_dev, uint16_t queue_id) { (void)eth_dev; @@ -474,6 +484,21 @@ eth_dev_close(struct rte_eth_dev *eth_dev) struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; struct drv_s *p_drv = internals->p_drv; + if (internals->type != PORT_TYPE_VIRTUAL) { + struct ntnic_rx_queue *rx_q = internals->rxq_scg; + struct ntnic_tx_queue *tx_q = internals->txq_scg; + + uint q; + + if (sg_ops != NULL) { + for (q = 0; q < internals->nb_rx_queues; q++) + sg_ops->nthw_release_mngd_rx_virt_queue(rx_q[q].vq); + + for (q = 0; q < internals->nb_tx_queues; q++) + sg_ops->nthw_release_mngd_tx_virt_queue(tx_q[q].vq); + } + } + internals->p_drv = NULL; if (p_drv) { @@ -728,6 +753,28 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev) return -1; } + /* Initialize the queue system */ + if (err == 0) { + sg_ops = get_sg_ops(); + + if (sg_ops != NULL) { + err = sg_ops->nthw_virt_queue_init(fpga_info); + + if (err != 0) { + NT_LOG(ERR, NTNIC, + "%s: Cannot initialize scatter-gather queues\n", + p_nt_drv->adapter_info.mp_adapter_id_str); + + } else { + NT_LOG(DBG, NTNIC, "%s: Initialized scatter-gather queues\n", + p_nt_drv->adapter_info.mp_adapter_id_str); + } + + } else { + NT_LOG_DBGX(DBG, NTNIC, "SG module is not initialized\n"); + } + } + /* Start ctrl, monitor, stat thread only for primary process. */ if (err == 0) { /* mp_adapter_id_str is initialized after nt4ga_adapter_init(p_nt_drv) */ @@ -891,6 +938,26 @@ nthw_pci_dev_deinit(struct rte_eth_dev *eth_dev __rte_unused) ntdrv_4ga_t *p_ntdrv = &internals->p_drv->ntdrv; fpga_info_t *fpga_info = &p_ntdrv->adapter_info.fpga_info; const int n_phy_ports = fpga_info->n_phy_ports; + + /* let running threads end Rx and Tx activity */ + if (sg_ops != NULL) { + nt_os_wait_usec(1 * 1000 * 1000); + + while (internals) { + for (i = internals->nb_tx_queues - 1; i >= 0; i--) { + sg_ops->nthw_release_mngd_tx_virt_queue(internals->txq_scg[i].vq); + release_hw_virtio_queues(&internals->txq_scg[i].hwq); + } + + for (i = internals->nb_rx_queues - 1; i >= 0; i--) { + sg_ops->nthw_release_mngd_rx_virt_queue(internals->rxq_scg[i].vq); + release_hw_virtio_queues(&internals->rxq_scg[i].hwq); + } + + internals = internals->next; + } + } + for (i = 0; i < n_phy_ports; i++) { sprintf(name, "ntnic%d", i); eth_dev = rte_eth_dev_allocated(name); diff --git a/drivers/net/ntnic/ntnic_mod_reg.c b/drivers/net/ntnic/ntnic_mod_reg.c index ff9afbeb7c..8fe5193027 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.c +++ b/drivers/net/ntnic/ntnic_mod_reg.c @@ -5,6 +5,11 @@ #include "ntnic_mod_reg.h" +const struct sg_ops_s *get_sg_ops(void) +{ + return NULL; +} + static struct link_ops_s *link_100g_ops; void register_100g_link_ops(struct link_ops_s *ops) diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h index 602f5de77d..e9dff51935 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.h +++ b/drivers/net/ntnic/ntnic_mod_reg.h @@ -13,6 +13,99 @@ #include "nthw_drv.h" #include "nt4ga_adapter.h" #include "ntnic_nthw_fpga_rst_nt200a0x.h" +#include "ntnic_virt_queue.h" + +/* sg ops section */ +struct sg_ops_s { + /* Setup a virtQueue for a VM */ + struct nthw_virt_queue *(*nthw_setup_rx_virt_queue)(nthw_dbs_t *p_nthw_dbs, + uint32_t index, + uint16_t start_idx, + uint16_t start_ptr, + void *avail_struct_phys_addr, + void *used_struct_phys_addr, + void *desc_struct_phys_addr, + uint16_t queue_size, + uint32_t host_id, + uint32_t header, + uint32_t vq_type, + int irq_vector); + struct nthw_virt_queue *(*nthw_setup_tx_virt_queue)(nthw_dbs_t *p_nthw_dbs, + uint32_t index, + uint16_t start_idx, + uint16_t start_ptr, + void *avail_struct_phys_addr, + void *used_struct_phys_addr, + void *desc_struct_phys_addr, + uint16_t queue_size, + uint32_t host_id, + uint32_t port, + uint32_t virtual_port, + uint32_t header, + uint32_t vq_type, + int irq_vector, + uint32_t in_order); + struct nthw_virt_queue *(*nthw_setup_mngd_rx_virt_queue)(nthw_dbs_t *p_nthw_dbs, + uint32_t index, + uint32_t queue_size, + uint32_t host_id, + uint32_t header, + /* + * Memory that can be used + * for virtQueue structs + */ + struct nthw_memory_descriptor *p_virt_struct_area, + /* + * Memory that can be used for packet + * buffers - Array must have queue_size + * entries + */ + struct nthw_memory_descriptor *p_packet_buffers, + uint32_t vq_type, + int irq_vector); + int (*nthw_release_mngd_rx_virt_queue)(struct nthw_virt_queue *rxvq); + struct nthw_virt_queue *(*nthw_setup_mngd_tx_virt_queue)(nthw_dbs_t *p_nthw_dbs, + uint32_t index, + uint32_t queue_size, + uint32_t host_id, + uint32_t port, + uint32_t virtual_port, + uint32_t header, + /* + * Memory that can be used + * for virtQueue structs + */ + struct nthw_memory_descriptor *p_virt_struct_area, + /* + * Memory that can be used for packet + * buffers - Array must have queue_size + * entries + */ + struct nthw_memory_descriptor *p_packet_buffers, + uint32_t vq_type, + int irq_vector, + uint32_t in_order); + int (*nthw_release_mngd_tx_virt_queue)(struct nthw_virt_queue *txvq); + /* + * These functions handles both Split and Packed including merged buffers (jumbo) + */ + uint16_t (*nthw_get_rx_packets)(struct nthw_virt_queue *rxvq, + uint16_t n, + struct nthw_received_packets *rp, + uint16_t *nb_pkts); + void (*nthw_release_rx_packets)(struct nthw_virt_queue *rxvq, uint16_t n); + uint16_t (*nthw_get_tx_packets)(struct nthw_virt_queue *txvq, + uint16_t n, + uint16_t *first_idx, + struct nthw_cvirtq_desc *cvq, + struct nthw_memory_descriptor **p_virt_addr); + void (*nthw_release_tx_packets)(struct nthw_virt_queue *txvq, + uint16_t n, + uint16_t n_segs[]); + int (*nthw_virt_queue_init)(struct fpga_info_s *p_fpga_info); +}; + +const struct sg_ops_s *get_sg_ops(void); struct link_ops_s { int (*link_init)(struct adapter_info_s *p_adapter_info, nthw_fpga_t *p_fpga); From patchwork Fri Oct 4 15:34:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145094 X-Patchwork-Delegate: ferruh.yigit@amd.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 5909645AAF; Fri, 4 Oct 2024 17:51:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6E78442D35; Fri, 4 Oct 2024 17:50:55 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id DF98A42DAC for ; Fri, 4 Oct 2024 17:50:52 +0200 (CEST) Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02lp2232.outbound.protection.outlook.com [104.47.11.232]) by mx-outbound8-201.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:50:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Pmvwcnziic2DoOjNP38aywgg5tiVT7il4fw9EKKAVRD7OOVnNyUY1XzcVMsDhlIjDuHpekkW5QcpJB8WaEOs0NT4X5Svfxd8GcdMF6/9vX+WyQHq64v+ZRviCpjO1eiDb23YVC8FKvWRysgDDOjl4qOCvx2FXsvNNmc017V46b07q8fTzTtyvF1K+BDc83VFU2HeKWe1ArnOt3uTItxP0G/lUwzRiPqFYv8974yVFUOU2v5aDmLdo7qRuz/zyoloOZU9M/jSwPoHytmE3AfPF68nx0IwDgZausVgC3hsAapxyczHKnOHEDrpRXl1V6itmzhIwfO8DiiGHOY2TkjGLA== 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=WGeIchOet9N6QwDzFE/8YrkxOlJdtt7RzSj3herrzrw=; b=Wbd/7Aug2ETB2BVRVtZq2+46GGZBQe4s05ZJXsKDU/PVSToEiml+WCFuOqHAKpjD3vLZtxBI9rtT/S9/nwoeI0dW5K/S/bUCadGbozaPK327oWPvxRFgvxxAM41PCfK5S/i2k+kAsjYWj20wWQmxpvf/eC9rQHUdzUkLuvKCgGxQ2QY2PhxG7xBM0pismGM/U4f4JhaiUdjiUpSIuxsmqZNiUsRt3boVrDpeUZwpyI0/rFIl9VDUjlRift6VhJMe/ftkkhzJIB4Vlb6ESX41l8k5kG90Auh9Sv6P+kSD7OZgEy/4cCjaisXIgNKYZ72v3Iwvn415NKid6D3Vk8fuPQ== 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=WGeIchOet9N6QwDzFE/8YrkxOlJdtt7RzSj3herrzrw=; b=IZCOtcf/MEb1HeyFwY6BGPKHgeQflK66UcnuME3Ie5BxykWg52ifpCNru1yPRwYXnTJBbT6Cow9mgDVthCURP2flzKwzutHRu122nEYhpZqSzM0AjADn3GRo+GSjSB8GoAikxPEdOFBcRR0QqXJaLG0mJx8Q7GYexMQp8TOy5C4= Received: from AM0PR10CA0128.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::45) by DU0P190MB2002.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:3b6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 15:36:03 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::7f) by AM0PR10CA0128.outlook.office365.com (2603:10a6:208:e6::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:03 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:03 +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, Oleksandr Kolomeiets Subject: [PATCH v1 3/5] net/ntnic: update documentation Date: Fri, 4 Oct 2024 17:34:21 +0200 Message-ID: <20241004153551.267935-4-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|DU0P190MB2002:EE_ X-MS-Office365-Filtering-Correlation-Id: 5844cea8-4da5-4e0e-1060-08dce48a4158 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: A9DYqWcai9IzjB0/SM4OjCDyeGHL80G/sq4rTV/EuegXILvUVvC/F184ptE5WrZTbb7lh7XykdoZV1H0j1qEo7Ue0jCLuHWp7BOU73tot36uJnuqyB2XaBos5Q7kuOHSQIuwTvHqrzCNgND8C8DW2f4TpR9UJ6KX+PAx7ZjnBdpXQ8X76mjRG+tvzMwTWWngyCaCSYI+UtmGDRZxBMPR9Jgz2G0lcHGwPcTRjOwjDXYMopfDuqSTDegOk1GPtVnnX7JQUrhQj+5qtw/GfgmHbLBINxM4H4qhXnithBr74XI5SWlQF2PAVJOYxPRexX1h4OX2NOmo6GfV2oWz2S9k5FkqHkWrYRakW6Jz5mRCymuxCGnPgeVUa3jRAC2qmhXysWDAuSUYzB3hr95V1u8/gwD9MSrxTe+FnAi/N8eNF77+GZoZUi6LfHjnTNsgOQitrrXXgVGN/Umzp2WVKp4hbavKkZ7E3XqFsmWWdd5eeDhJxMN/va+Evh+8r+2M3tJ9Rf2EPjJYYkpLIsu36mFfUsrLZItwtFo94gmjsCcVc0FTLCd/aiM3tu3yhbtRop/GCEGGRcnER0wa60Osr92IHBszzQ8Hc6jpI3Hk8VrcxjkzdOAHkHYZC29co8rL9hDpEtHy5+emeBhz7EP5MClyBB7RuYeQVErlYX1ldiUWT6XLcwXp65B6krrAZPp4J06Tz9Cl1X0V3Cpqv2HfCUWRb4uNJzaJBG/9VFjjUf+lxKjO9WVVFb1Peumf/xz2WCE5NbroInzYUFQw6c66JwVkbKOJLcavXV6oOsd6fy1G1JyGCRQ11obcnYlGou3vKTTwF4Lu+YbIw8oH53cmVTuXKQbmqoE22MVpehCZGDqnrXUqZu5EK6ZAOHw+2gKi9hkdcu7l6tD0sDKhQgxeGDhN7wA2/mK4iT8l0nvWZxZfXIgSGFyr60294ediQHasVjyqs3jAAJVrx4/VoFoBGAA1ibgqMN0zi+P/GYbiHJ9GwlNtnWKbeI7AQah15pq20OXNwjeYHVo4cWMsTHHhcgb0wo4MLkUNouDURZ3ZLHHKE1+WbEYsnG1ytF3wHE9xZDRAsQI/cPd9FZIC4HtewOO8J6E4jAck9Fig+nLnziHrSHagH1119/WtsberKPfy0ppnHJPF104iW+VUTFSvU17GExrayc3B/+MB64E+3PjmEntc255wDxL2A7r1lZCcQpIEFG+wRSsNjf6HFtzTQzH8f8qD/SsfNR6zODmXINgvRVQymgP3D1kdWuW9pweUM6XC+jWFmgvjgj3KDiuB9iAZVKBZzKjfRZ9lX3zD6a+Itd4FU8nnNI93+6mdJbUJXC/gUcUDQcwXFKKAtSR9fsEsSS2qM0QIDXwIFHIi3WQ7qzK45rIGa0djxISNCwwEvCXn 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)(36860700013)(376014)(1800799024)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: opEJpkrszTv2zh706tA3C3o4gnEf4BaSYh2J5EGPeDKV6GV4+o2r3ayRYyJm2OpIPcY4ArpOcKrzP6EVhUVAQsEdtcN/daF8f/Ho/qkWAyanw72EOFihEGR9tmgf7DCwFzbeVh4U+7+a+Azu6KxkpfXTNkFD3Ut7DyLG+/3y9VAASKf4TtvFXbKRuIrw5dwPTlYMgS2A7E0aWDASx/NCj/I8qI/f85IBlgkNwpZGs66+1e2f8sLyoAu5r/GioC3x61qm4lYGxfQv9lBkQzU7OZ55o/PKQwlj8010n4MN5kSASFzl3CYGyULQ1jMRZPo2M3IXzrTqanI330AI+D3Vz3xqFLUD7FsZicW5jdLn8lM33ZsFcKZY9oaODqP8I+j6Ykx0w4piD2EX3xNWxkzYI1dF4A4+CPjwqIw2nXJzcT6tmYBU6WQHqHnvyDpoYFAG4xVkN8XHFQnByqEHk6SCIZ9pkisxIzuibVjPtlsLu5F4+3v1fTekzuXS1fTN/ZbuUqFzPgsACR2QpYQ1Et934AJffY7EfBe9MgRVTDTXUXFPgX0Wy4LhkPYF7W2zw2MQtQBhH7tyHg6EcVk3y67Auuysjm0IaRRiTjCRjx2VvB/U0o9NpQbdU+UH3vVECk2z/B24c+irt9XRTpvn97ZOCQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:03.0802 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5844cea8-4da5-4e0e-1060-08dce48a4158 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0P190MB2002 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057052-302249-12645-33862-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.11.232 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmYmJkBGBlDMIiU5OSk5Ndk80d DM3DLZxDItKdHIwDQxJdXUIs3U0FCpNhYAA1jgcUAAAAA= X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan11-24.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: Oleksandr Kolomeiets Add forgotten feature to the documentation (ntnic.ini) Signed-off-by: Oleksandr Kolomeiets --- doc/guides/nics/features/ntnic.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/guides/nics/features/ntnic.ini b/doc/guides/nics/features/ntnic.ini index 0a74817fcf..b6d92c7ee1 100644 --- a/doc/guides/nics/features/ntnic.ini +++ b/doc/guides/nics/features/ntnic.ini @@ -6,6 +6,7 @@ [Features] FW version = Y Speed capabilities = Y +Link status = Y Unicast MAC filter = Y Multicast MAC filter = Y Linux = Y From patchwork Fri Oct 4 15:34:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145090 X-Patchwork-Delegate: ferruh.yigit@amd.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 4534D45AAF; Fri, 4 Oct 2024 17:51:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 06DB7427DA; Fri, 4 Oct 2024 17:50:48 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id F2AF6427CE for ; Fri, 4 Oct 2024 17:50:44 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2105.outbound.protection.outlook.com [104.47.17.105]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:50:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VETR+oIaEVMTqUoaty0XvLZk2NTK/0+OYbrS7gW89bbuIyzd0JtTLuuZo08SVMtSbY3Diu3cQXbDEsFXVR6/X4GBZ5gAyF74ZuNyqVRPoGJ5+Q2RYkDHhOiPJjD2NTJe8QoUx1VCmkmUxrW9y29R5HTTNWgueGtdwkwbIlneiPn2XIbOIezXHpCQs3eBi9gmVe1biie/vbLd2PUjagxXI70qRdmIfPjRhS6KvfrQHLdPzAOCgDOR7uaqW1ljkGnUMfjzBCga6LffgN/tYGp7wEJOwx9hXDL1OttUTYuYWAsLxYVyLk2Rew+pFW2+KYlZzriNRRzSxUF5NKcgzdYYMg== 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=Jait+83qO9a8si1jf0oj5RSM6m1nawX84PMAikikLLE=; b=fyak99YGVV+gZfDpyITpdHC0pkYvOif9+d2vv+uB9Ag3MIzjj0xcG/V3oRmb0KXbeu/PSuVRWkz4nLY0znxqCSIGNHrDOcp+zzjZOvHyHbqaO6MuEYvQMV6S1J0T6NSDMMVd1Mx/TViEppR49yBwe1kiOSLq+Waj5H0W4t3INCh8DfELRxLxGzCl01v30uzRWWLkswRgFbA1oM9jdDq3PKo2OnOtZjEHR/iTHlrjOtG++K2/LYJoPCS+FA5TbKDqQj0IVFZleyguo6YWMLm3L53vIyj8+oH414pzA3bVQxOaww/oLYDffndE2oD6fXTesjcJRmgPGIBsUsaK+rdEQg== 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=Jait+83qO9a8si1jf0oj5RSM6m1nawX84PMAikikLLE=; b=WePr0J7qQrx3+nXCP3Dbd/ZjSSrYmewUJKgnjReKede+C90wuETDLG0fpNthIgKu20YhhfVdvurIIxDZMRLm3V6y20ZsHW8j6Dc3w3iWanlQtPut/Ok0r/CqWQDV9o2Lg08d8abonQkrMvXsD9j2FjXMqXAscjsIGWGRW3HoubA= Received: from AM0PR10CA0121.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::38) by AM7P190MB0662.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:115::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 15:36:32 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::f9) by AM0PR10CA0121.outlook.office365.com (2603:10a6:208:e6::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:32 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:32 +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 04/14] net/ntnic: add queue setup operations Date: Fri, 4 Oct 2024 17:34:58 +0200 Message-ID: <20241004153551.267935-41-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|AM7P190MB0662:EE_ X-MS-Office365-Filtering-Correlation-Id: 52bc70c1-fad7-40d9-094c-08dce48a52eb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: t+zp0pymnXubq24Tc+KppUGmIFHsmrH5/FG8eOr9BnhnnWfpxltziSHtz6YXV5gMooy9j7tWMstxG4RWxfMy5UNQwsJSlaacOE7UEXJ2q7XbrAcWyAmmCMJtS7HqvNOoZIZRBwsQky9SJA0ChlhnbktLBl/gerj5X5fQM9fRclJqTFhToZUVgd58l090qYw3JM4t3t9dOipgyEGvnHurVM7jwHsOpAkeSW5bY8EMhJ/Cuot72/L8DS5yTDUOlB5QB/1FtWIfmW0JM6pCctb0M3napgDzuprFbGoeS7sTOD5Z5N5G+NHxeIaucStLnqNqr5u69MVH9/760VH2drWjyEgOxXfXd9hA4jtB4IKoohJuV84WvZjAH2XSE6jEhOJuPtrw6UEn5a/q1xqmHNms4zU9q1yH4EPj82fAQiDQ7xeN2tJaN3IDIDkyeyAB1y0uxKQLr4UvHqf1V3v8pcJqJnTxWGOz9RA8DKdwHnyiPhrrOPqHwzCkz4wP+y2/VTmNJUDbSjvlfD9kzFETe68KW1jBaEjzB3BC3U2qO48QdnlSOejYWQMikjDaEQEm5DxwMMJAD36OSFjL8eXYSeWrlWYcImVnwXEa8MJs0FU+asyiQmScnGqVzQvg4QhTvYYI2Q7V1s5n0y+33dAIx0VDRBFsCEKiVNoio7jsKD4nap5W4twJbWPVKaPMiioGsR3rwH5VRk20e2+zGZaxauGJMe1Hyn75rmXWuuFQ12+gD4ccE+I4GXgpflXdrZ1QgfD0EBg7ywc6Zc9hfSu+0n8KtNcWsHc3Io2Cohhlp1GH7MrDXZjXohlp5ataVfcTsu8Onl0iI1M2bg6R3h8IL2TeIYuLTmZck/E/nYXQE2PK3Cf27fxQi1zHiyVc2lAppUdIomHZvfSEArkxTIYWNgvFWmfrhVVOlnsLdAsubgzqqTf4+hzVbZjtSEOnmow5MjizjvDCQDkqGRBNmxpvplPWqjTuLRmddrerNHMnmx6/y7B01l0RL6V5lgeWJov+MhiMxTqPMWo/37Ek1ve9CTk2frk4wSFDRn77q3TtOCxmnTuMyg1ZlOH/mI7Kqsa6ZmLy4cDgwH9izXSKFgn8WCO5VO8C329o5FtErUHrq9nMz74Y0ZvJxxFLJCTMUzaeRkeDeZb45lEffh4RkfTFNzCBDi6GTgg8PYS3V/lr1iuucQaeGF+Q0CEmja4TQ6jhruQb2d8o+wO6JoxNOqfmoxNkAIdl4KtZb476Pg1h0pSHTle61oDXZ1R3SkNCSQs8PyaXanRba+BFSVdYdUqAaPNhsx/KaBi+Fj2xXvL9OqJEAqgbAUwPvyemNLnXLQ4zUbQVVBMbXAcErrxQ/TOsAEUuEReEKZpnWr/xvOnkfKpW2yHGfPnkKOkpxossa5DalANZ 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)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: iHh6M6/qwzLtj070gm5JxFlww/ueB+nP0YMVp5gU8rBd5gz78yaukl1sSgzPZQWcBsWqP97z9ikqL8dz5aul3kGkJ5KBAa5k8pNCkCuEBlCoYG/0e73WFbDCPaHR9wpvLN+fCH+DV4xp+6l0ZzvouJc/X2evzIm134ZrUfW8x1xPeuITTWur7Sk8UybWlduj93QSb6rKmuaWPUrnR0/OnY/JWTQAnn58Eh2aBHV3GxzYwky6YJUp0ys5pRg3vmGCMI4pUI7vedbmH5eQ3eIqCkV5GGXsipMMitb4mrkRUyvqPJbMut+rfRvfkYBaanmjczeVulysbsYyCkUIlFD7PDsqPrRpC2d8X6+ygtG0RxjDpzXdIbpfPpnQNexDeJQdsMcFNYprE1b8rhnPd4tLYIqqpa1/NYpWqK06b3owqEbvCz0AsaPlv6sGlxVovBytNxnSHu7aifrvZrvqg8XAE3NutIdslaI/RKz+FK8sDk9+kwO28U9uT0YJ8Q9WQAPpRZ377kq97Y9oKskLTuTSBbkwbtVannAv5WRqc2sG2tY6Oghx9NFk53QWPuWbbLTTd1Id75oafB7Y+dqCpMQfGDDj2oOz92jeFF9Z8PvFFOuuRUCYB7l9c+FxViaFle6FstK5mpk63vHa1+OR6vaMBw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:32.5647 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 52bc70c1-fad7-40d9-094c-08dce48a52eb 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7P190MB0662 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057043-311388-12691-32508-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.105 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYmBobGQGYGUDTFNNHE1CjNIN EyJTXFNNnE2MLUJDHZKDnFPDXFzCzJQqk2FgCskqqTQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan20-205.eu-central-1b.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 Added TX and RX queue setup. Handles memory allocation and hardware Virtio queue setup. Allocates and configures memory for hardware Virtio queues, including handling IOMMU and VFIO mappings. Signed-off-by: Danylo Vodopianov --- drivers/net/ntnic/include/ntnic_virt_queue.h | 3 +- drivers/net/ntnic/include/ntos_drv.h | 6 + drivers/net/ntnic/nthw/nthw_drv.h | 2 + drivers/net/ntnic/ntnic_ethdev.c | 323 +++++++++++++++++++ 4 files changed, 333 insertions(+), 1 deletion(-) diff --git a/drivers/net/ntnic/include/ntnic_virt_queue.h b/drivers/net/ntnic/include/ntnic_virt_queue.h index 422ac3b950..821b23af6c 100644 --- a/drivers/net/ntnic/include/ntnic_virt_queue.h +++ b/drivers/net/ntnic/include/ntnic_virt_queue.h @@ -13,7 +13,8 @@ struct nthw_virt_queue; -struct nthw_virtq_desc_buf; +#define SPLIT_RING 0 +#define IN_ORDER 1 struct nthw_cvirtq_desc; diff --git a/drivers/net/ntnic/include/ntos_drv.h b/drivers/net/ntnic/include/ntos_drv.h index 233d585303..933b012e07 100644 --- a/drivers/net/ntnic/include/ntos_drv.h +++ b/drivers/net/ntnic/include/ntos_drv.h @@ -47,6 +47,7 @@ struct __rte_cache_aligned ntnic_rx_queue { struct hwq_s hwq; struct nthw_virt_queue *vq; + int nb_hw_rx_descr; nt_meta_port_type_t type; uint32_t port; /* Rx port for this queue */ enum fpga_info_profile profile; /* Inline / Capture */ @@ -57,7 +58,12 @@ struct __rte_cache_aligned ntnic_tx_queue { struct flow_queue_id_s queue; /* queue info - user id and hw queue index */ struct hwq_s hwq; struct nthw_virt_queue *vq; + int nb_hw_tx_descr; + /* Used for bypass in NTDVIO0 header on Tx - pre calculated */ + int target_id; nt_meta_port_type_t type; + /* only used for exception tx queue from OVS SW switching */ + int rss_target_id; uint32_t port; /* Tx port for this queue */ int enabled; /* Enabling/disabling of this queue */ diff --git a/drivers/net/ntnic/nthw/nthw_drv.h b/drivers/net/ntnic/nthw/nthw_drv.h index eaa2b19015..69e0360f5f 100644 --- a/drivers/net/ntnic/nthw/nthw_drv.h +++ b/drivers/net/ntnic/nthw/nthw_drv.h @@ -71,6 +71,8 @@ typedef struct fpga_info_s { struct nthw_pcie3 *mp_nthw_pcie3; struct nthw_tsm *mp_nthw_tsm; + nthw_dbs_t *mp_nthw_dbs; + uint8_t *bar0_addr; /* Needed for register read/write */ size_t bar0_size; diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c index 78a689d444..57827d73d5 100644 --- a/drivers/net/ntnic/ntnic_ethdev.c +++ b/drivers/net/ntnic/ntnic_ethdev.c @@ -31,10 +31,16 @@ #define MAX_TOTAL_QUEUES 128 +#define SG_NB_HW_RX_DESCRIPTORS 1024 +#define SG_NB_HW_TX_DESCRIPTORS 1024 +#define SG_HW_RX_PKT_BUFFER_SIZE (1024 << 1) +#define SG_HW_TX_PKT_BUFFER_SIZE (1024 << 1) + /* Max RSS queues */ #define MAX_QUEUES 125 #define ONE_G_SIZE 0x40000000 +#define ONE_G_MASK (ONE_G_SIZE - 1) #define ETH_DEV_NTNIC_HELP_ARG "help" #define ETH_DEV_NTHW_RXQUEUES_ARG "rxqs" @@ -187,6 +193,157 @@ eth_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_info return 0; } +static int allocate_hw_virtio_queues(struct rte_eth_dev *eth_dev, int vf_num, struct hwq_s *hwq, + int num_descr, int buf_size) +{ + int i, res; + uint32_t size; + uint64_t iova_addr; + + NT_LOG(DBG, NTNIC, "***** Configure IOMMU for HW queues on VF %i *****\n", vf_num); + + /* Just allocate 1MB to hold all combined descr rings */ + uint64_t tot_alloc_size = 0x100000 + buf_size * num_descr; + + void *virt = + rte_malloc_socket("VirtQDescr", tot_alloc_size, nt_util_align_size(tot_alloc_size), + eth_dev->data->numa_node); + + if (!virt) + return -1; + + uint64_t gp_offset = (uint64_t)virt & ONE_G_MASK; + rte_iova_t hpa = rte_malloc_virt2iova(virt); + + NT_LOG(DBG, NTNIC, "Allocated virtio descr rings : virt " + "%p [0x%" PRIX64 "],hpa %" PRIX64 " [0x%" PRIX64 "]\n", + virt, gp_offset, hpa, hpa & ONE_G_MASK); + + /* + * Same offset on both HPA and IOVA + * Make sure 1G boundary is never crossed + */ + if (((hpa & ONE_G_MASK) != gp_offset) || + (((uint64_t)virt + tot_alloc_size) & ~ONE_G_MASK) != + ((uint64_t)virt & ~ONE_G_MASK)) { + NT_LOG(ERR, NTNIC, "*********************************************************\n"); + NT_LOG(ERR, NTNIC, "ERROR, no optimal IOMMU mapping available hpa: %016" PRIX64 + "(%016" PRIX64 "), gp_offset: %016" PRIX64 " size: %" PRIu64 "\n", + hpa, hpa & ONE_G_MASK, gp_offset, tot_alloc_size); + NT_LOG(ERR, NTNIC, "*********************************************************\n"); + + rte_free(virt); + + /* Just allocate 1MB to hold all combined descr rings */ + size = 0x100000; + void *virt = rte_malloc_socket("VirtQDescr", size, 4096, eth_dev->data->numa_node); + + if (!virt) + return -1; + + res = nt_vfio_dma_map(vf_num, virt, &iova_addr, size); + + NT_LOG(DBG, NTNIC, "VFIO MMAP res %i, vf_num %i\n", res, vf_num); + + if (res != 0) + return -1; + + hwq->vf_num = vf_num; + hwq->virt_queues_ctrl.virt_addr = virt; + hwq->virt_queues_ctrl.phys_addr = (void *)iova_addr; + hwq->virt_queues_ctrl.len = size; + + NT_LOG(DBG, NTNIC, + "Allocated for virtio descr rings combined 1MB : %p, IOVA %016" PRIX64 "\n", + virt, iova_addr); + + size = num_descr * sizeof(struct nthw_memory_descriptor); + hwq->pkt_buffers = + rte_zmalloc_socket("rx_pkt_buffers", size, 64, eth_dev->data->numa_node); + + if (!hwq->pkt_buffers) { + NT_LOG(ERR, NTNIC, + "Failed to allocated buffer array for hw-queue %p, total size %i, elements %i\n", + hwq->pkt_buffers, size, num_descr); + rte_free(virt); + return -1; + } + + size = buf_size * num_descr; + void *virt_addr = + rte_malloc_socket("pkt_buffer_pkts", size, 4096, eth_dev->data->numa_node); + + if (!virt_addr) { + NT_LOG(ERR, NTNIC, + "Failed allocate packet buffers for hw-queue %p, buf size %i, elements %i\n", + hwq->pkt_buffers, buf_size, num_descr); + rte_free(hwq->pkt_buffers); + rte_free(virt); + return -1; + } + + res = nt_vfio_dma_map(vf_num, virt_addr, &iova_addr, size); + + NT_LOG(DBG, NTNIC, + "VFIO MMAP res %i, virt %p, iova %016" PRIX64 ", vf_num %i, num pkt bufs %i, tot size %i\n", + res, virt_addr, iova_addr, vf_num, num_descr, size); + + if (res != 0) + return -1; + + for (i = 0; i < num_descr; i++) { + hwq->pkt_buffers[i].virt_addr = + (void *)((char *)virt_addr + ((uint64_t)(i) * buf_size)); + hwq->pkt_buffers[i].phys_addr = + (void *)(iova_addr + ((uint64_t)(i) * buf_size)); + hwq->pkt_buffers[i].len = buf_size; + } + + return 0; + } /* End of: no optimal IOMMU mapping available */ + + res = nt_vfio_dma_map(vf_num, virt, &iova_addr, ONE_G_SIZE); + + if (res != 0) { + NT_LOG(ERR, NTNIC, "VFIO MMAP FAILED! res %i, vf_num %i\n", res, vf_num); + return -1; + } + + hwq->vf_num = vf_num; + hwq->virt_queues_ctrl.virt_addr = virt; + hwq->virt_queues_ctrl.phys_addr = (void *)(iova_addr); + hwq->virt_queues_ctrl.len = 0x100000; + iova_addr += 0x100000; + + NT_LOG(DBG, NTNIC, + "VFIO MMAP: virt_addr=%p phys_addr=%p size=%" PRIX32 " hpa=%" PRIX64 "\n", + hwq->virt_queues_ctrl.virt_addr, hwq->virt_queues_ctrl.phys_addr, + hwq->virt_queues_ctrl.len, rte_malloc_virt2iova(hwq->virt_queues_ctrl.virt_addr)); + + size = num_descr * sizeof(struct nthw_memory_descriptor); + hwq->pkt_buffers = + rte_zmalloc_socket("rx_pkt_buffers", size, 64, eth_dev->data->numa_node); + + if (!hwq->pkt_buffers) { + NT_LOG(ERR, NTNIC, + "Failed to allocated buffer array for hw-queue %p, total size %i, elements %i\n", + hwq->pkt_buffers, size, num_descr); + rte_free(virt); + return -1; + } + + void *virt_addr = (void *)((uint64_t)virt + 0x100000); + + for (i = 0; i < num_descr; i++) { + hwq->pkt_buffers[i].virt_addr = + (void *)((char *)virt_addr + ((uint64_t)(i) * buf_size)); + hwq->pkt_buffers[i].phys_addr = (void *)(iova_addr + ((uint64_t)(i) * buf_size)); + hwq->pkt_buffers[i].len = buf_size; + } + + return 0; +} + static void release_hw_virtio_queues(struct hwq_s *hwq) { if (!hwq || hwq->vf_num == 0) @@ -245,6 +402,170 @@ static int allocate_queue(int num) return next_free; } +static int eth_rx_scg_queue_setup(struct rte_eth_dev *eth_dev, + uint16_t rx_queue_id, + uint16_t nb_rx_desc __rte_unused, + unsigned int socket_id __rte_unused, + const struct rte_eth_rxconf *rx_conf __rte_unused, + struct rte_mempool *mb_pool) +{ + NT_LOG_DBGX(DBG, NTNIC, "\n"); + struct rte_pktmbuf_pool_private *mbp_priv; + struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; + struct ntnic_rx_queue *rx_q = &internals->rxq_scg[rx_queue_id]; + struct drv_s *p_drv = internals->p_drv; + struct ntdrv_4ga_s *p_nt_drv = &p_drv->ntdrv; + + if (sg_ops == NULL) { + NT_LOG_DBGX(DBG, NTNIC, "SG module is not initialized\n"); + return 0; + } + + if (internals->type == PORT_TYPE_OVERRIDE) { + rx_q->mb_pool = mb_pool; + eth_dev->data->rx_queues[rx_queue_id] = rx_q; + mbp_priv = rte_mempool_get_priv(rx_q->mb_pool); + rx_q->buf_size = (uint16_t)(mbp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM); + rx_q->enabled = 1; + return 0; + } + + NT_LOG(DBG, NTNIC, "(%i) NTNIC RX OVS-SW queue setup: queue id %i, hw queue index %i\n", + internals->port, rx_queue_id, rx_q->queue.hw_id); + + rx_q->mb_pool = mb_pool; + + eth_dev->data->rx_queues[rx_queue_id] = rx_q; + + mbp_priv = rte_mempool_get_priv(rx_q->mb_pool); + rx_q->buf_size = (uint16_t)(mbp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM); + rx_q->enabled = 1; + + if (allocate_hw_virtio_queues(eth_dev, EXCEPTION_PATH_HID, &rx_q->hwq, + SG_NB_HW_RX_DESCRIPTORS, SG_HW_RX_PKT_BUFFER_SIZE) < 0) + return -1; + + rx_q->nb_hw_rx_descr = SG_NB_HW_RX_DESCRIPTORS; + + rx_q->profile = p_drv->ntdrv.adapter_info.fpga_info.profile; + + rx_q->vq = + sg_ops->nthw_setup_mngd_rx_virt_queue(p_nt_drv->adapter_info.fpga_info.mp_nthw_dbs, + rx_q->queue.hw_id, /* index */ + rx_q->nb_hw_rx_descr, + EXCEPTION_PATH_HID, /* host_id */ + 1, /* header NT DVIO header for exception path */ + &rx_q->hwq.virt_queues_ctrl, + rx_q->hwq.pkt_buffers, + SPLIT_RING, + -1); + + NT_LOG(DBG, NTNIC, "(%i) NTNIC RX OVS-SW queues successfully setup\n", internals->port); + + return 0; +} + +static int eth_tx_scg_queue_setup(struct rte_eth_dev *eth_dev, + uint16_t tx_queue_id, + uint16_t nb_tx_desc __rte_unused, + unsigned int socket_id __rte_unused, + const struct rte_eth_txconf *tx_conf __rte_unused) +{ + const struct port_ops *port_ops = get_port_ops(); + + if (port_ops == NULL) { + NT_LOG_DBGX(ERR, NTNIC, "Link management module uninitialized\n"); + return -1; + } + + NT_LOG_DBGX(DBG, NTNIC, "\n"); + struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; + struct drv_s *p_drv = internals->p_drv; + struct ntdrv_4ga_s *p_nt_drv = &p_drv->ntdrv; + struct ntnic_tx_queue *tx_q = &internals->txq_scg[tx_queue_id]; + + if (internals->type == PORT_TYPE_OVERRIDE) { + eth_dev->data->tx_queues[tx_queue_id] = tx_q; + return 0; + } + + if (sg_ops == NULL) { + NT_LOG_DBGX(DBG, NTNIC, "SG module is not initialized\n"); + return 0; + } + + NT_LOG(DBG, NTNIC, "(%i) NTNIC TX OVS-SW queue setup: queue id %i, hw queue index %i\n", + tx_q->port, tx_queue_id, tx_q->queue.hw_id); + + if (tx_queue_id > internals->nb_tx_queues) { + NT_LOG(ERR, NTNIC, "Error invalid tx queue id\n"); + return -1; + } + + eth_dev->data->tx_queues[tx_queue_id] = tx_q; + + /* Calculate target ID for HW - to be used in NTDVIO0 header bypass_port */ + if (tx_q->rss_target_id >= 0) { + /* bypass to a multiqueue port - qsl-hsh index */ + tx_q->target_id = tx_q->rss_target_id + 0x90; + + } else if (internals->vpq[tx_queue_id].hw_id > -1) { + /* virtual port - queue index */ + tx_q->target_id = internals->vpq[tx_queue_id].hw_id; + + } else { + /* Phy port - phy port identifier */ + /* output/bypass to MAC */ + tx_q->target_id = (int)(tx_q->port + 0x80); + } + + if (allocate_hw_virtio_queues(eth_dev, EXCEPTION_PATH_HID, &tx_q->hwq, + SG_NB_HW_TX_DESCRIPTORS, SG_HW_TX_PKT_BUFFER_SIZE) < 0) { + return -1; + } + + tx_q->nb_hw_tx_descr = SG_NB_HW_TX_DESCRIPTORS; + + tx_q->profile = p_drv->ntdrv.adapter_info.fpga_info.profile; + + uint32_t port, header; + port = tx_q->port; /* transmit port */ + header = 0; /* header type VirtIO-Net */ + + tx_q->vq = + sg_ops->nthw_setup_mngd_tx_virt_queue(p_nt_drv->adapter_info.fpga_info.mp_nthw_dbs, + tx_q->queue.hw_id, /* index */ + tx_q->nb_hw_tx_descr, /* queue size */ + EXCEPTION_PATH_HID, /* host_id always VF4 */ + port, + /* + * in_port - in vswitch mode has + * to move tx port from OVS excep. + * away from VM tx port, + * because of QoS is matched by port id! + */ + tx_q->port + 128, + header, + &tx_q->hwq.virt_queues_ctrl, + tx_q->hwq.pkt_buffers, + SPLIT_RING, + -1, + IN_ORDER); + + tx_q->enabled = 1; + + NT_LOG(DBG, NTNIC, "(%i) NTNIC TX OVS-SW queues successfully setup\n", internals->port); + + if (internals->type == PORT_TYPE_PHYSICAL) { + struct adapter_info_s *p_adapter_info = &internals->p_drv->ntdrv.adapter_info; + NT_LOG(DBG, NTNIC, "Port %i is ready for data. Enable port\n", + internals->n_intf_no); + port_ops->set_adm_state(p_adapter_info, internals->n_intf_no, true); + } + + return 0; +} + static int eth_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) { eth_dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED; @@ -580,9 +901,11 @@ static const struct eth_dev_ops nthw_eth_dev_ops = { .link_update = eth_link_update, .dev_infos_get = eth_dev_infos_get, .fw_version_get = eth_fw_version_get, + .rx_queue_setup = eth_rx_scg_queue_setup, .rx_queue_start = eth_rx_queue_start, .rx_queue_stop = eth_rx_queue_stop, .rx_queue_release = eth_rx_queue_release, + .tx_queue_setup = eth_tx_scg_queue_setup, .tx_queue_start = eth_tx_queue_start, .tx_queue_stop = eth_tx_queue_stop, .tx_queue_release = eth_tx_queue_release, From patchwork Fri Oct 4 15:34:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145106 X-Patchwork-Delegate: ferruh.yigit@amd.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 37B0D45AAF; Fri, 4 Oct 2024 17:53:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0694D42E93; Fri, 4 Oct 2024 17:51:25 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id F257F42E84 for ; Fri, 4 Oct 2024 17:51:19 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2104.outbound.protection.outlook.com [104.47.17.104]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:51:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QBX7q5XKIBw4xWYN763+oLpjdALJvEs9UmQlSC9luyOxC0NdDRVyh66d1jH+4E+KLDpNoyUm2ZVUfaoSOEu42tJWlNAFzMwn5kYpFn/UZZDM2yGbIVaSpeCdVdch62Rd1eismwZYuLKtk2G5QBQjQy1/y8tXd8TStpKb/CEqOn6x+xf6wWsPj69aRvH43Kr8Y6UM8H6xsAxF+9AopkxqEUFTN8j+lK29Guqu6z5fi22BkxrR49mC7k4fRJ4sMA65/Xixdrvjeh4nzhuQfMXwd5bHEn1ysfMK70taOgHGT+PuU69L7d3V7/KnJmC7MqhVCkS8p3cejiBtGymLhWEe9A== 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=kl135QL+Wilsxaog3ZfKJhEIfQPHVBRKv6TVgSdqZI8=; b=Y7fGaqMYD2cDfG4n98SwqJbm/YxcqhxkhZ0E/mUlrClrbPJ6KjEV9vj2Q6azV3xbZ9R3yi/clPqb3k9mBE3K+nG7vWvyCUdyW2mVjvjkje1bdqQtMGy8Yq7JJY1L1E94H+YTPT962a7AWWYhgNY2dSCZBG7U6udGKQsjNwv+XBrKOUhH26xOH+MWsTit+pWFjaXQLKq95gfNAymNfdXXmQ4TgeKAapqJyws7ys5DYdS64I641HXj9DQECnmPYuKkqhGEDDiPBm3jOgA+0wf0wd0fmEYFw2Aetb0qceq5Tc/Y26hPgAvQOC7iBeoV3X5irYiV+QCW/mpBgjX12/sqlQ== 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=kl135QL+Wilsxaog3ZfKJhEIfQPHVBRKv6TVgSdqZI8=; b=OMKejYUIm1Dca0AfhdvpVJ+C87t8Tv7jgmDr+F28C0GURyXVlZwJwfD/Ssgabncl/btoJbBMPbrIHnPSn5c/KM4aHR4f8IULi3Noe/jr9q+lJsNSezENVqMgfuNIA8r88/1gQ7Uj+UxSTcn1uzBNfj/bZYGw3O2QCQ7eYuVtazg= Received: from AM0PR10CA0108.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::25) by VI0P190MB2063.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:207::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 15:36:33 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::4c) by AM0PR10CA0108.outlook.office365.com (2603:10a6:208:e6::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.19 via Frontend Transport; Fri, 4 Oct 2024 15:36:33 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:33 +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 05/14] net/ntnic: add packet handler for virtio queues Date: Fri, 4 Oct 2024 17:34:59 +0200 Message-ID: <20241004153551.267935-42-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|VI0P190MB2063:EE_ X-MS-Office365-Filtering-Correlation-Id: 2b966b46-aa72-4079-7bcc-08dce48a533e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: NEaUoPLem8V9slpc4ya2px9f3Xb/fOqGyQMEXNRj+OG0II2WfhQB+lyiIJyphDDJw+e0exID99RZ6Gfp6moU08/EytCyrwBYC5Hi+1IVctUz/6kUBSR2tNM6bUrl+oNHpgARXZ5u1tMwB1mAg3v1UzmDDRs/uHOryzPieBlAAe2/gARqQCnfR6UUx5ynUGTTiWm7SAcnJtYm1vzwspVEJq3CG/d10L8qnU2WJXjQ3qeSny1x6dmWdJz8fQA5ul3X/+x5F/xNX6Sc5xgP9ejLRjOX81Ivtz8nr4+pTcNfMKhLb1+4jU2vH++itmYVCibSZ17bWs9A1So64m4GiVol26mtBQ43Bp4sodzSHori0d0x+hIkhMZ3iNPJ/eCC2se+cOa5yANy3ZbrzAW6H7tV1H21U1vB2UJThMlqWd0LNRRN5SmFRPEV+JFu7RCXsZHOrQnTJ9karlS4W31Bk+TimmbOCRRVu80Xx3ASBfkSTHeQhrqRZqblL6QfIDS66a4wsBU+mO/ebT+c2/321ElqwUsgHWcXDQvENyYTf4h9uoxyGIRMp5UpcZTbwqjYxLyIrLLPxmqwQ94lxEfreE2Tvv3ltb6R7sMBt+aSCjbYOenVE4BV6dGex5tRElftc+nmmrtMcByYJol5IkWysvHWXOEBr/4AztGbuDbY2tvgOE92dxb79MFGUAp43EWNTRYgS1rLm9izb2VL2U0XkuAfURA5MhLP6GTwvdx6KHk+vbdg/KcYyBjPwGxO71Z2ZahBb495DVYkLwUabWpeGC59Pv0/n/3JwmrIesnGWjRc39wsNRCkAoQtQvHkgzV8VWLXj1IsDa0cnhOM2jXUSw4yfo+e81AZRhlzYPw1xa0ga6kShCXQ9hMVoSQIS/y1rDXnDQ6qJO48CUvfA5/x12oRxM2r+Fo88gKoXilFSXLiUGJUFq3CNSRCj3jnsMZ0qtLopiBNRGfxtc+A9Gyo0QwTRkMYi5Q176fwo+tq4tS9yNYCOLmGhGJFShOvV954ARHyUPlt4U+9yXhFcB3Pc/WreS+eDAAJ7TZkEYvF6I/jaCx82zre6pCB7iLV4hm4qfezDPN5s6o/LslzVaykZXeRPU6PHHw9n6MpEtqClGgjSJ1D0WybhShMyWcMwLm7HeeSzmQvpXNsu0My9spzhS1McXlXI4GpsOEd4I3FcLgqNj8IQ7yqy4NDBym3JN3/J/CuwPENDmXplatlCzm8ixAo60Z9EIYVMEjZ3RXkLHmLz7x7t2PjULrfRKXrLtL9v/GQAESrAOX/ZtkCyBmahSgt8Av6IpBiyfwpLw3lMnjvFumg37ZfAfi/TQuTilDLn9XDYJ43LwO71fYlShsUuE1jmKBGvbZSUYTPr9CGVtYAWb0nzUdqFJ7UbYdA3gVCdxMJ 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)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: JYwXUu78+WYVCKiuiNGh8L50Dnhpe4FHHeyjCwTdynL/9y1JAmwlphGDkfVLXrFg8SuGV1dvzp/BZKcWgIh6e8/KmXFLHTZ5ApAdHPx55CVabIZowbEaiKZ1WJP6Wbn7fCIMEoi1Kh8moDGrFkLe1KTAgPiTEY1ZW98xSz4Xho72y6CVXpxSTAnLu0kCGd/EYwuqpVcNkdrOGYsuVLal/pgY3KUVrZerrsPmzmeALejlzsPsUBRWyTyqWnVjKx4/3oz3iFXhX6ZEcEJ/Nfnazi3Jyl9TPdxA9JzGwi7M8fBhdvK4x5uDjk+STuBKo+PYHWL40nis7H5eR+PhOEDZUz02eYv5r52WWlTpF6Njddz3LY1X7ONsLTErLiIcBan0lQXxIfdJ/hKc1ZCpiSY9SM0ubwY2pSRTn3LqvvrNScZ5Gq9ity0naylDPYK+sYv9+KHE2EMT3QWqXmnS0dwnRT3qdb6qB3juzvDgC2xWxtG6vZ+TmCTW491GxE5CwYkZ4pX5+e6n4Lq6elc0o3Vz1UUYQeAoIbKaf3feH/FoDHVahUhEnV1BQgbNMh5e9T4H02zyPmsETprZruDn1RHvUv2reQ5N22Q+iTx6rg2B1Soa5AP3UWM8qEliYGuOu86MBjoEXAtF3Jb87RJD0UJc3Q== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:33.1272 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2b966b46-aa72-4079-7bcc-08dce48a533e 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0P190MB2063 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057078-311388-12691-32537-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.104 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZmBuYWQGYGUDQ1Mc0oJTHVND HJ0DzNwtA4OcnA0jLJwsjA3Cw5KS0xVak2FgAKOWdTQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan16-55.eu-central-1b.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 Added functionality to handles the copying of segmented queue data into a rte_mbuf and vice versa. Added functionality to manages packet transmission for a specified TX and RX queues. Signed-off-by: Danylo Vodopianov --- drivers/net/ntnic/include/ntnic_virt_queue.h | 87 +++- drivers/net/ntnic/include/ntos_drv.h | 14 + drivers/net/ntnic/ntnic_ethdev.c | 441 +++++++++++++++++++ 3 files changed, 540 insertions(+), 2 deletions(-) diff --git a/drivers/net/ntnic/include/ntnic_virt_queue.h b/drivers/net/ntnic/include/ntnic_virt_queue.h index 821b23af6c..f8842819e4 100644 --- a/drivers/net/ntnic/include/ntnic_virt_queue.h +++ b/drivers/net/ntnic/include/ntnic_virt_queue.h @@ -14,10 +14,93 @@ struct nthw_virt_queue; #define SPLIT_RING 0 +#define PACKED_RING 1 #define IN_ORDER 1 -struct nthw_cvirtq_desc; +/* + * SPLIT : This marks a buffer as continuing via the next field. + * PACKED: This marks a buffer as continuing. (packed does not have a next field, so must be + * contiguous) In Used descriptors it must be ignored + */ +#define VIRTQ_DESC_F_NEXT 1 + +/* + * Split Ring virtq Descriptor + */ +struct __rte_aligned(8) virtq_desc { + /* Address (guest-physical). */ + uint64_t addr; + /* Length. */ + uint32_t len; + /* The flags as indicated above. */ + uint16_t flags; + /* Next field if flags & NEXT */ + uint16_t next; +}; + +/* descr phys address must be 16 byte aligned */ +struct __rte_aligned(16) pvirtq_desc { + /* Buffer Address. */ + uint64_t addr; + /* Buffer Length. */ + uint32_t len; + /* Buffer ID. */ + uint16_t id; + /* The flags depending on descriptor type. */ + uint16_t flags; +}; + +/* + * Common virtq descr + */ +#define vq_set_next(vq, index, nxt) \ +do { \ + struct nthw_cvirtq_desc *temp_vq = (vq); \ + if (temp_vq->vq_type == SPLIT_RING) \ + temp_vq->s[index].next = nxt; \ +} while (0) + +#define vq_add_flags(vq, index, flgs) \ +do { \ + struct nthw_cvirtq_desc *temp_vq = (vq); \ + uint16_t tmp_index = (index); \ + typeof(flgs) tmp_flgs = (flgs); \ + if (temp_vq->vq_type == SPLIT_RING) \ + temp_vq->s[tmp_index].flags |= tmp_flgs; \ + else if (temp_vq->vq_type == PACKED_RING) \ + temp_vq->p[tmp_index].flags |= tmp_flgs; \ +} while (0) + +#define vq_set_flags(vq, index, flgs) \ +do { \ + struct nthw_cvirtq_desc *temp_vq = (vq); \ + uint32_t temp_flags = (flgs); \ + uint32_t temp_index = (index); \ + if ((temp_vq)->vq_type == SPLIT_RING) \ + (temp_vq)->s[temp_index].flags = temp_flags; \ + else if ((temp_vq)->vq_type == PACKED_RING) \ + (temp_vq)->p[temp_index].flags = temp_flags; \ +} while (0) + +struct nthw_virtq_desc_buf { + /* Address (guest-physical). */ + alignas(16) uint64_t addr; + /* Length. */ + uint32_t len; +}; + +struct nthw_cvirtq_desc { + union { + struct nthw_virtq_desc_buf *b; /* buffer part as is common */ + struct virtq_desc *s; /* SPLIT */ + struct pvirtq_desc *p; /* PACKED */ + }; + uint16_t vq_type; +}; -struct nthw_received_packets; +struct nthw_received_packets { + void *addr; + uint32_t len; +}; #endif /* __NTOSS_VIRT_QUEUE_H__ */ diff --git a/drivers/net/ntnic/include/ntos_drv.h b/drivers/net/ntnic/include/ntos_drv.h index 933b012e07..d51d1e3677 100644 --- a/drivers/net/ntnic/include/ntos_drv.h +++ b/drivers/net/ntnic/include/ntos_drv.h @@ -27,6 +27,20 @@ #define MAX_QUEUES 125 /* Structs: */ +#define SG_HDR_SIZE 12 + +struct _pkt_hdr_rx { + uint32_t cap_len:14; + uint32_t fid:10; + uint32_t ofs1:8; + uint32_t ip_prot:8; + uint32_t port:13; + uint32_t descr:8; + uint32_t descr_12b:1; + uint32_t color_type:2; + uint32_t color:32; +}; + struct nthw_memory_descriptor { void *phys_addr; void *virt_addr; diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c index 57827d73d5..b0ec41e2bb 100644 --- a/drivers/net/ntnic/ntnic_ethdev.c +++ b/drivers/net/ntnic/ntnic_ethdev.c @@ -39,9 +39,29 @@ /* Max RSS queues */ #define MAX_QUEUES 125 +#define NUM_VQ_SEGS(_data_size_) \ + ({ \ + size_t _size = (_data_size_); \ + size_t _segment_count = ((_size + SG_HDR_SIZE) > SG_HW_TX_PKT_BUFFER_SIZE) \ + ? (((_size + SG_HDR_SIZE) + SG_HW_TX_PKT_BUFFER_SIZE - 1) / \ + SG_HW_TX_PKT_BUFFER_SIZE) \ + : 1; \ + _segment_count; \ + }) + +#define VIRTQ_DESCR_IDX(_tx_pkt_idx_) \ + (((_tx_pkt_idx_) + first_vq_descr_idx) % SG_NB_HW_TX_DESCRIPTORS) + +#define VIRTQ_DESCR_IDX_NEXT(_vq_descr_idx_) (((_vq_descr_idx_) + 1) % SG_NB_HW_TX_DESCRIPTORS) + #define ONE_G_SIZE 0x40000000 #define ONE_G_MASK (ONE_G_SIZE - 1) +#define MAX_RX_PACKETS 128 +#define MAX_TX_PACKETS 128 + +int kill_pmd; + #define ETH_DEV_NTNIC_HELP_ARG "help" #define ETH_DEV_NTHW_RXQUEUES_ARG "rxqs" #define ETH_DEV_NTHW_TXQUEUES_ARG "txqs" @@ -193,6 +213,423 @@ eth_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_info return 0; } +static __rte_always_inline int copy_virtqueue_to_mbuf(struct rte_mbuf *mbuf, + struct rte_mempool *mb_pool, + struct nthw_received_packets *hw_recv, + int max_segs, + uint16_t data_len) +{ + int src_pkt = 0; + /* + * 1. virtqueue packets may be segmented + * 2. the mbuf size may be too small and may need to be segmented + */ + char *data = (char *)hw_recv->addr + SG_HDR_SIZE; + char *dst = (char *)mbuf->buf_addr + RTE_PKTMBUF_HEADROOM; + + /* set packet length */ + mbuf->pkt_len = data_len - SG_HDR_SIZE; + + int remain = mbuf->pkt_len; + /* First cpy_size is without header */ + int cpy_size = (data_len > SG_HW_RX_PKT_BUFFER_SIZE) + ? SG_HW_RX_PKT_BUFFER_SIZE - SG_HDR_SIZE + : remain; + + struct rte_mbuf *m = mbuf; /* if mbuf segmentation is needed */ + + while (++src_pkt <= max_segs) { + /* keep track of space in dst */ + int cpto_size = rte_pktmbuf_tailroom(m); + + if (cpy_size > cpto_size) { + int new_cpy_size = cpto_size; + + rte_memcpy((void *)dst, (void *)data, new_cpy_size); + m->data_len += new_cpy_size; + remain -= new_cpy_size; + cpy_size -= new_cpy_size; + + data += new_cpy_size; + + /* + * loop if remaining data from this virtqueue seg + * cannot fit in one extra mbuf + */ + do { + m->next = rte_pktmbuf_alloc(mb_pool); + + if (unlikely(!m->next)) + return -1; + + m = m->next; + + /* Headroom is not needed in chained mbufs */ + rte_pktmbuf_prepend(m, rte_pktmbuf_headroom(m)); + dst = (char *)m->buf_addr; + m->data_len = 0; + m->pkt_len = 0; + + cpto_size = rte_pktmbuf_tailroom(m); + + int actual_cpy_size = + (cpy_size > cpto_size) ? cpto_size : cpy_size; + + rte_memcpy((void *)dst, (void *)data, actual_cpy_size); + m->pkt_len += actual_cpy_size; + m->data_len += actual_cpy_size; + + remain -= actual_cpy_size; + cpy_size -= actual_cpy_size; + + data += actual_cpy_size; + + mbuf->nb_segs++; + + } while (cpy_size && remain); + + } else { + /* all data from this virtqueue segment can fit in current mbuf */ + rte_memcpy((void *)dst, (void *)data, cpy_size); + m->data_len += cpy_size; + + if (mbuf->nb_segs > 1) + m->pkt_len += cpy_size; + + remain -= cpy_size; + } + + /* packet complete - all data from current virtqueue packet has been copied */ + if (remain == 0) + break; + + /* increment dst to data end */ + dst = rte_pktmbuf_mtod_offset(m, char *, m->data_len); + /* prepare for next virtqueue segment */ + data = (char *)hw_recv[src_pkt].addr; /* following packets are full data */ + + cpy_size = (remain > SG_HW_RX_PKT_BUFFER_SIZE) ? SG_HW_RX_PKT_BUFFER_SIZE : remain; + }; + + if (src_pkt > max_segs) { + NT_LOG(ERR, NTNIC, + "Did not receive correct number of segment for a whole packet"); + return -1; + } + + return src_pkt; +} + +static uint16_t eth_dev_rx_scg(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) +{ + unsigned int i; + struct rte_mbuf *mbuf; + struct ntnic_rx_queue *rx_q = queue; + uint16_t num_rx = 0; + + struct nthw_received_packets hw_recv[MAX_RX_PACKETS]; + + if (kill_pmd) + return 0; + + if (unlikely(nb_pkts == 0)) + return 0; + + if (nb_pkts > MAX_RX_PACKETS) + nb_pkts = MAX_RX_PACKETS; + + uint16_t whole_pkts = 0; + uint16_t hw_recv_pkt_segs = 0; + + if (sg_ops != NULL) { + hw_recv_pkt_segs = + sg_ops->nthw_get_rx_packets(rx_q->vq, nb_pkts, hw_recv, &whole_pkts); + + if (!hw_recv_pkt_segs) + return 0; + } + + nb_pkts = whole_pkts; + + int src_pkt = 0;/* from 0 to hw_recv_pkt_segs */ + + for (i = 0; i < nb_pkts; i++) { + bufs[i] = rte_pktmbuf_alloc(rx_q->mb_pool); + + if (!bufs[i]) { + NT_LOG(ERR, NTNIC, "ERROR - no more buffers mbuf in mempool\n"); + goto err_exit; + } + + mbuf = bufs[i]; + + struct _pkt_hdr_rx *phdr = (struct _pkt_hdr_rx *)hw_recv[src_pkt].addr; + + if (phdr->cap_len < SG_HDR_SIZE) { + NT_LOG(ERR, NTNIC, + "Pkt len of zero received. No header!! - dropping packets\n"); + rte_pktmbuf_free(mbuf); + goto err_exit; + } + + { + if (phdr->cap_len <= SG_HW_RX_PKT_BUFFER_SIZE && + (phdr->cap_len - SG_HDR_SIZE) <= rte_pktmbuf_tailroom(mbuf)) { + mbuf->data_len = phdr->cap_len - SG_HDR_SIZE; + rte_memcpy(rte_pktmbuf_mtod(mbuf, char *), + (char *)hw_recv[src_pkt].addr + SG_HDR_SIZE, + mbuf->data_len); + + mbuf->pkt_len = mbuf->data_len; + src_pkt++; + + } else { + int cpy_segs = copy_virtqueue_to_mbuf(mbuf, rx_q->mb_pool, + &hw_recv[src_pkt], + hw_recv_pkt_segs - src_pkt, + phdr->cap_len); + + if (cpy_segs < 0) { + /* Error */ + rte_pktmbuf_free(mbuf); + goto err_exit; + } + + src_pkt += cpy_segs; + } + + num_rx++; + + mbuf->ol_flags &= ~(RTE_MBUF_F_RX_FDIR_ID | RTE_MBUF_F_RX_FDIR); + mbuf->port = (uint16_t)-1; + } + } + +err_exit: + + if (sg_ops != NULL) + sg_ops->nthw_release_rx_packets(rx_q->vq, hw_recv_pkt_segs); + + return num_rx; +} + +static int copy_mbuf_to_virtqueue(struct nthw_cvirtq_desc *cvq_desc, + uint16_t vq_descr_idx, + struct nthw_memory_descriptor *vq_bufs, + int max_segs, + struct rte_mbuf *mbuf) +{ + /* + * 1. mbuf packet may be segmented + * 2. the virtqueue buffer size may be too small and may need to be segmented + */ + + char *data = rte_pktmbuf_mtod(mbuf, char *); + char *dst = (char *)vq_bufs[vq_descr_idx].virt_addr + SG_HDR_SIZE; + + int remain = mbuf->pkt_len; + int cpy_size = mbuf->data_len; + + struct rte_mbuf *m = mbuf; + int cpto_size = SG_HW_TX_PKT_BUFFER_SIZE - SG_HDR_SIZE; + + cvq_desc->b[vq_descr_idx].len = SG_HDR_SIZE; + + int cur_seg_num = 0; /* start from 0 */ + + while (m) { + /* Can all data in current src segment be in current dest segment */ + if (cpy_size > cpto_size) { + int new_cpy_size = cpto_size; + + rte_memcpy((void *)dst, (void *)data, new_cpy_size); + + cvq_desc->b[vq_descr_idx].len += new_cpy_size; + + remain -= new_cpy_size; + cpy_size -= new_cpy_size; + + data += new_cpy_size; + + /* + * Loop if remaining data from this virtqueue seg cannot fit in one extra + * mbuf + */ + do { + vq_add_flags(cvq_desc, vq_descr_idx, VIRTQ_DESC_F_NEXT); + + int next_vq_descr_idx = VIRTQ_DESCR_IDX_NEXT(vq_descr_idx); + + vq_set_next(cvq_desc, vq_descr_idx, next_vq_descr_idx); + + vq_descr_idx = next_vq_descr_idx; + + vq_set_flags(cvq_desc, vq_descr_idx, 0); + vq_set_next(cvq_desc, vq_descr_idx, 0); + + if (++cur_seg_num > max_segs) + break; + + dst = (char *)vq_bufs[vq_descr_idx].virt_addr; + cpto_size = SG_HW_TX_PKT_BUFFER_SIZE; + + int actual_cpy_size = + (cpy_size > cpto_size) ? cpto_size : cpy_size; + rte_memcpy((void *)dst, (void *)data, actual_cpy_size); + + cvq_desc->b[vq_descr_idx].len = actual_cpy_size; + + remain -= actual_cpy_size; + cpy_size -= actual_cpy_size; + cpto_size -= actual_cpy_size; + + data += actual_cpy_size; + + } while (cpy_size && remain); + + } else { + /* All data from this segment can fit in current virtqueue buffer */ + rte_memcpy((void *)dst, (void *)data, cpy_size); + + cvq_desc->b[vq_descr_idx].len += cpy_size; + + remain -= cpy_size; + cpto_size -= cpy_size; + } + + /* Packet complete - all segments from current mbuf has been copied */ + if (remain == 0) + break; + + /* increment dst to data end */ + dst = (char *)vq_bufs[vq_descr_idx].virt_addr + cvq_desc->b[vq_descr_idx].len; + + m = m->next; + + if (!m) { + NT_LOG(ERR, NTNIC, "ERROR: invalid packet size\n"); + break; + } + + /* Prepare for next mbuf segment */ + data = rte_pktmbuf_mtod(m, char *); + cpy_size = m->data_len; + }; + + cur_seg_num++; + + if (cur_seg_num > max_segs) { + NT_LOG(ERR, NTNIC, + "Did not receive correct number of segment for a whole packet"); + return -1; + } + + return cur_seg_num; +} + +static uint16_t eth_dev_tx_scg(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) +{ + uint16_t pkt; + uint16_t first_vq_descr_idx = 0; + + struct nthw_cvirtq_desc cvq_desc; + + struct nthw_memory_descriptor *vq_bufs; + + struct ntnic_tx_queue *tx_q = queue; + + int nb_segs = 0, i; + int pkts_sent = 0; + uint16_t nb_segs_arr[MAX_TX_PACKETS]; + + if (kill_pmd) + return 0; + + if (nb_pkts > MAX_TX_PACKETS) + nb_pkts = MAX_TX_PACKETS; + + /* + * count all segments needed to contain all packets in vq buffers + */ + for (i = 0; i < nb_pkts; i++) { + /* build the num segments array for segmentation control and release function */ + int vq_segs = NUM_VQ_SEGS(bufs[i]->pkt_len); + nb_segs_arr[i] = vq_segs; + nb_segs += vq_segs; + } + + if (!nb_segs) + goto exit_out; + + if (sg_ops == NULL) + goto exit_out; + + int got_nb_segs = sg_ops->nthw_get_tx_packets(tx_q->vq, nb_segs, &first_vq_descr_idx, + &cvq_desc /*&vq_descr,*/, &vq_bufs); + + if (!got_nb_segs) + goto exit_out; + + /* + * we may get less vq buffers than we have asked for + * calculate last whole packet that can fit into what + * we have got + */ + while (got_nb_segs < nb_segs) { + if (!--nb_pkts) + goto exit_out; + + nb_segs -= NUM_VQ_SEGS(bufs[nb_pkts]->pkt_len); + + if (nb_segs <= 0) + goto exit_out; + } + + /* + * nb_pkts & nb_segs, got it all, ready to copy + */ + int seg_idx = 0; + int last_seg_idx = seg_idx; + + for (pkt = 0; pkt < nb_pkts; ++pkt) { + uint16_t vq_descr_idx = VIRTQ_DESCR_IDX(seg_idx); + + vq_set_flags(&cvq_desc, vq_descr_idx, 0); + vq_set_next(&cvq_desc, vq_descr_idx, 0); + + if (bufs[pkt]->nb_segs == 1 && nb_segs_arr[pkt] == 1) { + rte_memcpy((void *)((char *)vq_bufs[vq_descr_idx].virt_addr + SG_HDR_SIZE), + rte_pktmbuf_mtod(bufs[pkt], void *), bufs[pkt]->pkt_len); + + cvq_desc.b[vq_descr_idx].len = bufs[pkt]->pkt_len + SG_HDR_SIZE; + + seg_idx++; + + } else { + int cpy_segs = copy_mbuf_to_virtqueue(&cvq_desc, vq_descr_idx, vq_bufs, + nb_segs - last_seg_idx, bufs[pkt]); + + if (cpy_segs < 0) + break; + + seg_idx += cpy_segs; + } + + last_seg_idx = seg_idx; + rte_pktmbuf_free(bufs[pkt]); + pkts_sent++; + } + +exit_out: + + if (sg_ops != NULL) { + if (pkts_sent) + sg_ops->nthw_release_tx_packets(tx_q->vq, pkts_sent, nb_segs_arr); + } + + return pkts_sent; +} + static int allocate_hw_virtio_queues(struct rte_eth_dev *eth_dev, int vf_num, struct hwq_s *hwq, int num_descr, int buf_size) { @@ -1252,6 +1689,10 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev) rte_memcpy(ð_dev->data->mac_addrs[0], &internals->eth_addrs[0], RTE_ETHER_ADDR_LEN); + NT_LOG_DBGX(DBG, NTNIC, "Setting up RX functions for SCG\n"); + eth_dev->rx_pkt_burst = eth_dev_rx_scg; + eth_dev->tx_pkt_burst = eth_dev_tx_scg; + eth_dev->tx_pkt_prepare = NULL; struct rte_eth_link pmd_link; pmd_link.link_speed = RTE_ETH_SPEED_NUM_NONE; From patchwork Fri Oct 4 15:35:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145091 X-Patchwork-Delegate: ferruh.yigit@amd.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 C251C45AAF; Fri, 4 Oct 2024 17:51:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 620FA427E7; Fri, 4 Oct 2024 17:50:49 +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 70475427D2 for ; Fri, 4 Oct 2024 17:50:45 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2176.outbound.protection.outlook.com [104.47.17.176]) by mx-outbound8-201.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:50:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Etg6u/yGN7ReLyjoVPPGDo3j7gLBC9GOkn/LAFJ/SOkpbaF/Ocnm1XnrOwT6jF93grwXcjOD+62LQ3qFeQu863YiDw6r22CtfAALfjz0Q5Jha4Z0f+rZHRfWlYHm2omZYt3CT/PusGMBHyG7C/Z9xPiBesFN1US1n3kTGok1w22bNNebqnzv1OXuMBYeT+5B2+I1YouikUNWUVhNa1w9IZjD6ChSXJKfuwJcPqAn9P+6SoFYsoN1uNgBnfemsnGygava6xrqxImiEnMuOTZk6zUjxsXuI63Mz6YxNFsFBH+mz58lRclhQeXnty0T7M4YDz75jpIBLCylvvgotUj16A== 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=CIUKQRa+9m6X8SaN5snGHAk/5MeLQCpmIvri8PwYaBE=; b=ikqh/gxiV0YxekgM0O20zdwqGr0eBrDgplvPobqNnEopJeJIA3Dl1GAu7lay7ruI8jgmj+hMsQnm9ODj4jBhlj0oAvVDt4Rsqjv/VRtTnHea92m/rUkquJnaNQm/a1O7dIbDdCdLrCE008iSFPN/HRTVbMKMXl5zZdhI+VZpDdpz1g05xtDrtzNkifn75gIOmipB9dsh/hwu02aomcbRWMQ7aFvX1akEFg2XCOfncDca7TTvr+zMfytvpsZ+0QUqPvHSyYS3D3Xku3YK4JpeQFIO5zPhXHuxuswtvtgIrsshcybtnN7Wj4VVNuUuFs5AXWu7nbTi+JKgL0sga5oALQ== 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=CIUKQRa+9m6X8SaN5snGHAk/5MeLQCpmIvri8PwYaBE=; b=fg7pt2LfIoOZNXod9+aeNT733OAhqcUGmOqrRt4ouq0K89bomckAAhkNlug2y0hHtWBPaRmiXNe8G9Pn8NsKYqRXqSrLelCU9RNhzV+Vv0ncUtjBdVV+cZ858ykoc6YRKDTpvdIgYX5ZGxzZ7CC2K9TZDn7Tfr6zyx8giyMvHbg= Received: from AM0PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::18) by DBAP190MB0822.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:1a4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 15:36:34 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::33) by AM0PR10CA0101.outlook.office365.com (2603:10a6:208:e6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:34 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:34 +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 06/14] net/ntnic: add init for virt queues in the DBS Date: Fri, 4 Oct 2024 17:35:00 +0200 Message-ID: <20241004153551.267935-43-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|DBAP190MB0822:EE_ X-MS-Office365-Filtering-Correlation-Id: d867c44a-0aed-40b6-2666-08dce48a53cb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: zNXbT541mB2XSRt0A8M6kV4UX0+Miowt+lUuZmQj9HW4pKNsxxRxz1hblXsulYRtqY9/PclLlX3tFvSGNd0uKIYMOvjPeOoCxUMUTfeEd3HH/e2DzrXwHrsSIMrNGsbnPlGPT/5CrMUqUENkQH/52Pk25dB7q1WzGgNvCqgDkYUEXIK/iYeZGneHK+Jyi8mVktvkVynhQnn93aaCKY0ChHT46wG8zJsTR7+Hq4sg1l75eWm+evl+1Da3alFVMxFbuULjveEVbzVPhDdot1UGFG6RWW2iWU6O/NdQcywo80r/4A0VunAG9JvBG8ao/i2IdWCW4GSzc2RsbViDS4OXt+FJNe9JxLrPuz5UqzoTObdPkdQb5g4WFMymfl0zGSdpgYQZHKCzr8kApBYobO4fzdg4QkIFLY/H1aIeE8qQNhueye4gyHmlbv3HAyL5wtWyMzM8LLIdyS93DUe15EuzoMFKL66LEqeh91WRFHxiiQ0Rg0TjD/zUHVL3qaPbp7XsCFu/VN5mh3IH8rT8a387T5/JVgTjzWKYkAiDECU0naAa/XwzoBdCRurfbLZC6uQDj6vE+DUOZyHuvDrgH4YUE7Ayu+7sf8sHrR5m8PNyiCxUdx7sWrJlQM0nRfx2I/+wwtXWS9EDWes6eO1m8IhzHjK4KeU7UsU9cgGymjSGdYWQWc1Gk/8alFSQjshgXr90Ff+Oa/GtcPBYuGCwFoX7NaoNu2l9hO+LlIN/wEbTPQwQxAsZ1NmZiQte8+hZPaL3EYlaD7H4sCwsjSFs4Rsasj9/RwFMvLaIyRTiPxghiwdHXzJc8mDvhvDXoN2Q6y5b7QAy2RckplrovS+RKjZsScsrrYW8eB+FrA8AacH6Bys9jswZYs2S8uk64Kc1kZYtt0R6K1BD9CuC9w5+zN4Q4c6gtWvx1gtsYLcpjuBOlMpBEHmtyZ2dCqD4pMQEOR6DdPftqLzXl29haJndTKJPVTGFj1Jk7aWggBT+qrWDvB8EIh5M1iIyhELAhw3Thk6w8NNPfHTd+JvtGjzBDkLmeDjpUNkszU39xAxm47A/eBBOt+BaXsz+2q0onXLGpATZZmOn4a4kY9UrHIRwSlmXrl6r6Xli/nOYmuwTTtjlL+YG5ZvXZeKDrko/Qr715FEMTJ1HvzuheUs6q6OUlSnd9uJ723dGPMcAMaH2ykM7s+pJ+j3zNjoDV6buF+wuWE/7Es2W9iU2YYtZIYsTXiZPjPF6vy6lKlVsp+qoD2xfanET44JE7n82QR2dqaIAzLCNrybcuBa8nrJckOL8nLEifNqAfrCt8j7rtuYtlJZ7wyWY0AzybSrO1xq+0PTOcNqDdBBn+Xkk/VqzCjAXJaUF+2+Nhoggxersr1yemDas1BA= 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)(376014)(82310400026)(36860700013)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: TVsXtk6HsjYCbwRaBDZNr21F3GES5+H77al+0Spg3msDe5kdYSs5g8KM2xxVKLzfBW9iYDZtwzXWri4G1hsXDZ3zMUEbfMHsnsgArIkSDilCmcaC6UqxKun1wJ+M388V1LvbmIEIAGEI11FqOHKBsSEMSQAWZsxUkiFK8zXmjwFCUjtYBdBWVTPycOU6wDXs5fI8Rrto+zuYEIeVNXcfxrqX47Dd5ZTWelk6P2H1M2+EuBN9Mu/kTu4fUvWAlCPVzxYYG6DUddSM5jiJhEzKlJI0M/8szowXO51IIxWXH9y6Oh7Y/s7diHV1UaGqLcXon0FvS/Amvh+phwfjbuIwoayPmnmlSG1hcN8hk/KHGoRrQfkV6CuoH5f6NCgvI/cAlH6axuFCoqu/mdYvL9iRhMqt3xyRiCEmw6kpP5CFoyeWnCllsJa1WyP4lejDm+vlzQlpQPcDbLqpOrSuE/wzKil9G/e5tBWzDgz0jymY271qGiUfxoWJNZZDORarvKO0ui3hLI9BP+G52zilvY7N7sqw4N1wfTST1kVM9uIBm8oMg8NCXyiHFsUq9UYGWK661BeK5TAHTaMcxOl/F1mp87XY2/16w80woIi0KF6vC34tcthippy6c4IAPtJiG1McY+2LW75SI3Q2ncKb3Q2c3Q== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:34.0491 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d867c44a-0aed-40b6-2666-08dce48a53cb 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAP190MB0822 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057043-302249-12644-33729-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.176 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYmZuaWQGYGUDTVwMwk0TTZ2M zQwMLSxCDRyMjEzDjR0NLSIMnCMs3EQqk2FgA+0MfCQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan21-181.eu-central-1b.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 DBS (DVIO Buffer System) module controls the scatter-gather buffer system that let's the host CPU interact with packets. Macros and Definitions: Defined constants for queue management and polling speeds. Data Structures: Added structures and arrays for RX and TX queue management. Procedures: Implemented initialization routines for setting up queues and configuring Direct Buffer Storage (DBS) in FPGA. Main Initialization: Allocates DBS modules, resets, and configures RX and TX queues. Signed-off-by: Danylo Vodopianov --- drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c | 154 ++++++++++++++++++ drivers/net/ntnic/include/ntnic_dbs.h | 71 +++++++- drivers/net/ntnic/meson.build | 2 + drivers/net/ntnic/nthw/dbs/nthw_dbs.c | 135 +++++++++++++++ .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + drivers/net/ntnic/ntnic_mod_reg.c | 11 +- drivers/net/ntnic/ntnic_mod_reg.h | 2 + 7 files changed, 374 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c create mode 100644 drivers/net/ntnic/nthw/dbs/nthw_dbs.c diff --git a/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c b/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c new file mode 100644 index 0000000000..fc1dab6c5f --- /dev/null +++ b/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c @@ -0,0 +1,154 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include + +#include "ntos_drv.h" +#include "ntnic_virt_queue.h" +#include "ntnic_mod_reg.h" +#include "ntlog.h" + +#define MAX_VIRT_QUEUES 128 + +#define LAST_QUEUE 127 +#define DISABLE 0 +#define ENABLE 1 +#define RX_AM_DISABLE DISABLE +#define RX_AM_ENABLE ENABLE +#define RX_UW_DISABLE DISABLE +#define RX_UW_ENABLE ENABLE +#define RX_Q_DISABLE DISABLE +#define RX_Q_ENABLE ENABLE +#define RX_AM_POLL_SPEED 5 +#define RX_UW_POLL_SPEED 9 +#define INIT_QUEUE 1 + +#define TX_AM_DISABLE DISABLE +#define TX_AM_ENABLE ENABLE +#define TX_UW_DISABLE DISABLE +#define TX_UW_ENABLE ENABLE +#define TX_Q_DISABLE DISABLE +#define TX_Q_ENABLE ENABLE +#define TX_AM_POLL_SPEED 5 +#define TX_UW_POLL_SPEED 8 + +enum nthw_virt_queue_usage { + NTHW_VIRTQ_UNUSED = 0 +}; + +struct nthw_virt_queue { + enum nthw_virt_queue_usage usage; +}; + +static struct nthw_virt_queue rxvq[MAX_VIRT_QUEUES]; +static struct nthw_virt_queue txvq[MAX_VIRT_QUEUES]; + +static void dbs_init_rx_queue(nthw_dbs_t *p_nthw_dbs, uint32_t queue, uint32_t start_idx, + uint32_t start_ptr) +{ + uint32_t busy; + uint32_t init; + uint32_t dummy; + + do { + get_rx_init(p_nthw_dbs, &init, &dummy, &busy); + } while (busy != 0); + + set_rx_init(p_nthw_dbs, start_idx, start_ptr, INIT_QUEUE, queue); + + do { + get_rx_init(p_nthw_dbs, &init, &dummy, &busy); + } while (busy != 0); +} + +static void dbs_init_tx_queue(nthw_dbs_t *p_nthw_dbs, uint32_t queue, uint32_t start_idx, + uint32_t start_ptr) +{ + uint32_t busy; + uint32_t init; + uint32_t dummy; + + do { + get_tx_init(p_nthw_dbs, &init, &dummy, &busy); + } while (busy != 0); + + set_tx_init(p_nthw_dbs, start_idx, start_ptr, INIT_QUEUE, queue); + + do { + get_tx_init(p_nthw_dbs, &init, &dummy, &busy); + } while (busy != 0); +} + +static int nthw_virt_queue_init(struct fpga_info_s *p_fpga_info) +{ + assert(p_fpga_info); + + nthw_fpga_t *const p_fpga = p_fpga_info->mp_fpga; + nthw_dbs_t *p_nthw_dbs; + int res = 0; + uint32_t i; + + p_fpga_info->mp_nthw_dbs = NULL; + + p_nthw_dbs = nthw_dbs_new(); + + if (p_nthw_dbs == NULL) + return -1; + + res = dbs_init(NULL, p_fpga, 0);/* Check that DBS exists in FPGA */ + + if (res) { + free(p_nthw_dbs); + return res; + } + + res = dbs_init(p_nthw_dbs, p_fpga, 0); /* Create DBS module */ + + if (res) { + free(p_nthw_dbs); + return res; + } + + p_fpga_info->mp_nthw_dbs = p_nthw_dbs; + + for (i = 0; i < MAX_VIRT_QUEUES; ++i) { + rxvq[i].usage = NTHW_VIRTQ_UNUSED; + txvq[i].usage = NTHW_VIRTQ_UNUSED; + } + + dbs_reset(p_nthw_dbs); + + for (i = 0; i < NT_DBS_RX_QUEUES_MAX; ++i) + dbs_init_rx_queue(p_nthw_dbs, i, 0, 0); + + for (i = 0; i < NT_DBS_TX_QUEUES_MAX; ++i) + dbs_init_tx_queue(p_nthw_dbs, i, 0, 0); + + set_rx_control(p_nthw_dbs, LAST_QUEUE, RX_AM_DISABLE, RX_AM_POLL_SPEED, RX_UW_DISABLE, + RX_UW_POLL_SPEED, RX_Q_DISABLE); + set_rx_control(p_nthw_dbs, LAST_QUEUE, RX_AM_ENABLE, RX_AM_POLL_SPEED, RX_UW_ENABLE, + RX_UW_POLL_SPEED, RX_Q_DISABLE); + set_rx_control(p_nthw_dbs, LAST_QUEUE, RX_AM_ENABLE, RX_AM_POLL_SPEED, RX_UW_ENABLE, + RX_UW_POLL_SPEED, RX_Q_ENABLE); + + set_tx_control(p_nthw_dbs, LAST_QUEUE, TX_AM_DISABLE, TX_AM_POLL_SPEED, TX_UW_DISABLE, + TX_UW_POLL_SPEED, TX_Q_DISABLE); + set_tx_control(p_nthw_dbs, LAST_QUEUE, TX_AM_ENABLE, TX_AM_POLL_SPEED, TX_UW_ENABLE, + TX_UW_POLL_SPEED, TX_Q_DISABLE); + set_tx_control(p_nthw_dbs, LAST_QUEUE, TX_AM_ENABLE, TX_AM_POLL_SPEED, TX_UW_ENABLE, + TX_UW_POLL_SPEED, TX_Q_ENABLE); + + return 0; +} + +static struct sg_ops_s sg_ops = { + .nthw_virt_queue_init = nthw_virt_queue_init +}; + +void sg_init(void) +{ + NT_LOG(INF, NTNIC, "SG ops initialized\n"); + register_sg_ops(&sg_ops); +} diff --git a/drivers/net/ntnic/include/ntnic_dbs.h b/drivers/net/ntnic/include/ntnic_dbs.h index 551c6ade43..a64d2a0aeb 100644 --- a/drivers/net/ntnic/include/ntnic_dbs.h +++ b/drivers/net/ntnic/include/ntnic_dbs.h @@ -8,12 +8,81 @@ #include "nthw_fpga_model.h" +#define NT_DBS_RX_QUEUES_MAX (128) +#define NT_DBS_TX_QUEUES_MAX (128) + /* * Struct for implementation of memory bank shadows */ -struct nthw_dbs_s; +struct nthw_dbs_s { + nthw_fpga_t *mp_fpga; + nthw_module_t *mp_mod_dbs; + int mn_instance; + + int mn_param_dbs_present; + + nthw_register_t *mp_reg_rx_control; + nthw_field_t *mp_fld_rx_control_last_queue; + nthw_field_t *mp_fld_rx_control_avail_monitor_enable; + nthw_field_t *mp_fld_rx_control_avail_monitor_scan_speed; + nthw_field_t *mp_fld_rx_control_used_write_enable; + nthw_field_t *mp_fld_rx_control_used_writer_update_speed; + nthw_field_t *mp_fld_rx_control_rx_queues_enable; + + nthw_register_t *mp_reg_tx_control; + nthw_field_t *mp_fld_tx_control_last_queue; + nthw_field_t *mp_fld_tx_control_avail_monitor_enable; + nthw_field_t *mp_fld_tx_control_avail_monitor_scan_speed; + nthw_field_t *mp_fld_tx_control_used_write_enable; + nthw_field_t *mp_fld_tx_control_used_writer_update_speed; + nthw_field_t *mp_fld_tx_control_tx_queues_enable; + + nthw_register_t *mp_reg_rx_init; + nthw_field_t *mp_fld_rx_init_init; + nthw_field_t *mp_fld_rx_init_queue; + nthw_field_t *mp_fld_rx_init_busy; + + nthw_register_t *mp_reg_rx_init_val; + nthw_field_t *mp_fld_rx_init_val_idx; + nthw_field_t *mp_fld_rx_init_val_ptr; + + nthw_register_t *mp_reg_tx_init; + nthw_field_t *mp_fld_tx_init_init; + nthw_field_t *mp_fld_tx_init_queue; + nthw_field_t *mp_fld_tx_init_busy; + + nthw_register_t *mp_reg_tx_init_val; + nthw_field_t *mp_fld_tx_init_val_idx; + nthw_field_t *mp_fld_tx_init_val_ptr; + +}; typedef struct nthw_dbs_s nthw_dbs_t; +nthw_dbs_t *nthw_dbs_new(void); +int dbs_init(nthw_dbs_t *p, nthw_fpga_t *p_fpga, int n_instance); +void dbs_reset(nthw_dbs_t *p); + +int set_rx_control(nthw_dbs_t *p, + uint32_t last_queue, + uint32_t avail_monitor_enable, + uint32_t avail_monitor_speed, + uint32_t used_write_enable, + uint32_t used_write_speed, + uint32_t rx_queue_enable); +int set_tx_control(nthw_dbs_t *p, + uint32_t last_queue, + uint32_t avail_monitor_enable, + uint32_t avail_monitor_speed, + uint32_t used_write_enable, + uint32_t used_write_speed, + uint32_t tx_queue_enable); +int set_rx_init(nthw_dbs_t *p, uint32_t start_idx, uint32_t start_ptr, uint32_t init, + uint32_t queue); +int get_rx_init(nthw_dbs_t *p, uint32_t *init, uint32_t *queue, uint32_t *busy); +int set_tx_init(nthw_dbs_t *p, uint32_t start_idx, uint32_t start_ptr, uint32_t init, + uint32_t queue); +int get_tx_init(nthw_dbs_t *p, uint32_t *init, uint32_t *queue, uint32_t *busy); + #endif /* _NTNIC_DBS_H_ */ diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 66d2770da7..3d9566a52e 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -24,9 +24,11 @@ includes = [ # all sources sources = files( 'adapter/nt4ga_adapter.c', + 'dbsconfig/ntnic_dbsconfig.c', 'link_mgmt/link_100g/nt4ga_link_100g.c', 'link_mgmt/nt4ga_link.c', 'nim/i2c_nim.c', + 'nthw/dbs/nthw_dbs.c', 'nthw/supported/nthw_fpga_9563_055_049_0000.c', 'nthw/supported/nthw_fpga_instances.c', 'nthw/supported/nthw_fpga_mod_str_map.c', diff --git a/drivers/net/ntnic/nthw/dbs/nthw_dbs.c b/drivers/net/ntnic/nthw/dbs/nthw_dbs.c new file mode 100644 index 0000000000..853d7bc1ec --- /dev/null +++ b/drivers/net/ntnic/nthw/dbs/nthw_dbs.c @@ -0,0 +1,135 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include "ntlog.h" + +#include "nthw_drv.h" +#include "nthw_register.h" + +nthw_dbs_t *nthw_dbs_new(void) +{ + nthw_dbs_t *p = malloc(sizeof(nthw_dbs_t)); + + if (p) + memset(p, 0, sizeof(nthw_dbs_t)); + + return p; +} + +int dbs_init(nthw_dbs_t *p, nthw_fpga_t *p_fpga, int n_instance) +{ + nthw_module_t *mod = nthw_fpga_query_module(p_fpga, MOD_DBS, n_instance); + + if (p == NULL) + return mod == NULL ? -1 : 0; + + if (mod == NULL) { + NT_LOG(ERR, NTHW, "%s: DBS %d: no such instance\n", + p_fpga->p_fpga_info->mp_adapter_id_str, n_instance); + return -1; + } + + p->mp_fpga = p_fpga; + p->mn_instance = n_instance; + p->mp_mod_dbs = mod; + + p->mn_param_dbs_present = nthw_fpga_get_product_param(p_fpga, NT_DBS_PRESENT, 0); + + if (p->mn_param_dbs_present == 0) { + NT_LOG(WRN, NTHW, + "%s: DBS %d: logical error: module found but not flagged at present\n", + p->mp_fpga->p_fpga_info->mp_adapter_id_str, p->mn_instance); + } + + return 0; +} + +void dbs_reset(nthw_dbs_t *p) +{ + (void)p; +} + +int set_rx_control(nthw_dbs_t *p, + uint32_t last_queue, + uint32_t avail_monitor_enable, + uint32_t avail_monitor_speed, + uint32_t used_write_enable, + uint32_t used_write_speed, + uint32_t rx_queue_enable) +{ + nthw_field_set_val32(p->mp_fld_rx_control_last_queue, last_queue); + nthw_field_set_val32(p->mp_fld_rx_control_avail_monitor_enable, avail_monitor_enable); + nthw_field_set_val32(p->mp_fld_rx_control_avail_monitor_scan_speed, avail_monitor_speed); + nthw_field_set_val32(p->mp_fld_rx_control_used_write_enable, used_write_enable); + nthw_field_set_val32(p->mp_fld_rx_control_used_writer_update_speed, used_write_speed); + nthw_field_set_val32(p->mp_fld_rx_control_rx_queues_enable, rx_queue_enable); + nthw_register_flush(p->mp_reg_rx_control, 1); + return 0; +} + +int set_tx_control(nthw_dbs_t *p, + uint32_t last_queue, + uint32_t avail_monitor_enable, + uint32_t avail_monitor_speed, + uint32_t used_write_enable, + uint32_t used_write_speed, + uint32_t tx_queue_enable) +{ + nthw_field_set_val32(p->mp_fld_tx_control_last_queue, last_queue); + nthw_field_set_val32(p->mp_fld_tx_control_avail_monitor_enable, avail_monitor_enable); + nthw_field_set_val32(p->mp_fld_tx_control_avail_monitor_scan_speed, avail_monitor_speed); + nthw_field_set_val32(p->mp_fld_tx_control_used_write_enable, used_write_enable); + nthw_field_set_val32(p->mp_fld_tx_control_used_writer_update_speed, used_write_speed); + nthw_field_set_val32(p->mp_fld_tx_control_tx_queues_enable, tx_queue_enable); + nthw_register_flush(p->mp_reg_tx_control, 1); + return 0; +} + +int set_rx_init(nthw_dbs_t *p, uint32_t start_idx, uint32_t start_ptr, uint32_t init, + uint32_t queue) +{ + if (p->mp_reg_rx_init_val) { + nthw_field_set_val32(p->mp_fld_rx_init_val_idx, start_idx); + nthw_field_set_val32(p->mp_fld_rx_init_val_ptr, start_ptr); + nthw_register_flush(p->mp_reg_rx_init_val, 1); + } + + nthw_field_set_val32(p->mp_fld_rx_init_init, init); + nthw_field_set_val32(p->mp_fld_rx_init_queue, queue); + nthw_register_flush(p->mp_reg_rx_init, 1); + return 0; +} + +int get_rx_init(nthw_dbs_t *p, uint32_t *init, uint32_t *queue, uint32_t *busy) +{ + *init = nthw_field_get_val32(p->mp_fld_rx_init_init); + *queue = nthw_field_get_val32(p->mp_fld_rx_init_queue); + *busy = nthw_field_get_val32(p->mp_fld_rx_init_busy); + return 0; +} + +int set_tx_init(nthw_dbs_t *p, uint32_t start_idx, uint32_t start_ptr, uint32_t init, + uint32_t queue) +{ + if (p->mp_reg_tx_init_val) { + nthw_field_set_val32(p->mp_fld_tx_init_val_idx, start_idx); + nthw_field_set_val32(p->mp_fld_tx_init_val_ptr, start_ptr); + nthw_register_flush(p->mp_reg_tx_init_val, 1); + } + + nthw_field_set_val32(p->mp_fld_tx_init_init, init); + nthw_field_set_val32(p->mp_fld_tx_init_queue, queue); + nthw_register_flush(p->mp_reg_tx_init, 1); + return 0; +} + +int get_tx_init(nthw_dbs_t *p, uint32_t *init, uint32_t *queue, uint32_t *busy) +{ + *init = nthw_field_get_val32(p->mp_fld_tx_init_init); + *queue = nthw_field_get_val32(p->mp_fld_tx_init_queue); + *busy = nthw_field_get_val32(p->mp_fld_tx_init_busy); + return 0; +} diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h index 5d6aac122c..b6be02f45e 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h @@ -16,6 +16,7 @@ #define MOD_UNKNOWN (0L)/* Unknown/uninitialized - keep this as the first element */ #define MOD_CAT (0x30b447c2UL) #define MOD_CSU (0x3f470787UL) +#define MOD_DBS (0x80b29727UL) #define MOD_FLM (0xe7ba53a4UL) #define MOD_GFG (0xfc423807UL) #define MOD_GMF (0x68b1d15aUL) diff --git a/drivers/net/ntnic/ntnic_mod_reg.c b/drivers/net/ntnic/ntnic_mod_reg.c index 8fe5193027..a03c97801b 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.c +++ b/drivers/net/ntnic/ntnic_mod_reg.c @@ -5,9 +5,18 @@ #include "ntnic_mod_reg.h" +static struct sg_ops_s *sg_ops; + +void register_sg_ops(struct sg_ops_s *ops) +{ + sg_ops = ops; +} + const struct sg_ops_s *get_sg_ops(void) { - return NULL; + if (sg_ops == NULL) + sg_init(); + return sg_ops; } static struct link_ops_s *link_100g_ops; diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h index e9dff51935..5b97b3d8ac 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.h +++ b/drivers/net/ntnic/ntnic_mod_reg.h @@ -105,7 +105,9 @@ struct sg_ops_s { int (*nthw_virt_queue_init)(struct fpga_info_s *p_fpga_info); }; +void register_sg_ops(struct sg_ops_s *ops); const struct sg_ops_s *get_sg_ops(void); +void sg_init(void); struct link_ops_s { int (*link_init)(struct adapter_info_s *p_adapter_info, nthw_fpga_t *p_fpga); From patchwork Fri Oct 4 15:35:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145125 X-Patchwork-Delegate: ferruh.yigit@amd.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 77C6245AAF; Fri, 4 Oct 2024 17:56:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6E42142F1D; Fri, 4 Oct 2024 17:52:00 +0200 (CEST) Received: from egress-ip42b.ess.de.barracuda.com (egress-ip42b.ess.de.barracuda.com [18.185.115.246]) by mails.dpdk.org (Postfix) with ESMTP id 246E7427DA for ; Fri, 4 Oct 2024 17:51:55 +0200 (CEST) Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03lp2233.outbound.protection.outlook.com [104.47.51.233]) by mx-outbound22-159.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:51:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dWgMvrikXWqnCdIEvz6X6JnkZalcDbquEerz1OA9IJ5ydQSdKGZpvn1e1Ood7qBxah9tyaKMUfUm42RHWH0ahSKPidKzNwAXZ6b8zkMoYzZ3DVTaPv1MCZ6SCPJ3RftHmwlHYNsH4Iwy1c5B9Lc/d1M7xxeH1B8YBpOBxjKUAD3es95KP2JqJoO8jpnm44aqu8MN1t9XfS4WmBnM/FugoqdvOsiqucmIf6Ai9Ln9hZyImfYfpOQKx8Vee5Somy5/ozp7J15/6TWRhg4Ae/x93kpQccB4sebK0AsjUqKj2hdqHtNVN+jSPR1s6QTKsnf3HlbszxuwlVyWQBoTvpDiKQ== 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=hPBuaF8EY9r2M5SH9hhxJcenydRdmxqnp/m08V43Tro=; b=LrCu/L6HOtiPj0dkjDxNYAd+whJ9hEbdpxxRJUNf6cBonqMDIz09gpYTwOag78euTNyk2Cj8G5bmFYjqHRxA5qXGcaSmv0npyKdckG8IWhcnTgYQ/06b1eZsL+6iYe7t5RzchgJd4a+CT3n4FFBoalRP1AiY70avaEpvq8OJ5Zbvk4vAujQTuC+2ssFDKreKy9ATyUsFsmRZWjcW/c3xu7jpztVatxYJGWl0qUWfXCbNbpJ3KrEDDf3x0PCsj6P8T1Iz/y+5a9tY0LEOGQ0EeO/SQqwD1D21N1xoTe/CYd1tBklR1Lq7cZZtYyMy/2DuBYwXn5k8BTWmmmrwtU2PmA== 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=hPBuaF8EY9r2M5SH9hhxJcenydRdmxqnp/m08V43Tro=; b=O1zW4UNCR+/vrGLQRlHReyDDp7r4fFGPbPOZ4prBjmJWDejnX+J3Mb0mA5eh+Gp5JBFJxdP7iL+Fm0lBXqrNL2jOHw51fCTcklyoTYFmZoFtq6cpk1KtsuuiPtmgeJSLGpcGhgOTEm8BkSj8eBBoXsUVhwsnv2OxAuKX+UxjvZI= Received: from AM0PR10CA0123.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::40) by PA2P190MB2127.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:403::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 15:36:34 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::37) by AM0PR10CA0123.outlook.office365.com (2603:10a6:208:e6::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:34 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:34 +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 07/14] net/ntnic: add split-queue support Date: Fri, 4 Oct 2024 17:35:01 +0200 Message-ID: <20241004153551.267935-44-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|PA2P190MB2127:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f066342-39ee-4d5d-d295-08dce48a5438 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: ThXtvflt124iLr+VX/HzE8u2Vj550K24RHO222wKEcr4BAsDyNLZX2RIeBuXqj44gj8wb4Km5d+GSAI4Hi2E6Pp9oXsgAZI55HP+5tGBDyqNf65TpvjNFvWXFenyTgnCqfdl3wd7nmBSYMlmY343lKkGflRy7ITHSVaLzQKZmAm5wrJXmamQQyJHOOOpe9y20lhHUn6Qbm7S14sSsvgwut3rRNdmikXGs+hvLfFm4L7VViGLeAnf8aQ8LJVxhIy2ieozA7iuZ/k0HG4Rjtwtn+F1QV4rSZAcxSR1OJcN/3esHPRVFjPC7XkxEvzmfrqL/LNZZo5lJjDfqSw5EcPBQqzEF3J95eR3hgp2/5IS6KwnJrMdG9UroaVe0UsnoIkiPKuuAkPPxNNiiIoEZhnquDJC99EupOfTRz0lMCDV5ew8mOkoQZN+Pdm9flUYEAKPUbo1k2qdpbhLJCYSZVQV5PjKG/ycaVEV9O4Avr8gg2fkdVeuWVVlsQ4tUyu2ppTKXBGgXQUkzgDPFvZPGVb6jREhrBDxl4BZVWmSGs422untTeyyUJzzX2I1lBdUc63RAR9o1Gh7/wYUJtMkrv3L6PWUAzBVi5UciegDQsaDBaySk38MhPl9pXMDowbI7Av7FrH4r1urcba5KvxFegCtPWxqJbAHC0UqSSwJpARuPGhisUxB8m2slagWU41LsBNOE4pOkmoiPRV+DkQC8+ZtDdOTzm1ySKPDuyybSJ7KpvUyDHkybm/avFHyAKx6yetisXdR3LhAcT7LporY/vgEcxpX1sr7C7Pr0gbGlGKDlLBk73c0NNexfXiFdWkX25n0Q2WdqRVgMS+Ia/2hlPgOtm8OefaOntSwUg5CSepbHxRa3yHVO7cLwhkPysNmoVzKFh/xntzDvVmuYRqBmR8XZSWWZ7CkbgazsAxDlO2Jff1eZC/tLFX2Ek3+/TuVrJe/0vJdm+i9vn2cBEpc6Stj9ZcRwYmYE6s/omeqBMy//43N18JE+Ut8fQ7scvb/KCEOK/6RxcoiHssHI37yx9Zuu37aOeXD5eMXckGersaWRVN+sfYxw+x9MFxjHhGn3Zy1G1oTim8DYHc0naFZ0sJskcPa6uM4Z911kFhhe8c06A1Y1ZbWN0h/zLw/+cmSEPejJqOXZXCQTnSUCmTvk3S+RoXOovjK0OeH4j9StVIVQ3TbcSKkVd0fYxa9nGYJwPfoit0leqY+5Y1xaq8KerWWEpEQy0v13iFjz/uai6lTZjxxIxAM4bR+BYVCRScdS6SChR+ubxunnS5h72jcmyZoBEt8HSmp960TSrJR2VHqwIHj0CE6473sFbS88F/TPVRsqz+aAgUoJbdIfiiV/ctfrAa8Mk0ULMLXwTaK1xjW3q0= 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)(376014)(82310400026)(1800799024)(36860700013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: +dUs/KIavz0OMXbchoHcKfDcclEmzDV6rciK/UPLhqclc260rs88tHi6UGpGGmJGhRNUUWmNV0XBFeSx74ItZAOujVzIvd7N9AyfKNUXq7qayTsiPXfkMw0/p8bUuGm+YR9a9IDMrdbJRIkIaJ5vQxYLJmvYcq3kC0YTLcer3TpECEWhbLYXYtnsY4XKn7URQIsraiFnywvc0u1HwMeBm+pLCIAedoMFBU7s9PyA/jM51ePVqudFU0KoFzPReYvTSlevsS8w79CJ2gNWaF7dVtPYrNqcYUzHQzFP0OVn7nxBtBpJYaSjaCvn40w/gglCi8BwQjPGa1Lrn8RRdTHQM3qIgMmaoqDCDXe9YX+xKix+xSFAUVPxYRbo3ZvebTMfEX4vCOz1hmfKFH95C2uVrg3GzPgJNDWnkD50gOxlhNR0A48rwmQRUHT6cidMakTZ2Zd9uSBeeIxHfwArKIa5i4DiEfVirK26h3lJ0zcFEP/ODNwUSsArpYQwnq8jn/6dwptpOVhAKQaZvUtWYs5rMDG0FLb/DWucDyx233bGrKq1fAGo96mOBJvCJD4aHEJqzf4DmAIZ10zs8q+pOGb08jVVJFMHCCQMatpVKsXMoYZCSwkl3+VtuF/Y2em0LvKlCN7KP8GDY5N4ZiV842Q/sQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:34.6897 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f066342-39ee-4d5d-d295-08dce48a5438 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2P190MB2127 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057113-305791-12648-36031-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.51.233 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkamhsbmQGYGUNTYNNnQzNzQ1C Qt1djCItUgOSXNIDXZINHENMXC3DTJTKk2FgBBvblfQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan20-223.eu-central-1b.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 Split-queue support was added. Internal structures were enhanced with additional managmnet fields. Implement a managed virtual queue function based on the queue type and configuration parameters. DBS control registers were added. Signed-off-by: Danylo Vodopianov --- drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c | 411 +++++++++++++++++- drivers/net/ntnic/include/ntnic_dbs.h | 19 + drivers/net/ntnic/include/ntnic_virt_queue.h | 7 + drivers/net/ntnic/nthw/dbs/nthw_dbs.c | 125 +++++- .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 1 + .../nthw/supported/nthw_fpga_reg_defs_dbs.h | 79 ++++ 6 files changed, 640 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h diff --git a/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c b/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c index fc1dab6c5f..e69cf7ad21 100644 --- a/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c +++ b/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c @@ -10,6 +10,7 @@ #include "ntnic_mod_reg.h" #include "ntlog.h" +#define STRUCT_ALIGNMENT (4 * 1024LU) #define MAX_VIRT_QUEUES 128 #define LAST_QUEUE 127 @@ -34,12 +35,79 @@ #define TX_AM_POLL_SPEED 5 #define TX_UW_POLL_SPEED 8 +#define VIRTQ_AVAIL_F_NO_INTERRUPT 1 + +struct __rte_aligned(8) virtq_avail { + uint16_t flags; + uint16_t idx; + uint16_t ring[]; /* Queue Size */ +}; + +struct __rte_aligned(8) virtq_used_elem { + /* Index of start of used descriptor chain. */ + uint32_t id; + /* Total length of the descriptor chain which was used (written to) */ + uint32_t len; +}; + +struct __rte_aligned(8) virtq_used { + uint16_t flags; + uint16_t idx; + struct virtq_used_elem ring[]; /* Queue Size */ +}; + +struct virtq_struct_layout_s { + size_t used_offset; + size_t desc_offset; +}; + enum nthw_virt_queue_usage { - NTHW_VIRTQ_UNUSED = 0 + NTHW_VIRTQ_UNUSED = 0, + NTHW_VIRTQ_UNMANAGED, + NTHW_VIRTQ_MANAGED }; struct nthw_virt_queue { + /* Pointers to virt-queue structs */ + struct { + /* SPLIT virtqueue */ + struct virtq_avail *p_avail; + struct virtq_used *p_used; + struct virtq_desc *p_desc; + /* Control variables for virt-queue structs */ + uint16_t am_idx; + uint16_t used_idx; + uint16_t cached_idx; + uint16_t tx_descr_avail_idx; + }; + + /* Array with packet buffers */ + struct nthw_memory_descriptor *p_virtual_addr; + + /* Queue configuration info */ + nthw_dbs_t *mp_nthw_dbs; + enum nthw_virt_queue_usage usage; + uint16_t irq_vector; + uint16_t vq_type; + uint16_t in_order; + + uint16_t queue_size; + uint32_t index; + uint32_t am_enable; + uint32_t host_id; + uint32_t port; /* Only used by TX queues */ + uint32_t virtual_port; /* Only used by TX queues */ + /* + * Only used by TX queues: + * 0: VirtIO-Net header (12 bytes). + * 1: Napatech DVIO0 descriptor (12 bytes). + */ +}; + +struct pvirtq_struct_layout_s { + size_t driver_event_offset; + size_t device_event_offset; }; static struct nthw_virt_queue rxvq[MAX_VIRT_QUEUES]; @@ -143,7 +211,348 @@ static int nthw_virt_queue_init(struct fpga_info_s *p_fpga_info) return 0; } +static struct virtq_struct_layout_s dbs_calc_struct_layout(uint32_t queue_size) +{ + /* + sizeof(uint16_t); ("avail->used_event" is not used) */ + size_t avail_mem = sizeof(struct virtq_avail) + queue_size * sizeof(uint16_t); + size_t avail_mem_aligned = ((avail_mem % STRUCT_ALIGNMENT) == 0) + ? avail_mem + : STRUCT_ALIGNMENT * (avail_mem / STRUCT_ALIGNMENT + 1); + + /* + sizeof(uint16_t); ("used->avail_event" is not used) */ + size_t used_mem = sizeof(struct virtq_used) + queue_size * sizeof(struct virtq_used_elem); + size_t used_mem_aligned = ((used_mem % STRUCT_ALIGNMENT) == 0) + ? used_mem + : STRUCT_ALIGNMENT * (used_mem / STRUCT_ALIGNMENT + 1); + + struct virtq_struct_layout_s virtq_layout; + virtq_layout.used_offset = avail_mem_aligned; + virtq_layout.desc_offset = avail_mem_aligned + used_mem_aligned; + + return virtq_layout; +} + +static void dbs_initialize_avail_struct(void *addr, uint16_t queue_size, + uint16_t initial_avail_idx) +{ + uint16_t i; + struct virtq_avail *p_avail = (struct virtq_avail *)addr; + + p_avail->flags = VIRTQ_AVAIL_F_NO_INTERRUPT; + p_avail->idx = initial_avail_idx; + + for (i = 0; i < queue_size; ++i) + p_avail->ring[i] = i; +} + +static void dbs_initialize_used_struct(void *addr, uint16_t queue_size) +{ + int i; + struct virtq_used *p_used = (struct virtq_used *)addr; + + p_used->flags = 1; + p_used->idx = 0; + + for (i = 0; i < queue_size; ++i) { + p_used->ring[i].id = 0; + p_used->ring[i].len = 0; + } +} + +static void +dbs_initialize_descriptor_struct(void *addr, + struct nthw_memory_descriptor *packet_buffer_descriptors, + uint16_t queue_size, uint16_t flgs) +{ + if (packet_buffer_descriptors) { + int i; + struct virtq_desc *p_desc = (struct virtq_desc *)addr; + + for (i = 0; i < queue_size; ++i) { + p_desc[i].addr = (uint64_t)packet_buffer_descriptors[i].phys_addr; + p_desc[i].len = packet_buffer_descriptors[i].len; + p_desc[i].flags = flgs; + p_desc[i].next = 0; + } + } +} + +static void +dbs_initialize_virt_queue_structs(void *avail_struct_addr, void *used_struct_addr, + void *desc_struct_addr, + struct nthw_memory_descriptor *packet_buffer_descriptors, + uint16_t queue_size, uint16_t initial_avail_idx, uint16_t flgs) +{ + dbs_initialize_avail_struct(avail_struct_addr, queue_size, initial_avail_idx); + dbs_initialize_used_struct(used_struct_addr, queue_size); + dbs_initialize_descriptor_struct(desc_struct_addr, packet_buffer_descriptors, queue_size, + flgs); +} + +static struct nthw_virt_queue *nthw_setup_rx_virt_queue(nthw_dbs_t *p_nthw_dbs, + uint32_t index, + uint16_t start_idx, + uint16_t start_ptr, + void *avail_struct_phys_addr, + void *used_struct_phys_addr, + void *desc_struct_phys_addr, + uint16_t queue_size, + uint32_t host_id, + uint32_t header, + uint32_t vq_type, + int irq_vector) +{ + (void)header; + (void)desc_struct_phys_addr; + (void)avail_struct_phys_addr; + (void)used_struct_phys_addr; + + + /* + * 5. Initialize all RX queues (all DBS_RX_QUEUES of them) using the + * DBS.RX_INIT register. + */ + dbs_init_rx_queue(p_nthw_dbs, index, start_idx, start_ptr); + + /* Save queue state */ + rxvq[index].usage = NTHW_VIRTQ_UNMANAGED; + rxvq[index].mp_nthw_dbs = p_nthw_dbs; + rxvq[index].index = index; + rxvq[index].queue_size = queue_size; + rxvq[index].am_enable = (irq_vector < 0) ? RX_AM_ENABLE : RX_AM_DISABLE; + rxvq[index].host_id = host_id; + rxvq[index].vq_type = vq_type; + rxvq[index].in_order = 0; /* not used */ + rxvq[index].irq_vector = irq_vector; + + /* Return queue handle */ + return &rxvq[index]; +} + +static struct nthw_virt_queue *nthw_setup_tx_virt_queue(nthw_dbs_t *p_nthw_dbs, + uint32_t index, + uint16_t start_idx, + uint16_t start_ptr, + void *avail_struct_phys_addr, + void *used_struct_phys_addr, + void *desc_struct_phys_addr, + uint16_t queue_size, + uint32_t host_id, + uint32_t port, + uint32_t virtual_port, + uint32_t header, + uint32_t vq_type, + int irq_vector, + uint32_t in_order) +{ + (void)header; + (void)desc_struct_phys_addr; + (void)avail_struct_phys_addr; + (void)used_struct_phys_addr; + + /* + * 5. Initialize all TX queues (all DBS_TX_QUEUES of them) using the + * DBS.TX_INIT register. + */ + dbs_init_tx_queue(p_nthw_dbs, index, start_idx, start_ptr); + + /* Save queue state */ + txvq[index].usage = NTHW_VIRTQ_UNMANAGED; + txvq[index].mp_nthw_dbs = p_nthw_dbs; + txvq[index].index = index; + txvq[index].queue_size = queue_size; + txvq[index].am_enable = (irq_vector < 0) ? TX_AM_ENABLE : TX_AM_DISABLE; + txvq[index].host_id = host_id; + txvq[index].port = port; + txvq[index].virtual_port = virtual_port; + txvq[index].vq_type = vq_type; + txvq[index].in_order = in_order; + txvq[index].irq_vector = irq_vector; + + /* Return queue handle */ + return &txvq[index]; +} + +static struct nthw_virt_queue * +nthw_setup_mngd_rx_virt_queue_split(nthw_dbs_t *p_nthw_dbs, + uint32_t index, + uint32_t queue_size, + uint32_t host_id, + uint32_t header, + struct nthw_memory_descriptor *p_virt_struct_area, + struct nthw_memory_descriptor *p_packet_buffers, + int irq_vector) +{ + struct virtq_struct_layout_s virtq_struct_layout = dbs_calc_struct_layout(queue_size); + + dbs_initialize_virt_queue_structs(p_virt_struct_area->virt_addr, + (char *)p_virt_struct_area->virt_addr + + virtq_struct_layout.used_offset, + (char *)p_virt_struct_area->virt_addr + + virtq_struct_layout.desc_offset, + p_packet_buffers, + (uint16_t)queue_size, + p_packet_buffers ? (uint16_t)queue_size : 0, + VIRTQ_DESC_F_WRITE /* Rx */); + + rxvq[index].p_avail = p_virt_struct_area->virt_addr; + rxvq[index].p_used = + (void *)((char *)p_virt_struct_area->virt_addr + virtq_struct_layout.used_offset); + rxvq[index].p_desc = + (void *)((char *)p_virt_struct_area->virt_addr + virtq_struct_layout.desc_offset); + + rxvq[index].am_idx = p_packet_buffers ? (uint16_t)queue_size : 0; + rxvq[index].used_idx = 0; + rxvq[index].cached_idx = 0; + rxvq[index].p_virtual_addr = NULL; + + if (p_packet_buffers) { + rxvq[index].p_virtual_addr = malloc(queue_size * sizeof(*p_packet_buffers)); + memcpy(rxvq[index].p_virtual_addr, p_packet_buffers, + queue_size * sizeof(*p_packet_buffers)); + } + + nthw_setup_rx_virt_queue(p_nthw_dbs, index, 0, 0, (void *)p_virt_struct_area->phys_addr, + (char *)p_virt_struct_area->phys_addr + + virtq_struct_layout.used_offset, + (char *)p_virt_struct_area->phys_addr + + virtq_struct_layout.desc_offset, + (uint16_t)queue_size, host_id, header, SPLIT_RING, irq_vector); + + rxvq[index].usage = NTHW_VIRTQ_MANAGED; + + return &rxvq[index]; +} + +static struct nthw_virt_queue * +nthw_setup_mngd_tx_virt_queue_split(nthw_dbs_t *p_nthw_dbs, + uint32_t index, + uint32_t queue_size, + uint32_t host_id, + uint32_t port, + uint32_t virtual_port, + uint32_t header, + int irq_vector, + uint32_t in_order, + struct nthw_memory_descriptor *p_virt_struct_area, + struct nthw_memory_descriptor *p_packet_buffers) +{ + struct virtq_struct_layout_s virtq_struct_layout = dbs_calc_struct_layout(queue_size); + + dbs_initialize_virt_queue_structs(p_virt_struct_area->virt_addr, + (char *)p_virt_struct_area->virt_addr + + virtq_struct_layout.used_offset, + (char *)p_virt_struct_area->virt_addr + + virtq_struct_layout.desc_offset, + p_packet_buffers, + (uint16_t)queue_size, + 0, + 0 /* Tx */); + + txvq[index].p_avail = p_virt_struct_area->virt_addr; + txvq[index].p_used = + (void *)((char *)p_virt_struct_area->virt_addr + virtq_struct_layout.used_offset); + txvq[index].p_desc = + (void *)((char *)p_virt_struct_area->virt_addr + virtq_struct_layout.desc_offset); + txvq[index].queue_size = (uint16_t)queue_size; + txvq[index].am_idx = 0; + txvq[index].used_idx = 0; + txvq[index].cached_idx = 0; + txvq[index].p_virtual_addr = NULL; + + txvq[index].tx_descr_avail_idx = 0; + + if (p_packet_buffers) { + txvq[index].p_virtual_addr = malloc(queue_size * sizeof(*p_packet_buffers)); + memcpy(txvq[index].p_virtual_addr, p_packet_buffers, + queue_size * sizeof(*p_packet_buffers)); + } + + nthw_setup_tx_virt_queue(p_nthw_dbs, index, 0, 0, (void *)p_virt_struct_area->phys_addr, + (char *)p_virt_struct_area->phys_addr + + virtq_struct_layout.used_offset, + (char *)p_virt_struct_area->phys_addr + + virtq_struct_layout.desc_offset, + (uint16_t)queue_size, host_id, port, virtual_port, header, + SPLIT_RING, irq_vector, in_order); + + txvq[index].usage = NTHW_VIRTQ_MANAGED; + + return &txvq[index]; +} + +/* + * Create a Managed Rx Virt Queue + * + * Notice: The queue will be created with interrupts disabled. + * If interrupts are required, make sure to call nthw_enable_rx_virt_queue() + * afterwards. + */ +static struct nthw_virt_queue * +nthw_setup_mngd_rx_virt_queue(nthw_dbs_t *p_nthw_dbs, + uint32_t index, + uint32_t queue_size, + uint32_t host_id, + uint32_t header, + struct nthw_memory_descriptor *p_virt_struct_area, + struct nthw_memory_descriptor *p_packet_buffers, + uint32_t vq_type, + int irq_vector) +{ + switch (vq_type) { + case SPLIT_RING: + return nthw_setup_mngd_rx_virt_queue_split(p_nthw_dbs, index, queue_size, + host_id, header, p_virt_struct_area, + p_packet_buffers, irq_vector); + + default: + break; + } + + return NULL; +} + +/* + * Create a Managed Tx Virt Queue + * + * Notice: The queue will be created with interrupts disabled. + * If interrupts are required, make sure to call nthw_enable_tx_virt_queue() + * afterwards. + */ +static struct nthw_virt_queue * +nthw_setup_mngd_tx_virt_queue(nthw_dbs_t *p_nthw_dbs, + uint32_t index, + uint32_t queue_size, + uint32_t host_id, + uint32_t port, + uint32_t virtual_port, + uint32_t header, + struct nthw_memory_descriptor *p_virt_struct_area, + struct nthw_memory_descriptor *p_packet_buffers, + uint32_t vq_type, + int irq_vector, + uint32_t in_order) +{ + switch (vq_type) { + case SPLIT_RING: + return nthw_setup_mngd_tx_virt_queue_split(p_nthw_dbs, index, queue_size, + host_id, port, virtual_port, header, + irq_vector, in_order, + p_virt_struct_area, + p_packet_buffers); + + default: + break; + } + + return NULL; +} + static struct sg_ops_s sg_ops = { + .nthw_setup_rx_virt_queue = nthw_setup_rx_virt_queue, + .nthw_setup_tx_virt_queue = nthw_setup_tx_virt_queue, + .nthw_setup_mngd_rx_virt_queue = nthw_setup_mngd_rx_virt_queue, + .nthw_setup_mngd_tx_virt_queue = nthw_setup_mngd_tx_virt_queue, .nthw_virt_queue_init = nthw_virt_queue_init }; diff --git a/drivers/net/ntnic/include/ntnic_dbs.h b/drivers/net/ntnic/include/ntnic_dbs.h index a64d2a0aeb..4e6236e8b4 100644 --- a/drivers/net/ntnic/include/ntnic_dbs.h +++ b/drivers/net/ntnic/include/ntnic_dbs.h @@ -47,6 +47,11 @@ struct nthw_dbs_s { nthw_field_t *mp_fld_rx_init_val_idx; nthw_field_t *mp_fld_rx_init_val_ptr; + nthw_register_t *mp_reg_rx_ptr; + nthw_field_t *mp_fld_rx_ptr_ptr; + nthw_field_t *mp_fld_rx_ptr_queue; + nthw_field_t *mp_fld_rx_ptr_valid; + nthw_register_t *mp_reg_tx_init; nthw_field_t *mp_fld_tx_init_init; nthw_field_t *mp_fld_tx_init_queue; @@ -56,6 +61,20 @@ struct nthw_dbs_s { nthw_field_t *mp_fld_tx_init_val_idx; nthw_field_t *mp_fld_tx_init_val_ptr; + nthw_register_t *mp_reg_tx_ptr; + nthw_field_t *mp_fld_tx_ptr_ptr; + nthw_field_t *mp_fld_tx_ptr_queue; + nthw_field_t *mp_fld_tx_ptr_valid; + + nthw_register_t *mp_reg_rx_idle; + nthw_field_t *mp_fld_rx_idle_idle; + nthw_field_t *mp_fld_rx_idle_queue; + nthw_field_t *mp_fld_rx_idle_busy; + + nthw_register_t *mp_reg_tx_idle; + nthw_field_t *mp_fld_tx_idle_idle; + nthw_field_t *mp_fld_tx_idle_queue; + nthw_field_t *mp_fld_tx_idle_busy; }; typedef struct nthw_dbs_s nthw_dbs_t; diff --git a/drivers/net/ntnic/include/ntnic_virt_queue.h b/drivers/net/ntnic/include/ntnic_virt_queue.h index f8842819e4..97cb474dc8 100644 --- a/drivers/net/ntnic/include/ntnic_virt_queue.h +++ b/drivers/net/ntnic/include/ntnic_virt_queue.h @@ -23,6 +23,13 @@ struct nthw_virt_queue; * contiguous) In Used descriptors it must be ignored */ #define VIRTQ_DESC_F_NEXT 1 +/* + * SPLIT : This marks a buffer as device write-only (otherwise device read-only). + * PACKED: This marks a descriptor as device write-only (otherwise device read-only). + * PACKED: In a used descriptor, this bit is used to specify whether any data has been written by + * the device into any parts of the buffer. + */ +#define VIRTQ_DESC_F_WRITE 2 /* * Split Ring virtq Descriptor diff --git a/drivers/net/ntnic/nthw/dbs/nthw_dbs.c b/drivers/net/ntnic/nthw/dbs/nthw_dbs.c index 853d7bc1ec..cd1123b6f3 100644 --- a/drivers/net/ntnic/nthw/dbs/nthw_dbs.c +++ b/drivers/net/ntnic/nthw/dbs/nthw_dbs.c @@ -44,12 +44,135 @@ int dbs_init(nthw_dbs_t *p, nthw_fpga_t *p_fpga, int n_instance) p->mp_fpga->p_fpga_info->mp_adapter_id_str, p->mn_instance); } + p->mp_reg_rx_control = nthw_module_get_register(p->mp_mod_dbs, DBS_RX_CONTROL); + p->mp_fld_rx_control_last_queue = + nthw_register_get_field(p->mp_reg_rx_control, DBS_RX_CONTROL_LQ); + p->mp_fld_rx_control_avail_monitor_enable = + nthw_register_get_field(p->mp_reg_rx_control, DBS_RX_CONTROL_AME); + p->mp_fld_rx_control_avail_monitor_scan_speed = + nthw_register_get_field(p->mp_reg_rx_control, DBS_RX_CONTROL_AMS); + p->mp_fld_rx_control_used_write_enable = + nthw_register_get_field(p->mp_reg_rx_control, DBS_RX_CONTROL_UWE); + p->mp_fld_rx_control_used_writer_update_speed = + nthw_register_get_field(p->mp_reg_rx_control, DBS_RX_CONTROL_UWS); + p->mp_fld_rx_control_rx_queues_enable = + nthw_register_get_field(p->mp_reg_rx_control, DBS_RX_CONTROL_QE); + + p->mp_reg_tx_control = nthw_module_get_register(p->mp_mod_dbs, DBS_TX_CONTROL); + p->mp_fld_tx_control_last_queue = + nthw_register_get_field(p->mp_reg_tx_control, DBS_TX_CONTROL_LQ); + p->mp_fld_tx_control_avail_monitor_enable = + nthw_register_get_field(p->mp_reg_tx_control, DBS_TX_CONTROL_AME); + p->mp_fld_tx_control_avail_monitor_scan_speed = + nthw_register_get_field(p->mp_reg_tx_control, DBS_TX_CONTROL_AMS); + p->mp_fld_tx_control_used_write_enable = + nthw_register_get_field(p->mp_reg_tx_control, DBS_TX_CONTROL_UWE); + p->mp_fld_tx_control_used_writer_update_speed = + nthw_register_get_field(p->mp_reg_tx_control, DBS_TX_CONTROL_UWS); + p->mp_fld_tx_control_tx_queues_enable = + nthw_register_get_field(p->mp_reg_tx_control, DBS_TX_CONTROL_QE); + + p->mp_reg_rx_init = nthw_module_get_register(p->mp_mod_dbs, DBS_RX_INIT); + p->mp_fld_rx_init_init = nthw_register_get_field(p->mp_reg_rx_init, DBS_RX_INIT_INIT); + p->mp_fld_rx_init_queue = nthw_register_get_field(p->mp_reg_rx_init, DBS_RX_INIT_QUEUE); + p->mp_fld_rx_init_busy = nthw_register_get_field(p->mp_reg_rx_init, DBS_RX_INIT_BUSY); + + p->mp_reg_rx_init_val = nthw_module_query_register(p->mp_mod_dbs, DBS_RX_INIT_VAL); + + if (p->mp_reg_rx_init_val) { + p->mp_fld_rx_init_val_idx = + nthw_register_query_field(p->mp_reg_rx_init_val, DBS_RX_INIT_VAL_IDX); + p->mp_fld_rx_init_val_ptr = + nthw_register_query_field(p->mp_reg_rx_init_val, DBS_RX_INIT_VAL_PTR); + } + + p->mp_reg_rx_ptr = nthw_module_query_register(p->mp_mod_dbs, DBS_RX_PTR); + + if (p->mp_reg_rx_ptr) { + p->mp_fld_rx_ptr_ptr = nthw_register_query_field(p->mp_reg_rx_ptr, DBS_RX_PTR_PTR); + p->mp_fld_rx_ptr_queue = + nthw_register_query_field(p->mp_reg_rx_ptr, DBS_RX_PTR_QUEUE); + p->mp_fld_rx_ptr_valid = + nthw_register_query_field(p->mp_reg_rx_ptr, DBS_RX_PTR_VALID); + } + + p->mp_reg_tx_init = nthw_module_get_register(p->mp_mod_dbs, DBS_TX_INIT); + p->mp_fld_tx_init_init = nthw_register_get_field(p->mp_reg_tx_init, DBS_TX_INIT_INIT); + p->mp_fld_tx_init_queue = nthw_register_get_field(p->mp_reg_tx_init, DBS_TX_INIT_QUEUE); + p->mp_fld_tx_init_busy = nthw_register_get_field(p->mp_reg_tx_init, DBS_TX_INIT_BUSY); + + p->mp_reg_tx_init_val = nthw_module_query_register(p->mp_mod_dbs, DBS_TX_INIT_VAL); + + if (p->mp_reg_tx_init_val) { + p->mp_fld_tx_init_val_idx = + nthw_register_query_field(p->mp_reg_tx_init_val, DBS_TX_INIT_VAL_IDX); + p->mp_fld_tx_init_val_ptr = + nthw_register_query_field(p->mp_reg_tx_init_val, DBS_TX_INIT_VAL_PTR); + } + + p->mp_reg_tx_ptr = nthw_module_query_register(p->mp_mod_dbs, DBS_TX_PTR); + + if (p->mp_reg_tx_ptr) { + p->mp_fld_tx_ptr_ptr = nthw_register_query_field(p->mp_reg_tx_ptr, DBS_TX_PTR_PTR); + p->mp_fld_tx_ptr_queue = + nthw_register_query_field(p->mp_reg_tx_ptr, DBS_TX_PTR_QUEUE); + p->mp_fld_tx_ptr_valid = + nthw_register_query_field(p->mp_reg_tx_ptr, DBS_TX_PTR_VALID); + } + + p->mp_reg_rx_idle = nthw_module_query_register(p->mp_mod_dbs, DBS_RX_IDLE); + + if (p->mp_reg_rx_idle) { + p->mp_fld_rx_idle_idle = + nthw_register_query_field(p->mp_reg_rx_idle, DBS_RX_IDLE_IDLE); + p->mp_fld_rx_idle_queue = + nthw_register_query_field(p->mp_reg_rx_idle, DBS_RX_IDLE_QUEUE); + p->mp_fld_rx_idle_busy = + nthw_register_query_field(p->mp_reg_rx_idle, DBS_RX_IDLE_BUSY); + } + + p->mp_reg_tx_idle = nthw_module_query_register(p->mp_mod_dbs, DBS_TX_IDLE); + + if (p->mp_reg_tx_idle) { + p->mp_fld_tx_idle_idle = + nthw_register_query_field(p->mp_reg_tx_idle, DBS_TX_IDLE_IDLE); + p->mp_fld_tx_idle_queue = + nthw_register_query_field(p->mp_reg_tx_idle, DBS_TX_IDLE_QUEUE); + p->mp_fld_tx_idle_busy = + nthw_register_query_field(p->mp_reg_tx_idle, DBS_TX_IDLE_BUSY); + } + + return 0; +} + +static int dbs_reset_rx_control(nthw_dbs_t *p) +{ + nthw_field_set_val32(p->mp_fld_rx_control_last_queue, 0); + nthw_field_set_val32(p->mp_fld_rx_control_avail_monitor_enable, 0); + nthw_field_set_val32(p->mp_fld_rx_control_avail_monitor_scan_speed, 8); + nthw_field_set_val32(p->mp_fld_rx_control_used_write_enable, 0); + nthw_field_set_val32(p->mp_fld_rx_control_used_writer_update_speed, 5); + nthw_field_set_val32(p->mp_fld_rx_control_rx_queues_enable, 0); + nthw_register_flush(p->mp_reg_rx_control, 1); + return 0; +} + +static int dbs_reset_tx_control(nthw_dbs_t *p) +{ + nthw_field_set_val32(p->mp_fld_tx_control_last_queue, 0); + nthw_field_set_val32(p->mp_fld_tx_control_avail_monitor_enable, 0); + nthw_field_set_val32(p->mp_fld_tx_control_avail_monitor_scan_speed, 5); + nthw_field_set_val32(p->mp_fld_tx_control_used_write_enable, 0); + nthw_field_set_val32(p->mp_fld_tx_control_used_writer_update_speed, 8); + nthw_field_set_val32(p->mp_fld_tx_control_tx_queues_enable, 0); + nthw_register_flush(p->mp_reg_tx_control, 1); return 0; } void dbs_reset(nthw_dbs_t *p) { - (void)p; + dbs_reset_rx_control(p); + dbs_reset_tx_control(p); } int set_rx_control(nthw_dbs_t *p, diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h index 45f9794958..3560eeda7d 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h @@ -16,6 +16,7 @@ #include "nthw_fpga_reg_defs_cat.h" #include "nthw_fpga_reg_defs_cpy.h" #include "nthw_fpga_reg_defs_csu.h" +#include "nthw_fpga_reg_defs_dbs.h" #include "nthw_fpga_reg_defs_flm.h" #include "nthw_fpga_reg_defs_gfg.h" #include "nthw_fpga_reg_defs_gmf.h" diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h new file mode 100644 index 0000000000..ee5d726aab --- /dev/null +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h @@ -0,0 +1,79 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +/* + * nthw_fpga_reg_defs_dbs.h + * + * Auto-generated file - do *NOT* edit + * + */ + +#ifndef _NTHW_FPGA_REG_DEFS_DBS_ +#define _NTHW_FPGA_REG_DEFS_DBS_ + +/* DBS */ +#define DBS_RX_CONTROL (0xb18b2866UL) +#define DBS_RX_CONTROL_AME (0x1f9219acUL) +#define DBS_RX_CONTROL_AMS (0xeb46acfdUL) +#define DBS_RX_CONTROL_LQ (0xe65f90b2UL) +#define DBS_RX_CONTROL_QE (0x3e928d3UL) +#define DBS_RX_CONTROL_UWE (0xb490e8dbUL) +#define DBS_RX_CONTROL_UWS (0x40445d8aUL) +#define DBS_RX_IDLE (0x93c723bfUL) +#define DBS_RX_IDLE_BUSY (0x8e043b5bUL) +#define DBS_RX_IDLE_IDLE (0x9dba27ccUL) +#define DBS_RX_IDLE_QUEUE (0xbbddab49UL) +#define DBS_RX_INIT (0x899772deUL) +#define DBS_RX_INIT_BUSY (0x8576d90aUL) +#define DBS_RX_INIT_INIT (0x8c9894fcUL) +#define DBS_RX_INIT_QUEUE (0xa7bab8c9UL) +#define DBS_RX_INIT_VAL (0x7789b4d8UL) +#define DBS_RX_INIT_VAL_IDX (0xead0e2beUL) +#define DBS_RX_INIT_VAL_PTR (0x5330810eUL) +#define DBS_RX_PTR (0x628ce523UL) +#define DBS_RX_PTR_PTR (0x7f834481UL) +#define DBS_RX_PTR_QUEUE (0x4f3fa6d1UL) +#define DBS_RX_PTR_VALID (0xbcc5ec4dUL) +#define DBS_STATUS (0xb5f35220UL) +#define DBS_STATUS_OK (0xcf09a30fUL) +#define DBS_TX_CONTROL (0xbc955821UL) +#define DBS_TX_CONTROL_AME (0xe750521aUL) +#define DBS_TX_CONTROL_AMS (0x1384e74bUL) +#define DBS_TX_CONTROL_LQ (0x46ba4f6fUL) +#define DBS_TX_CONTROL_QE (0xa30cf70eUL) +#define DBS_TX_CONTROL_UWE (0x4c52a36dUL) +#define DBS_TX_CONTROL_UWS (0xb886163cUL) +#define DBS_TX_IDLE (0xf0171685UL) +#define DBS_TX_IDLE_BUSY (0x61399ebbUL) +#define DBS_TX_IDLE_IDLE (0x7287822cUL) +#define DBS_TX_IDLE_QUEUE (0x1b387494UL) +#define DBS_TX_INIT (0xea4747e4UL) +#define DBS_TX_INIT_BUSY (0x6a4b7ceaUL) +#define DBS_TX_INIT_INIT (0x63a5311cUL) +#define DBS_TX_INIT_QUEUE (0x75f6714UL) +#define DBS_TX_INIT_VAL (0x9f3c7e9bUL) +#define DBS_TX_INIT_VAL_IDX (0xc82a364cUL) +#define DBS_TX_INIT_VAL_PTR (0x71ca55fcUL) +#define DBS_TX_PTR (0xb4d5063eUL) +#define DBS_TX_PTR_PTR (0x729d34c6UL) +#define DBS_TX_PTR_QUEUE (0xa0020331UL) +#define DBS_TX_PTR_VALID (0x53f849adUL) +#define DBS_TX_QOS_CTRL (0x3b2c3286UL) +#define DBS_TX_QOS_CTRL_ADR (0x666600acUL) +#define DBS_TX_QOS_CTRL_CNT (0x766e997dUL) +#define DBS_TX_QOS_DATA (0x94fdb09fUL) +#define DBS_TX_QOS_DATA_BS (0x2c394071UL) +#define DBS_TX_QOS_DATA_EN (0x7eba6fUL) +#define DBS_TX_QOS_DATA_IR (0xb8caa92cUL) +#define DBS_TX_QOS_DATA_MUL (0xd7407a67UL) +#define DBS_TX_QOS_RATE (0xe6e27cc5UL) +#define DBS_TX_QOS_RATE_DIV (0x8cd07ba3UL) +#define DBS_TX_QOS_RATE_MUL (0x9814e40bUL) + +#endif /* _NTHW_FPGA_REG_DEFS_DBS_ */ + +/* + * Auto-generated file - do *NOT* edit + */ From patchwork Fri Oct 4 15:34:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145099 X-Patchwork-Delegate: ferruh.yigit@amd.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 50F2645AAF; Fri, 4 Oct 2024 17:52:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1EDE742E4A; Fri, 4 Oct 2024 17:51:08 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id 0777D42E0B for ; Fri, 4 Oct 2024 17:51:03 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2104.outbound.protection.outlook.com [104.47.17.104]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:50:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xmG7TwhVY48C3QnVhLSNVW0DcXKgi1f/Av7vMPwEsLSVly8NK9RSJvwuxr5W/f3gNYCPQMBAimgB1CeV5FhhrMwumYBWPsRihhlZ6s8nWVX2s8wiFMrmPSTBbUbw0mEHf1UbR9Ew78SoKym1iW/HlORi7mja+tPEDFxltKRnsjv0DNCetJjzkQgZ2I5B98MfqgqlH4MYMWNwoF6B+m0a36sjvs8YhwveLCSZ5gGPY3xSnpJebZpf+dlHYZPp7XIu6/HV0iqQDrHIsA+O4qUi8r2OZoQSMpNIEYImLe7+beIHK1rZXn+C1csDJLAN5ghw3WTc+1rEaR8G+yua59HKFg== 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=xGxyKEKXX6ZIJZ4njIDnTmWUIo/zfvdswW5QupfUaDw=; b=o5I8cJ9I2wxehjsAzh9Al1IYxLVcRziJC6d5VO4kAYhHsrIbat776kFGDqI/DF2UClhcm0Gta5xHHYwLM33397R1blmO5NU4kGuBKXfwlBkOQGvAn9t1vNbtQ+BG45M0Ht3lHZoCTA79yPEXseO8xT1aZl8ZTHKuEptXXjR652wUP2F0nV0jCQtanTDnbq5Y/ztH4KzMybzoOfHJsFZ0oWd0vXFxCqGtyulYs5BagTJwFjPT0zBncWb86MmynVigfdfIrKAkXl1Ybl7oUY/YbNTt1j8SmqEoYmI7TiJpG+YlnC2P9fkJ/k8VwYWmjzMUbqrp/RgumVSPNtoQBd8aZg== 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=xGxyKEKXX6ZIJZ4njIDnTmWUIo/zfvdswW5QupfUaDw=; b=JwwZ0gQTXOQ5a0nuDx5Dmu9aYMN5gvcbfP+gqP2fUic4G0cJQlSLP8csjef4sacQTLWzveOyu6n6kj3Je2S7l0yYlqpwrxeGECBVaSE3Il8UsMV2Q/PnOHroknUZZYnIqczwvyxKa4SMGVGCnEu1haE5FcaXTCYaTMOxP9ZfP9g= Received: from AM0PR10CA0119.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::36) by AM8P190MB0835.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:1c6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.17; Fri, 4 Oct 2024 15:36:10 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::c) by AM0PR10CA0119.outlook.office365.com (2603:10a6:208:e6::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:09 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:09 +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, Oleksandr Kolomeiets Subject: [PATCH v1 08/31] net/ntnic: add flow matcher (FLM) flow module Date: Fri, 4 Oct 2024 17:34:31 +0200 Message-ID: <20241004153551.267935-14-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|AM8P190MB0835:EE_ X-MS-Office365-Filtering-Correlation-Id: 82aaf810-82ff-4ce2-e218-08dce48a4556 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: WJXrMFu3zmb10WNqHLGcGnVEFY5FIW2aIwGENJB4esaaxfB3uG4ghlQQ0MOAxAO9P66YUQFY7+EWa1zR1n5Li6PLnSUHup7A4YtwmZUeMeQJ7NVf/2OyBkQjfqRtXa1A/G51azB0CvTJTaWPR77gx68GiXcWIv2h0SlZba61ItrVqBviv/3mITbe1k4cBw+ekJDoDdCkLOIGDmiYH2grA7bkAoI/ovj6I8TT1+RtRnSlDuQIji9/EyVnL0O4jDYkdghZFiByRh4StnhTzRzPlh8VoAFLqCmGrsWy68GMVKj++VA84UviQqiuM618wIqwNOKquPQtQ15dEsQexze9G2cir9mhF0sHj8aDzk4XDsnNr+aFNu9lOakDAFaiaay5DpVtfxjznfUtn+Ub/xbFiB1ChFVL+Pi47Bzw/NsBnf5HWSoDSZlg4+uFmYwngGih2jtslkKSbNhG3W5eJxfXFUNe+3IPPmYgaUGqRC+65goi9qeN+/aUtAUgzm5b8LORQSbw3XmTy/47pV0CGZLVJ3KzjmCuwUnB0DMOfA951y69q8Dad9PJiWmbJmWQ12UGfGd/kCM/N8p2028aY7fCDwCcHuoh1iqF+rebu93Y5D7Q6h/yC1KWaxTEgYrJbnNCcPShMoDvvtHa61kAP6FHocF7K9tpmFuQcWZaSyELk2VoI1s/zET7Dpn1qok8TKKecBjw1WIQIHva4iMTiNKTN3RGhnejNZaazn8P+cHOk5v4cN5aBJfWprMM16ef19vSJ8WloSFl7s6BKzQaOopu6G3/MlAr3dqc6Ej2+hR+2d9NqwGg+4qiXpQqclDs5mFMTYrPki7NELY6R37vvdehP4aqGbldAbcunE729aHh9/Ks4n6O7zgGUc5sm5OG5XpHHn7GdJ8aIkSr6EvE7nEy/FjY0u50fT8NdrwJZpTCr3flejfMxF6UcsSrlEu0qAZQ9jtdILa75l/iuhMLwWGxHDf/Hjg9bh8DHiIkaXMyyyUzubyF9n0O3sQuMlqo3J2BLGPMUJOhXGKzxikUK7lk1iHlydnwKCH/Yz6FQK2PdvMU9NsxWH7oYLxFQX5zpfZN0nolj/XVR79MKUxdvxntuU8sz09+vqKIdD/DQfLI8/lNi53uMX2Xi5Bmd7vA5XRRy7urC0+OLCZdQAhbyTYIqIXUZh6QlHqq1WVrqpRWDwDUBQ7QuB9x9tVhWF8YP2vZ6XLwstbXq2Y44m5nNsAesZDYI2tOLBc7hdls9fR4P8cD4yVQcYo9YQ2iwtoXuNRTxqlGi2ossV/6KgnXi4vFjZioqLwCZZobByjzVLpdvnPk3j7Zh/tITIk0iqeyG481wH2BAONxQkU0RBlSZgFaxrcM6dgLGU45wPa1QM6L+jZZpu3dBUdNEzt1eDvn7nSN 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)(36860700013)(1800799024)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ZlDnIf8TrH9XyTLDuKbOlQZku1fTN4pDC4l9JZyEim9fC6NuPTiPYiQ4jGuth1HLBFGc2NAx/gsTlztcJVRR8nIOxoSUdii7itttLRMJD7voOs36K0ZhE4aWBOknSB7MYZjHyr/kveUCfVv/KL+iR/EW/UEr19v6O/filfTH0w+p2KwYT2GLNbvjkFZz7nV9+VKdM58Ba9VRICRN+v80Ljh5hk6gQOsjV+USsoQraqN9T/S1hTLLh/2SgKpBbfd8+wtvXk9SSCm56tQkepWOcB/SQuQBbN8ZxeHYgOtoE9K26eCzaPzkdDqZWACUS0uizz4EYkMbFaX0o0o7Z+6ruzG+9z6vTajw+ttWm+a4OyqeA9yVr/XGB83DEDE69tBF1pTVZRAetMtefU/cFH/4Apwb3fkzjMRXgMCDopH8SSaEcRhzT31eIrafYZv4UzZPMsKqGqYXOZqEnwJdO5qyOaymh0hfwAsMFmam4rtNd69iVzkhFTxYg6cwKWYobENHp5a9Xst9ALXcPom4dIYj4c2jdMeDjrAnL7cj+pLOPdGl2y4chivQ6beJ/oP1V6sOE3o2Lm9xocjLzuSfAC9yRSRYbFNaSORTlkcuJAFf5wUbwBlREMR3j8Gd7rkqPAqQzNDR5rVEYBGtvtJfvsI2BA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:09.7521 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 82aaf810-82ff-4ce2-e218-08dce48a4556 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8P190MB0835 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057058-311388-12689-32520-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.104 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYGRoaGFkB2BlA4ycDEwDgxKS kx1djU3NQgzdDAPMnUxMDIzMIyMTU1MVGpNhYAku7qhkMAAAA= X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan20-223.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, 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: Oleksandr Kolomeiets The Flow Matcher module is a high-performance stateful SDRAM lookup and programming engine which supported exact match lookup in line-rate of up to hundreds of millions of flows. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/include/hw_mod_backend.h | 40 + drivers/net/ntnic/include/hw_mod_flm_v25.h | 342 +++++ drivers/net/ntnic/meson.build | 1 + .../nthw/flow_api/flow_backend/flow_backend.c | 378 +++++ .../ntnic/nthw/flow_filter/flow_nthw_flm.c | 1225 +++++++++++++++++ .../ntnic/nthw/flow_filter/flow_nthw_flm.h | 433 ++++++ drivers/net/ntnic/nthw/nthw_rac.c | 181 +++ drivers/net/ntnic/nthw/nthw_rac.h | 9 + .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 1 + .../nthw/supported/nthw_fpga_reg_defs_flm.h | 242 ++++ drivers/net/ntnic/ntutil/nt_util.c | 6 + drivers/net/ntnic/ntutil/nt_util.h | 1 + 13 files changed, 2860 insertions(+) create mode 100644 drivers/net/ntnic/include/hw_mod_flm_v25.h create mode 100644 drivers/net/ntnic/nthw/flow_filter/flow_nthw_flm.c create mode 100644 drivers/net/ntnic/nthw/flow_filter/flow_nthw_flm.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_flm.h diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index b921c06643..133a61fe9c 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -10,6 +10,7 @@ #include "hw_mod_cat_v18.h" #include "hw_mod_cat_v21.h" +#include "hw_mod_flm_v25.h" #include "hw_mod_km_v7.h" #define MAX_PHYS_ADAPTERS 8 @@ -58,6 +59,22 @@ struct km_func_s { }; }; +struct flm_func_s { + COMMON_FUNC_INFO_S; + uint32_t nb_categories; + uint32_t nb_size_mb; + uint32_t nb_entry_size; + uint32_t nb_variant; + uint32_t nb_prios; + uint32_t nb_pst_profiles; + uint32_t nb_scrub_profiles; + uint32_t nb_rpp_clock_in_ps; + uint32_t nb_load_aps_max; + union { + struct hw_mod_flm_v25_s v25; + }; +}; + enum debug_mode_e { FLOW_BACKEND_DEBUG_MODE_NONE = 0x0000, FLOW_BACKEND_DEBUG_MODE_WRITE = 0x0001 @@ -140,6 +157,29 @@ struct flow_api_backend_ops { int cnt); int (*km_tci_flush)(void *dev, const struct km_func_s *km, int bank, int record, int cnt); int (*km_tcq_flush)(void *dev, const struct km_func_s *km, int bank, int record, int cnt); + + /* FLM */ + bool (*get_flm_present)(void *dev); + uint32_t (*get_flm_version)(void *dev); + int (*flm_control_flush)(void *dev, const struct flm_func_s *flm); + int (*flm_status_flush)(void *dev, const struct flm_func_s *flm); + int (*flm_status_update)(void *dev, const struct flm_func_s *flm); + int (*flm_scan_flush)(void *dev, const struct flm_func_s *flm); + int (*flm_load_bin_flush)(void *dev, const struct flm_func_s *flm); + int (*flm_prio_flush)(void *dev, const struct flm_func_s *flm); + int (*flm_pst_flush)(void *dev, const struct flm_func_s *flm, int index, int cnt); + int (*flm_rcp_flush)(void *dev, const struct flm_func_s *flm, int index, int cnt); + int (*flm_scrub_flush)(void *dev, const struct flm_func_s *flm, int index, int cnt); + int (*flm_buf_ctrl_update)(void *dev, const struct flm_func_s *flm); + int (*flm_stat_update)(void *dev, const struct flm_func_s *flm); + int (*flm_lrn_data_flush)(void *be_dev, const struct flm_func_s *flm, + const uint32_t *lrn_data, uint32_t records, + uint32_t *handled_records, uint32_t words_per_record, + uint32_t *inf_word_cnt, uint32_t *sta_word_cnt); + int (*flm_inf_sta_data_update)(void *be_dev, const struct flm_func_s *flm, + uint32_t *inf_data, uint32_t inf_size, + uint32_t *inf_word_cnt, uint32_t *sta_data, + uint32_t sta_size, uint32_t *sta_word_cnt); }; struct flow_api_backend_s { diff --git a/drivers/net/ntnic/include/hw_mod_flm_v25.h b/drivers/net/ntnic/include/hw_mod_flm_v25.h new file mode 100644 index 0000000000..12135a652c --- /dev/null +++ b/drivers/net/ntnic/include/hw_mod_flm_v25.h @@ -0,0 +1,342 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +#ifndef _HW_MOD_FLM_V25_H_ +#define _HW_MOD_FLM_V25_H_ + +#include + +/* SCRUB record constraints */ +#define SCRUB_T_MAX 0xEF/* MAX encoded timeout value, approx. 127 years */ +#define SCRUB_DEL \ + 0 /* Indicates if flow should be deleted upon timeout. If DEL=0 then the flow is \ + * marked as aged rather than being deleted. \ + */ +#define SCRUB_INF \ + 1 /* Indicates if a flow info record should be generated upon timeout. \ + * If INF=1 a flow info record will be generated even for a stateless flow. \ + */ + +struct flm_v25_control_s { + uint32_t enable; + uint32_t init; + uint32_t lds; + uint32_t lfs; + uint32_t lis; + uint32_t uds; + uint32_t uis; + uint32_t rds; + uint32_t ris; + uint32_t pds; + uint32_t pis; + uint32_t crcwr; + uint32_t crcrd; + uint32_t rbl; + uint32_t eab; + uint32_t split_sdram_usage; +}; + +struct flm_v25_status_s { + uint32_t calib_success; + uint32_t calib_fail; + uint32_t initdone; + uint32_t idle; + uint32_t critical; + uint32_t panic; + uint32_t crcerr; + uint32_t eft_bp; + uint32_t cache_buf_critical; +}; + +struct flm_v25_load_bin_s { + uint32_t bin; +}; + +struct flm_v25_load_pps_s { + uint32_t pps; +}; + +struct flm_v25_load_lps_s { + uint32_t lps; +}; + +struct flm_v25_load_aps_s { + uint32_t aps; +}; + +struct flm_v25_prio_s { + uint32_t limit0; + uint32_t ft0; + uint32_t limit1; + uint32_t ft1; + uint32_t limit2; + uint32_t ft2; + uint32_t limit3; + uint32_t ft3; +}; + +struct flm_v25_pst_s { + uint32_t bp; + uint32_t pp; + uint32_t tp; +}; + +struct flm_v25_rcp_s { + uint32_t lookup; + uint32_t qw0_dyn; + uint32_t qw0_ofs; + uint32_t qw0_sel; + uint32_t qw4_dyn; + uint32_t qw4_ofs; + uint32_t sw8_dyn; + uint32_t sw8_ofs; + uint32_t sw8_sel; + uint32_t sw9_dyn; + uint32_t sw9_ofs; + uint32_t mask[10]; + uint32_t kid; + uint32_t opn; + uint32_t ipn; + uint32_t byt_dyn; + uint32_t byt_ofs; + uint32_t txplm; + uint32_t auto_ipv4_mask; +}; + +struct flm_v25_buf_ctrl_s { + uint32_t lrn_free; + uint32_t inf_avail; + uint32_t sta_avail; +}; + +struct flm_v25_stat_lrn_done_s { + uint32_t cnt; +}; + +struct flm_v25_stat_lrn_ignore_s { + uint32_t cnt; +}; + +struct flm_v25_stat_lrn_fail_s { + uint32_t cnt; +}; + +struct flm_v25_stat_unl_done_s { + uint32_t cnt; +}; + +struct flm_v25_stat_unl_ignore_s { + uint32_t cnt; +}; + +struct flm_v25_stat_rel_done_s { + uint32_t cnt; +}; + +struct flm_v25_stat_rel_ignore_s { + uint32_t cnt; +}; + +struct flm_v25_stat_aul_done_s { + uint32_t cnt; +}; + +struct flm_v25_stat_aul_ignore_s { + uint32_t cnt; +}; + +struct flm_v25_stat_aul_fail_s { + uint32_t cnt; +}; + +struct flm_v25_stat_tul_done_s { + uint32_t cnt; +}; + +struct flm_v25_stat_flows_s { + uint32_t cnt; +}; + +struct flm_v25_stat_prb_done_s { + uint32_t cnt; +}; + +struct flm_v25_stat_prb_ignore_s { + uint32_t cnt; +}; + +struct flm_v25_stat_sta_done_s { + uint32_t cnt; +}; + +struct flm_v25_stat_inf_done_s { + uint32_t cnt; +}; + +struct flm_v25_stat_inf_skip_s { + uint32_t cnt; +}; + +struct flm_v25_stat_pck_hit_s { + uint32_t cnt; +}; + +struct flm_v25_stat_pck_miss_s { + uint32_t cnt; +}; + +struct flm_v25_stat_pck_unh_s { + uint32_t cnt; +}; + +struct flm_v25_stat_pck_dis_s { + uint32_t cnt; +}; + +struct flm_v25_stat_csh_hit_s { + uint32_t cnt; +}; + +struct flm_v25_stat_csh_miss_s { + uint32_t cnt; +}; + +struct flm_v25_stat_csh_unh_s { + uint32_t cnt; +}; + +struct flm_v25_stat_cuc_start_s { + uint32_t cnt; +}; + +struct flm_v25_stat_cuc_move_s { + uint32_t cnt; +}; + +struct flm_v25_scan_s { + uint32_t i; +}; + +struct flm_v25_scrub_s { + uint8_t t; + uint8_t r; + uint8_t del; + uint8_t inf; +}; + +#pragma pack(1) +struct flm_v25_lrn_data_s { + uint32_t sw9; /* 31:0 (32) */ + uint32_t sw8; /* 63:32 (32) */ + uint32_t qw4[4];/* 191:64 (128) */ + uint32_t qw0[4];/* 319:192 (128) */ + uint8_t prot; /* 327:320 (8) */ + uint8_t kid; /* 335:328 (8) */ + uint32_t nat_ip;/* 367:336 (32) */ + uint32_t teid; /* 399:368 (32) */ + uint16_t nat_port; /* 415:400 (16) */ + uint16_t rate; /* 431:416 (16) */ + uint16_t size; /* 447:432 (16) */ + uint32_t color; /* 479:448 (32) */ + uint32_t adj; /* 511:480 (32) */ + uint32_t id; /* 543:512 (32) */ + uint16_t fill; /* 559:544 (16) */ + + /* + * Bit fields + */ + uint64_t ft : 4;/* 563:560 (4) */ + uint64_t ft_mbr : 4; /* 567:564 (4) */ + uint64_t ft_miss : 4; /* 571:568 (4) */ + uint64_t mbr_idx1 : 28; /* 599:572 (28) */ + uint64_t mbr_idx2 : 28; /* 627:600 (28) */ + uint64_t mbr_idx3 : 28; /* 655:628 (28) */ + uint64_t mbr_idx4 : 28; /* 683:656 (28) */ + uint64_t vol_idx : 3; /* 686:684 (3) */ + uint64_t stat_prof : 4; /* 690:687 (4) */ + uint64_t prio : 2; /* 692:691 (2) */ + uint64_t ent : 1; /* 693:693 (1) */ + uint64_t op : 4;/* 697:694 (4) */ + uint64_t dscp : 6; /* 703:698 (6) */ + uint64_t qfi : 6; /* 709:704 (6) */ + uint64_t rqi : 1; /* 710:710 (1) */ + uint64_t nat_en : 1; /* 711:711 (1) */ + uint64_t scrub_prof : 4;/* 715:712 (4) */ + uint64_t nofi : 1; /* 716:716 (1) */ + uint64_t pad : 50; /* 766:717 (50) */ + uint64_t eor : 1; /* 767:767 (1) */ +}; + +struct flm_v25_inf_data_s { + uint64_t bytes; + uint64_t packets; + uint64_t ts; + uint32_t id; + uint64_t cause : 3; + uint64_t pad : 60; + uint64_t eor : 1; +}; + +struct flm_v25_sta_data_s { + uint32_t id; + uint64_t lds : 1; + uint64_t lfs : 1; + uint64_t lis : 1; + uint64_t uds : 1; + uint64_t uis : 1; + uint64_t rds : 1; + uint64_t ris : 1; + uint64_t pds : 1; + uint64_t pis : 1; + uint64_t pad : 54; + uint64_t eor : 1; +}; +#pragma pack() + +struct hw_mod_flm_v25_s { + struct flm_v25_control_s *control; + struct flm_v25_status_s *status; + struct flm_v25_load_bin_s *load_bin; + struct flm_v25_load_pps_s *load_pps; + struct flm_v25_load_lps_s *load_lps; + struct flm_v25_load_aps_s *load_aps; + struct flm_v25_prio_s *prio; + struct flm_v25_pst_s *pst; + struct flm_v25_rcp_s *rcp; + struct flm_v25_buf_ctrl_s *buf_ctrl; + /* lrn_data is not handled by struct */ + /* inf_data is not handled by struct */ + /* sta_data is not handled by struct */ + struct flm_v25_stat_lrn_done_s *lrn_done; + struct flm_v25_stat_lrn_ignore_s *lrn_ignore; + struct flm_v25_stat_lrn_fail_s *lrn_fail; + struct flm_v25_stat_unl_done_s *unl_done; + struct flm_v25_stat_unl_ignore_s *unl_ignore; + struct flm_v25_stat_rel_done_s *rel_done; + struct flm_v25_stat_rel_ignore_s *rel_ignore; + struct flm_v25_stat_aul_done_s *aul_done; + struct flm_v25_stat_aul_ignore_s *aul_ignore; + struct flm_v25_stat_aul_fail_s *aul_fail; + struct flm_v25_stat_tul_done_s *tul_done; + struct flm_v25_stat_flows_s *flows; + struct flm_v25_stat_prb_done_s *prb_done; + struct flm_v25_stat_prb_ignore_s *prb_ignore; + struct flm_v25_stat_sta_done_s *sta_done; + struct flm_v25_stat_inf_done_s *inf_done; + struct flm_v25_stat_inf_skip_s *inf_skip; + struct flm_v25_stat_pck_hit_s *pck_hit; + struct flm_v25_stat_pck_miss_s *pck_miss; + struct flm_v25_stat_pck_unh_s *pck_unh; + struct flm_v25_stat_pck_dis_s *pck_dis; + struct flm_v25_stat_csh_hit_s *csh_hit; + struct flm_v25_stat_csh_miss_s *csh_miss; + struct flm_v25_stat_csh_unh_s *csh_unh; + struct flm_v25_stat_cuc_start_s *cuc_start; + struct flm_v25_stat_cuc_move_s *cuc_move; + struct flm_v25_scan_s *scan; + struct flm_v25_scrub_s *scrub; +}; + +#endif /* _HW_MOD_FLM_V25_H_ */ diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 8d297cbb61..317b696d5f 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -47,6 +47,7 @@ sources = files( 'nthw/flow_api/flow_backend/flow_backend.c', 'nthw/flow_api/flow_filter.c', 'nthw/flow_filter/flow_nthw_cat.c', + 'nthw/flow_filter/flow_nthw_flm.c', 'nthw/flow_filter/flow_nthw_info.c', 'nthw/flow_filter/flow_nthw_km.c', 'nthw/model/nthw_fpga_model.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c index c004000cc0..8703a4c712 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c @@ -8,6 +8,7 @@ #include "flow_nthw_info.h" #include "flow_nthw_cat.h" #include "flow_nthw_km.h" +#include "flow_nthw_flm.h" #include "ntnic_mod_reg.h" #include "nthw_fpga_model.h" #include "hw_mod_backend.h" @@ -25,6 +26,7 @@ static struct backend_dev_s { struct info_nthw *p_info_nthw; struct cat_nthw *p_cat_nthw; struct km_nthw *p_km_nthw; + struct flm_nthw *p_flm_nthw; } be_devs[MAX_PHYS_ADAPTERS]; #define CHECK_DEBUG_ON(be, mod, inst) \ @@ -907,6 +909,355 @@ static int km_tcq_flush(void *be_dev, const struct km_func_s *km, int bank, int return 0; } +/* + * FLM + */ + +static bool flm_get_present(void *be_dev) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + return be->p_flm_nthw != NULL; +} + +static uint32_t flm_get_version(void *be_dev) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + return (uint32_t)((nthw_module_get_major_version(be->p_flm_nthw->m_flm) << 16) | + (nthw_module_get_minor_version(be->p_flm_nthw->m_flm) & 0xffff)); +} + +static int flm_control_flush(void *be_dev, const struct flm_func_s *flm) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, flm, be->p_flm_nthw); + + if (flm->ver >= 25) { + flm_nthw_control_enable(be->p_flm_nthw, flm->v25.control->enable); + flm_nthw_control_init(be->p_flm_nthw, flm->v25.control->init); + flm_nthw_control_lds(be->p_flm_nthw, flm->v25.control->lds); + flm_nthw_control_lfs(be->p_flm_nthw, flm->v25.control->lfs); + flm_nthw_control_lis(be->p_flm_nthw, flm->v25.control->lis); + flm_nthw_control_uds(be->p_flm_nthw, flm->v25.control->uds); + flm_nthw_control_uis(be->p_flm_nthw, flm->v25.control->uis); + flm_nthw_control_rds(be->p_flm_nthw, flm->v25.control->rds); + flm_nthw_control_ris(be->p_flm_nthw, flm->v25.control->ris); + flm_nthw_control_pds(be->p_flm_nthw, flm->v25.control->pds); + flm_nthw_control_pis(be->p_flm_nthw, flm->v25.control->pis); + flm_nthw_control_crcwr(be->p_flm_nthw, flm->v25.control->crcwr); + flm_nthw_control_crcrd(be->p_flm_nthw, flm->v25.control->crcrd); + flm_nthw_control_rbl(be->p_flm_nthw, flm->v25.control->rbl); + flm_nthw_control_eab(be->p_flm_nthw, flm->v25.control->eab); + flm_nthw_control_split_sdram_usage(be->p_flm_nthw, + flm->v25.control->split_sdram_usage); + flm_nthw_control_flush(be->p_flm_nthw); + } + + CHECK_DEBUG_OFF(flm, be->p_flm_nthw); + return 0; +} + +static int flm_status_flush(void *be_dev, const struct flm_func_s *flm) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, flm, be->p_flm_nthw); + + if (flm->ver >= 25) { + /* CALIBDONE, INITDONE, IDLE, and EFT_BP is read only */ + flm_nthw_status_critical(be->p_flm_nthw, &flm->v25.status->critical, 0); + flm_nthw_status_panic(be->p_flm_nthw, &flm->v25.status->panic, 0); + flm_nthw_status_crcerr(be->p_flm_nthw, &flm->v25.status->crcerr, 0); + flm_nthw_status_cache_buf_crit(be->p_flm_nthw, + &flm->v25.status->cache_buf_critical, 0); + flm_nthw_status_flush(be->p_flm_nthw); + } + + CHECK_DEBUG_OFF(flm, be->p_flm_nthw); + return 0; +} + +static int flm_status_update(void *be_dev, const struct flm_func_s *flm) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, flm, be->p_flm_nthw); + + if (flm->ver >= 25) { + flm_nthw_status_update(be->p_flm_nthw); + flm_nthw_status_calib_success(be->p_flm_nthw, &flm->v25.status->calib_success, 1); + flm_nthw_status_calib_fail(be->p_flm_nthw, &flm->v25.status->calib_fail, 1); + flm_nthw_status_initdone(be->p_flm_nthw, &flm->v25.status->initdone, 1); + flm_nthw_status_idle(be->p_flm_nthw, &flm->v25.status->idle, 1); + flm_nthw_status_critical(be->p_flm_nthw, &flm->v25.status->critical, 1); + flm_nthw_status_panic(be->p_flm_nthw, &flm->v25.status->panic, 1); + flm_nthw_status_crcerr(be->p_flm_nthw, &flm->v25.status->crcerr, 1); + flm_nthw_status_eft_bp(be->p_flm_nthw, &flm->v25.status->eft_bp, 1); + flm_nthw_status_cache_buf_crit(be->p_flm_nthw, + &flm->v25.status->cache_buf_critical, 1); + } + + CHECK_DEBUG_OFF(flm, be->p_flm_nthw); + return 0; +} + +static int flm_scan_flush(void *be_dev, const struct flm_func_s *flm) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, flm, be->p_flm_nthw); + + if (flm->ver >= 25) { + flm_nthw_scan_i(be->p_flm_nthw, flm->v25.scan->i); + flm_nthw_scan_flush(be->p_flm_nthw); + } + + CHECK_DEBUG_OFF(flm, be->p_flm_nthw); + return 0; +} + +static int flm_load_bin_flush(void *be_dev, const struct flm_func_s *flm) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, flm, be->p_flm_nthw); + + if (flm->ver >= 25) { + flm_nthw_load_bin(be->p_flm_nthw, flm->v25.load_bin->bin); + flm_nthw_load_bin_flush(be->p_flm_nthw); + } + + CHECK_DEBUG_OFF(flm, be->p_flm_nthw); + return 0; +} + +static int flm_prio_flush(void *be_dev, const struct flm_func_s *flm) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, flm, be->p_flm_nthw); + + if (flm->ver >= 25) { + flm_nthw_prio_limit0(be->p_flm_nthw, flm->v25.prio->limit0); + flm_nthw_prio_ft0(be->p_flm_nthw, flm->v25.prio->ft0); + flm_nthw_prio_limit1(be->p_flm_nthw, flm->v25.prio->limit1); + flm_nthw_prio_ft1(be->p_flm_nthw, flm->v25.prio->ft1); + flm_nthw_prio_limit2(be->p_flm_nthw, flm->v25.prio->limit2); + flm_nthw_prio_ft2(be->p_flm_nthw, flm->v25.prio->ft2); + flm_nthw_prio_limit3(be->p_flm_nthw, flm->v25.prio->limit3); + flm_nthw_prio_ft3(be->p_flm_nthw, flm->v25.prio->ft3); + flm_nthw_prio_flush(be->p_flm_nthw); + } + + CHECK_DEBUG_OFF(flm, be->p_flm_nthw); + return 0; +} + +static int flm_pst_flush(void *be_dev, const struct flm_func_s *flm, int index, int cnt) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, flm, be->p_flm_nthw); + + if (flm->ver >= 25) { + flm_nthw_pst_cnt(be->p_flm_nthw, 1); + + for (int i = 0; i < cnt; i++) { + flm_nthw_pst_select(be->p_flm_nthw, index + i); + flm_nthw_pst_bp(be->p_flm_nthw, flm->v25.pst[index + i].bp); + flm_nthw_pst_pp(be->p_flm_nthw, flm->v25.pst[index + i].pp); + flm_nthw_pst_tp(be->p_flm_nthw, flm->v25.pst[index + i].tp); + flm_nthw_pst_flush(be->p_flm_nthw); + } + } + + CHECK_DEBUG_OFF(flm, be->p_flm_nthw); + return 0; +} + +static int flm_rcp_flush(void *be_dev, const struct flm_func_s *flm, int index, int cnt) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, flm, be->p_flm_nthw); + + if (flm->ver >= 25) { + flm_nthw_rcp_cnt(be->p_flm_nthw, 1); + + for (int i = 0; i < cnt; i++) { + flm_nthw_rcp_select(be->p_flm_nthw, index + i); + flm_nthw_rcp_lookup(be->p_flm_nthw, flm->v25.rcp[index + i].lookup); + flm_nthw_rcp_qw0_dyn(be->p_flm_nthw, flm->v25.rcp[index + i].qw0_dyn); + flm_nthw_rcp_qw0_ofs(be->p_flm_nthw, flm->v25.rcp[index + i].qw0_ofs); + flm_nthw_rcp_qw0_sel(be->p_flm_nthw, flm->v25.rcp[index + i].qw0_sel); + flm_nthw_rcp_qw4_dyn(be->p_flm_nthw, flm->v25.rcp[index + i].qw4_dyn); + flm_nthw_rcp_qw4_ofs(be->p_flm_nthw, flm->v25.rcp[index + i].qw4_ofs); + flm_nthw_rcp_sw8_dyn(be->p_flm_nthw, flm->v25.rcp[index + i].sw8_dyn); + flm_nthw_rcp_sw8_ofs(be->p_flm_nthw, flm->v25.rcp[index + i].sw8_ofs); + flm_nthw_rcp_sw8_sel(be->p_flm_nthw, flm->v25.rcp[index + i].sw8_sel); + flm_nthw_rcp_sw9_dyn(be->p_flm_nthw, flm->v25.rcp[index + i].sw9_dyn); + flm_nthw_rcp_sw9_ofs(be->p_flm_nthw, flm->v25.rcp[index + i].sw9_ofs); + flm_nthw_rcp_mask(be->p_flm_nthw, flm->v25.rcp[index + i].mask); + flm_nthw_rcp_kid(be->p_flm_nthw, flm->v25.rcp[index + i].kid); + flm_nthw_rcp_opn(be->p_flm_nthw, flm->v25.rcp[index + i].opn); + flm_nthw_rcp_ipn(be->p_flm_nthw, flm->v25.rcp[index + i].ipn); + flm_nthw_rcp_byt_dyn(be->p_flm_nthw, flm->v25.rcp[index + i].byt_dyn); + flm_nthw_rcp_byt_ofs(be->p_flm_nthw, flm->v25.rcp[index + i].byt_ofs); + flm_nthw_rcp_txplm(be->p_flm_nthw, flm->v25.rcp[index + i].txplm); + flm_nthw_rcp_auto_ipv4_mask(be->p_flm_nthw, + flm->v25.rcp[index + i].auto_ipv4_mask); + flm_nthw_rcp_flush(be->p_flm_nthw); + } + } + + CHECK_DEBUG_OFF(flm, be->p_flm_nthw); + return 0; +} + +static int flm_scrub_flush(void *be_dev, const struct flm_func_s *flm, int index, int cnt) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, flm, be->p_flm_nthw); + + if (flm->ver >= 25) { + flm_nthw_scrub_cnt(be->p_flm_nthw, 1); + + for (int i = 0; i < cnt; i++) { + flm_nthw_scrub_select(be->p_flm_nthw, index + i); + flm_nthw_scrub_t(be->p_flm_nthw, flm->v25.scrub[index + i].t); + flm_nthw_scrub_r(be->p_flm_nthw, flm->v25.scrub[index + i].r); + flm_nthw_scrub_del(be->p_flm_nthw, flm->v25.scrub[index + i].del); + flm_nthw_scrub_inf(be->p_flm_nthw, flm->v25.scrub[index + i].inf); + flm_nthw_scrub_flush(be->p_flm_nthw); + } + } + + CHECK_DEBUG_OFF(flm, be->p_flm_nthw); + return 0; +} + +static int flm_buf_ctrl_update(void *be_dev, const struct flm_func_s *flm) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, flm, be->p_flm_nthw); + + if (flm->ver >= 25) { + flm_nthw_buf_ctrl_update(be->p_flm_nthw, + &flm->v25.buf_ctrl->lrn_free, + &flm->v25.buf_ctrl->inf_avail, + &flm->v25.buf_ctrl->sta_avail); + } + + CHECK_DEBUG_OFF(flm, be->p_flm_nthw); + return 0; +} + +static int flm_stat_update(void *be_dev, const struct flm_func_s *flm) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, flm, be->p_flm_nthw); + + if (flm->ver >= 25) { + flm_nthw_stat_lrn_done_update(be->p_flm_nthw); + flm_nthw_stat_lrn_ignore_update(be->p_flm_nthw); + flm_nthw_stat_lrn_fail_update(be->p_flm_nthw); + flm_nthw_stat_unl_done_update(be->p_flm_nthw); + flm_nthw_stat_unl_ignore_update(be->p_flm_nthw); + flm_nthw_stat_rel_done_update(be->p_flm_nthw); + flm_nthw_stat_rel_ignore_update(be->p_flm_nthw); + flm_nthw_stat_aul_done_update(be->p_flm_nthw); + flm_nthw_stat_aul_ignore_update(be->p_flm_nthw); + flm_nthw_stat_aul_fail_update(be->p_flm_nthw); + flm_nthw_stat_tul_done_update(be->p_flm_nthw); + flm_nthw_stat_flows_update(be->p_flm_nthw); + flm_nthw_load_lps_update(be->p_flm_nthw); + flm_nthw_load_aps_update(be->p_flm_nthw); + + flm_nthw_stat_lrn_done_cnt(be->p_flm_nthw, &flm->v25.lrn_done->cnt, 1); + flm_nthw_stat_lrn_ignore_cnt(be->p_flm_nthw, &flm->v25.lrn_ignore->cnt, 1); + flm_nthw_stat_lrn_fail_cnt(be->p_flm_nthw, &flm->v25.lrn_fail->cnt, 1); + flm_nthw_stat_unl_done_cnt(be->p_flm_nthw, &flm->v25.unl_done->cnt, 1); + flm_nthw_stat_unl_ignore_cnt(be->p_flm_nthw, &flm->v25.unl_ignore->cnt, 1); + flm_nthw_stat_rel_done_cnt(be->p_flm_nthw, &flm->v25.rel_done->cnt, 1); + flm_nthw_stat_rel_ignore_cnt(be->p_flm_nthw, &flm->v25.rel_ignore->cnt, 1); + flm_nthw_stat_aul_done_cnt(be->p_flm_nthw, &flm->v25.aul_done->cnt, 1); + flm_nthw_stat_aul_ignore_cnt(be->p_flm_nthw, &flm->v25.aul_ignore->cnt, 1); + flm_nthw_stat_aul_fail_cnt(be->p_flm_nthw, &flm->v25.aul_fail->cnt, 1); + flm_nthw_stat_tul_done_cnt(be->p_flm_nthw, &flm->v25.tul_done->cnt, 1); + flm_nthw_stat_flows_cnt(be->p_flm_nthw, &flm->v25.flows->cnt, 1); + + flm_nthw_stat_prb_done_update(be->p_flm_nthw); + flm_nthw_stat_prb_ignore_update(be->p_flm_nthw); + flm_nthw_stat_prb_done_cnt(be->p_flm_nthw, &flm->v25.prb_done->cnt, 1); + flm_nthw_stat_prb_ignore_cnt(be->p_flm_nthw, &flm->v25.prb_ignore->cnt, 1); + + flm_nthw_load_lps_cnt(be->p_flm_nthw, &flm->v25.load_lps->lps, 1); + flm_nthw_load_aps_cnt(be->p_flm_nthw, &flm->v25.load_aps->aps, 1); + } + + if (flm->ver >= 25) { + flm_nthw_stat_sta_done_update(be->p_flm_nthw); + flm_nthw_stat_inf_done_update(be->p_flm_nthw); + flm_nthw_stat_inf_skip_update(be->p_flm_nthw); + flm_nthw_stat_pck_hit_update(be->p_flm_nthw); + flm_nthw_stat_pck_miss_update(be->p_flm_nthw); + flm_nthw_stat_pck_unh_update(be->p_flm_nthw); + flm_nthw_stat_pck_dis_update(be->p_flm_nthw); + flm_nthw_stat_csh_hit_update(be->p_flm_nthw); + flm_nthw_stat_csh_miss_update(be->p_flm_nthw); + flm_nthw_stat_csh_unh_update(be->p_flm_nthw); + flm_nthw_stat_cuc_start_update(be->p_flm_nthw); + flm_nthw_stat_cuc_move_update(be->p_flm_nthw); + + flm_nthw_stat_sta_done_cnt(be->p_flm_nthw, &flm->v25.sta_done->cnt, 1); + flm_nthw_stat_inf_done_cnt(be->p_flm_nthw, &flm->v25.inf_done->cnt, 1); + flm_nthw_stat_inf_skip_cnt(be->p_flm_nthw, &flm->v25.inf_skip->cnt, 1); + flm_nthw_stat_pck_hit_cnt(be->p_flm_nthw, &flm->v25.pck_hit->cnt, 1); + flm_nthw_stat_pck_miss_cnt(be->p_flm_nthw, &flm->v25.pck_miss->cnt, 1); + flm_nthw_stat_pck_unh_cnt(be->p_flm_nthw, &flm->v25.pck_unh->cnt, 1); + flm_nthw_stat_pck_dis_cnt(be->p_flm_nthw, &flm->v25.pck_dis->cnt, 1); + flm_nthw_stat_csh_hit_cnt(be->p_flm_nthw, &flm->v25.csh_hit->cnt, 1); + flm_nthw_stat_csh_miss_cnt(be->p_flm_nthw, &flm->v25.csh_miss->cnt, 1); + flm_nthw_stat_csh_unh_cnt(be->p_flm_nthw, &flm->v25.csh_unh->cnt, 1); + flm_nthw_stat_cuc_start_cnt(be->p_flm_nthw, &flm->v25.cuc_start->cnt, 1); + flm_nthw_stat_cuc_move_cnt(be->p_flm_nthw, &flm->v25.cuc_move->cnt, 1); + } + + CHECK_DEBUG_OFF(flm, be->p_flm_nthw); + return 0; +} + +static int flm_lrn_data_flush(void *be_dev, const struct flm_func_s *flm, const uint32_t *lrn_data, + uint32_t records, uint32_t *handled_records, + uint32_t words_per_record, uint32_t *inf_word_cnt, + uint32_t *sta_word_cnt) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, flm, be->p_flm_nthw); + + int ret = flm_nthw_lrn_data_flush(be->p_flm_nthw, lrn_data, records, words_per_record, + handled_records, &flm->v25.buf_ctrl->lrn_free, + &flm->v25.buf_ctrl->inf_avail, + &flm->v25.buf_ctrl->sta_avail); + + *inf_word_cnt = flm->v25.buf_ctrl->inf_avail; + *sta_word_cnt = flm->v25.buf_ctrl->sta_avail; + + CHECK_DEBUG_OFF(flm, be->p_flm_nthw); + return ret; +} + +static int flm_inf_sta_data_update(void *be_dev, const struct flm_func_s *flm, uint32_t *inf_data, + uint32_t inf_size, uint32_t *inf_word_cnt, uint32_t *sta_data, + uint32_t sta_size, uint32_t *sta_word_cnt) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, flm, be->p_flm_nthw); + + int ret = flm_nthw_inf_sta_data_update(be->p_flm_nthw, inf_data, inf_size, sta_data, + sta_size, &flm->v25.buf_ctrl->lrn_free, + &flm->v25.buf_ctrl->inf_avail, + &flm->v25.buf_ctrl->sta_avail); + + *inf_word_cnt = flm->v25.buf_ctrl->inf_avail; + *sta_word_cnt = flm->v25.buf_ctrl->sta_avail; + + CHECK_DEBUG_OFF(flm, be->p_flm_nthw); + return ret; +} + /* * DBS */ @@ -1000,6 +1351,22 @@ const struct flow_api_backend_ops flow_be_iface = { km_tcam_flush, km_tci_flush, km_tcq_flush, + + flm_get_present, + flm_get_version, + flm_control_flush, + flm_status_flush, + flm_status_update, + flm_scan_flush, + flm_load_bin_flush, + flm_prio_flush, + flm_pst_flush, + flm_rcp_flush, + flm_scrub_flush, + flm_buf_ctrl_update, + flm_stat_update, + flm_lrn_data_flush, + flm_inf_sta_data_update, }; const struct flow_api_backend_ops *bin_flow_backend_init(nthw_fpga_t *p_fpga, void **dev) @@ -1030,6 +1397,16 @@ const struct flow_api_backend_ops *bin_flow_backend_init(nthw_fpga_t *p_fpga, vo be_devs[physical_adapter_no].p_km_nthw = NULL; } + /* Init nthw FLM */ + if (flm_nthw_init(NULL, p_fpga, physical_adapter_no) == 0) { + struct flm_nthw *pflmnthw = flm_nthw_new(); + flm_nthw_init(pflmnthw, p_fpga, physical_adapter_no); + be_devs[physical_adapter_no].p_flm_nthw = pflmnthw; + + } else { + be_devs[physical_adapter_no].p_flm_nthw = NULL; + } + be_devs[physical_adapter_no].adapter_no = physical_adapter_no; *dev = (void *)&be_devs[physical_adapter_no]; @@ -1042,6 +1419,7 @@ static void bin_flow_backend_done(void *dev) info_nthw_delete(be_dev->p_info_nthw); cat_nthw_delete(be_dev->p_cat_nthw); km_nthw_delete(be_dev->p_km_nthw); + flm_nthw_delete(be_dev->p_flm_nthw); } static const struct flow_backend_ops ops = { diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_flm.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_flm.c new file mode 100644 index 0000000000..e8ca67d691 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_flm.c @@ -0,0 +1,1225 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include + +#include "ntlog.h" + +#include "nthw_drv.h" +#include "nthw_register.h" +#include "nthw_rac.h" + +#include "flow_nthw_flm.h" + +struct flm_nthw *flm_nthw_new(void) +{ + struct flm_nthw *p = malloc(sizeof(struct flm_nthw)); + + if (p) + (void)memset(p, 0, sizeof(*p)); + + return p; +} + +void flm_nthw_delete(struct flm_nthw *p) +{ + if (p) { + (void)memset(p, 0, sizeof(*p)); + free(p); + } +} + +void flm_nthw_set_debug_mode(struct flm_nthw *p, unsigned int n_debug_mode) +{ + nthw_module_set_debug_mode(p->m_flm, n_debug_mode); +} + +int flm_nthw_init(struct flm_nthw *p, nthw_fpga_t *p_fpga, int n_instance) +{ + const char *const p_adapter_id_str = p_fpga->p_fpga_info->mp_adapter_id_str; + nthw_module_t *p_mod = nthw_fpga_query_module(p_fpga, MOD_FLM, n_instance); + + assert(n_instance >= 0 && n_instance < 256); + + if (p == NULL) + return p_mod == NULL ? -1 : 0; + + if (p_mod == NULL) { + NT_LOG(ERR, NTHW, "%s: Flm %d: no such instance\n", p_adapter_id_str, n_instance); + return -1; + } + + p->mp_rac = p_fpga->p_fpga_info->mp_nthw_rac; + + p->mp_fpga = p_fpga; + p->m_physical_adapter_no = (uint8_t)n_instance; + p->m_flm = p_mod; + + p->mp_control = nthw_module_get_register(p->m_flm, FLM_CONTROL); + p->mp_control_enable = nthw_register_get_field(p->mp_control, FLM_CONTROL_ENABLE); + p->mp_control_init = nthw_register_get_field(p->mp_control, FLM_CONTROL_INIT); + p->mp_control_lds = nthw_register_get_field(p->mp_control, FLM_CONTROL_LDS); + p->mp_control_lfs = nthw_register_get_field(p->mp_control, FLM_CONTROL_LFS); + p->mp_control_lis = nthw_register_get_field(p->mp_control, FLM_CONTROL_LIS); + p->mp_control_uds = nthw_register_get_field(p->mp_control, FLM_CONTROL_UDS); + p->mp_control_uis = nthw_register_get_field(p->mp_control, FLM_CONTROL_UIS); + p->mp_control_rds = nthw_register_get_field(p->mp_control, FLM_CONTROL_RDS); + p->mp_control_ris = nthw_register_get_field(p->mp_control, FLM_CONTROL_RIS); + p->mp_control_pds = nthw_register_query_field(p->mp_control, FLM_CONTROL_PDS); + p->mp_control_pis = nthw_register_query_field(p->mp_control, FLM_CONTROL_PIS); + p->mp_control_crcwr = nthw_register_get_field(p->mp_control, FLM_CONTROL_CRCWR); + p->mp_control_crcrd = nthw_register_get_field(p->mp_control, FLM_CONTROL_CRCRD); + p->mp_control_rbl = nthw_register_get_field(p->mp_control, FLM_CONTROL_RBL); + p->mp_control_eab = nthw_register_get_field(p->mp_control, FLM_CONTROL_EAB); + p->mp_control_split_sdram_usage = + nthw_register_get_field(p->mp_control, FLM_CONTROL_SPLIT_SDRAM_USAGE); + p->mp_control_calib_recalibrate = + nthw_register_query_field(p->mp_control, FLM_CONTROL_CALIB_RECALIBRATE); + + p->mp_status = nthw_module_get_register(p->m_flm, FLM_STATUS); + p->mp_status_calib_success = + nthw_register_get_field(p->mp_status, FLM_STATUS_CALIB_SUCCESS); + p->mp_status_calib_fail = nthw_register_get_field(p->mp_status, FLM_STATUS_CALIB_FAIL); + p->mp_status_initdone = nthw_register_get_field(p->mp_status, FLM_STATUS_INITDONE); + p->mp_status_idle = nthw_register_get_field(p->mp_status, FLM_STATUS_IDLE); + p->mp_status_critical = nthw_register_get_field(p->mp_status, FLM_STATUS_CRITICAL); + p->mp_status_panic = nthw_register_get_field(p->mp_status, FLM_STATUS_PANIC); + p->mp_status_crcerr = nthw_register_get_field(p->mp_status, FLM_STATUS_CRCERR); + p->mp_status_eft_bp = nthw_register_get_field(p->mp_status, FLM_STATUS_EFT_BP); + p->mp_status_cache_buf_critical = + nthw_register_get_field(p->mp_status, FLM_STATUS_CACHE_BUFFER_CRITICAL); + + p->mp_scan = nthw_module_get_register(p->m_flm, FLM_SCAN); + p->mp_scan_i = nthw_register_get_field(p->mp_scan, FLM_SCAN_I); + + p->mp_load_bin = nthw_module_get_register(p->m_flm, FLM_LOAD_BIN); + p->mp_load_bin_bin = nthw_register_get_field(p->mp_load_bin, FLM_LOAD_BIN_BIN); + + p->mp_load_lps = nthw_module_get_register(p->m_flm, FLM_LOAD_LPS); + p->mp_load_lps_lps = nthw_register_get_field(p->mp_load_lps, FLM_LOAD_LPS_LPS); + + p->mp_load_aps = nthw_module_get_register(p->m_flm, FLM_LOAD_APS); + p->mp_load_aps_aps = nthw_register_get_field(p->mp_load_aps, FLM_LOAD_APS_APS); + + p->mp_prio = nthw_module_get_register(p->m_flm, FLM_PRIO); + p->mp_prio_limit0 = nthw_register_get_field(p->mp_prio, FLM_PRIO_LIMIT0); + p->mp_prio_ft0 = nthw_register_get_field(p->mp_prio, FLM_PRIO_FT0); + p->mp_prio_limit1 = nthw_register_get_field(p->mp_prio, FLM_PRIO_LIMIT1); + p->mp_prio_ft1 = nthw_register_get_field(p->mp_prio, FLM_PRIO_FT1); + p->mp_prio_limit2 = nthw_register_get_field(p->mp_prio, FLM_PRIO_LIMIT2); + p->mp_prio_ft2 = nthw_register_get_field(p->mp_prio, FLM_PRIO_FT2); + p->mp_prio_limit3 = nthw_register_get_field(p->mp_prio, FLM_PRIO_LIMIT3); + p->mp_prio_ft3 = nthw_register_get_field(p->mp_prio, FLM_PRIO_FT3); + + p->mp_pst_ctrl = nthw_module_get_register(p->m_flm, FLM_PST_CTRL); + p->mp_pst_ctrl_adr = nthw_register_get_field(p->mp_pst_ctrl, FLM_PST_CTRL_ADR); + p->mp_pst_ctrl_cnt = nthw_register_get_field(p->mp_pst_ctrl, FLM_PST_CTRL_CNT); + p->mp_pst_data = nthw_module_get_register(p->m_flm, FLM_PST_DATA); + p->mp_pst_data_bp = nthw_register_get_field(p->mp_pst_data, FLM_PST_DATA_BP); + p->mp_pst_data_pp = nthw_register_get_field(p->mp_pst_data, FLM_PST_DATA_PP); + p->mp_pst_data_tp = nthw_register_get_field(p->mp_pst_data, FLM_PST_DATA_TP); + + p->mp_rcp_ctrl = nthw_module_get_register(p->m_flm, FLM_RCP_CTRL); + p->mp_rcp_ctrl_adr = nthw_register_get_field(p->mp_rcp_ctrl, FLM_RCP_CTRL_ADR); + p->mp_rcp_ctrl_cnt = nthw_register_get_field(p->mp_rcp_ctrl, FLM_RCP_CTRL_CNT); + p->mp_rcp_data = nthw_module_get_register(p->m_flm, FLM_RCP_DATA); + p->mp_rcp_data_lookup = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_LOOKUP); + p->mp_rcp_data_qw0_dyn = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_QW0_DYN); + p->mp_rcp_data_qw0_ofs = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_QW0_OFS); + p->mp_rcp_data_qw0_sel = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_QW0_SEL); + p->mp_rcp_data_qw4_dyn = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_QW4_DYN); + p->mp_rcp_data_qw4_ofs = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_QW4_OFS); + p->mp_rcp_data_sw8_dyn = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_SW8_DYN); + p->mp_rcp_data_sw8_ofs = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_SW8_OFS); + p->mp_rcp_data_sw8_sel = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_SW8_SEL); + p->mp_rcp_data_sw9_dyn = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_SW9_DYN); + p->mp_rcp_data_sw9_ofs = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_SW9_OFS); + p->mp_rcp_data_mask = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_MASK); + p->mp_rcp_data_kid = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_KID); + p->mp_rcp_data_opn = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_OPN); + p->mp_rcp_data_ipn = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_IPN); + p->mp_rcp_data_byt_dyn = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_BYT_DYN); + p->mp_rcp_data_byt_ofs = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_BYT_OFS); + p->mp_rcp_data_txplm = nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_TXPLM); + p->mp_rcp_data_auto_ipv4_mask = + nthw_register_get_field(p->mp_rcp_data, FLM_RCP_DATA_AUTO_IPV4_MASK); + + p->mp_buf_ctrl = nthw_module_get_register(p->m_flm, FLM_BUF_CTRL); + + p->mp_lrn_data = nthw_module_get_register(p->m_flm, FLM_LRN_DATA); + p->mp_inf_data = nthw_module_get_register(p->m_flm, FLM_INF_DATA); + p->mp_sta_data = nthw_module_get_register(p->m_flm, FLM_STA_DATA); + + p->mp_stat_lrn_done = nthw_module_get_register(p->m_flm, FLM_STAT_LRN_DONE); + p->mp_stat_lrn_done_cnt = + nthw_register_get_field(p->mp_stat_lrn_done, FLM_STAT_LRN_DONE_CNT); + + p->mp_stat_lrn_ignore = nthw_module_get_register(p->m_flm, FLM_STAT_LRN_IGNORE); + p->mp_stat_lrn_ignore_cnt = + nthw_register_get_field(p->mp_stat_lrn_ignore, FLM_STAT_LRN_IGNORE_CNT); + + p->mp_stat_lrn_fail = nthw_module_get_register(p->m_flm, FLM_STAT_LRN_FAIL); + p->mp_stat_lrn_fail_cnt = + nthw_register_get_field(p->mp_stat_lrn_fail, FLM_STAT_LRN_FAIL_CNT); + + p->mp_stat_unl_done = nthw_module_get_register(p->m_flm, FLM_STAT_UNL_DONE); + p->mp_stat_unl_done_cnt = + nthw_register_get_field(p->mp_stat_unl_done, FLM_STAT_UNL_DONE_CNT); + + p->mp_stat_unl_ignore = nthw_module_get_register(p->m_flm, FLM_STAT_UNL_IGNORE); + p->mp_stat_unl_ignore_cnt = + nthw_register_get_field(p->mp_stat_unl_ignore, FLM_STAT_UNL_IGNORE_CNT); + + p->mp_stat_prb_done = nthw_module_query_register(p->m_flm, FLM_STAT_PRB_DONE); + p->mp_stat_prb_done_cnt = + nthw_register_query_field(p->mp_stat_prb_done, FLM_STAT_PRB_DONE_CNT); + + p->mp_stat_prb_ignore = nthw_module_query_register(p->m_flm, FLM_STAT_PRB_IGNORE); + p->mp_stat_prb_ignore_cnt = + nthw_register_query_field(p->mp_stat_prb_ignore, FLM_STAT_PRB_IGNORE_CNT); + + p->mp_stat_rel_done = nthw_module_get_register(p->m_flm, FLM_STAT_REL_DONE); + p->mp_stat_rel_done_cnt = + nthw_register_get_field(p->mp_stat_rel_done, FLM_STAT_REL_DONE_CNT); + + p->mp_stat_rel_ignore = nthw_module_get_register(p->m_flm, FLM_STAT_REL_IGNORE); + p->mp_stat_rel_ignore_cnt = + nthw_register_get_field(p->mp_stat_rel_ignore, FLM_STAT_REL_IGNORE_CNT); + + p->mp_stat_aul_done = nthw_module_get_register(p->m_flm, FLM_STAT_AUL_DONE); + p->mp_stat_aul_done_cnt = + nthw_register_get_field(p->mp_stat_aul_done, FLM_STAT_AUL_DONE_CNT); + + p->mp_stat_aul_ignore = nthw_module_get_register(p->m_flm, FLM_STAT_AUL_IGNORE); + p->mp_stat_aul_ignore_cnt = + nthw_register_get_field(p->mp_stat_aul_ignore, FLM_STAT_AUL_IGNORE_CNT); + + p->mp_stat_aul_fail = nthw_module_get_register(p->m_flm, FLM_STAT_AUL_FAIL); + p->mp_stat_aul_fail_cnt = + nthw_register_get_field(p->mp_stat_aul_fail, FLM_STAT_AUL_FAIL_CNT); + + p->mp_stat_tul_done = nthw_module_get_register(p->m_flm, FLM_STAT_TUL_DONE); + p->mp_stat_tul_done_cnt = + nthw_register_get_field(p->mp_stat_tul_done, FLM_STAT_TUL_DONE_CNT); + + p->mp_stat_flows = nthw_module_get_register(p->m_flm, FLM_STAT_FLOWS); + p->mp_stat_flows_cnt = nthw_register_get_field(p->mp_stat_flows, FLM_STAT_FLOWS_CNT); + + p->mp_stat_sta_done = nthw_module_query_register(p->m_flm, FLM_STAT_STA_DONE); + p->mp_stat_sta_done_cnt = + nthw_register_query_field(p->mp_stat_sta_done, FLM_STAT_STA_DONE_CNT); + + p->mp_stat_inf_done = nthw_module_query_register(p->m_flm, FLM_STAT_INF_DONE); + p->mp_stat_inf_done_cnt = + nthw_register_query_field(p->mp_stat_inf_done, FLM_STAT_INF_DONE_CNT); + + p->mp_stat_inf_skip = nthw_module_query_register(p->m_flm, FLM_STAT_INF_SKIP); + p->mp_stat_inf_skip_cnt = + nthw_register_query_field(p->mp_stat_inf_skip, FLM_STAT_INF_SKIP_CNT); + + p->mp_stat_pck_hit = nthw_module_query_register(p->m_flm, FLM_STAT_PCK_HIT); + p->mp_stat_pck_hit_cnt = + nthw_register_query_field(p->mp_stat_pck_hit, FLM_STAT_PCK_HIT_CNT); + + p->mp_stat_pck_miss = nthw_module_query_register(p->m_flm, FLM_STAT_PCK_MISS); + p->mp_stat_pck_miss_cnt = + nthw_register_query_field(p->mp_stat_pck_miss, FLM_STAT_PCK_MISS_CNT); + + p->mp_stat_pck_unh = nthw_module_query_register(p->m_flm, FLM_STAT_PCK_UNH); + p->mp_stat_pck_unh_cnt = + nthw_register_query_field(p->mp_stat_pck_unh, FLM_STAT_PCK_UNH_CNT); + + p->mp_stat_pck_dis = nthw_module_query_register(p->m_flm, FLM_STAT_PCK_DIS); + p->mp_stat_pck_dis_cnt = + nthw_register_query_field(p->mp_stat_pck_dis, FLM_STAT_PCK_DIS_CNT); + + p->mp_stat_csh_hit = nthw_module_query_register(p->m_flm, FLM_STAT_CSH_HIT); + p->mp_stat_csh_hit_cnt = + nthw_register_query_field(p->mp_stat_csh_hit, FLM_STAT_CSH_HIT_CNT); + + p->mp_stat_csh_miss = nthw_module_query_register(p->m_flm, FLM_STAT_CSH_MISS); + p->mp_stat_csh_miss_cnt = + nthw_register_query_field(p->mp_stat_csh_miss, FLM_STAT_CSH_MISS_CNT); + + p->mp_stat_csh_unh = nthw_module_query_register(p->m_flm, FLM_STAT_CSH_UNH); + p->mp_stat_csh_unh_cnt = + nthw_register_query_field(p->mp_stat_csh_unh, FLM_STAT_CSH_UNH_CNT); + + p->mp_stat_cuc_start = nthw_module_query_register(p->m_flm, FLM_STAT_CUC_START); + p->mp_stat_cuc_start_cnt = + nthw_register_query_field(p->mp_stat_cuc_start, FLM_STAT_CUC_START_CNT); + + p->mp_stat_cuc_move = nthw_module_query_register(p->m_flm, FLM_STAT_CUC_MOVE); + p->mp_stat_cuc_move_cnt = + nthw_register_query_field(p->mp_stat_cuc_move, FLM_STAT_CUC_MOVE_CNT); + + p->mp_scrub_ctrl = nthw_module_query_register(p->m_flm, FLM_SCRUB_CTRL); + p->mp_scrub_ctrl_adr = nthw_register_query_field(p->mp_scrub_ctrl, FLM_SCRUB_CTRL_ADR); + p->mp_scrub_ctrl_cnt = nthw_register_query_field(p->mp_scrub_ctrl, FLM_SCRUB_CTRL_CNT); + + p->mp_scrub_data = nthw_module_query_register(p->m_flm, FLM_SCRUB_DATA); + p->mp_scrub_data_t = nthw_register_query_field(p->mp_scrub_data, FLM_SCRUB_DATA_T); + p->mp_scrub_data_r = nthw_register_query_field(p->mp_scrub_data, FLM_SCRUB_DATA_R); + p->mp_scrub_data_del = nthw_register_query_field(p->mp_scrub_data, FLM_SCRUB_DATA_DEL); + p->mp_scrub_data_inf = nthw_register_query_field(p->mp_scrub_data, FLM_SCRUB_DATA_INF); + + return 0; +} + +void flm_nthw_control_enable(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_control_enable, val); +} + +void flm_nthw_control_init(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_control_init, val); +} + +void flm_nthw_control_lds(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_control_lds, val); +} + +void flm_nthw_control_lfs(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_control_lfs, val); +} + +void flm_nthw_control_lis(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_control_lis, val); +} + +void flm_nthw_control_uds(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_control_uds, val); +} + +void flm_nthw_control_uis(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_control_uis, val); +} + +void flm_nthw_control_rds(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_control_rds, val); +} + +void flm_nthw_control_ris(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_control_ris, val); +} + +void flm_nthw_control_pds(const struct flm_nthw *p, uint32_t val) +{ + assert(p->mp_control_pds); + nthw_field_set_val32(p->mp_control_pds, val); +} + +void flm_nthw_control_pis(const struct flm_nthw *p, uint32_t val) +{ + assert(p->mp_control_pis); + nthw_field_set_val32(p->mp_control_pis, val); +} + +void flm_nthw_control_crcwr(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_control_crcwr, val); +} + +void flm_nthw_control_crcrd(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_control_crcrd, val); +} + +void flm_nthw_control_rbl(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_control_rbl, val); +} + +void flm_nthw_control_eab(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_control_eab, val); +} + +void flm_nthw_control_split_sdram_usage(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_control_split_sdram_usage, val); +} + +void flm_nthw_control_flush(const struct flm_nthw *p) +{ + nthw_register_flush(p->mp_control, 1); +} + +void flm_nthw_status_calib_success(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) { + uint32_t w = nthw_field_get_bit_width(p->mp_status_calib_success); + uint32_t all_ones = (1 << w) - 1; + *val = nthw_field_get_val32(p->mp_status_calib_success); + + if (all_ones == *val) { + /* Mark all calibrated */ + *val |= 0x80000000; + } + } +} + +void flm_nthw_status_calib_fail(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_status_calib_fail); +} + +void flm_nthw_status_initdone(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_status_initdone); +} + +void flm_nthw_status_idle(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_status_idle); +} + +void flm_nthw_status_critical(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_status_critical); + + else + nthw_field_set_val32(p->mp_status_critical, *val); +} + +void flm_nthw_status_panic(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_status_panic); + + else + nthw_field_set_val32(p->mp_status_panic, *val); +} + +void flm_nthw_status_crcerr(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_status_crcerr); + + else + nthw_field_set_val32(p->mp_status_crcerr, *val); +} + +void flm_nthw_status_eft_bp(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_status_eft_bp); +} + +void flm_nthw_status_cache_buf_crit(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_status_cache_buf_critical); + + else + nthw_field_set_val32(p->mp_status_cache_buf_critical, *val); +} + +void flm_nthw_status_flush(const struct flm_nthw *p) +{ + nthw_register_flush(p->mp_status, 1); +} + +void flm_nthw_status_update(const struct flm_nthw *p) +{ + nthw_register_update(p->mp_status); +} + +void flm_nthw_scan_i(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_scan_i, val); +} + +void flm_nthw_scan_flush(const struct flm_nthw *p) +{ + nthw_register_flush(p->mp_scan, 1); +} + +void flm_nthw_load_bin(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_load_bin_bin, val); +} + +void flm_nthw_load_bin_flush(const struct flm_nthw *p) +{ + nthw_register_flush(p->mp_load_bin, 1); +} + +void flm_nthw_load_lps_update(const struct flm_nthw *p) +{ + nthw_register_update(p->mp_load_lps); +} + +void flm_nthw_load_lps_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_load_lps_lps); +} + +void flm_nthw_load_aps_update(const struct flm_nthw *p) +{ + nthw_register_update(p->mp_load_aps); +} + +void flm_nthw_load_aps_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_load_aps_aps); +} + +void flm_nthw_prio_limit0(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_prio_limit0, val); +} + +void flm_nthw_prio_ft0(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_prio_ft0, val); +} + +void flm_nthw_prio_limit1(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_prio_limit1, val); +} + +void flm_nthw_prio_ft1(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_prio_ft1, val); +} + +void flm_nthw_prio_limit2(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_prio_limit2, val); +} + +void flm_nthw_prio_ft2(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_prio_ft2, val); +} + +void flm_nthw_prio_limit3(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_prio_limit3, val); +} + +void flm_nthw_prio_ft3(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_prio_ft3, val); +} + +void flm_nthw_prio_flush(const struct flm_nthw *p) +{ + nthw_register_flush(p->mp_prio, 1); +} + +void flm_nthw_pst_select(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_pst_ctrl_adr, val); +} + +void flm_nthw_pst_cnt(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_pst_ctrl_cnt, val); +} + +void flm_nthw_pst_bp(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_pst_data_bp, val); +} + +void flm_nthw_pst_pp(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_pst_data_pp, val); +} + +void flm_nthw_pst_tp(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_pst_data_tp, val); +} + +void flm_nthw_pst_flush(const struct flm_nthw *p) +{ + nthw_register_flush(p->mp_pst_ctrl, 1); + nthw_register_flush(p->mp_pst_data, 1); +} + +void flm_nthw_rcp_select(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_ctrl_adr, val); +} + +void flm_nthw_rcp_cnt(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_ctrl_cnt, val); +} + +void flm_nthw_rcp_lookup(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_lookup, val); +} + +void flm_nthw_rcp_qw0_dyn(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_qw0_dyn, val); +} + +void flm_nthw_rcp_qw0_ofs(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_qw0_ofs, val); +} + +void flm_nthw_rcp_qw0_sel(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_qw0_sel, val); +} + +void flm_nthw_rcp_qw4_dyn(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_qw4_dyn, val); +} + +void flm_nthw_rcp_qw4_ofs(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_qw4_ofs, val); +} + +void flm_nthw_rcp_sw8_dyn(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_sw8_dyn, val); +} + +void flm_nthw_rcp_sw8_ofs(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_sw8_ofs, val); +} + +void flm_nthw_rcp_sw8_sel(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_sw8_sel, val); +} + +void flm_nthw_rcp_sw9_dyn(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_sw9_dyn, val); +} + +void flm_nthw_rcp_sw9_ofs(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_sw9_ofs, val); +} + +void flm_nthw_rcp_mask(const struct flm_nthw *p, const uint32_t *val) +{ + nthw_field_set_val(p->mp_rcp_data_mask, val, 10); +} + +void flm_nthw_rcp_kid(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_kid, val); +} + +void flm_nthw_rcp_opn(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_opn, val); +} + +void flm_nthw_rcp_ipn(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_ipn, val); +} + +void flm_nthw_rcp_byt_dyn(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_byt_dyn, val); +} + +void flm_nthw_rcp_byt_ofs(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_byt_ofs, val); +} + +void flm_nthw_rcp_txplm(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_txplm, val); +} + +void flm_nthw_rcp_auto_ipv4_mask(const struct flm_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_auto_ipv4_mask, val); +} + +void flm_nthw_rcp_flush(const struct flm_nthw *p) +{ + nthw_register_flush(p->mp_rcp_ctrl, 1); + nthw_register_flush(p->mp_rcp_data, 1); +} + +int flm_nthw_buf_ctrl_update(const struct flm_nthw *p, uint32_t *lrn_free, uint32_t *inf_avail, + uint32_t *sta_avail) +{ + int ret = -1; + + struct nthw_rac *rac = (struct nthw_rac *)p->mp_rac; + uint32_t address_bufctrl = nthw_register_get_address(p->mp_buf_ctrl); + nthw_rab_bus_id_t bus_id = 1; + struct dma_buf_ptr bc_buf; + ret = nthw_rac_rab_dma_begin(rac); + + if (ret == 0) { + nthw_rac_rab_read32_dma(rac, bus_id, address_bufctrl, 2, &bc_buf); + ret = nthw_rac_rab_dma_commit(rac); + + if (ret != 0) + return ret; + + uint32_t bc_mask = bc_buf.size - 1; + uint32_t bc_index = bc_buf.index; + *lrn_free = bc_buf.base[bc_index & bc_mask] & 0xffff; + *inf_avail = (bc_buf.base[bc_index & bc_mask] >> 16) & 0xffff; + *sta_avail = bc_buf.base[(bc_index + 1) & bc_mask] & 0xffff; + } + + return ret; +} + +int flm_nthw_lrn_data_flush(const struct flm_nthw *p, const uint32_t *data, uint32_t records, + uint32_t words_per_record, uint32_t *handled_records, + uint32_t *lrn_free, uint32_t *inf_avail, uint32_t *sta_avail) +{ + struct nthw_rac *rac = (struct nthw_rac *)p->mp_rac; + uint32_t address = nthw_register_get_address(p->mp_lrn_data); + uint32_t address_bufctrl = nthw_register_get_address(p->mp_buf_ctrl); + nthw_rab_bus_id_t bus_id = 1; + struct dma_buf_ptr bc_buf; + + uint32_t max_records_per_write = 256 / words_per_record; + + /* Check for dma overhead */ + if ((256 % words_per_record) < (max_records_per_write + 3 + 1)) + --max_records_per_write; + + *handled_records = 0; + int max_tries = 10000; + + while (*inf_avail == 0 && *sta_avail == 0 && records != 0 && --max_tries > 0) + if (nthw_rac_rab_dma_begin(rac) == 0) { + uint32_t dma_free = nthw_rac_rab_get_free(rac); + + if (dma_free != RAB_DMA_BUF_CNT) { + assert(0); /* alert developer that something is wrong */ + return -1; + } + + uint32_t max_writes_from_learn_free = + *lrn_free / (max_records_per_write * words_per_record); + + /* + * Not strictly needed as dma_free will always + * (per design) be much larger than lrn_free + */ + uint32_t max_writes_from_dma_free = dma_free / 256; + uint32_t max_writes = + (max_writes_from_learn_free < max_writes_from_dma_free) + ? max_writes_from_learn_free + : max_writes_from_dma_free; + + uint32_t records_per_write = (records < max_records_per_write) + ? records + : max_records_per_write; + + while (records != 0 && max_writes != 0) { + /* + * Announce the number of words to write + * to LRN_DATA in next write operation + */ + uint32_t bufctrl_data[2]; + bufctrl_data[0] = records_per_write * words_per_record; + bufctrl_data[1] = 0; + nthw_rac_rab_write32_dma(rac, bus_id, address_bufctrl, 2, + bufctrl_data); + + /* Write data */ + nthw_rac_rab_write32_dma(rac, bus_id, address, bufctrl_data[0], + data); + + /* Prepare next write operation */ + data += bufctrl_data[0]; + records -= records_per_write; + *handled_records += records_per_write; + records_per_write = (records < max_records_per_write) + ? records + : max_records_per_write; + --max_writes; + } + + /* Read buf ctrl */ + nthw_rac_rab_read32_dma(rac, bus_id, address_bufctrl, 2, &bc_buf); + + if (nthw_rac_rab_dma_commit(rac) != 0) + return -1; + + uint32_t bc_mask = bc_buf.size - 1; + uint32_t bc_index = bc_buf.index; + *lrn_free = bc_buf.base[bc_index & bc_mask] & 0xffff; + *inf_avail = (bc_buf.base[bc_index & bc_mask] >> 16) & 0xffff; + *sta_avail = bc_buf.base[(bc_index + 1) & bc_mask] & 0xffff; + } + + return 0; +} + +int flm_nthw_inf_sta_data_update(const struct flm_nthw *p, uint32_t *inf_data, + uint32_t inf_word_count, uint32_t *sta_data, + uint32_t sta_word_count, uint32_t *lrn_free, uint32_t *inf_avail, + uint32_t *sta_avail) +{ + int ret = -1; + + struct nthw_rac *rac = (struct nthw_rac *)p->mp_rac; + uint32_t address_inf_data = nthw_register_get_address(p->mp_inf_data); + uint32_t address_sta_data = nthw_register_get_address(p->mp_sta_data); + uint32_t address_bufctrl = nthw_register_get_address(p->mp_buf_ctrl); + nthw_rab_bus_id_t bus_id = 1; + struct dma_buf_ptr inf_buf; + struct dma_buf_ptr sta_buf; + struct dma_buf_ptr bc_buf; + uint32_t mask; + uint32_t index; + + ret = nthw_rac_rab_dma_begin(rac); + + if (ret == 0) { + /* Announce the number of words to read from INF_DATA */ + uint32_t bufctrl_data[2]; + bufctrl_data[0] = inf_word_count << 16; + bufctrl_data[1] = sta_word_count; + nthw_rac_rab_write32_dma(rac, bus_id, address_bufctrl, 2, bufctrl_data); + + if (inf_word_count > 0) { + nthw_rac_rab_read32_dma(rac, bus_id, address_inf_data, inf_word_count, + &inf_buf); + } + + if (sta_word_count > 0) { + nthw_rac_rab_read32_dma(rac, bus_id, address_sta_data, sta_word_count, + &sta_buf); + } + + nthw_rac_rab_read32_dma(rac, bus_id, address_bufctrl, 2, &bc_buf); + ret = nthw_rac_rab_dma_commit(rac); + + if (ret != 0) + return ret; + + if (inf_word_count > 0) { + mask = inf_buf.size - 1; + index = inf_buf.index; + + for (uint32_t i = 0; i < inf_word_count; ++index, ++i) + inf_data[i] = inf_buf.base[index & mask]; + } + + if (sta_word_count > 0) { + mask = sta_buf.size - 1; + index = sta_buf.index; + + for (uint32_t i = 0; i < sta_word_count; ++index, ++i) + sta_data[i] = sta_buf.base[index & mask]; + } + + mask = bc_buf.size - 1; + index = bc_buf.index; + *lrn_free = bc_buf.base[index & mask] & 0xffff; + *inf_avail = (bc_buf.base[index & mask] >> 16) & 0xffff; + *sta_avail = bc_buf.base[(index + 1) & mask] & 0xffff; + } + + return ret; +} + +void flm_nthw_stat_lrn_done_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_stat_lrn_done_cnt); +} + +void flm_nthw_stat_lrn_done_update(const struct flm_nthw *p) +{ + nthw_register_update(p->mp_stat_lrn_done); +} + +void flm_nthw_stat_lrn_ignore_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_stat_lrn_ignore_cnt); +} + +void flm_nthw_stat_lrn_ignore_update(const struct flm_nthw *p) +{ + nthw_register_update(p->mp_stat_lrn_ignore); +} + +void flm_nthw_stat_lrn_fail_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_stat_lrn_fail_cnt); +} + +void flm_nthw_stat_lrn_fail_update(const struct flm_nthw *p) +{ + nthw_register_update(p->mp_stat_lrn_fail); +} + +void flm_nthw_stat_unl_done_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_stat_unl_done_cnt); +} + +void flm_nthw_stat_unl_done_update(const struct flm_nthw *p) +{ + nthw_register_update(p->mp_stat_unl_done); +} + +void flm_nthw_stat_unl_ignore_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_stat_unl_ignore_cnt); +} + +void flm_nthw_stat_unl_ignore_update(const struct flm_nthw *p) +{ + nthw_register_update(p->mp_stat_unl_ignore); +} + +void flm_nthw_stat_prb_done_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + assert(p->mp_stat_prb_done_cnt); + + if (get) + *val = nthw_field_get_val32(p->mp_stat_prb_done_cnt); +} + +void flm_nthw_stat_prb_done_update(const struct flm_nthw *p) +{ + assert(p->mp_stat_prb_done); + nthw_register_update(p->mp_stat_prb_done); +} + +void flm_nthw_stat_prb_ignore_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + assert(p->mp_stat_prb_ignore_cnt); + + if (get) + *val = nthw_field_get_val32(p->mp_stat_prb_ignore_cnt); +} + +void flm_nthw_stat_prb_ignore_update(const struct flm_nthw *p) +{ + assert(p->mp_stat_prb_ignore); + nthw_register_update(p->mp_stat_prb_ignore); +} + +void flm_nthw_stat_rel_done_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_stat_rel_done_cnt); +} + +void flm_nthw_stat_rel_done_update(const struct flm_nthw *p) +{ + nthw_register_update(p->mp_stat_rel_done); +} + +void flm_nthw_stat_rel_ignore_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_stat_rel_ignore_cnt); +} + +void flm_nthw_stat_rel_ignore_update(const struct flm_nthw *p) +{ + nthw_register_update(p->mp_stat_rel_ignore); +} + +void flm_nthw_stat_aul_done_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_stat_aul_done_cnt); +} + +void flm_nthw_stat_aul_done_update(const struct flm_nthw *p) +{ + nthw_register_update(p->mp_stat_aul_done); +} + +void flm_nthw_stat_aul_ignore_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_stat_aul_ignore_cnt); +} + +void flm_nthw_stat_aul_ignore_update(const struct flm_nthw *p) +{ + nthw_register_update(p->mp_stat_aul_ignore); +} + +void flm_nthw_stat_aul_fail_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_stat_aul_fail_cnt); +} + +void flm_nthw_stat_aul_fail_update(const struct flm_nthw *p) +{ + nthw_register_update(p->mp_stat_aul_fail); +} + +void flm_nthw_stat_tul_done_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_stat_tul_done_cnt); +} + +void flm_nthw_stat_tul_done_update(const struct flm_nthw *p) +{ + nthw_register_update(p->mp_stat_tul_done); +} + +void flm_nthw_stat_flows_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + if (get) + *val = nthw_field_get_val32(p->mp_stat_flows_cnt); +} + +void flm_nthw_stat_flows_update(const struct flm_nthw *p) +{ + nthw_register_update(p->mp_stat_flows); +} + +void flm_nthw_stat_sta_done_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + assert(p->mp_stat_sta_done_cnt); + + if (get) + *val = nthw_field_get_val32(p->mp_stat_sta_done_cnt); +} + +void flm_nthw_stat_sta_done_update(const struct flm_nthw *p) +{ + assert(p->mp_stat_sta_done); + nthw_register_update(p->mp_stat_sta_done); +} + +void flm_nthw_stat_inf_done_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + assert(p->mp_stat_inf_done_cnt); + + if (get) + *val = nthw_field_get_val32(p->mp_stat_inf_done_cnt); +} + +void flm_nthw_stat_inf_done_update(const struct flm_nthw *p) +{ + assert(p->mp_stat_inf_done); + nthw_register_update(p->mp_stat_inf_done); +} + +void flm_nthw_stat_inf_skip_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + assert(p->mp_stat_inf_skip_cnt); + + if (get) + *val = nthw_field_get_val32(p->mp_stat_inf_skip_cnt); +} + +void flm_nthw_stat_inf_skip_update(const struct flm_nthw *p) +{ + assert(p->mp_stat_inf_skip); + nthw_register_update(p->mp_stat_inf_skip); +} + +void flm_nthw_stat_pck_hit_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + assert(p->mp_stat_pck_hit_cnt); + + if (get) + *val = nthw_field_get_val32(p->mp_stat_pck_hit_cnt); +} + +void flm_nthw_stat_pck_hit_update(const struct flm_nthw *p) +{ + assert(p->mp_stat_pck_hit); + nthw_register_update(p->mp_stat_pck_hit); +} + +void flm_nthw_stat_pck_miss_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + assert(p->mp_stat_pck_miss_cnt); + + if (get) + *val = nthw_field_get_val32(p->mp_stat_pck_miss_cnt); +} + +void flm_nthw_stat_pck_miss_update(const struct flm_nthw *p) +{ + assert(p->mp_stat_pck_miss); + nthw_register_update(p->mp_stat_pck_miss); +} + +void flm_nthw_stat_pck_unh_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + assert(p->mp_stat_pck_unh_cnt); + + if (get) + *val = nthw_field_get_val32(p->mp_stat_pck_unh_cnt); +} + +void flm_nthw_stat_pck_unh_update(const struct flm_nthw *p) +{ + assert(p->mp_stat_pck_unh); + nthw_register_update(p->mp_stat_pck_unh); +} + +void flm_nthw_stat_pck_dis_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + assert(p->mp_stat_pck_dis_cnt); + + if (get) + *val = nthw_field_get_val32(p->mp_stat_pck_dis_cnt); +} + +void flm_nthw_stat_pck_dis_update(const struct flm_nthw *p) +{ + assert(p->mp_stat_pck_dis); + nthw_register_update(p->mp_stat_pck_dis); +} + +void flm_nthw_stat_csh_hit_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + assert(p->mp_stat_csh_hit_cnt); + + if (get) + *val = nthw_field_get_val32(p->mp_stat_csh_hit_cnt); +} + +void flm_nthw_stat_csh_hit_update(const struct flm_nthw *p) +{ + assert(p->mp_stat_csh_hit); + nthw_register_update(p->mp_stat_csh_hit); +} + +void flm_nthw_stat_csh_miss_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + assert(p->mp_stat_csh_miss_cnt); + + if (get) + *val = nthw_field_get_val32(p->mp_stat_csh_miss_cnt); +} + +void flm_nthw_stat_csh_miss_update(const struct flm_nthw *p) +{ + assert(p->mp_stat_csh_miss); + nthw_register_update(p->mp_stat_csh_miss); +} + +void flm_nthw_stat_csh_unh_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + assert(p->mp_stat_csh_unh_cnt); + + if (get) + *val = nthw_field_get_val32(p->mp_stat_csh_unh_cnt); +} + +void flm_nthw_stat_csh_unh_update(const struct flm_nthw *p) +{ + assert(p->mp_stat_csh_unh); + nthw_register_update(p->mp_stat_csh_unh); +} + +void flm_nthw_stat_cuc_start_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + assert(p->mp_stat_cuc_start_cnt); + + if (get) + *val = nthw_field_get_val32(p->mp_stat_cuc_start_cnt); +} + +void flm_nthw_stat_cuc_start_update(const struct flm_nthw *p) +{ + assert(p->mp_stat_cuc_start); + nthw_register_update(p->mp_stat_cuc_start); +} + +void flm_nthw_stat_cuc_move_cnt(const struct flm_nthw *p, uint32_t *val, int get) +{ + assert(p->mp_stat_cuc_move_cnt); + + if (get) + *val = nthw_field_get_val32(p->mp_stat_cuc_move_cnt); +} + +void flm_nthw_stat_cuc_move_update(const struct flm_nthw *p) +{ + assert(p->mp_stat_cuc_move); + nthw_register_update(p->mp_stat_cuc_move); +} + +void flm_nthw_scrub_select(const struct flm_nthw *p, uint32_t val) +{ + assert(p->mp_scrub_ctrl_adr); + nthw_field_set_val32(p->mp_scrub_ctrl_adr, val); +} + +void flm_nthw_scrub_cnt(const struct flm_nthw *p, uint32_t val) +{ + assert(p->mp_scrub_ctrl_cnt); + nthw_field_set_val32(p->mp_scrub_ctrl_cnt, val); +} + +void flm_nthw_scrub_t(const struct flm_nthw *p, uint32_t val) +{ + assert(p->mp_scrub_data_t); + nthw_field_set_val32(p->mp_scrub_data_t, val); +} + +void flm_nthw_scrub_r(const struct flm_nthw *p, uint32_t val) +{ + assert(p->mp_scrub_data_r); + nthw_field_set_val32(p->mp_scrub_data_r, val); +} + +void flm_nthw_scrub_del(const struct flm_nthw *p, uint32_t val) +{ + assert(p->mp_scrub_data_del); + nthw_field_set_val32(p->mp_scrub_data_del, val); +} + +void flm_nthw_scrub_inf(const struct flm_nthw *p, uint32_t val) +{ + assert(p->mp_scrub_data_inf); + nthw_field_set_val32(p->mp_scrub_data_inf, val); +} + +void flm_nthw_scrub_flush(const struct flm_nthw *p) +{ + assert(p->mp_scrub_ctrl); + assert(p->mp_scrub_data); + nthw_register_flush(p->mp_scrub_ctrl, 1); + nthw_register_flush(p->mp_scrub_data, 1); +} diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_flm.h b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_flm.h new file mode 100644 index 0000000000..5cc95ab03c --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_flm.h @@ -0,0 +1,433 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef __FLOW_NTHW_FLM_H__ +#define __FLOW_NTHW_FLM_H__ + +#include + +#include "nthw_fpga_model.h" + +struct flm_nthw; + +typedef struct flm_nthw flm_nthw_t; + +struct flm_nthw *flm_nthw_new(void); +void flm_nthw_delete(struct flm_nthw *p); +int flm_nthw_init(struct flm_nthw *p, nthw_fpga_t *p_fpga, int n_instance); +void flm_nthw_set_debug_mode(struct flm_nthw *p, unsigned int n_debug_mode); + +/* Control */ +void flm_nthw_control_enable(const struct flm_nthw *p, uint32_t val); +void flm_nthw_control_init(const struct flm_nthw *p, uint32_t val); +void flm_nthw_control_lds(const struct flm_nthw *p, uint32_t val); +void flm_nthw_control_lfs(const struct flm_nthw *p, uint32_t val); +void flm_nthw_control_lis(const struct flm_nthw *p, uint32_t val); +void flm_nthw_control_uds(const struct flm_nthw *p, uint32_t val); +void flm_nthw_control_uis(const struct flm_nthw *p, uint32_t val); +void flm_nthw_control_rds(const struct flm_nthw *p, uint32_t val); +void flm_nthw_control_ris(const struct flm_nthw *p, uint32_t val); +void flm_nthw_control_pds(const struct flm_nthw *p, uint32_t val); +void flm_nthw_control_pis(const struct flm_nthw *p, uint32_t val); +void flm_nthw_control_crcwr(const struct flm_nthw *p, uint32_t val); +void flm_nthw_control_crcrd(const struct flm_nthw *p, uint32_t val); +void flm_nthw_control_rbl(const struct flm_nthw *p, uint32_t val); +void flm_nthw_control_eab(const struct flm_nthw *p, uint32_t val); +void flm_nthw_control_split_sdram_usage(const struct flm_nthw *p, uint32_t val); +void flm_nthw_control_flush(const struct flm_nthw *p); + +/* Status */ +void flm_nthw_status_calib_success(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_status_calib_fail(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_status_initdone(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_status_idle(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_status_critical(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_status_panic(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_status_crcerr(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_status_eft_bp(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_status_cache_buf_crit(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_status_flush(const struct flm_nthw *p); +void flm_nthw_status_update(const struct flm_nthw *p); + +/* Scan */ +void flm_nthw_scan_i(const struct flm_nthw *p, uint32_t val); +void flm_nthw_scan_flush(const struct flm_nthw *p); + +/* Load BIN */ +void flm_nthw_load_bin(const struct flm_nthw *p, uint32_t val); +void flm_nthw_load_bin_flush(const struct flm_nthw *p); + +/* Load LPS */ +void flm_nthw_load_lps_update(const struct flm_nthw *p); +void flm_nthw_load_lps_cnt(const struct flm_nthw *p, uint32_t *val, int get); + +/* Load APS */ +void flm_nthw_load_aps_update(const struct flm_nthw *p); +void flm_nthw_load_aps_cnt(const struct flm_nthw *p, uint32_t *val, int get); + +/* Prio */ +void flm_nthw_prio_limit0(const struct flm_nthw *p, uint32_t val); +void flm_nthw_prio_ft0(const struct flm_nthw *p, uint32_t val); +void flm_nthw_prio_limit1(const struct flm_nthw *p, uint32_t val); +void flm_nthw_prio_ft1(const struct flm_nthw *p, uint32_t val); +void flm_nthw_prio_limit2(const struct flm_nthw *p, uint32_t val); +void flm_nthw_prio_ft2(const struct flm_nthw *p, uint32_t val); +void flm_nthw_prio_limit3(const struct flm_nthw *p, uint32_t val); +void flm_nthw_prio_ft3(const struct flm_nthw *p, uint32_t val); +void flm_nthw_prio_flush(const struct flm_nthw *p); + +/* PST */ +void flm_nthw_pst_select(const struct flm_nthw *p, uint32_t val); +void flm_nthw_pst_cnt(const struct flm_nthw *p, uint32_t val); +void flm_nthw_pst_bp(const struct flm_nthw *p, uint32_t val); +void flm_nthw_pst_pp(const struct flm_nthw *p, uint32_t val); +void flm_nthw_pst_tp(const struct flm_nthw *p, uint32_t val); +void flm_nthw_pst_flush(const struct flm_nthw *p); + +/* RCP */ +void flm_nthw_rcp_select(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_cnt(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_lookup(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_qw0_dyn(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_qw0_ofs(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_qw0_sel(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_qw4_dyn(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_qw4_ofs(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_sw8_dyn(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_sw8_ofs(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_sw8_sel(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_sw9_dyn(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_sw9_ofs(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_mask(const struct flm_nthw *p, const uint32_t *val); +void flm_nthw_rcp_kid(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_opn(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_ipn(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_byt_dyn(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_byt_ofs(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_txplm(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_auto_ipv4_mask(const struct flm_nthw *p, uint32_t val); +void flm_nthw_rcp_flush(const struct flm_nthw *p); + +/* Buf Ctrl */ +int flm_nthw_buf_ctrl_update(const struct flm_nthw *p, uint32_t *lrn_free, uint32_t *inf_avail, + uint32_t *sta_avail); + +/* Lrn Data */ +int flm_nthw_lrn_data_flush(const struct flm_nthw *p, const uint32_t *data, uint32_t records, + uint32_t words_per_record, uint32_t *handled_records, + uint32_t *lrn_free, uint32_t *inf_avail, uint32_t *sta_avail); + +/* Inf - Sta Data */ +int flm_nthw_inf_sta_data_update(const struct flm_nthw *p, uint32_t *inf_data, + uint32_t inf_word_count, uint32_t *sta_data, + uint32_t sta_word_count, uint32_t *lrn_free, uint32_t *inf_avail, + uint32_t *sta_avail); + +/* Stat Lrn Done */ +void flm_nthw_stat_lrn_done_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_lrn_done_update(const struct flm_nthw *p); + +/* Stat Lrn Ignore */ +void flm_nthw_stat_lrn_ignore_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_lrn_ignore_update(const struct flm_nthw *p); + +/* Stat Lrn Fail */ +void flm_nthw_stat_lrn_fail_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_lrn_fail_update(const struct flm_nthw *p); + +/* Stat Unl Done */ +void flm_nthw_stat_unl_done_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_unl_done_update(const struct flm_nthw *p); + +/* Stat Unl Ignore */ +void flm_nthw_stat_unl_ignore_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_unl_ignore_update(const struct flm_nthw *p); + +/* Stat Prb Done */ +void flm_nthw_stat_prb_done_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_prb_done_update(const struct flm_nthw *p); + +/* Stat Prb Ignore */ +void flm_nthw_stat_prb_ignore_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_prb_ignore_update(const struct flm_nthw *p); + +/* Stat Rel Done */ +void flm_nthw_stat_rel_done_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_rel_done_update(const struct flm_nthw *p); + +/* Stat Rel Ignore */ +void flm_nthw_stat_rel_ignore_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_rel_ignore_update(const struct flm_nthw *p); + +/* Stat Aul Done */ +void flm_nthw_stat_aul_done_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_aul_done_update(const struct flm_nthw *p); + +/* Stat Aul Ignore */ +void flm_nthw_stat_aul_ignore_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_aul_ignore_update(const struct flm_nthw *p); + +/* Stat Aul Fail */ +void flm_nthw_stat_aul_fail_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_aul_fail_update(const struct flm_nthw *p); + +/* Stat Tul Done */ +void flm_nthw_stat_tul_done_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_tul_done_update(const struct flm_nthw *p); + +/* Stat Flows */ +void flm_nthw_stat_flows_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_flows_update(const struct flm_nthw *p); + +/* Stat Sta Done */ +void flm_nthw_stat_sta_done_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_sta_done_update(const struct flm_nthw *p); + +/* Stat Inf Done */ +void flm_nthw_stat_inf_done_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_inf_done_update(const struct flm_nthw *p); + +/* Stat Inf Skip */ +void flm_nthw_stat_inf_skip_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_inf_skip_update(const struct flm_nthw *p); + +/* Stat Pck Hit */ +void flm_nthw_stat_pck_hit_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_pck_hit_update(const struct flm_nthw *p); + +/* Stat Pck Miss */ +void flm_nthw_stat_pck_miss_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_pck_miss_update(const struct flm_nthw *p); + +/* Stat Pck Unh */ +void flm_nthw_stat_pck_unh_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_pck_unh_update(const struct flm_nthw *p); + +/* Stat Pck Dis */ +void flm_nthw_stat_pck_dis_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_pck_dis_update(const struct flm_nthw *p); + +/* Stat Csh Hit */ +void flm_nthw_stat_csh_hit_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_csh_hit_update(const struct flm_nthw *p); + +/* Stat Csh Miss */ +void flm_nthw_stat_csh_miss_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_csh_miss_update(const struct flm_nthw *p); + +/* Stat Csh Unh */ +void flm_nthw_stat_csh_unh_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_csh_unh_update(const struct flm_nthw *p); + +/* Stat Cuc Start */ +void flm_nthw_stat_cuc_start_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_cuc_start_update(const struct flm_nthw *p); + +/* Stat Cuc Move */ +void flm_nthw_stat_cuc_move_cnt(const struct flm_nthw *p, uint32_t *val, int get); +void flm_nthw_stat_cuc_move_update(const struct flm_nthw *p); + +/* Scrubber profile memory */ +void flm_nthw_scrub_select(const struct flm_nthw *p, uint32_t val); +void flm_nthw_scrub_cnt(const struct flm_nthw *p, uint32_t val); +void flm_nthw_scrub_t(const struct flm_nthw *p, uint32_t val); +void flm_nthw_scrub_r(const struct flm_nthw *p, uint32_t val); +void flm_nthw_scrub_del(const struct flm_nthw *p, uint32_t val); +void flm_nthw_scrub_inf(const struct flm_nthw *p, uint32_t val); +void flm_nthw_scrub_flush(const struct flm_nthw *p); + +struct flm_nthw { + uint8_t m_physical_adapter_no; + nthw_fpga_t *mp_fpga; + void *mp_rac; + + nthw_module_t *m_flm; + + nthw_register_t *mp_control; + nthw_field_t *mp_control_enable; + nthw_field_t *mp_control_init; + nthw_field_t *mp_control_lds; + nthw_field_t *mp_control_lfs; + nthw_field_t *mp_control_lis; + nthw_field_t *mp_control_uds; + nthw_field_t *mp_control_uis; + nthw_field_t *mp_control_rds; + nthw_field_t *mp_control_ris; + nthw_field_t *mp_control_pds; + nthw_field_t *mp_control_pis; + nthw_field_t *mp_control_crcwr; + nthw_field_t *mp_control_crcrd; + nthw_field_t *mp_control_rbl; + nthw_field_t *mp_control_eab; + nthw_field_t *mp_control_split_sdram_usage; + nthw_field_t *mp_control_calib_recalibrate; + + nthw_register_t *mp_status; + nthw_field_t *mp_status_calib_success; + nthw_field_t *mp_status_calib_fail; + nthw_field_t *mp_status_initdone; + nthw_field_t *mp_status_idle; + nthw_field_t *mp_status_critical; + nthw_field_t *mp_status_panic; + nthw_field_t *mp_status_crcerr; + nthw_field_t *mp_status_eft_bp; + nthw_field_t *mp_status_cache_buf_critical; + + nthw_register_t *mp_timeout; + nthw_field_t *mp_timeout_t; + + nthw_register_t *mp_scan; + nthw_field_t *mp_scan_i; + + nthw_register_t *mp_load_bin; + nthw_field_t *mp_load_bin_bin; + + nthw_register_t *mp_load_lps; + nthw_field_t *mp_load_lps_lps; + + nthw_register_t *mp_load_aps; + nthw_field_t *mp_load_aps_aps; + + nthw_register_t *mp_prio; + nthw_field_t *mp_prio_limit0; + nthw_field_t *mp_prio_ft0; + nthw_field_t *mp_prio_limit1; + nthw_field_t *mp_prio_ft1; + nthw_field_t *mp_prio_limit2; + nthw_field_t *mp_prio_ft2; + nthw_field_t *mp_prio_limit3; + nthw_field_t *mp_prio_ft3; + + nthw_register_t *mp_pst_ctrl; + nthw_field_t *mp_pst_ctrl_adr; + nthw_field_t *mp_pst_ctrl_cnt; + nthw_register_t *mp_pst_data; + nthw_field_t *mp_pst_data_bp; + nthw_field_t *mp_pst_data_pp; + nthw_field_t *mp_pst_data_tp; + + nthw_register_t *mp_rcp_ctrl; + nthw_field_t *mp_rcp_ctrl_adr; + nthw_field_t *mp_rcp_ctrl_cnt; + nthw_register_t *mp_rcp_data; + nthw_field_t *mp_rcp_data_lookup; + nthw_field_t *mp_rcp_data_qw0_dyn; + nthw_field_t *mp_rcp_data_qw0_ofs; + nthw_field_t *mp_rcp_data_qw0_sel; + nthw_field_t *mp_rcp_data_qw4_dyn; + nthw_field_t *mp_rcp_data_qw4_ofs; + nthw_field_t *mp_rcp_data_sw8_dyn; + nthw_field_t *mp_rcp_data_sw8_ofs; + nthw_field_t *mp_rcp_data_sw8_sel; + nthw_field_t *mp_rcp_data_sw9_dyn; + nthw_field_t *mp_rcp_data_sw9_ofs; + nthw_field_t *mp_rcp_data_mask; + nthw_field_t *mp_rcp_data_kid; + nthw_field_t *mp_rcp_data_opn; + nthw_field_t *mp_rcp_data_ipn; + nthw_field_t *mp_rcp_data_byt_dyn; + nthw_field_t *mp_rcp_data_byt_ofs; + nthw_field_t *mp_rcp_data_txplm; + nthw_field_t *mp_rcp_data_auto_ipv4_mask; + + nthw_register_t *mp_buf_ctrl; + nthw_field_t *mp_buf_ctrl_lrn_free; + nthw_field_t *mp_buf_ctrl_inf_avail; + nthw_field_t *mp_buf_ctrl_sta_avail; + + nthw_register_t *mp_lrn_data; + nthw_register_t *mp_inf_data; + nthw_register_t *mp_sta_data; + + nthw_register_t *mp_stat_lrn_done; + nthw_field_t *mp_stat_lrn_done_cnt; + + nthw_register_t *mp_stat_lrn_ignore; + nthw_field_t *mp_stat_lrn_ignore_cnt; + + nthw_register_t *mp_stat_lrn_fail; + nthw_field_t *mp_stat_lrn_fail_cnt; + + nthw_register_t *mp_stat_unl_done; + nthw_field_t *mp_stat_unl_done_cnt; + + nthw_register_t *mp_stat_unl_ignore; + nthw_field_t *mp_stat_unl_ignore_cnt; + + nthw_register_t *mp_stat_prb_done; + nthw_field_t *mp_stat_prb_done_cnt; + + nthw_register_t *mp_stat_prb_ignore; + nthw_field_t *mp_stat_prb_ignore_cnt; + + nthw_register_t *mp_stat_rel_done; + nthw_field_t *mp_stat_rel_done_cnt; + + nthw_register_t *mp_stat_rel_ignore; + nthw_field_t *mp_stat_rel_ignore_cnt; + + nthw_register_t *mp_stat_aul_done; + nthw_field_t *mp_stat_aul_done_cnt; + + nthw_register_t *mp_stat_aul_ignore; + nthw_field_t *mp_stat_aul_ignore_cnt; + + nthw_register_t *mp_stat_aul_fail; + nthw_field_t *mp_stat_aul_fail_cnt; + + nthw_register_t *mp_stat_tul_done; + nthw_field_t *mp_stat_tul_done_cnt; + + nthw_register_t *mp_stat_flows; + nthw_field_t *mp_stat_flows_cnt; + + nthw_register_t *mp_stat_sta_done; + nthw_field_t *mp_stat_sta_done_cnt; + + nthw_register_t *mp_stat_inf_done; + nthw_field_t *mp_stat_inf_done_cnt; + + nthw_register_t *mp_stat_inf_skip; + nthw_field_t *mp_stat_inf_skip_cnt; + + nthw_register_t *mp_stat_pck_hit; + nthw_field_t *mp_stat_pck_hit_cnt; + + nthw_register_t *mp_stat_pck_miss; + nthw_field_t *mp_stat_pck_miss_cnt; + + nthw_register_t *mp_stat_pck_unh; + nthw_field_t *mp_stat_pck_unh_cnt; + + nthw_register_t *mp_stat_pck_dis; + nthw_field_t *mp_stat_pck_dis_cnt; + + nthw_register_t *mp_stat_csh_hit; + nthw_field_t *mp_stat_csh_hit_cnt; + + nthw_register_t *mp_stat_csh_miss; + nthw_field_t *mp_stat_csh_miss_cnt; + + nthw_register_t *mp_stat_csh_unh; + nthw_field_t *mp_stat_csh_unh_cnt; + + nthw_register_t *mp_stat_cuc_start; + nthw_field_t *mp_stat_cuc_start_cnt; + + nthw_register_t *mp_stat_cuc_move; + nthw_field_t *mp_stat_cuc_move_cnt; + + nthw_register_t *mp_scrub_ctrl; + nthw_field_t *mp_scrub_ctrl_adr; + nthw_field_t *mp_scrub_ctrl_cnt; + + nthw_register_t *mp_scrub_data; + nthw_field_t *mp_scrub_data_t; + nthw_field_t *mp_scrub_data_r; + nthw_field_t *mp_scrub_data_del; + nthw_field_t *mp_scrub_data_inf; +}; + +#endif /* __FLOW_NTHW_FLM_H__ */ diff --git a/drivers/net/ntnic/nthw/nthw_rac.c b/drivers/net/ntnic/nthw/nthw_rac.c index 2aef0c148f..8be6f7623e 100644 --- a/drivers/net/ntnic/nthw/nthw_rac.c +++ b/drivers/net/ntnic/nthw/nthw_rac.c @@ -12,6 +12,7 @@ #include +#define RAB_DMA_WAIT (1000000) #define RAB_READ (0x01) #define RAB_WRITE (0x02) @@ -386,6 +387,186 @@ void nthw_rac_bar0_write32(const struct fpga_info_s *p_fpga_info, uint32_t reg_a dst_addr[i] = p_data[i]; } +int nthw_rac_rab_dma_begin(nthw_rac_t *p) +{ + const struct fpga_info_s *const p_fpga_info = p->mp_fpga->p_fpga_info; + const char *const p_adapter_id_str = p_fpga_info->mp_adapter_id_str; + + pthread_mutex_lock(&p->m_mutex); + + if (p->m_dma_active) { + pthread_mutex_unlock(&p->m_mutex); + NT_LOG(ERR, NTHW, + "%s: DMA begin requested, but a DMA transaction is already active\n", + p_adapter_id_str); + return -1; + } + + p->m_dma_active = true; + + return 0; +} + +static void nthw_rac_rab_dma_activate(nthw_rac_t *p) +{ + const struct fpga_info_s *const p_fpga_info = p->mp_fpga->p_fpga_info; + const uint32_t completion = RAB_COMPLETION << RAB_OPR_LO; + + /* Write completion word */ + p->m_dma_in_buf[p->m_dma_in_ptr_wr] = completion; + p->m_dma_in_ptr_wr = (uint16_t)((p->m_dma_in_ptr_wr + 1) & (RAB_DMA_BUF_CNT - 1)); + + /* Clear output completion word */ + p->m_dma_out_buf[p->m_dma_out_ptr_rd] = 0; + + /* Update DMA pointer and start transfer */ + nthw_rac_reg_write32(p_fpga_info, p->RAC_RAB_DMA_IB_WR_ADDR, + (uint32_t)(p->m_dma_in_ptr_wr * sizeof(uint32_t))); +} + +static int nthw_rac_rab_dma_wait(nthw_rac_t *p) +{ + const struct fpga_info_s *const p_fpga_info = p->mp_fpga->p_fpga_info; + const char *const p_adapter_id_str = p_fpga_info->mp_adapter_id_str; + const uint32_t completion = RAB_COMPLETION << RAB_OPR_LO; + uint32_t i; + + for (i = 0; i < RAB_DMA_WAIT; i++) { + nt_os_wait_usec_poll(1); + + if ((p->m_dma_out_buf[p->m_dma_out_ptr_rd] & completion) == completion) + break; + } + + if (i == RAB_DMA_WAIT) { + NT_LOG(ERR, NTHW, "%s: RAB: Unexpected value of completion (0x%08X)\n", + p_adapter_id_str, p->m_dma_out_buf[p->m_dma_out_ptr_rd]); + return -1; + } + + p->m_dma_out_ptr_rd = (uint16_t)((p->m_dma_out_ptr_rd + 1) & (RAB_DMA_BUF_CNT - 1)); + p->m_in_free = RAB_DMA_BUF_CNT; + + return 0; +} + +int nthw_rac_rab_dma_commit(nthw_rac_t *p) +{ + int ret; + + if (!p->m_dma_active) { + /* Expecting mutex not to be locked! */ + assert(0); /* alert developer that something is wrong */ + return -1; + } + + nthw_rac_rab_dma_activate(p); + ret = nthw_rac_rab_dma_wait(p); + + p->m_dma_active = false; + + pthread_mutex_unlock(&p->m_mutex); + + return ret; +} + +uint32_t nthw_rac_rab_get_free(nthw_rac_t *p) +{ + if (!p->m_dma_active) { + /* Expecting mutex not to be locked! */ + assert(0); /* alert developer that something is wrong */ + return -1; + } + + return p->m_in_free; +} + +int nthw_rac_rab_write32_dma(nthw_rac_t *p, nthw_rab_bus_id_t bus_id, uint32_t address, + uint32_t word_cnt, const uint32_t *p_data) +{ + const struct fpga_info_s *const p_fpga_info = p->mp_fpga->p_fpga_info; + const char *const p_adapter_id_str = p_fpga_info->mp_adapter_id_str; + + if (word_cnt == 0 || word_cnt > 256) { + NT_LOG(ERR, NTHW, + "%s: Failed rab dma write length check - bus: %d addr: 0x%08X wordcount: %d - inBufFree: 0x%08X\n", + p_adapter_id_str, bus_id, address, word_cnt, p->m_in_free); + assert(0); /* alert developer that something is wrong */ + return -1; + } + + if (p->m_in_free < (word_cnt + 3)) { + /* + * No more memory available. + * nthw_rac_rab_dma_commit() needs to be called to start and finish pending + * transfers. + */ + return -1; + } + + p->m_in_free -= (word_cnt + 1); + + /* Write the command word */ + p->m_dma_in_buf[p->m_dma_in_ptr_wr] = (RAB_WRITE << RAB_OPR_LO) | + ((word_cnt & ((1 << RAB_CNT_BW) - 1)) << RAB_CNT_LO) | (bus_id << RAB_BUSID_LO) | + address; + p->m_dma_in_ptr_wr = (uint16_t)((p->m_dma_in_ptr_wr + 1) & (RAB_DMA_BUF_CNT - 1)); + + for (uint32_t i = 0; i < word_cnt; i++) { + p->m_dma_in_buf[p->m_dma_in_ptr_wr] = p_data[i]; + p->m_dma_in_ptr_wr = (uint16_t)((p->m_dma_in_ptr_wr + 1) & (RAB_DMA_BUF_CNT - 1)); + } + + return 0; +} + +int nthw_rac_rab_read32_dma(nthw_rac_t *p, nthw_rab_bus_id_t bus_id, uint32_t address, + uint32_t word_cnt, struct dma_buf_ptr *buf_ptr) +{ + const struct fpga_info_s *const p_fpga_info = p->mp_fpga->p_fpga_info; + const char *const p_adapter_id_str = p_fpga_info->mp_adapter_id_str; + + if (word_cnt == 0 || word_cnt > 256) { + NT_LOG(ERR, NTHW, + "%s: Failed rab dma read length check - bus: %d addr: 0x%08X wordcount: %d - inBufFree: 0x%08X\n", + p_adapter_id_str, bus_id, address, word_cnt, p->m_in_free); + assert(0); /* alert developer that something is wrong */ + return -1; + } + + if ((word_cnt + 3) > RAB_DMA_BUF_CNT) { + NT_LOG(ERR, NTHW, + "%s: Failed rab dma read length check - bus: %d addr: 0x%08X wordcount: %d", + p_adapter_id_str, bus_id, address, word_cnt); + return -1; + } + + if (p->m_in_free < 3) { + /* + * No more memory available. + * nthw_rac_rab_dma_commit() needs to be called to start and finish pending + * transfers. + */ + return -1; + } + + p->m_in_free -= 1; + + /* Write the command word */ + p->m_dma_in_buf[p->m_dma_in_ptr_wr] = (RAB_READ << RAB_OPR_LO) | + ((word_cnt & ((1 << RAB_CNT_BW) - 1)) << RAB_CNT_LO) | (bus_id << RAB_BUSID_LO) | + address; + p->m_dma_in_ptr_wr = (uint16_t)((p->m_dma_in_ptr_wr + 1) & (RAB_DMA_BUF_CNT - 1)); + + buf_ptr->index = p->m_dma_out_ptr_rd; + buf_ptr->size = RAB_DMA_BUF_CNT; + buf_ptr->base = p->m_dma_out_buf; + p->m_dma_out_ptr_rd = + (uint16_t)((p->m_dma_out_ptr_rd + word_cnt) & (RAB_DMA_BUF_CNT - 1U)); + + return 0; +} + int nthw_rac_rab_write32(nthw_rac_t *p, bool trc, nthw_rab_bus_id_t bus_id, uint32_t address, uint32_t word_cnt, const uint32_t *p_data) { diff --git a/drivers/net/ntnic/nthw/nthw_rac.h b/drivers/net/ntnic/nthw/nthw_rac.h index c16ff77189..c64dac9da9 100644 --- a/drivers/net/ntnic/nthw/nthw_rac.h +++ b/drivers/net/ntnic/nthw/nthw_rac.h @@ -140,11 +140,20 @@ int nthw_rac_rab_reset(nthw_rac_t *p); int nthw_rac_rab_write32(nthw_rac_t *p, bool trc, nthw_rab_bus_id_t bus_id, uint32_t address, uint32_t word_cnt, const uint32_t *p_data); +int nthw_rac_rab_write32_dma(nthw_rac_t *p, nthw_rab_bus_id_t bus_id, uint32_t address, + uint32_t word_cnt, const uint32_t *p_data); int nthw_rac_rab_read32(nthw_rac_t *p, bool trc, nthw_rab_bus_id_t bus_id, uint32_t address, uint32_t word_cnt, uint32_t *p_data); +int nthw_rac_rab_read32_dma(nthw_rac_t *p, nthw_rab_bus_id_t bus_id, uint32_t address, + uint32_t word_cnt, struct dma_buf_ptr *buf_ptr); + +uint32_t nthw_rac_rab_get_free(nthw_rac_t *p); int nthw_rac_rab_flush(nthw_rac_t *p); +int nthw_rac_rab_dma_begin(nthw_rac_t *p); +int nthw_rac_rab_dma_commit(nthw_rac_t *p); + void nthw_rac_bar0_read32(const struct fpga_info_s *p_fpga_info, uint32_t reg_addr, uint32_t word_cnt, uint32_t *p_data); void nthw_rac_bar0_write32(const struct fpga_info_s *p_fpga_info, uint32_t reg_addr, diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h index 7d48e4012e..01254f7f5d 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h @@ -15,6 +15,7 @@ #define MOD_UNKNOWN (0L)/* Unknown/uninitialized - keep this as the first element */ #define MOD_CAT (0x30b447c2UL) +#define MOD_FLM (0xe7ba53a4UL) #define MOD_GFG (0xfc423807UL) #define MOD_GMF (0x68b1d15aUL) #define MOD_GPIO_PHY (0xbbe81659UL) diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h index 96676bf8d4..0c153e21ed 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h @@ -14,6 +14,7 @@ #define _NTHW_FPGA_REG_DEFS_ #include "nthw_fpga_reg_defs_cat.h" +#include "nthw_fpga_reg_defs_flm.h" #include "nthw_fpga_reg_defs_gfg.h" #include "nthw_fpga_reg_defs_gmf.h" #include "nthw_fpga_reg_defs_gpio_phy.h" diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_flm.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_flm.h new file mode 100644 index 0000000000..1f8678779e --- /dev/null +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_flm.h @@ -0,0 +1,242 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +/* + * nthw_fpga_reg_defs_flm.h + * + * Auto-generated file - do *NOT* edit + * + */ + +#ifndef _NTHW_FPGA_REG_DEFS_FLM_ +#define _NTHW_FPGA_REG_DEFS_FLM_ + +/* FLM */ +#define NTHW_MOD_FLM (0xe7ba53a4UL) +#define FLM_BUF_CTRL (0x2d7ba0b7UL) +#define FLM_BUF_CTRL_INF_AVAIL (0x55993c46UL) +#define FLM_BUF_CTRL_LRN_FREE (0x60b97a24UL) +#define FLM_BUF_CTRL_STA_AVAIL (0x44abe7c4UL) +#define FLM_CONTROL (0xdbb393a2UL) +#define FLM_CONTROL_CALIB_RECALIBRATE (0xd787824aUL) +#define FLM_CONTROL_CRCRD (0x35ba7f13UL) +#define FLM_CONTROL_CRCWR (0xbc193e07UL) +#define FLM_CONTROL_EAB (0xa09637c2UL) +#define FLM_CONTROL_ENABLE (0x5d80d95eUL) +#define FLM_CONTROL_INIT (0x69b06e85UL) +#define FLM_CONTROL_LDS (0xb880d8faUL) +#define FLM_CONTROL_LFS (0x8ab6ba78UL) +#define FLM_CONTROL_LIS (0xd2ea6b7UL) +#define FLM_CONTROL_PDS (0xadbc82eeUL) +#define FLM_CONTROL_PIS (0x1812fca3UL) +#define FLM_CONTROL_RBL (0x756afcf3UL) +#define FLM_CONTROL_RDS (0xae385680UL) +#define FLM_CONTROL_RIS (0x1b9628cdUL) +#define FLM_CONTROL_SPLIT_SDRAM_USAGE (0x71e7a8a4UL) +#define FLM_CONTROL_UDS (0xab774005UL) +#define FLM_CONTROL_UIS (0x1ed93e48UL) +#define FLM_CONTROL_WPD (0x58ec6f9UL) +#define FLM_INF_DATA (0xba19f6ccUL) +#define FLM_INF_DATA_BYTES (0x480dab67UL) +#define FLM_INF_DATA_BYT_A (0xb9920f4UL) +#define FLM_INF_DATA_BYT_B (0x9290714eUL) +#define FLM_INF_DATA_CAUSE (0x94e9716UL) +#define FLM_INF_DATA_EOR (0xd81a867eUL) +#define FLM_INF_DATA_ID (0x23a04258UL) +#define FLM_INF_DATA_PACKETS (0x33a4ab9eUL) +#define FLM_INF_DATA_PCK_A (0x3967b7a0UL) +#define FLM_INF_DATA_PCK_B (0xa06ee61aUL) +#define FLM_INF_DATA_RTX_A (0x900996cfUL) +#define FLM_INF_DATA_RTX_B (0x900c775UL) +#define FLM_INF_DATA_TCP_A (0xdc945df1UL) +#define FLM_INF_DATA_TCP_B (0x459d0c4bUL) +#define FLM_INF_DATA_TS (0x5f1fab83UL) +#define FLM_LOAD_APS (0x4e7601e5UL) +#define FLM_LOAD_APS_APS (0x504ad426UL) +#define FLM_LOAD_BIN (0xb4367a7dUL) +#define FLM_LOAD_BIN_BIN (0x274bb543UL) +#define FLM_LOAD_LPS (0x46ae92b6UL) +#define FLM_LOAD_LPS_LPS (0x394526b5UL) +#define FLM_LRN_CTRL (0x11050e66UL) +#define FLM_LRN_CTRL_FREE (0x4193813dUL) +#define FLM_LRN_DATA (0xbed48c7fUL) +#define FLM_LRN_DATA_ADJ (0x130ed7UL) +#define FLM_LRN_DATA_COLOR (0x33d0a7f2UL) +#define FLM_LRN_DATA_DSCP (0x5eab148eUL) +#define FLM_LRN_DATA_ENT (0x7fa73e2UL) +#define FLM_LRN_DATA_EOR (0xf782e796UL) +#define FLM_LRN_DATA_FILL (0x768aba23UL) +#define FLM_LRN_DATA_FT (0x4e9221cfUL) +#define FLM_LRN_DATA_FT_MBR (0x48f095acUL) +#define FLM_LRN_DATA_FT_MISS (0xea062e35UL) +#define FLM_LRN_DATA_GFI (0xafa1415dUL) +#define FLM_LRN_DATA_ID (0xd4bd2d64UL) +#define FLM_LRN_DATA_KID (0x5f92d84bUL) +#define FLM_LRN_DATA_MBR_ID1 (0x9931440eUL) +#define FLM_LRN_DATA_MBR_ID2 (0x3815b4UL) +#define FLM_LRN_DATA_MBR_ID3 (0x773f2522UL) +#define FLM_LRN_DATA_MBR_ID4 (0xe95bb081UL) +#define FLM_LRN_DATA_NAT_EN (0x9f4035a4UL) +#define FLM_LRN_DATA_NAT_IP (0xc9fa47cbUL) +#define FLM_LRN_DATA_NAT_PORT (0x5f8f57d0UL) +#define FLM_LRN_DATA_NOFI (0x3d36f27bUL) +#define FLM_LRN_DATA_OP (0x983d5e9fUL) +#define FLM_LRN_DATA_PRIO (0xf7f55b0eUL) +#define FLM_LRN_DATA_PROT (0x2bca3564UL) +#define FLM_LRN_DATA_QFI (0xb70a9e9fUL) +#define FLM_LRN_DATA_QW0 (0xcd0a7417UL) +#define FLM_LRN_DATA_QW4 (0xca67b00eUL) +#define FLM_LRN_DATA_RATE (0x5c250baeUL) +#define FLM_LRN_DATA_RQI (0xb0cfa450UL) +#define FLM_LRN_DATA_SCRUB_PROF (0xc3730f6bUL) +#define FLM_LRN_DATA_SIZE (0x740910fdUL) +#define FLM_LRN_DATA_STAT_PROF (0xded894eaUL) +#define FLM_LRN_DATA_SW8 (0xc055284bUL) +#define FLM_LRN_DATA_SW9 (0xb75218ddUL) +#define FLM_LRN_DATA_TAU (0xea8196fcUL) +#define FLM_LRN_DATA_TEID (0xf62ca024UL) +#define FLM_LRN_DATA_TTL (0xb95fd828UL) +#define FLM_LRN_DATA_VOL_IDX (0xabc86ffbUL) +#define FLM_PRIO (0x5ed7bcbeUL) +#define FLM_PRIO_FT0 (0x9ef34f69UL) +#define FLM_PRIO_FT1 (0xe9f47fffUL) +#define FLM_PRIO_FT2 (0x70fd2e45UL) +#define FLM_PRIO_FT3 (0x7fa1ed3UL) +#define FLM_PRIO_LIMIT0 (0xcce9cfe8UL) +#define FLM_PRIO_LIMIT1 (0xbbeeff7eUL) +#define FLM_PRIO_LIMIT2 (0x22e7aec4UL) +#define FLM_PRIO_LIMIT3 (0x55e09e52UL) +#define FLM_PST_CTRL (0x3e2b004bUL) +#define FLM_PST_CTRL_ADR (0xfa8565c1UL) +#define FLM_PST_CTRL_CNT (0xea8dfc10UL) +#define FLM_PST_DATA (0x91fa8252UL) +#define FLM_PST_DATA_BP (0x5f53d50fUL) +#define FLM_PST_DATA_PP (0x27a7a5dcUL) +#define FLM_PST_DATA_TP (0x43cb60d8UL) +#define FLM_RCP_CTRL (0x8041d9eeUL) +#define FLM_RCP_CTRL_ADR (0xb1a39fefUL) +#define FLM_RCP_CTRL_CNT (0xa1ab063eUL) +#define FLM_RCP_DATA (0x2f905bf7UL) +#define FLM_RCP_DATA_A (0xec41ba43UL) +#define FLM_RCP_DATA_AUTO_IPV4_MASK (0xa7818261UL) +#define FLM_RCP_DATA_B (0x7548ebf9UL) +#define FLM_RCP_DATA_BYT_DYN (0x28334583UL) +#define FLM_RCP_DATA_BYT_OFS (0x8a3ac825UL) +#define FLM_RCP_DATA_IPN (0x94f5d891UL) +#define FLM_RCP_DATA_ITF (0xfe4295a7UL) +#define FLM_RCP_DATA_KID (0xeca44cf9UL) +#define FLM_RCP_DATA_LOOKUP (0x5d0f2e84UL) +#define FLM_RCP_DATA_MASK (0xd97a1393UL) +#define FLM_RCP_DATA_OPN (0x9078a423UL) +#define FLM_RCP_DATA_QW0_DYN (0x28bd732dUL) +#define FLM_RCP_DATA_QW0_OFS (0x8ab4fe8bUL) +#define FLM_RCP_DATA_QW0_SEL (0x39adfaa9UL) +#define FLM_RCP_DATA_QW4_DYN (0xdd3dd5edUL) +#define FLM_RCP_DATA_QW4_OFS (0x7f34584bUL) +#define FLM_RCP_DATA_SW8_DYN (0x8f5229c5UL) +#define FLM_RCP_DATA_SW8_OFS (0x2d5ba463UL) +#define FLM_RCP_DATA_SW8_SEL (0x9e42a041UL) +#define FLM_RCP_DATA_SW9_DYN (0xb2320075UL) +#define FLM_RCP_DATA_SW9_OFS (0x103b8dd3UL) +#define FLM_RCP_DATA_TXPLM (0xbe56af35UL) +#define FLM_SCAN (0xee586089UL) +#define FLM_SCAN_I (0xe22d4ee5UL) +#define FLM_SCRUB (0x690c7a66UL) +#define FLM_SCRUB_I (0xc6a9dfe8UL) +#define FLM_SCRUB_CTRL (0xc647074aUL) +#define FLM_SCRUB_CTRL_ADR (0x3d584aa4UL) +#define FLM_SCRUB_CTRL_CNT (0x2d50d375UL) +#define FLM_SCRUB_DATA (0x69968553UL) +#define FLM_SCRUB_DATA_DEL (0xc96d19b1UL) +#define FLM_SCRUB_DATA_INF (0xc294ba37UL) +#define FLM_SCRUB_DATA_R (0xc3ff3ba5UL) +#define FLM_SCRUB_DATA_T (0x2a9c9e90UL) +#define FLM_STAT (0xa532c06UL) +#define FLM_STAT_I (0x215c23d1UL) +#define FLM_STATUS (0x10f57a96UL) +#define FLM_STATUS_CACHE_BUFFER_CRITICAL (0x39f44c00UL) +#define FLM_STATUS_CALIB_FAIL (0xb59e2af6UL) +#define FLM_STATUS_CALIB_SUCCESS (0x9c031e4fUL) +#define FLM_STATUS_CRCERR (0xcd852b33UL) +#define FLM_STATUS_CRITICAL (0xe9e1b478UL) +#define FLM_STATUS_EFT_BP (0xf60fc391UL) +#define FLM_STATUS_EFT_EVICT_BP (0xf4dd216fUL) +#define FLM_STATUS_IDLE (0xd02fd0e7UL) +#define FLM_STATUS_INITDONE (0xdd6bdbd8UL) +#define FLM_STATUS_PANIC (0xf676390fUL) +#define FLM_STAT_AUL_DONE (0x747800bbUL) +#define FLM_STAT_AUL_DONE_CNT (0x6b744caeUL) +#define FLM_STAT_AUL_FAIL (0xe272cb59UL) +#define FLM_STAT_AUL_FAIL_CNT (0x697b6247UL) +#define FLM_STAT_AUL_IGNORE (0x49aa46f4UL) +#define FLM_STAT_AUL_IGNORE_CNT (0x37721e3bUL) +#define FLM_STAT_CSH_HIT (0xd0dca28cUL) +#define FLM_STAT_CSH_HIT_CNT (0xc7a41ba4UL) +#define FLM_STAT_CSH_MISS (0xbc219a9fUL) +#define FLM_STAT_CSH_MISS_CNT (0x4a66e57eUL) +#define FLM_STAT_CSH_UNH (0x9f625827UL) +#define FLM_STAT_CSH_UNH_CNT (0x79b8ac91UL) +#define FLM_STAT_CUC_MOVE (0x381862c0UL) +#define FLM_STAT_CUC_MOVE_CNT (0x868e1261UL) +#define FLM_STAT_CUC_START (0x617a68acUL) +#define FLM_STAT_CUC_START_CNT (0xbf953f79UL) +#define FLM_STAT_FLOWS (0x3072544fUL) +#define FLM_STAT_FLOWS_CNT (0x829b2631UL) +#define FLM_STAT_INF_DONE (0x63dff05cUL) +#define FLM_STAT_INF_DONE_CNT (0xf78de916UL) +#define FLM_STAT_INF_SKIP (0x8b84458aUL) +#define FLM_STAT_INF_SKIP_CNT (0xc0b9dd7dUL) +#define FLM_STAT_LRN_DONE (0x67128aefUL) +#define FLM_STAT_LRN_DONE_CNT (0xd81588feUL) +#define FLM_STAT_LRN_FAIL (0xf118410dUL) +#define FLM_STAT_LRN_FAIL_CNT (0xda1aa617UL) +#define FLM_STAT_LRN_IGNORE (0x9a10a7f0UL) +#define FLM_STAT_LRN_IGNORE_CNT (0x11c0f6a7UL) +#define FLM_STAT_PCK_DIS (0x55e23053UL) +#define FLM_STAT_PCK_DIS_CNT (0x9b13b227UL) +#define FLM_STAT_PCK_HIT (0xc29c5c94UL) +#define FLM_STAT_PCK_HIT_CNT (0xee930443UL) +#define FLM_STAT_PCK_MISS (0xaf5f4237UL) +#define FLM_STAT_PCK_MISS_CNT (0x7421a5baUL) +#define FLM_STAT_PCK_UNH (0x8d22a63fUL) +#define FLM_STAT_PCK_UNH_CNT (0x508fb376UL) +#define FLM_STAT_PRB_DONE (0x3bc46ef0UL) +#define FLM_STAT_PRB_DONE_CNT (0xcb3bc80dUL) +#define FLM_STAT_PRB_IGNORE (0xf02dd3d9UL) +#define FLM_STAT_PRB_IGNORE_CNT (0x588d1667UL) +#define FLM_STAT_REL_DONE (0xe192aabdUL) +#define FLM_STAT_REL_DONE_CNT (0xbe04b769UL) +#define FLM_STAT_REL_IGNORE (0x29f33e6eUL) +#define FLM_STAT_REL_IGNORE_CNT (0x99a6a156UL) +#define FLM_STAT_STA_DONE (0x500f2e87UL) +#define FLM_STAT_STA_DONE_CNT (0xbf276bbdUL) +#define FLM_STAT_TUL_DONE (0x40233ff4UL) +#define FLM_STAT_TUL_DONE_CNT (0xffcfd642UL) +#define FLM_STAT_UNL_DONE (0xe950f75eUL) +#define FLM_STAT_UNL_DONE_CNT (0xe9bdd9a2UL) +#define FLM_STAT_UNL_IGNORE (0x497abbcaUL) +#define FLM_STAT_UNL_IGNORE_CNT (0x1ba2b435UL) +#define FLM_STA_DATA (0x89c92817UL) +#define FLM_STA_DATA_EOR (0x90b004d5UL) +#define FLM_STA_DATA_ID (0x3b14a2ffUL) +#define FLM_STA_DATA_LDS (0xb92d607UL) +#define FLM_STA_DATA_LFS (0x39a4b485UL) +#define FLM_STA_DATA_LIS (0xbe3ca84aUL) +#define FLM_STA_DATA_PDS (0x1eae8c13UL) +#define FLM_STA_DATA_PIS (0xab00f25eUL) +#define FLM_STA_DATA_RDS (0x1d2a587dUL) +#define FLM_STA_DATA_RIS (0xa8842630UL) +#define FLM_STA_DATA_UDS (0x18654ef8UL) +#define FLM_STA_DATA_UIS (0xadcb30b5UL) +#define FLM_TRSWIN (0xff97af47UL) +#define FLM_TRSWIN_S (0x41ed83b1UL) +#define FLM_TRTWIN (0x624097feUL) +#define FLM_TRTWIN_T (0xc28c26aaUL) + +#endif /* _NTHW_FPGA_REG_DEFS_FLM_ */ + +/* + * Auto-generated file - do *NOT* edit + */ diff --git a/drivers/net/ntnic/ntutil/nt_util.c b/drivers/net/ntnic/ntutil/nt_util.c index a69a8e10c1..72aabad090 100644 --- a/drivers/net/ntnic/ntutil/nt_util.c +++ b/drivers/net/ntnic/ntutil/nt_util.c @@ -23,6 +23,12 @@ void nt_os_wait_usec(int val) rte_delay_us_sleep(val); } +/* spins in a waiting loop calling pause asm instruction uses RDTSC - precise wait */ +void nt_os_wait_usec_poll(int val) +{ + rte_delay_us(val); +} + uint64_t nt_os_get_time_monotonic_counter(void) { return rte_get_timer_cycles(); diff --git a/drivers/net/ntnic/ntutil/nt_util.h b/drivers/net/ntnic/ntutil/nt_util.h index 540cd615f2..d82e6d3248 100644 --- a/drivers/net/ntnic/ntutil/nt_util.h +++ b/drivers/net/ntnic/ntutil/nt_util.h @@ -22,6 +22,7 @@ uint64_t nt_os_get_time_monotonic_counter(void); void nt_os_wait_usec(int val); +void nt_os_wait_usec_poll(int val); static inline int min(int a, int b) { From patchwork Fri Oct 4 15:35:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145112 X-Patchwork-Delegate: ferruh.yigit@amd.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 1C2F145AAF; Fri, 4 Oct 2024 17:54:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 78AA242E8B; Fri, 4 Oct 2024 17:51:33 +0200 (CEST) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id 6AC1042E9A for ; Fri, 4 Oct 2024 17:51:27 +0200 (CEST) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02lp2110.outbound.protection.outlook.com [104.47.11.110]) by mx-outbound22-159.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:51:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cb4osS/TpoM7DtSFOodDsYiuAF+JLBy10N08f7s0sEBjNfedwuYE6TggGZHEjYjeSduM0iX8QR9O8bAqFoBrG/2fG4jDMMMWMn4UUqc49NccO09dviRTkC1U0zib0609MLdNukTM1FjUeA2FIzRO7NzUDA6LIDuJ/N9FykHfHsxCJXfIsndIXHAWZC7F6fFqnAhAxtUCfjM35kYtHytmrpP+kVK4AixIqdWRwjZr7U35YWkjvvHxvS8JQjyq5bves9jHZV5Nity5+V494XqbPtIq33uSQUsAxKwqgUez9zjrbavF2Wk3iB3yahkyLrABi5y20wODw54p9Js5aBRtvQ== 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=XTDnyENbMqcn90eK0YTsRkkaqTy46V03yiHSRO7Ka34=; b=kSJ3LBYrbPi3Q5TTErmveu9rtmwijW6Y0+BiI7HLsImrbr0ND5QchxFQCYZQBOlLEZZLuUC1nEM5fcC4DDDlIHgvILZfXA+wN+dLPC7rjj07yAkP0MvwFt9UWu3WNyaY9ir2gUfmEtxA2tmnDN1dUeI3mKJA3bQz+1Zwz1nS3duw+vrH1T7iVoDolZ7njRU3fP87mXdkw44WQbGtSUYuPoMg//6P5aeokelBmuWM7szcM8B1ANlcjyV+ovREHTazSYdhDwHl147e9+rhClk7ydliRDD6CL05dI7vSmyki4f3fVxopdP6l2oCic0LLJNV/Rw2wQGJpjf1nZudYppO6Q== 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=XTDnyENbMqcn90eK0YTsRkkaqTy46V03yiHSRO7Ka34=; b=AzHmfLPk8ki8Srdql1WmovZPoL/P+9yxooKfuuHimkMtxhKeKYXcHnZp3rTsZTdhKRRv+HdRct3g5yNGjA/aht5Fq9b+MUjlelY4wnwkyn6qD3ONLgs9YRa6zRybV3iDnnaLOMg4OIfcWTJyxyg13yT66Xa20yxoyqkxif0jx+0= Received: from AM0PR10CA0105.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::22) by VI1P190MB0735.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:129::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 15:36:36 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::70) by AM0PR10CA0105.outlook.office365.com (2603:10a6:208:e6::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.17 via Frontend Transport; Fri, 4 Oct 2024 15:36:36 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:36 +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 09/14] net/ntnic: used writer data handling functions Date: Fri, 4 Oct 2024 17:35:03 +0200 Message-ID: <20241004153551.267935-46-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|VI1P190MB0735:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ea89e5f-a292-4c11-7923-08dce48a5522 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: NupNjTnWz1H5qfYw61g7z6yn9tiXifYLcem5aW/lJlhWtfG2qXYvwv1pDzSYw+4QcHe4jYXHVk7xVmk6mK5OKqk/LzyNaUEWBwbkF5h15Q02Sdn19gPH4wDbvG3fX0qoVDkRJ7Y0iaBr+i7CFbcLIqGXKZf4mEe8R+FQpAZmiNOLtisbPoFGxHIcw5dbzRL611PnZhmcFFwwnfjIMMMWTcar/ZdWzDL1JzEZwKepIyWepA2Aui08yAq8tv0hxpFekVYxNVMwYzSE9vr0qNaMKBNG+FJ7CVjVnBPcqPgszdbiNTCPmVxRv9k18+JJpFI9hIzi09luOtgEHMqjxv/e6TyKL8Hjo3erYdSIMReLmJb8LTL2y1nzltoxCw6vxg4L9yFqIwm7Ui0weLiiur32oTO0ooIXdytwI/wXBAFuZOtbOFyHxiJwuzoPT9Z5sJpbIrWR5qJu7J5Usdh4GzpFbuxQv+hxAWG30HpvSZq7ENsABEk18GX0ip/p/6TWAK97u15ZqBRG2cPxK6mvImfvbarAsixBCp2EVR/mL/wlRG4k2dKZ19zNF04yfVxWS+A45mo14JQKNIrwoQPKvlyXJBykpBe1PoEiuxnQIBlugMzo9LTcIGkLHhoCY4yecT+CT3OujCLKYB04C3iJ9znHhuRFvdffbbj4Ka+c1k7yqUgSyR5KDYVbVoQhXgudf2+W+zm4E/umYXUPXya9zpEa/Hgf8VyXNNSfJXMUeiIwAEhljtGQot9HO8n42qS+KZUWv1egL1XXUO5MIC+tc93NtC/RbF11NM+no5dGVH/rPQqfEghnQw6CXVC4w3o8OsIIfojEzm0s2volg6SRg9U9dAYHfOgd4p+h5LR1Rz70fHBl9D9fOfuZPNaFcib9BqzJ24nSJVwMticYwwmiXv59c42iGEh84aN6vH2nPWtMI2vmqlOwnt3T4OCCJ9YYT45luRh/m2ykilXpNl5MycVubxzaWQIJVdZ1KH1WQMUfnZ0BriShZe13LtwxlnMAh8Oy1v0ohRE60XE/1nPm/n2gwe7HNzypnB5NLI7DUjMxe37APM/11xZfGuHd59G7C/IEWX8yPWY670W8L1IWNtCJM7EJ6SmBzq9kDCWQ1EL4TrMMNkY+INaTTF5QD7o218/sk24Wy6/tXogKdmKnkOHcjY6JPoaompR6e+KiTpswT9dgCrZHBl/Kq3IySNwINqZllzij5OZhyOTmHmQmUjuEnDVD+bnfjh5wyJ57ynGv8F9NWZu9ZT2IhkyKFZ1YeW4idHlYjrnbs5JTzxv3olziK1xL9BC+ugUG38W/dSPXyI2ZmSOb+meDZzHJc8S0SdZcluLJaawAqsAcdVAdsuD7Jn6NzI2Tik6t6gE7oxHx1Oji6+KstqtqyE73kG6dAACK 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)(36860700013)(82310400026)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ozGfdZjm85N5IQ4eKPq8Pfc2wC8D9UnMKRLFdwhsJPL5/K6ZIXXup0PeB6WF7lgA+wE1sbJmrol5PwGO2JTTVIKW6PYNerlT4bZnA00eTGGw54OdOAJTee44SgfAwfU8GvNeEHfCbcI/ayxpDNxc2My7NlMlF449HUtDPTLj1PyYsW2W/Wi37l4mwe2/dS9Yl2t8aieTe1CLYi/srru8OGaDtEvFwagt/+OhT+UZllPkBtGXKbGUKURmbOpHI0xWMZ5sms6+rE1wFgOWONDCnzKHACEipTc1sh8ShaPIVFfz0vB/8lYotgDaUd7tk9E0WYjAuZbVLl31CsopFdLiPO1bnUa3B0ObOzl6Eyqz/KMrkCuhZD6P/t4nskmuFm0sg4QD1964UtAzQJOYKJhutSO2ehS/+fkn/jTXlSmUMqoWS8ZYUKeXAVJUZlt+yvP29XZKCIIvRjUfz+nIRk8KvSI6avSpC6PrUG1hNnm6Vga/p0ZMu4hiTf67sYEcPbsbuJSqJqESbr80fUyNVGIZojOeEYPyO5Ukpbm9EgoIqn0KKVm4mbw/965vPhnh94XCKlmX/nOXAf7pxmQB5JuM0mKdKSmFs34H2IbCg2tHwtLxqxLEl8MPXK7DdxJGl3j2/AMqZFkN9U6Ma7/hZuR9Yg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:36.2991 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ea89e5f-a292-4c11-7923-08dce48a5522 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1P190MB0735 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057081-305791-12643-36030-2 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.11.110 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkaGhgamQGYGUNTC0NTSNDXN3N zA2Cgp0dDQMNHcyNTU1MLCzDAp1cQ8Tak2FgDSByYwQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan20-205.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, 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 Introduced functions to set and flush RX and TX used writer data. Added support for setting shadow data with functions for guest physical address, host ID, queue size, packed, interrupt enable, vector, and ISTK for RX and TX. Implemented set_rx_used_writer_data and set_tx_used_writer_data to configure and flush data based on updated shadow structures. Signed-off-by: Danylo Vodopianov --- drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c | 60 +++- drivers/net/ntnic/include/ntnic_dbs.h | 71 ++++ drivers/net/ntnic/nthw/dbs/nthw_dbs.c | 316 ++++++++++++++++++ .../nthw/supported/nthw_fpga_reg_defs_dbs.h | 23 ++ 4 files changed, 468 insertions(+), 2 deletions(-) diff --git a/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c b/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c index 065dac6af0..1df42dad11 100644 --- a/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c +++ b/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c @@ -285,6 +285,19 @@ dbs_initialize_virt_queue_structs(void *avail_struct_addr, void *used_struct_add flgs); } +static uint16_t dbs_qsize_log2(uint16_t qsize) +{ + uint32_t qs = 0; + + while (qsize) { + qsize = qsize >> 1; + ++qs; + } + + --qs; + return qs; +} + static struct nthw_virt_queue *nthw_setup_rx_virt_queue(nthw_dbs_t *p_nthw_dbs, uint32_t index, uint16_t start_idx, @@ -300,7 +313,29 @@ static struct nthw_virt_queue *nthw_setup_rx_virt_queue(nthw_dbs_t *p_nthw_dbs, { (void)header; (void)desc_struct_phys_addr; - (void)used_struct_phys_addr; + uint32_t qs = dbs_qsize_log2(queue_size); + uint32_t int_enable; + uint32_t vec; + uint32_t istk; + + /* + * 4. Configure the DBS.RX_UW_DATA memory; good idea to initialize all + * DBS_RX_QUEUES entries. + * Notice: We always start out with interrupts disabled (by setting the + * "irq_vector" argument to -1). Queues that require interrupts will have + * it enabled at a later time (after we have enabled vfio interrupts in + * the kernel). + */ + int_enable = 0; + vec = 0; + istk = 0; + NT_LOG_DBGX(DBG, NTNIC, "set_rx_uw_data int=0 irq_vector=%u\n", irq_vector); + + if (set_rx_uw_data(p_nthw_dbs, index, + (uint64_t)used_struct_phys_addr, + host_id, qs, 0, int_enable, vec, istk) != 0) { + return NULL; + } /* * 2. Configure the DBS.RX_AM_DATA memory and enable the queues you plan to use; @@ -366,7 +401,28 @@ static struct nthw_virt_queue *nthw_setup_tx_virt_queue(nthw_dbs_t *p_nthw_dbs, { (void)header; (void)desc_struct_phys_addr; - (void)used_struct_phys_addr; + uint32_t int_enable; + uint32_t vec; + uint32_t istk; + uint32_t qs = dbs_qsize_log2(queue_size); + + /* + * 4. Configure the DBS.TX_UW_DATA memory; good idea to initialize all + * DBS_TX_QUEUES entries. + * Notice: We always start out with interrupts disabled (by setting the + * "irq_vector" argument to -1). Queues that require interrupts will have + * it enabled at a later time (after we have enabled vfio interrupts in the + * kernel). + */ + int_enable = 0; + vec = 0; + istk = 0; + + if (set_tx_uw_data(p_nthw_dbs, index, + (uint64_t)used_struct_phys_addr, + host_id, qs, 0, int_enable, vec, istk, in_order) != 0) { + return NULL; + } /* * 2. Configure the DBS.TX_AM_DATA memory and enable the queues you plan to use; diff --git a/drivers/net/ntnic/include/ntnic_dbs.h b/drivers/net/ntnic/include/ntnic_dbs.h index 438f1858f5..f3b5a20739 100644 --- a/drivers/net/ntnic/include/ntnic_dbs.h +++ b/drivers/net/ntnic/include/ntnic_dbs.h @@ -33,6 +33,29 @@ struct nthw_dbs_tx_am_data_s { uint32_t int_enable; }; +/* DBS_RX_UW_DATA */ +struct nthw_dbs_rx_uw_data_s { + uint64_t guest_physical_address; + uint32_t host_id; + uint32_t queue_size; + uint32_t packed; + uint32_t int_enable; + uint32_t vec; + uint32_t istk; +}; + +/* DBS_TX_UW_DATA */ +struct nthw_dbs_tx_uw_data_s { + uint64_t guest_physical_address; + uint32_t host_id; + uint32_t queue_size; + uint32_t packed; + uint32_t int_enable; + uint32_t vec; + uint32_t istk; + uint32_t in_order; +}; + /* DBS_TX_QP_DATA */ struct nthw_dbs_tx_qp_data_s { uint32_t virtual_port; @@ -121,6 +144,33 @@ struct nthw_dbs_s { nthw_field_t *mp_fld_tx_avail_monitor_data_packed; nthw_field_t *mp_fld_tx_avail_monitor_data_int; + nthw_register_t *mp_reg_rx_used_writer_control; + nthw_field_t *mp_fld_rx_used_writer_control_adr; + nthw_field_t *mp_fld_rx_used_writer_control_cnt; + + nthw_register_t *mp_reg_rx_used_writer_data; + nthw_field_t *mp_fld_rx_used_writer_data_guest_physical_address; + nthw_field_t *mp_fld_rx_used_writer_data_host_id; + nthw_field_t *mp_fld_rx_used_writer_data_queue_size; + nthw_field_t *mp_fld_rx_used_writer_data_packed; + nthw_field_t *mp_fld_rx_used_writer_data_int; + nthw_field_t *mp_fld_rx_used_writer_data_vec; + nthw_field_t *mp_fld_rx_used_writer_data_istk; + + nthw_register_t *mp_reg_tx_used_writer_control; + nthw_field_t *mp_fld_tx_used_writer_control_adr; + nthw_field_t *mp_fld_tx_used_writer_control_cnt; + + nthw_register_t *mp_reg_tx_used_writer_data; + nthw_field_t *mp_fld_tx_used_writer_data_guest_physical_address; + nthw_field_t *mp_fld_tx_used_writer_data_host_id; + nthw_field_t *mp_fld_tx_used_writer_data_queue_size; + nthw_field_t *mp_fld_tx_used_writer_data_packed; + nthw_field_t *mp_fld_tx_used_writer_data_int; + nthw_field_t *mp_fld_tx_used_writer_data_vec; + nthw_field_t *mp_fld_tx_used_writer_data_istk; + nthw_field_t *mp_fld_tx_used_writer_data_in_order; + nthw_register_t *mp_reg_tx_queue_property_control; nthw_field_t *mp_fld_tx_queue_property_control_adr; nthw_field_t *mp_fld_tx_queue_property_control_cnt; @@ -129,8 +179,10 @@ struct nthw_dbs_s { nthw_field_t *mp_fld_tx_queue_property_data_v_port; struct nthw_dbs_rx_am_data_s m_rx_am_shadow[NT_DBS_RX_QUEUES_MAX]; + struct nthw_dbs_rx_uw_data_s m_rx_uw_shadow[NT_DBS_RX_QUEUES_MAX]; struct nthw_dbs_tx_am_data_s m_tx_am_shadow[NT_DBS_TX_QUEUES_MAX]; + struct nthw_dbs_tx_uw_data_s m_tx_uw_shadow[NT_DBS_TX_QUEUES_MAX]; struct nthw_dbs_tx_qp_data_s m_tx_qp_shadow[NT_DBS_TX_QUEUES_MAX]; }; @@ -174,6 +226,25 @@ int set_tx_am_data(nthw_dbs_t *p, uint32_t host_id, uint32_t packed, uint32_t int_enable); +int set_rx_uw_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t packed, + uint32_t int_enable, + uint32_t vec, + uint32_t istk); +int set_tx_uw_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t packed, + uint32_t int_enable, + uint32_t vec, + uint32_t istk, + uint32_t in_order); int nthw_dbs_set_tx_qp_data(nthw_dbs_t *p, uint32_t index, uint32_t virtual_port); #endif /* _NTNIC_DBS_H_ */ diff --git a/drivers/net/ntnic/nthw/dbs/nthw_dbs.c b/drivers/net/ntnic/nthw/dbs/nthw_dbs.c index 99a1575036..11453d8d38 100644 --- a/drivers/net/ntnic/nthw/dbs/nthw_dbs.c +++ b/drivers/net/ntnic/nthw/dbs/nthw_dbs.c @@ -11,6 +11,27 @@ static void set_shadow_tx_qp_data(nthw_dbs_t *p, uint32_t index, uint32_t virtual_port); static void flush_tx_qp_data(nthw_dbs_t *p, uint32_t index); +static void set_shadow_tx_uw_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t packed, + uint32_t int_enable, + uint32_t vec, + uint32_t istk, + uint32_t in_order); +static void flush_tx_uw_data(nthw_dbs_t *p, uint32_t index); +static void set_shadow_rx_uw_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t packed, + uint32_t int_enable, + uint32_t vec, + uint32_t istk); +static void flush_rx_uw_data(nthw_dbs_t *p, uint32_t index); static void set_shadow_rx_am_data(nthw_dbs_t *p, uint32_t index, uint64_t guest_physical_address, @@ -199,6 +220,52 @@ int dbs_init(nthw_dbs_t *p, nthw_fpga_t *p_fpga, int n_instance) p->mp_fld_tx_avail_monitor_data_int = nthw_register_query_field(p->mp_reg_tx_avail_monitor_data, DBS_TX_AM_DATA_INT); + p->mp_reg_rx_used_writer_control = nthw_module_get_register(p->mp_mod_dbs, DBS_RX_UW_CTRL); + p->mp_fld_rx_used_writer_control_adr = + nthw_register_get_field(p->mp_reg_rx_used_writer_control, DBS_RX_UW_CTRL_ADR); + p->mp_fld_rx_used_writer_control_cnt = + nthw_register_get_field(p->mp_reg_rx_used_writer_control, DBS_RX_UW_CTRL_CNT); + + p->mp_reg_rx_used_writer_data = nthw_module_get_register(p->mp_mod_dbs, DBS_RX_UW_DATA); + p->mp_fld_rx_used_writer_data_guest_physical_address = + nthw_register_get_field(p->mp_reg_rx_used_writer_data, DBS_RX_UW_DATA_GPA); + p->mp_fld_rx_used_writer_data_host_id = + nthw_register_get_field(p->mp_reg_rx_used_writer_data, DBS_RX_UW_DATA_HID); + p->mp_fld_rx_used_writer_data_queue_size = + nthw_register_get_field(p->mp_reg_rx_used_writer_data, DBS_RX_UW_DATA_QS); + p->mp_fld_rx_used_writer_data_packed = + nthw_register_query_field(p->mp_reg_rx_used_writer_data, DBS_RX_UW_DATA_PCKED); + p->mp_fld_rx_used_writer_data_int = + nthw_register_query_field(p->mp_reg_rx_used_writer_data, DBS_RX_UW_DATA_INT); + p->mp_fld_rx_used_writer_data_vec = + nthw_register_query_field(p->mp_reg_rx_used_writer_data, DBS_RX_UW_DATA_VEC); + p->mp_fld_rx_used_writer_data_istk = + nthw_register_query_field(p->mp_reg_rx_used_writer_data, DBS_RX_UW_DATA_ISTK); + + p->mp_reg_tx_used_writer_control = nthw_module_get_register(p->mp_mod_dbs, DBS_TX_UW_CTRL); + p->mp_fld_tx_used_writer_control_adr = + nthw_register_get_field(p->mp_reg_tx_used_writer_control, DBS_TX_UW_CTRL_ADR); + p->mp_fld_tx_used_writer_control_cnt = + nthw_register_get_field(p->mp_reg_tx_used_writer_control, DBS_TX_UW_CTRL_CNT); + + p->mp_reg_tx_used_writer_data = nthw_module_get_register(p->mp_mod_dbs, DBS_TX_UW_DATA); + p->mp_fld_tx_used_writer_data_guest_physical_address = + nthw_register_get_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_GPA); + p->mp_fld_tx_used_writer_data_host_id = + nthw_register_get_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_HID); + p->mp_fld_tx_used_writer_data_queue_size = + nthw_register_get_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_QS); + p->mp_fld_tx_used_writer_data_packed = + nthw_register_query_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_PCKED); + p->mp_fld_tx_used_writer_data_int = + nthw_register_query_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_INT); + p->mp_fld_tx_used_writer_data_vec = + nthw_register_query_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_VEC); + p->mp_fld_tx_used_writer_data_istk = + nthw_register_query_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_ISTK); + p->mp_fld_tx_used_writer_data_in_order = + nthw_register_query_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_INO); + p->mp_reg_tx_queue_property_control = nthw_module_get_register(p->mp_mod_dbs, DBS_TX_QP_CTRL); p->mp_fld_tx_queue_property_control_adr = @@ -247,6 +314,9 @@ void dbs_reset(nthw_dbs_t *p) for (i = 0; i < NT_DBS_RX_QUEUES_MAX; ++i) { set_shadow_rx_am_data(p, i, 0, 0, 0, 0, 0); flush_rx_am_data(p, i); + + set_shadow_rx_uw_data(p, i, 0, 0, 0, 0, 0, 0, 0); + flush_rx_uw_data(p, i); } /* Reset TX memory banks and shado */ @@ -254,6 +324,9 @@ void dbs_reset(nthw_dbs_t *p) set_shadow_tx_am_data(p, i, 0, 0, 0, 0, 0); flush_tx_am_data(p, i); + set_shadow_tx_uw_data(p, i, 0, 0, 0, 0, 0, 0, 0, 0); + flush_tx_uw_data(p, i); + set_shadow_tx_qp_data(p, i, 0); flush_tx_qp_data(p, i); } @@ -491,6 +564,249 @@ int set_tx_am_data(nthw_dbs_t *p, return 0; } +static void set_rx_uw_data_index(nthw_dbs_t *p, uint32_t index) +{ + nthw_field_set_val32(p->mp_fld_rx_used_writer_control_adr, index); + nthw_field_set_val32(p->mp_fld_rx_used_writer_control_cnt, 1); + nthw_register_flush(p->mp_reg_rx_used_writer_control, 1); +} + +static void set_shadow_rx_uw_data_guest_physical_address(nthw_dbs_t *p, uint32_t index, + uint64_t guest_physical_address) +{ + p->m_rx_uw_shadow[index].guest_physical_address = guest_physical_address; +} + +static void set_shadow_rx_uw_data_host_id(nthw_dbs_t *p, uint32_t index, uint32_t host_id) +{ + p->m_rx_uw_shadow[index].host_id = host_id; +} + +static void set_shadow_rx_uw_data_queue_size(nthw_dbs_t *p, uint32_t index, uint32_t queue_size) +{ + p->m_rx_uw_shadow[index].queue_size = queue_size; +} + +static void set_shadow_rx_uw_data_packed(nthw_dbs_t *p, uint32_t index, uint32_t packed) +{ + p->m_rx_uw_shadow[index].packed = packed; +} + +static void set_shadow_rx_uw_data_int_enable(nthw_dbs_t *p, uint32_t index, uint32_t int_enable) +{ + p->m_rx_uw_shadow[index].int_enable = int_enable; +} + +static void set_shadow_rx_uw_data_vec(nthw_dbs_t *p, uint32_t index, uint32_t vec) +{ + p->m_rx_uw_shadow[index].vec = vec; +} + +static void set_shadow_rx_uw_data_istk(nthw_dbs_t *p, uint32_t index, uint32_t istk) +{ + p->m_rx_uw_shadow[index].istk = istk; +} + +static void set_shadow_rx_uw_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t packed, + uint32_t int_enable, + uint32_t vec, + uint32_t istk) +{ + set_shadow_rx_uw_data_guest_physical_address(p, index, guest_physical_address); + set_shadow_rx_uw_data_host_id(p, index, host_id); + set_shadow_rx_uw_data_queue_size(p, index, queue_size); + set_shadow_rx_uw_data_packed(p, index, packed); + set_shadow_rx_uw_data_int_enable(p, index, int_enable); + set_shadow_rx_uw_data_vec(p, index, vec); + set_shadow_rx_uw_data_istk(p, index, istk); +} + +static void flush_rx_uw_data(nthw_dbs_t *p, uint32_t index) +{ + nthw_field_set_val(p->mp_fld_rx_used_writer_data_guest_physical_address, + (uint32_t *)&p->m_rx_uw_shadow[index].guest_physical_address, 2); + nthw_field_set_val32(p->mp_fld_rx_used_writer_data_host_id, + p->m_rx_uw_shadow[index].host_id); + + if (nthw_module_is_version_newer(p->mp_mod_dbs, 0, 8)) { + nthw_field_set_val32(p->mp_fld_rx_used_writer_data_queue_size, + (1U << p->m_rx_uw_shadow[index].queue_size) - 1U); + + } else { + nthw_field_set_val32(p->mp_fld_rx_used_writer_data_queue_size, + p->m_rx_uw_shadow[index].queue_size); + } + + if (p->mp_fld_rx_used_writer_data_packed) { + nthw_field_set_val32(p->mp_fld_rx_used_writer_data_packed, + p->m_rx_uw_shadow[index].packed); + } + + if (p->mp_fld_rx_used_writer_data_int) { + nthw_field_set_val32(p->mp_fld_rx_used_writer_data_int, + p->m_rx_uw_shadow[index].int_enable); + nthw_field_set_val32(p->mp_fld_rx_used_writer_data_vec, + p->m_rx_uw_shadow[index].vec); + nthw_field_set_val32(p->mp_fld_rx_used_writer_data_istk, + p->m_rx_uw_shadow[index].istk); + } + + set_rx_uw_data_index(p, index); + nthw_register_flush(p->mp_reg_rx_used_writer_data, 1); +} + +int set_rx_uw_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t packed, + uint32_t int_enable, + uint32_t vec, + uint32_t istk) +{ + if (!p->mp_reg_rx_used_writer_data) + return -ENOTSUP; + + set_shadow_rx_uw_data(p, index, guest_physical_address, host_id, queue_size, packed, + int_enable, vec, istk); + flush_rx_uw_data(p, index); + return 0; +} + +static void set_tx_uw_data_index(nthw_dbs_t *p, uint32_t index) +{ + nthw_field_set_val32(p->mp_fld_tx_used_writer_control_adr, index); + nthw_field_set_val32(p->mp_fld_tx_used_writer_control_cnt, 1); + nthw_register_flush(p->mp_reg_tx_used_writer_control, 1); +} + +static void set_shadow_tx_uw_data_guest_physical_address(nthw_dbs_t *p, uint32_t index, + uint64_t guest_physical_address) +{ + p->m_tx_uw_shadow[index].guest_physical_address = guest_physical_address; +} + +static void set_shadow_tx_uw_data_host_id(nthw_dbs_t *p, uint32_t index, uint32_t host_id) +{ + p->m_tx_uw_shadow[index].host_id = host_id; +} + +static void set_shadow_tx_uw_data_queue_size(nthw_dbs_t *p, uint32_t index, uint32_t queue_size) +{ + p->m_tx_uw_shadow[index].queue_size = queue_size; +} + +static void set_shadow_tx_uw_data_packed(nthw_dbs_t *p, uint32_t index, uint32_t packed) +{ + p->m_tx_uw_shadow[index].packed = packed; +} + +static void set_shadow_tx_uw_data_int_enable(nthw_dbs_t *p, uint32_t index, uint32_t int_enable) +{ + p->m_tx_uw_shadow[index].int_enable = int_enable; +} + +static void set_shadow_tx_uw_data_vec(nthw_dbs_t *p, uint32_t index, uint32_t vec) +{ + p->m_tx_uw_shadow[index].vec = vec; +} + +static void set_shadow_tx_uw_data_istk(nthw_dbs_t *p, uint32_t index, uint32_t istk) +{ + p->m_tx_uw_shadow[index].istk = istk; +} + +static void set_shadow_tx_uw_data_in_order(nthw_dbs_t *p, uint32_t index, uint32_t in_order) +{ + p->m_tx_uw_shadow[index].in_order = in_order; +} + +static void set_shadow_tx_uw_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t packed, + uint32_t int_enable, + uint32_t vec, + uint32_t istk, + uint32_t in_order) +{ + set_shadow_tx_uw_data_guest_physical_address(p, index, guest_physical_address); + set_shadow_tx_uw_data_host_id(p, index, host_id); + set_shadow_tx_uw_data_queue_size(p, index, queue_size); + set_shadow_tx_uw_data_packed(p, index, packed); + set_shadow_tx_uw_data_int_enable(p, index, int_enable); + set_shadow_tx_uw_data_vec(p, index, vec); + set_shadow_tx_uw_data_istk(p, index, istk); + set_shadow_tx_uw_data_in_order(p, index, in_order); +} + +static void flush_tx_uw_data(nthw_dbs_t *p, uint32_t index) +{ + nthw_field_set_val(p->mp_fld_tx_used_writer_data_guest_physical_address, + (uint32_t *)&p->m_tx_uw_shadow[index].guest_physical_address, 2); + nthw_field_set_val32(p->mp_fld_tx_used_writer_data_host_id, + p->m_tx_uw_shadow[index].host_id); + + if (nthw_module_is_version_newer(p->mp_mod_dbs, 0, 8)) { + nthw_field_set_val32(p->mp_fld_tx_used_writer_data_queue_size, + (1U << p->m_tx_uw_shadow[index].queue_size) - 1U); + + } else { + nthw_field_set_val32(p->mp_fld_tx_used_writer_data_queue_size, + p->m_tx_uw_shadow[index].queue_size); + } + + if (p->mp_fld_tx_used_writer_data_packed) { + nthw_field_set_val32(p->mp_fld_tx_used_writer_data_packed, + p->m_tx_uw_shadow[index].packed); + } + + if (p->mp_fld_tx_used_writer_data_int) { + nthw_field_set_val32(p->mp_fld_tx_used_writer_data_int, + p->m_tx_uw_shadow[index].int_enable); + nthw_field_set_val32(p->mp_fld_tx_used_writer_data_vec, + p->m_tx_uw_shadow[index].vec); + nthw_field_set_val32(p->mp_fld_tx_used_writer_data_istk, + p->m_tx_uw_shadow[index].istk); + } + + if (p->mp_fld_tx_used_writer_data_in_order) { + nthw_field_set_val32(p->mp_fld_tx_used_writer_data_in_order, + p->m_tx_uw_shadow[index].in_order); + } + + set_tx_uw_data_index(p, index); + nthw_register_flush(p->mp_reg_tx_used_writer_data, 1); +} + +int set_tx_uw_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t packed, + uint32_t int_enable, + uint32_t vec, + uint32_t istk, + uint32_t in_order) +{ + if (!p->mp_reg_tx_used_writer_data) + return -ENOTSUP; + + set_shadow_tx_uw_data(p, index, guest_physical_address, host_id, queue_size, packed, + int_enable, vec, istk, in_order); + flush_tx_uw_data(p, index); + return 0; +} + static void set_tx_qp_data_index(nthw_dbs_t *p, uint32_t index) { nthw_field_set_val32(p->mp_fld_tx_queue_property_control_adr, index); diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h index 00570fa8af..c6c23de0ef 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h @@ -45,6 +45,17 @@ #define DBS_RX_PTR_PTR (0x7f834481UL) #define DBS_RX_PTR_QUEUE (0x4f3fa6d1UL) #define DBS_RX_PTR_VALID (0xbcc5ec4dUL) +#define DBS_RX_UW_CTRL (0x31afc0deUL) +#define DBS_RX_UW_CTRL_ADR (0x2ee4a2c9UL) +#define DBS_RX_UW_CTRL_CNT (0x3eec3b18UL) +#define DBS_RX_UW_DATA (0x9e7e42c7UL) +#define DBS_RX_UW_DATA_GPA (0x9193d52cUL) +#define DBS_RX_UW_DATA_HID (0x71a5cf86UL) +#define DBS_RX_UW_DATA_INT (0x22912312UL) +#define DBS_RX_UW_DATA_ISTK (0xd469a7ddUL) +#define DBS_RX_UW_DATA_PCKED (0xef15c665UL) +#define DBS_RX_UW_DATA_QS (0x7d422f44UL) +#define DBS_RX_UW_DATA_VEC (0x55cc9b53UL) #define DBS_STATUS (0xb5f35220UL) #define DBS_STATUS_OK (0xcf09a30fUL) #define DBS_TX_AM_CTRL (0xd6d29b9UL) @@ -94,6 +105,18 @@ #define DBS_TX_QP_CTRL_CNT (0x942b1855UL) #define DBS_TX_QP_DATA (0x7a2a262bUL) #define DBS_TX_QP_DATA_VPORT (0xda741d67UL) +#define DBS_TX_UW_CTRL (0x3cb1b099UL) +#define DBS_TX_UW_CTRL_ADR (0xd626e97fUL) +#define DBS_TX_UW_CTRL_CNT (0xc62e70aeUL) +#define DBS_TX_UW_DATA (0x93603280UL) +#define DBS_TX_UW_DATA_GPA (0x69519e9aUL) +#define DBS_TX_UW_DATA_HID (0x89678430UL) +#define DBS_TX_UW_DATA_INO (0x5036a148UL) +#define DBS_TX_UW_DATA_INT (0xda5368a4UL) +#define DBS_TX_UW_DATA_ISTK (0xf693732fUL) +#define DBS_TX_UW_DATA_PCKED (0xbc84af81UL) +#define DBS_TX_UW_DATA_QS (0xdda7f099UL) +#define DBS_TX_UW_DATA_VEC (0xad0ed0e5UL) #endif /* _NTHW_FPGA_REG_DEFS_DBS_ */ From patchwork Fri Oct 4 15:35:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145118 X-Patchwork-Delegate: ferruh.yigit@amd.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 B818A45AAF; Fri, 4 Oct 2024 17:55:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 028FC42EF1; Fri, 4 Oct 2024 17:51:43 +0200 (CEST) Received: from egress-ip42b.ess.de.barracuda.com (egress-ip42b.ess.de.barracuda.com [18.185.115.246]) by mails.dpdk.org (Postfix) with ESMTP id 4BE1A42EDA for ; Fri, 4 Oct 2024 17:51:38 +0200 (CEST) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02lp2045.outbound.protection.outlook.com [104.47.11.45]) by mx-outbound22-159.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:51:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=t6jzt8YMfZhguutYxVkci6caK3z6mJLZx88TdALZgBseEKWXFQSgChhodn+HfXnVMQHFDjPYuuZoLgW9k1UwQGcvkNTgqYHXVV9t+LvfxwD0ByXWMzxL7e05lP3gWOirRTzOoPU48rn1aHCcRMpPSaaNrB8XcOrEVbptsshtwgujuH8U/NWeVA0KIhQYtW5iyvkKFMZh684pqBnusmpCASCd6FL9TnfqqG2IXx7NJi7qZsaLeK/qVQwnc2uzzM+VYLYYGZwkZtAzCRGuGrIA61lWuKM7PUJmF8eowLP7gqDLkKnIn5KccXbw401vdgl6Mh/Z/fnyCiVAsVR0LXoFuA== 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=euIma8xIGzlfvCepZyLZ2n+mwmyhh2riFhBUYipISr8=; b=iKW+Hw4z+VdrirPPuCdxjIsLUKxPhXf4ihFzNIVf9vEUyh2waEb9QYJh+9F1wg5+orEqwDQGklXwPGa22Q3kQ8jBl9da17iHWMJEoopcBbnUUj9fFQqpTUHLb47ZdlvuVmiHiuN6m19sMeN4kCrpKJWTk9JaVMqUsYhdoF0xZEVbg8LXtsmKdXSCJWb2kn8R/6WA8D0lLOIFqIRyBnlGiI/QUYlfgrSLPhsgh35lcnqAIzehV5JW7Xl8zxnYuu5qVhJnkvvmgGTId9VDTGDGyMp0tKYg0X9rwANVFge2O/qMfn5M0yfvUoTZsgse90YvztmoArZ3nCWzDM5xDRB3hw== 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=euIma8xIGzlfvCepZyLZ2n+mwmyhh2riFhBUYipISr8=; b=m+EYS07XILcywYlhfnFN+0M4vA6Kg1m3VBFekwZ9tpU1oyw5m6a2c0d18g0LeQWqipXHsdX7YKMSCQ4MF1oOcoj91D+D/ZU+dwtZPWlRI4sJJ0gbNmtU8T1dbkqB6YOi0SzLAAj13i9C385+McgNK5JMp8WOtV1XinBxNy7CKb4= Received: from AM0PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::18) by DB8P190MB0793.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:fc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 15:36:37 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::d2) by AM0PR10CA0101.outlook.office365.com (2603:10a6:208:e6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:37 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:37 +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 10/14] net/ntnic: add descriptor reader data handling functions Date: Fri, 4 Oct 2024 17:35:04 +0200 Message-ID: <20241004153551.267935-47-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|DB8P190MB0793:EE_ X-MS-Office365-Filtering-Correlation-Id: 8cd01d34-8e7c-4c00-fb83-08dce48a55c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: 2BpQoFWpEm7efmb4hsaxw5fgkMm3J355oSbY14jpW4vmtRbkn7CvBNdxuMCQFpsvMuRLdyQ1P/310LPWKejeiEjwh6kjnhzLAQ1eB4ef8qqpu5XcueMbkvBx17HM4KXO99yyuFmsVDpXoXZsHadvXNmDthC/PS3E3AhcKDnV40XkCyJov67JS5AyPeulhKidyK8EARyUki0Zxd9HFcck+w2KjROYTM9J2pUa7Hi5KOQc1cw8UgLxdrzI8mc7dtI91QKAbzLdCGjQ2apY961LZ+mYrREJZR/kOPD6so1v38u8r82C6bT6dTTMc2+BSMEjaWqgWqMZsBik9jCGbOiPj2nBo/00ZTRoVdzz37tsb/eX7ws7agAhd+yjjMX21gcBQG+kbmsSVq2T2SysuwsOFglfIB7g6/FrKFuvl/k+CIfyCa8UFx/Y/zdpi6SF8sQ5d0lgVdaKUpcPm66RiKSp+6l8JyDEB5K+mSq4PqlRur7bo8gY007rN0LsN/Ol/vIwL5E9dHzwm7MkPy46ou0qvrffAHVvS2n1OxwBZseJG2/VEPGj3a1DwfofFZfP/Qhtrgmx9HIguu7ZoNM2QvAPY+/n/FuWx8hTSMwBFrMfIpjUyAC4QTPJLetlF4nWUsDI400+nlB6TW49+FU5jezmTj1Tt5zxmx26DulY9LVIHZ7czZDtTrqxPCsmiVml/IfTXg0PaUzCcFS+QmQrdmaJH+OqWxMpRwTEQ+HJOrniryOQdf/C/yhzMjTIEDeJxSmFWMl15YoMBehe3mqFGmZkBln35SnXkyRhPApaxLXECiwDRGYtljkx6xqlf3DBmUfge4fPbh/qcRTA/KfAO4OpKBb3FL/h/yfrkkP9DQ/aB9/nKDXSAzTZ8IHhXLiDMDwmG+W5/usaLO9IunlCbidcBp01uYtks9GUUCIZrlhH4xtaW3cctlwmJyL2/eX03c2EWyfweIR2j0iQ1qLLP8056onWypu02Yo4ICRRSM0iD8GUcoQ6Hapl/7/IxEFZk2DhjhYuWb9in7ilqtAo5gGMUQ46sjxMA7acM/is7RBn6gGy6OTYHFKbEeWubyBCP/x81iybUviOamaG4Q8r2RJ5zt3j+LwaD6nbZ3vvorCIdq7CKy8BVU0Z/IVN92r13Ktxoh+IoLJ8kkRHpzVk0eKxedmemOpPgCPBOKN5Ua1lBl/vTEF1bJ75wWQ4PMOC0PeBB55/OnyIWhN8w6yJogw4w3ObK68samljrONfInIM1d24QMg8UQfHKLQFAtF/WiOQ+e+ac7Joa1goszg1rMx9esrjs892zk4y992AI9Q4L7McgqM0eCpVpRhT+ac/XOYII10paesQcdOobxXmWzF+AcOTt4OMkgFH8uvc+FYTvup/3hdF3jywK9O14171XU6Q 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)(376014)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: BhidA/7FtUC1kacQdXN8Ka5whssUOwY+wdTC5xlqwm4F56mRC1ssFTznXxaHl8PXKzEV6h472NcYXF9GKGohaJCpmRxiqoKV0Ok34wvMQXgsqst9UHJOBnHDL6p8da4RvXT3E6na7a01TcG0aZ9sWeJM71BREYDK6jneafIZaqZehMTBQYps2B9LvEzzpi/UV5Nz9N70GMi6qQclIbf33woSLTW6rECF40jmhDTXhAnUd75qYSGIu79C2aL81x2DWPqhBEtZn4KA+SFBCF5m1+7Id42WbcPsrN/9ImD2oKDIpqk8O3yGAz7pi3abjRyIrHBcl+PKmsWziq2k9EG+x011szCvocAnEV7iAXLNxl4xKZO6FB6UMHSKHyLxvJAmUYgb9EebBgvZjt1Wy6ttn3Z+Y1njrvRfQECat/5mhKlQ+/ekV/cvgWZI38mnXX6cNPnHi4zqKpf/xiOMO1BavzSpp4hKKrNJ5Bgc+ZgIXOoaS2HwUSeDp4dy7GSNtf9v86Ixs//kgMKHrWS3a2WMBYOk4Prw0DGYZHISPZpQZDCN8YiRvq6BLkIBSuxvYto3cPDLnHHK+8sx2bTZmKKULVIhpISDwqsSONYqMKM6WPO0cGqrNgQDKppEBXyRSemrwLYyyTo+IZkwHA/AukwWCw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:37.3303 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8cd01d34-8e7c-4c00-fb83-08dce48a55c6 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8P190MB0793 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057096-305791-12646-36048-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.11.45 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaWhpbGQGYGUNTYwtQ81czINN EsMTXR0tQyOS3Z3DjZ1MjMzCTZJNUsUak2FgBmPzidQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan21-181.eu-central-1b.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 Added functions for setting and flushing RX and TX descriptor reader data. Implemented internal strcutres to update shadow structures with guest physical address, host ID, queue size, header, and packed status. Signed-off-by: Danylo Vodopianov --- drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c | 30 +- drivers/net/ntnic/include/ntnic_dbs.h | 59 ++++ drivers/net/ntnic/nthw/dbs/nthw_dbs.c | 267 ++++++++++++++++++ .../nthw/supported/nthw_fpga_reg_defs_dbs.h | 19 ++ 4 files changed, 371 insertions(+), 4 deletions(-) diff --git a/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c b/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c index 1df42dad11..5232a95eaa 100644 --- a/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c +++ b/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c @@ -104,6 +104,8 @@ struct nthw_virt_queue { * 1: Napatech DVIO0 descriptor (12 bytes). */ void *avail_struct_phys_addr; + void *used_struct_phys_addr; + void *desc_struct_phys_addr; }; static struct nthw_virt_queue rxvq[MAX_VIRT_QUEUES]; @@ -311,13 +313,21 @@ static struct nthw_virt_queue *nthw_setup_rx_virt_queue(nthw_dbs_t *p_nthw_dbs, uint32_t vq_type, int irq_vector) { - (void)header; - (void)desc_struct_phys_addr; uint32_t qs = dbs_qsize_log2(queue_size); uint32_t int_enable; uint32_t vec; uint32_t istk; + /* + * Setup DBS module - DSF00094 + * 3. Configure the DBS.RX_DR_DATA memory; good idea to initialize all + * DBS_RX_QUEUES entries. + */ + if (set_rx_dr_data(p_nthw_dbs, index, (uint64_t)desc_struct_phys_addr, host_id, qs, header, + 0) != 0) { + return NULL; + } + /* * 4. Configure the DBS.RX_UW_DATA memory; good idea to initialize all * DBS_RX_QUEUES entries. @@ -375,6 +385,8 @@ static struct nthw_virt_queue *nthw_setup_rx_virt_queue(nthw_dbs_t *p_nthw_dbs, rxvq[index].am_enable = (irq_vector < 0) ? RX_AM_ENABLE : RX_AM_DISABLE; rxvq[index].host_id = host_id; rxvq[index].avail_struct_phys_addr = avail_struct_phys_addr; + rxvq[index].used_struct_phys_addr = used_struct_phys_addr; + rxvq[index].desc_struct_phys_addr = desc_struct_phys_addr; rxvq[index].vq_type = vq_type; rxvq[index].in_order = 0; /* not used */ rxvq[index].irq_vector = irq_vector; @@ -399,13 +411,21 @@ static struct nthw_virt_queue *nthw_setup_tx_virt_queue(nthw_dbs_t *p_nthw_dbs, int irq_vector, uint32_t in_order) { - (void)header; - (void)desc_struct_phys_addr; uint32_t int_enable; uint32_t vec; uint32_t istk; uint32_t qs = dbs_qsize_log2(queue_size); + /* + * Setup DBS module - DSF00094 + * 3. Configure the DBS.TX_DR_DATA memory; good idea to initialize all + * DBS_TX_QUEUES entries. + */ + if (set_tx_dr_data(p_nthw_dbs, index, (uint64_t)desc_struct_phys_addr, host_id, qs, port, + header, 0) != 0) { + return NULL; + } + /* * 4. Configure the DBS.TX_UW_DATA memory; good idea to initialize all * DBS_TX_QUEUES entries. @@ -468,6 +488,8 @@ static struct nthw_virt_queue *nthw_setup_tx_virt_queue(nthw_dbs_t *p_nthw_dbs, txvq[index].port = port; txvq[index].virtual_port = virtual_port; txvq[index].avail_struct_phys_addr = avail_struct_phys_addr; + txvq[index].used_struct_phys_addr = used_struct_phys_addr; + txvq[index].desc_struct_phys_addr = desc_struct_phys_addr; txvq[index].vq_type = vq_type; txvq[index].in_order = in_order; txvq[index].irq_vector = irq_vector; diff --git a/drivers/net/ntnic/include/ntnic_dbs.h b/drivers/net/ntnic/include/ntnic_dbs.h index f3b5a20739..64947b4d8f 100644 --- a/drivers/net/ntnic/include/ntnic_dbs.h +++ b/drivers/net/ntnic/include/ntnic_dbs.h @@ -56,6 +56,25 @@ struct nthw_dbs_tx_uw_data_s { uint32_t in_order; }; +/* DBS_RX_DR_DATA */ +struct nthw_dbs_rx_dr_data_s { + uint64_t guest_physical_address; + uint32_t host_id; + uint32_t queue_size; + uint32_t header; + uint32_t packed; +}; + +/* DBS_TX_DR_DATA */ +struct nthw_dbs_tx_dr_data_s { + uint64_t guest_physical_address; + uint32_t host_id; + uint32_t queue_size; + uint32_t header; + uint32_t port; + uint32_t packed; +}; + /* DBS_TX_QP_DATA */ struct nthw_dbs_tx_qp_data_s { uint32_t virtual_port; @@ -171,6 +190,29 @@ struct nthw_dbs_s { nthw_field_t *mp_fld_tx_used_writer_data_istk; nthw_field_t *mp_fld_tx_used_writer_data_in_order; + nthw_register_t *mp_reg_rx_descriptor_reader_control; + nthw_field_t *mp_fld_rx_descriptor_reader_control_adr; + nthw_field_t *mp_fld_rx_descriptor_reader_control_cnt; + + nthw_register_t *mp_reg_rx_descriptor_reader_data; + nthw_field_t *mp_fld_rx_descriptor_reader_data_guest_physical_address; + nthw_field_t *mp_fld_rx_descriptor_reader_data_host_id; + nthw_field_t *mp_fld_rx_descriptor_reader_data_queue_size; + nthw_field_t *mp_fld_rx_descriptor_reader_data_header; + nthw_field_t *mp_fld_rx_descriptor_reader_data_packed; + + nthw_register_t *mp_reg_tx_descriptor_reader_control; + nthw_field_t *mp_fld_tx_descriptor_reader_control_adr; + nthw_field_t *mp_fld_tx_descriptor_reader_control_cnt; + + nthw_register_t *mp_reg_tx_descriptor_reader_data; + nthw_field_t *mp_fld_tx_descriptor_reader_data_guest_physical_address; + nthw_field_t *mp_fld_tx_descriptor_reader_data_host_id; + nthw_field_t *mp_fld_tx_descriptor_reader_data_queue_size; + nthw_field_t *mp_fld_tx_descriptor_reader_data_port; + nthw_field_t *mp_fld_tx_descriptor_reader_data_header; + nthw_field_t *mp_fld_tx_descriptor_reader_data_packed; + nthw_register_t *mp_reg_tx_queue_property_control; nthw_field_t *mp_fld_tx_queue_property_control_adr; nthw_field_t *mp_fld_tx_queue_property_control_cnt; @@ -180,9 +222,11 @@ struct nthw_dbs_s { struct nthw_dbs_rx_am_data_s m_rx_am_shadow[NT_DBS_RX_QUEUES_MAX]; struct nthw_dbs_rx_uw_data_s m_rx_uw_shadow[NT_DBS_RX_QUEUES_MAX]; + struct nthw_dbs_rx_dr_data_s m_rx_dr_shadow[NT_DBS_RX_QUEUES_MAX]; struct nthw_dbs_tx_am_data_s m_tx_am_shadow[NT_DBS_TX_QUEUES_MAX]; struct nthw_dbs_tx_uw_data_s m_tx_uw_shadow[NT_DBS_TX_QUEUES_MAX]; + struct nthw_dbs_tx_dr_data_s m_tx_dr_shadow[NT_DBS_TX_QUEUES_MAX]; struct nthw_dbs_tx_qp_data_s m_tx_qp_shadow[NT_DBS_TX_QUEUES_MAX]; }; @@ -245,6 +289,21 @@ int set_tx_uw_data(nthw_dbs_t *p, uint32_t vec, uint32_t istk, uint32_t in_order); +int set_rx_dr_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t header, + uint32_t packed); +int set_tx_dr_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t port, + uint32_t header, + uint32_t packed); int nthw_dbs_set_tx_qp_data(nthw_dbs_t *p, uint32_t index, uint32_t virtual_port); #endif /* _NTNIC_DBS_H_ */ diff --git a/drivers/net/ntnic/nthw/dbs/nthw_dbs.c b/drivers/net/ntnic/nthw/dbs/nthw_dbs.c index 11453d8d38..6e1c5a5af6 100644 --- a/drivers/net/ntnic/nthw/dbs/nthw_dbs.c +++ b/drivers/net/ntnic/nthw/dbs/nthw_dbs.c @@ -11,6 +11,23 @@ static void set_shadow_tx_qp_data(nthw_dbs_t *p, uint32_t index, uint32_t virtual_port); static void flush_tx_qp_data(nthw_dbs_t *p, uint32_t index); +static void set_shadow_tx_dr_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t port, + uint32_t header, + uint32_t packed); +static void flush_tx_dr_data(nthw_dbs_t *p, uint32_t index); +static void set_shadow_rx_dr_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t header, + uint32_t packed); +static void flush_rx_dr_data(nthw_dbs_t *p, uint32_t index); static void set_shadow_tx_uw_data(nthw_dbs_t *p, uint32_t index, uint64_t guest_physical_address, @@ -266,6 +283,54 @@ int dbs_init(nthw_dbs_t *p, nthw_fpga_t *p_fpga, int n_instance) p->mp_fld_tx_used_writer_data_in_order = nthw_register_query_field(p->mp_reg_tx_used_writer_data, DBS_TX_UW_DATA_INO); + p->mp_reg_rx_descriptor_reader_control = + nthw_module_get_register(p->mp_mod_dbs, DBS_RX_DR_CTRL); + p->mp_fld_rx_descriptor_reader_control_adr = + nthw_register_get_field(p->mp_reg_rx_descriptor_reader_control, + DBS_RX_DR_CTRL_ADR); + p->mp_fld_rx_descriptor_reader_control_cnt = + nthw_register_get_field(p->mp_reg_rx_descriptor_reader_control, + DBS_RX_DR_CTRL_CNT); + + p->mp_reg_rx_descriptor_reader_data = + nthw_module_get_register(p->mp_mod_dbs, DBS_RX_DR_DATA); + p->mp_fld_rx_descriptor_reader_data_guest_physical_address = + nthw_register_get_field(p->mp_reg_rx_descriptor_reader_data, DBS_RX_DR_DATA_GPA); + p->mp_fld_rx_descriptor_reader_data_host_id = + nthw_register_get_field(p->mp_reg_rx_descriptor_reader_data, DBS_RX_DR_DATA_HID); + p->mp_fld_rx_descriptor_reader_data_queue_size = + nthw_register_get_field(p->mp_reg_rx_descriptor_reader_data, DBS_RX_DR_DATA_QS); + p->mp_fld_rx_descriptor_reader_data_header = + nthw_register_get_field(p->mp_reg_rx_descriptor_reader_data, DBS_RX_DR_DATA_HDR); + p->mp_fld_rx_descriptor_reader_data_packed = + nthw_register_query_field(p->mp_reg_rx_descriptor_reader_data, + DBS_RX_DR_DATA_PCKED); + + p->mp_reg_tx_descriptor_reader_control = + nthw_module_get_register(p->mp_mod_dbs, DBS_TX_DR_CTRL); + p->mp_fld_tx_descriptor_reader_control_adr = + nthw_register_get_field(p->mp_reg_tx_descriptor_reader_control, + DBS_TX_DR_CTRL_ADR); + p->mp_fld_tx_descriptor_reader_control_cnt = + nthw_register_get_field(p->mp_reg_tx_descriptor_reader_control, + DBS_TX_DR_CTRL_CNT); + + p->mp_reg_tx_descriptor_reader_data = + nthw_module_get_register(p->mp_mod_dbs, DBS_TX_DR_DATA); + p->mp_fld_tx_descriptor_reader_data_guest_physical_address = + nthw_register_get_field(p->mp_reg_tx_descriptor_reader_data, DBS_TX_DR_DATA_GPA); + p->mp_fld_tx_descriptor_reader_data_host_id = + nthw_register_get_field(p->mp_reg_tx_descriptor_reader_data, DBS_TX_DR_DATA_HID); + p->mp_fld_tx_descriptor_reader_data_queue_size = + nthw_register_get_field(p->mp_reg_tx_descriptor_reader_data, DBS_TX_DR_DATA_QS); + p->mp_fld_tx_descriptor_reader_data_header = + nthw_register_get_field(p->mp_reg_tx_descriptor_reader_data, DBS_TX_DR_DATA_HDR); + p->mp_fld_tx_descriptor_reader_data_port = + nthw_register_get_field(p->mp_reg_tx_descriptor_reader_data, DBS_TX_DR_DATA_PORT); + p->mp_fld_tx_descriptor_reader_data_packed = + nthw_register_query_field(p->mp_reg_tx_descriptor_reader_data, + DBS_TX_DR_DATA_PCKED); + p->mp_reg_tx_queue_property_control = nthw_module_get_register(p->mp_mod_dbs, DBS_TX_QP_CTRL); p->mp_fld_tx_queue_property_control_adr = @@ -317,6 +382,9 @@ void dbs_reset(nthw_dbs_t *p) set_shadow_rx_uw_data(p, i, 0, 0, 0, 0, 0, 0, 0); flush_rx_uw_data(p, i); + + set_shadow_rx_dr_data(p, i, 0, 0, 0, 0, 0); + flush_rx_dr_data(p, i); } /* Reset TX memory banks and shado */ @@ -327,6 +395,9 @@ void dbs_reset(nthw_dbs_t *p) set_shadow_tx_uw_data(p, i, 0, 0, 0, 0, 0, 0, 0, 0); flush_tx_uw_data(p, i); + set_shadow_tx_dr_data(p, i, 0, 0, 0, 0, 0, 0); + flush_tx_dr_data(p, i); + set_shadow_tx_qp_data(p, i, 0); flush_tx_qp_data(p, i); } @@ -807,6 +878,202 @@ int set_tx_uw_data(nthw_dbs_t *p, return 0; } +static void set_rx_dr_data_index(nthw_dbs_t *p, uint32_t index) +{ + nthw_field_set_val32(p->mp_fld_rx_descriptor_reader_control_adr, index); + nthw_field_set_val32(p->mp_fld_rx_descriptor_reader_control_cnt, 1); + nthw_register_flush(p->mp_reg_rx_descriptor_reader_control, 1); +} + +static void set_shadow_rx_dr_data_guest_physical_address(nthw_dbs_t *p, uint32_t index, + uint64_t guest_physical_address) +{ + p->m_rx_dr_shadow[index].guest_physical_address = guest_physical_address; +} + +static void set_shadow_rx_dr_data_host_id(nthw_dbs_t *p, uint32_t index, uint32_t host_id) +{ + p->m_rx_dr_shadow[index].host_id = host_id; +} + +static void set_shadow_rx_dr_data_queue_size(nthw_dbs_t *p, uint32_t index, uint32_t queue_size) +{ + p->m_rx_dr_shadow[index].queue_size = queue_size; +} + +static void set_shadow_rx_dr_data_header(nthw_dbs_t *p, uint32_t index, uint32_t header) +{ + p->m_rx_dr_shadow[index].header = header; +} + +static void set_shadow_rx_dr_data_packed(nthw_dbs_t *p, uint32_t index, uint32_t packed) +{ + p->m_rx_dr_shadow[index].packed = packed; +} + +static void set_shadow_rx_dr_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t header, + uint32_t packed) +{ + set_shadow_rx_dr_data_guest_physical_address(p, index, guest_physical_address); + set_shadow_rx_dr_data_host_id(p, index, host_id); + set_shadow_rx_dr_data_queue_size(p, index, queue_size); + set_shadow_rx_dr_data_header(p, index, header); + set_shadow_rx_dr_data_packed(p, index, packed); +} + +static void flush_rx_dr_data(nthw_dbs_t *p, uint32_t index) +{ + nthw_field_set_val(p->mp_fld_rx_descriptor_reader_data_guest_physical_address, + (uint32_t *)&p->m_rx_dr_shadow[index].guest_physical_address, 2); + nthw_field_set_val32(p->mp_fld_rx_descriptor_reader_data_host_id, + p->m_rx_dr_shadow[index].host_id); + + if (nthw_module_is_version_newer(p->mp_mod_dbs, 0, 8)) { + nthw_field_set_val32(p->mp_fld_rx_descriptor_reader_data_queue_size, + (1U << p->m_rx_dr_shadow[index].queue_size) - 1U); + + } else { + nthw_field_set_val32(p->mp_fld_rx_descriptor_reader_data_queue_size, + p->m_rx_dr_shadow[index].queue_size); + } + + nthw_field_set_val32(p->mp_fld_rx_descriptor_reader_data_header, + p->m_rx_dr_shadow[index].header); + + if (p->mp_fld_rx_descriptor_reader_data_packed) { + nthw_field_set_val32(p->mp_fld_rx_descriptor_reader_data_packed, + p->m_rx_dr_shadow[index].packed); + } + + set_rx_dr_data_index(p, index); + nthw_register_flush(p->mp_reg_rx_descriptor_reader_data, 1); +} + +int set_rx_dr_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t header, + uint32_t packed) +{ + if (!p->mp_reg_rx_descriptor_reader_data) + return -ENOTSUP; + + set_shadow_rx_dr_data(p, index, guest_physical_address, host_id, queue_size, header, + packed); + flush_rx_dr_data(p, index); + return 0; +} + +static void set_tx_dr_data_index(nthw_dbs_t *p, uint32_t index) +{ + nthw_field_set_val32(p->mp_fld_tx_descriptor_reader_control_adr, index); + nthw_field_set_val32(p->mp_fld_tx_descriptor_reader_control_cnt, 1); + nthw_register_flush(p->mp_reg_tx_descriptor_reader_control, 1); +} + +static void set_shadow_tx_dr_data_guest_physical_address(nthw_dbs_t *p, uint32_t index, + uint64_t guest_physical_address) +{ + p->m_tx_dr_shadow[index].guest_physical_address = guest_physical_address; +} + +static void set_shadow_tx_dr_data_host_id(nthw_dbs_t *p, uint32_t index, uint32_t host_id) +{ + p->m_tx_dr_shadow[index].host_id = host_id; +} + +static void set_shadow_tx_dr_data_queue_size(nthw_dbs_t *p, uint32_t index, uint32_t queue_size) +{ + p->m_tx_dr_shadow[index].queue_size = queue_size; +} + +static void set_shadow_tx_dr_data_header(nthw_dbs_t *p, uint32_t index, uint32_t header) +{ + p->m_tx_dr_shadow[index].header = header; +} + +static void set_shadow_tx_dr_data_port(nthw_dbs_t *p, uint32_t index, uint32_t port) +{ + p->m_tx_dr_shadow[index].port = port; +} + +static void set_shadow_tx_dr_data_packed(nthw_dbs_t *p, uint32_t index, uint32_t packed) +{ + p->m_tx_dr_shadow[index].packed = packed; +} + +static void set_shadow_tx_dr_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t port, + uint32_t header, + uint32_t packed) +{ + set_shadow_tx_dr_data_guest_physical_address(p, index, guest_physical_address); + set_shadow_tx_dr_data_host_id(p, index, host_id); + set_shadow_tx_dr_data_queue_size(p, index, queue_size); + set_shadow_tx_dr_data_header(p, index, header); + set_shadow_tx_dr_data_port(p, index, port); + set_shadow_tx_dr_data_packed(p, index, packed); +} + +static void flush_tx_dr_data(nthw_dbs_t *p, uint32_t index) +{ + nthw_field_set_val(p->mp_fld_tx_descriptor_reader_data_guest_physical_address, + (uint32_t *)&p->m_tx_dr_shadow[index].guest_physical_address, 2); + nthw_field_set_val32(p->mp_fld_tx_descriptor_reader_data_host_id, + p->m_tx_dr_shadow[index].host_id); + + if (nthw_module_is_version_newer(p->mp_mod_dbs, 0, 8)) { + nthw_field_set_val32(p->mp_fld_tx_descriptor_reader_data_queue_size, + (1U << p->m_tx_dr_shadow[index].queue_size) - 1U); + + } else { + nthw_field_set_val32(p->mp_fld_tx_descriptor_reader_data_queue_size, + p->m_tx_dr_shadow[index].queue_size); + } + + nthw_field_set_val32(p->mp_fld_tx_descriptor_reader_data_header, + p->m_tx_dr_shadow[index].header); + nthw_field_set_val32(p->mp_fld_tx_descriptor_reader_data_port, + p->m_tx_dr_shadow[index].port); + + if (p->mp_fld_tx_descriptor_reader_data_packed) { + nthw_field_set_val32(p->mp_fld_tx_descriptor_reader_data_packed, + p->m_tx_dr_shadow[index].packed); + } + + set_tx_dr_data_index(p, index); + nthw_register_flush(p->mp_reg_tx_descriptor_reader_data, 1); +} + +int set_tx_dr_data(nthw_dbs_t *p, + uint32_t index, + uint64_t guest_physical_address, + uint32_t host_id, + uint32_t queue_size, + uint32_t port, + uint32_t header, + uint32_t packed) +{ + if (!p->mp_reg_tx_descriptor_reader_data) + return -ENOTSUP; + + set_shadow_tx_dr_data(p, index, guest_physical_address, host_id, queue_size, port, header, + packed); + flush_tx_dr_data(p, index); + return 0; +} + static void set_tx_qp_data_index(nthw_dbs_t *p, uint32_t index) { nthw_field_set_val32(p->mp_fld_tx_queue_property_control_adr, index); diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h index c6c23de0ef..0c7bbd8efd 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_dbs.h @@ -30,6 +30,15 @@ #define DBS_RX_CONTROL_QE (0x3e928d3UL) #define DBS_RX_CONTROL_UWE (0xb490e8dbUL) #define DBS_RX_CONTROL_UWS (0x40445d8aUL) +#define DBS_RX_DR_CTRL (0xa0cbc617UL) +#define DBS_RX_DR_CTRL_ADR (0xa7b57286UL) +#define DBS_RX_DR_CTRL_CNT (0xb7bdeb57UL) +#define DBS_RX_DR_DATA (0xf1a440eUL) +#define DBS_RX_DR_DATA_GPA (0x18c20563UL) +#define DBS_RX_DR_DATA_HDR (0xb98ed4d5UL) +#define DBS_RX_DR_DATA_HID (0xf8f41fc9UL) +#define DBS_RX_DR_DATA_PCKED (0x1e27ce2aUL) +#define DBS_RX_DR_DATA_QS (0xffb980ddUL) #define DBS_RX_IDLE (0x93c723bfUL) #define DBS_RX_IDLE_BUSY (0x8e043b5bUL) #define DBS_RX_IDLE_IDLE (0x9dba27ccUL) @@ -74,6 +83,16 @@ #define DBS_TX_CONTROL_QE (0xa30cf70eUL) #define DBS_TX_CONTROL_UWE (0x4c52a36dUL) #define DBS_TX_CONTROL_UWS (0xb886163cUL) +#define DBS_TX_DR_CTRL (0xadd5b650UL) +#define DBS_TX_DR_CTRL_ADR (0x5f773930UL) +#define DBS_TX_DR_CTRL_CNT (0x4f7fa0e1UL) +#define DBS_TX_DR_DATA (0x2043449UL) +#define DBS_TX_DR_DATA_GPA (0xe0004ed5UL) +#define DBS_TX_DR_DATA_HDR (0x414c9f63UL) +#define DBS_TX_DR_DATA_HID (0x36547fUL) +#define DBS_TX_DR_DATA_PCKED (0x4db6a7ceUL) +#define DBS_TX_DR_DATA_PORT (0xf306968cUL) +#define DBS_TX_DR_DATA_QS (0x5f5c5f00UL) #define DBS_TX_IDLE (0xf0171685UL) #define DBS_TX_IDLE_BUSY (0x61399ebbUL) #define DBS_TX_IDLE_IDLE (0x7287822cUL) From patchwork Fri Oct 4 15:35:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145109 X-Patchwork-Delegate: ferruh.yigit@amd.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 8A81245AAF; Fri, 4 Oct 2024 17:54:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE46C42E77; Fri, 4 Oct 2024 17:51:28 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id DB17D42E90 for ; Fri, 4 Oct 2024 17:51:24 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2105.outbound.protection.outlook.com [104.47.17.105]) by mx-outbound8-201.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:51:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iheGQ+8jVziSsvDPactGxkNrHuOxFsndxp3AgYDIY48PLj50YGehCz8rjpGP7NOQd7ugskusLHm7be1jJdjFFUUgqN16PtaSPMq//gTuEJ0IUMI2HqXO45le+25ozp+Ij01uZavi6u9A/P4oO0vS+0gr3JKhsZ3GfcA58CeHkjZ2aGFDkjpe1VRrQT+NIH7UBTQbE3Hc2hFNDonykNe40EJZ6SUNcrAIaLQjVoWXXKIut/Kn9kTMrZ45Uc/Da9yYJ1T3lNUvVRSu9sAbXKAZGV7NbCTNbUNkbEr+1Krye6kRyT4oMLGWpAf94BD1ETWvgSCn23QVErQUeuoqpSdAPA== 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=4XLft5na3I04QiHjYdk5JW435J6vqBFNWzVKQZRDGTM=; b=OouYV2B/a9Xq6dyBvnJKRlyki5vGgm4I1Mzez0SjR0DVBwO0q4a5Skd/pWLHqZtnXp4RhOLSYDXvbIDMp0J/Wxo/2shZfrFClVULEqhu9guURVVVoLUFMmdw9SjFaDb+U11YUMFe5sFBUmKN4sRfDfUqJPBSRUL8XRkWRZNU5LZvAEaoaKlurcUxnOZ59CLbpj67LNXuYdnOQEojwNTiKK0NggkCiAuP1TW1e+PixJnbYSrH7t6/p8zRFhKKVENLnmOAjPciZ6vYeUomi8/J9wqRt9t3eqBur2pp/01cuIDiWKoPXTCqEycuePnc2+wogFMBBnuuvfZw96t87VEIYw== 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=4XLft5na3I04QiHjYdk5JW435J6vqBFNWzVKQZRDGTM=; b=Dxgk9u82+mODz0A1B6EAL76I979QI8b5+51voPWu6St1vtqx+P5Xbm+bA2HWXihk6SjiOTdgMuu8ys0EddTlbPFIAcomqDCQ4/58pDlL07v+l/54DzIQxvtRSyLXZSZuimei8uud6Xfq4sLnnZXTP2zAwtRq1T9Kn+F67aLNzug= Received: from AM0PR10CA0106.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::23) by DBAP190MB0920.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:1a7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.17; Fri, 4 Oct 2024 15:36:38 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::af) by AM0PR10CA0106.outlook.office365.com (2603:10a6:208:e6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:38 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:38 +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 Subject: [PATCH v1 11/14] net/ntnic: update FPGA registeris related to DBS Date: Fri, 4 Oct 2024 17:35:05 +0200 Message-ID: <20241004153551.267935-48-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|DBAP190MB0920:EE_ X-MS-Office365-Filtering-Correlation-Id: a66f0fff-f8b6-4e7b-80b4-08dce48a562d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: DJdB0wFznldgmmumKwNKT2I1VGm/BONjYO8LkjjI/C/ysIdKB6gl6adhddGUe9g9HM2es5ytKxN4TZUK1Wme1DSSIoeHqoqTB/iQ1WjJBS+gJ1++XAVNP7OqCz25V7+Ev5+Hrt24DSZuiDTSptXsFdUFpp3bWYF0qKxCBL5qa/ZarsN3p2qIdVB6eP46uQTOUEhuVykfph0Yd68WV6RSCwFPL+TtuWLXJoIvjIT8XcmCvJiLyqg5WcpZuiviVGPCGvGPQ6ZxhLw3rx9b0k604Ijp5xjtY1dNf171y+EqddwPCsYWqrYOrlBb7iinDae8FsJARgq3/kF4hV/1j1mkGHRu0EMR+KStcaibXWilW5rPDFJ+OV3G/rohfmlGGiS1WXaCRwfzhH4xmEsLhQgaXMVwDgsUG28RQoD1UXI6GJAEQk2uJgaG5NpDljCrgxIPpv7oHxhPJOGSXyolNd+JDpTYGPl3FMqSMsonHWtNGcLDVr7wpN0+pUhzsdwVDezHI5eSQWG+hf1HN4fGseZIX1lng9IiZGVk5Uy2Z3FSYHvHjIpBr+EsFoR5NDTuQVzDf7Mye6wyjC9+siyoUjSLMb1Uzzc2on/VGJ3GocjjT95L3tw/Quxey3v1wK27NFgpeXfqwopzqODiwT9K+NB6a6R56XYp7e+3X8guRgPGi9GJcorfd8YZo4NWQaDhZAinkZsQ9sXxTmSyDr3DqvAopDgrjJXMn3xm+jO8YzLw49YeMYkkPTxDeRUaNJ9p3RSUfae7pB1dpAgwMYN05D4tguowpd4aYLRZBi4nhbuQg9XaLhRKnoZ2Xepg/Zs2boSL8HvXFq1GD9L2GUgzSbuM8jCn/mxFr6suLqmLtu3ZBRPcZVpGaUKzHEKa2/4H8rp30h6OIZTfDWL3HKLVxu3nngg5Sp5aTh/4ITX+VhKF+dM7Bb9AyBOFywIbdeqfU41lqgaxG45/euwZTlqVzClcrEJ0LhOloEyDDhyXo9bzyANR2WUrwZDcJrgwapvzrsgDkoIJPOiOyeUWnMM7YFiNivZvDsp/fmzoGm3nd1Zh8sjsOe/J/HyeZVbATxIC/Gt5SBBsiU4KKKNOra0WgacJUP1RYaJUWwndzQ8+sR6hANspBBPs/z3MWOBEno4DhSRWXEciNi3NOcZnAVunpRNMUZAZRXE3RTK/NcreOVsnAX3Jar0+eC8mpPD7jvMW/T8KEEJns/ieISbkjW+jZq4Wc9jOgPlh+XU2hd9Tyt+Vrat16sTBwSbsxl/FMBvTe6hO/ypehA98hOOE1WoLKcIE1WPzr1XZBti8NMeqFbDQGbf8dU/DT9HoNj1HCw20eDUW6ptP1BqDwjGzwDtS6wtJ3uuZDZdAMjRBAEjYKGZbzCr/pxxa3OCtqt2OnoHC2aoy 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)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: UYR3kIc9yiXsLZ1iJhUnopkV0r60gLccAMEBxyf5clPZeuaWaNgTD0ME93iwtZprJLNF43oC5AglIhQ3LXLHIZiI1wByNbw0+JABGWjkkhPqGJRqIr5GFB0mUp7O9UfQd8ysUE1M4eVq5va/Bt7nRxKNlCW+Qh61NizUPZGLvGx9GpSIJQKVl/CnK4GqbNaXqm1fNRCxcITYullrt13MSGqAgzV+psNxtV4fCxZe0c+08hFav7K3ImuWJre2tgVb4PQLz3W9EFYoI4BuMsd6lmJ9iRi+kdHOtByfkla4AOxvP48PlmJO5apwgcx6aNIVOHK4k7ukDf2Xc7HJVMyJqAJ5iByQ8wAgVyGrRBFjZ/ON91qT+aklhGEja+eDX1t+AdfGmAe16XIDmbiE32nZjKFCoKPwkRSxrfbf+fhVGjDhd+eqgZnWuZNqL09hpodtyxEEg6orCuGC7KVS/XPHyP9HvkPiiit2UVl93FHYpBTCCjUtcz/uArDfD+AXJ25ZHx7klznCv9cYK+2ug84frheJ78aoXacdFnlQdgo601NU1Nuhkzz5RaH+6Ek2h52gqGBNfHTl9i+CwY3QgJ9BSDhkG3Puc/Wr2pGvMPPRUkD+OnL56eeNxiH7NeTDfUY0ix2oBHedRR15sAyaW7s5aA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:38.0647 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a66f0fff-f8b6-4e7b-80b4-08dce48a562d 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAP190MB0920 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057083-302249-12642-33886-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.105 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVpaGZhZAVgZQMNXUItksxdDc0C TVwtjSwiDJLNHIJM0wOcXYNNE0Jc1QqTYWAOuCi1NBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan9-172.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 DBS - DVIO Buffer System Signed-off-by: Serhii Iliushyk --- .../supported/nthw_fpga_9563_055_049_0000.c | 184 +++++++++++++++++- 1 file changed, 183 insertions(+), 1 deletion(-) diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c index 98b857158e..6df7208649 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c @@ -1541,10 +1541,192 @@ static nthw_fpga_register_init_s rst9563_registers[] = { { RST9563_STICKY, 3, 6, NTHW_FPGA_REG_TYPE_RC1, 0, 6, rst9563_sticky_fields }, }; +static nthw_fpga_field_init_s dbs_rx_am_ctrl_fields[] = { + { DBS_RX_AM_CTRL_ADR, 7, 0, 0x0000 }, + { DBS_RX_AM_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_am_data_fields[] = { + { DBS_RX_AM_DATA_ENABLE, 1, 72, 0x0000 }, { DBS_RX_AM_DATA_GPA, 64, 0, 0x0000 }, + { DBS_RX_AM_DATA_HID, 8, 64, 0x0000 }, { DBS_RX_AM_DATA_INT, 1, 74, 0x0000 }, + { DBS_RX_AM_DATA_PCKED, 1, 73, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_control_fields[] = { + { DBS_RX_CONTROL_AME, 1, 7, 0 }, { DBS_RX_CONTROL_AMS, 4, 8, 8 }, + { DBS_RX_CONTROL_LQ, 7, 0, 0 }, { DBS_RX_CONTROL_QE, 1, 17, 0 }, + { DBS_RX_CONTROL_UWE, 1, 12, 0 }, { DBS_RX_CONTROL_UWS, 4, 13, 5 }, +}; + +static nthw_fpga_field_init_s dbs_rx_dr_ctrl_fields[] = { + { DBS_RX_DR_CTRL_ADR, 7, 0, 0x0000 }, + { DBS_RX_DR_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_dr_data_fields[] = { + { DBS_RX_DR_DATA_GPA, 64, 0, 0x0000 }, { DBS_RX_DR_DATA_HDR, 1, 88, 0x0000 }, + { DBS_RX_DR_DATA_HID, 8, 64, 0x0000 }, { DBS_RX_DR_DATA_PCKED, 1, 87, 0x0000 }, + { DBS_RX_DR_DATA_QS, 15, 72, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_idle_fields[] = { + { DBS_RX_IDLE_BUSY, 1, 8, 0 }, + { DBS_RX_IDLE_IDLE, 1, 0, 0x0000 }, + { DBS_RX_IDLE_QUEUE, 7, 1, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_init_fields[] = { + { DBS_RX_INIT_BUSY, 1, 8, 0 }, + { DBS_RX_INIT_INIT, 1, 0, 0x0000 }, + { DBS_RX_INIT_QUEUE, 7, 1, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_init_val_fields[] = { + { DBS_RX_INIT_VAL_IDX, 16, 0, 0x0000 }, + { DBS_RX_INIT_VAL_PTR, 15, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_ptr_fields[] = { + { DBS_RX_PTR_PTR, 16, 0, 0x0000 }, + { DBS_RX_PTR_QUEUE, 7, 16, 0x0000 }, + { DBS_RX_PTR_VALID, 1, 23, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_uw_ctrl_fields[] = { + { DBS_RX_UW_CTRL_ADR, 7, 0, 0x0000 }, + { DBS_RX_UW_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_uw_data_fields[] = { + { DBS_RX_UW_DATA_GPA, 64, 0, 0x0000 }, { DBS_RX_UW_DATA_HID, 8, 64, 0x0000 }, + { DBS_RX_UW_DATA_INT, 1, 88, 0x0000 }, { DBS_RX_UW_DATA_ISTK, 1, 92, 0x0000 }, + { DBS_RX_UW_DATA_PCKED, 1, 87, 0x0000 }, { DBS_RX_UW_DATA_QS, 15, 72, 0x0000 }, + { DBS_RX_UW_DATA_VEC, 3, 89, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_am_ctrl_fields[] = { + { DBS_TX_AM_CTRL_ADR, 7, 0, 0x0000 }, + { DBS_TX_AM_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_am_data_fields[] = { + { DBS_TX_AM_DATA_ENABLE, 1, 72, 0x0000 }, { DBS_TX_AM_DATA_GPA, 64, 0, 0x0000 }, + { DBS_TX_AM_DATA_HID, 8, 64, 0x0000 }, { DBS_TX_AM_DATA_INT, 1, 74, 0x0000 }, + { DBS_TX_AM_DATA_PCKED, 1, 73, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_control_fields[] = { + { DBS_TX_CONTROL_AME, 1, 7, 0 }, { DBS_TX_CONTROL_AMS, 4, 8, 5 }, + { DBS_TX_CONTROL_LQ, 7, 0, 0 }, { DBS_TX_CONTROL_QE, 1, 17, 0 }, + { DBS_TX_CONTROL_UWE, 1, 12, 0 }, { DBS_TX_CONTROL_UWS, 4, 13, 8 }, +}; + +static nthw_fpga_field_init_s dbs_tx_dr_ctrl_fields[] = { + { DBS_TX_DR_CTRL_ADR, 7, 0, 0x0000 }, + { DBS_TX_DR_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_dr_data_fields[] = { + { DBS_TX_DR_DATA_GPA, 64, 0, 0x0000 }, { DBS_TX_DR_DATA_HDR, 1, 88, 0x0000 }, + { DBS_TX_DR_DATA_HID, 8, 64, 0x0000 }, { DBS_TX_DR_DATA_PCKED, 1, 87, 0x0000 }, + { DBS_TX_DR_DATA_PORT, 1, 89, 0x0000 }, { DBS_TX_DR_DATA_QS, 15, 72, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_idle_fields[] = { + { DBS_TX_IDLE_BUSY, 1, 8, 0 }, + { DBS_TX_IDLE_IDLE, 1, 0, 0x0000 }, + { DBS_TX_IDLE_QUEUE, 7, 1, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_init_fields[] = { + { DBS_TX_INIT_BUSY, 1, 8, 0 }, + { DBS_TX_INIT_INIT, 1, 0, 0x0000 }, + { DBS_TX_INIT_QUEUE, 7, 1, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_init_val_fields[] = { + { DBS_TX_INIT_VAL_IDX, 16, 0, 0x0000 }, + { DBS_TX_INIT_VAL_PTR, 15, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_ptr_fields[] = { + { DBS_TX_PTR_PTR, 16, 0, 0x0000 }, + { DBS_TX_PTR_QUEUE, 7, 16, 0x0000 }, + { DBS_TX_PTR_VALID, 1, 23, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_qos_ctrl_fields[] = { + { DBS_TX_QOS_CTRL_ADR, 1, 0, 0x0000 }, + { DBS_TX_QOS_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_qos_data_fields[] = { + { DBS_TX_QOS_DATA_BS, 27, 17, 0x0000 }, + { DBS_TX_QOS_DATA_EN, 1, 0, 0x0000 }, + { DBS_TX_QOS_DATA_IR, 16, 1, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_qos_rate_fields[] = { + { DBS_TX_QOS_RATE_DIV, 19, 16, 2 }, + { DBS_TX_QOS_RATE_MUL, 16, 0, 1 }, +}; + +static nthw_fpga_field_init_s dbs_tx_qp_ctrl_fields[] = { + { DBS_TX_QP_CTRL_ADR, 7, 0, 0x0000 }, + { DBS_TX_QP_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_qp_data_fields[] = { + { DBS_TX_QP_DATA_VPORT, 1, 0, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_uw_ctrl_fields[] = { + { DBS_TX_UW_CTRL_ADR, 7, 0, 0x0000 }, + { DBS_TX_UW_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_uw_data_fields[] = { + { DBS_TX_UW_DATA_GPA, 64, 0, 0x0000 }, { DBS_TX_UW_DATA_HID, 8, 64, 0x0000 }, + { DBS_TX_UW_DATA_INO, 1, 93, 0x0000 }, { DBS_TX_UW_DATA_INT, 1, 88, 0x0000 }, + { DBS_TX_UW_DATA_ISTK, 1, 92, 0x0000 }, { DBS_TX_UW_DATA_PCKED, 1, 87, 0x0000 }, + { DBS_TX_UW_DATA_QS, 15, 72, 0x0000 }, { DBS_TX_UW_DATA_VEC, 3, 89, 0x0000 }, +}; + +static nthw_fpga_register_init_s dbs_registers[] = { + { DBS_RX_AM_CTRL, 10, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_am_ctrl_fields }, + { DBS_RX_AM_DATA, 11, 75, NTHW_FPGA_REG_TYPE_WO, 0, 5, dbs_rx_am_data_fields }, + { DBS_RX_CONTROL, 0, 18, NTHW_FPGA_REG_TYPE_RW, 43008, 6, dbs_rx_control_fields }, + { DBS_RX_DR_CTRL, 18, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_dr_ctrl_fields }, + { DBS_RX_DR_DATA, 19, 89, NTHW_FPGA_REG_TYPE_WO, 0, 5, dbs_rx_dr_data_fields }, + { DBS_RX_IDLE, 8, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_rx_idle_fields }, + { DBS_RX_INIT, 2, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_rx_init_fields }, + { DBS_RX_INIT_VAL, 3, 31, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_init_val_fields }, + { DBS_RX_PTR, 4, 24, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_rx_ptr_fields }, + { DBS_RX_UW_CTRL, 14, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_uw_ctrl_fields }, + { DBS_RX_UW_DATA, 15, 93, NTHW_FPGA_REG_TYPE_WO, 0, 7, dbs_rx_uw_data_fields }, + { DBS_TX_AM_CTRL, 12, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_am_ctrl_fields }, + { DBS_TX_AM_DATA, 13, 75, NTHW_FPGA_REG_TYPE_WO, 0, 5, dbs_tx_am_data_fields }, + { DBS_TX_CONTROL, 1, 18, NTHW_FPGA_REG_TYPE_RW, 66816, 6, dbs_tx_control_fields }, + { DBS_TX_DR_CTRL, 20, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_dr_ctrl_fields }, + { DBS_TX_DR_DATA, 21, 90, NTHW_FPGA_REG_TYPE_WO, 0, 6, dbs_tx_dr_data_fields }, + { DBS_TX_IDLE, 9, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_tx_idle_fields }, + { DBS_TX_INIT, 5, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_tx_init_fields }, + { DBS_TX_INIT_VAL, 6, 31, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_init_val_fields }, + { DBS_TX_PTR, 7, 24, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_tx_ptr_fields }, + { DBS_TX_QOS_CTRL, 24, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_qos_ctrl_fields }, + { DBS_TX_QOS_DATA, 25, 44, NTHW_FPGA_REG_TYPE_WO, 0, 3, dbs_tx_qos_data_fields }, + { DBS_TX_QOS_RATE, 26, 35, NTHW_FPGA_REG_TYPE_RW, 131073, 2, dbs_tx_qos_rate_fields }, + { DBS_TX_QP_CTRL, 22, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_qp_ctrl_fields }, + { DBS_TX_QP_DATA, 23, 1, NTHW_FPGA_REG_TYPE_WO, 0, 1, dbs_tx_qp_data_fields }, + { DBS_TX_UW_CTRL, 16, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_uw_ctrl_fields }, + { DBS_TX_UW_DATA, 17, 94, NTHW_FPGA_REG_TYPE_WO, 0, 8, dbs_tx_uw_data_fields }, +}; + static nthw_fpga_module_init_s fpga_modules[] = { { MOD_CAT, 0, MOD_CAT, 0, 21, NTHW_FPGA_BUS_TYPE_RAB1, 768, 34, cat_registers }, { MOD_GFG, 0, MOD_GFG, 1, 1, NTHW_FPGA_BUS_TYPE_RAB2, 8704, 10, gfg_registers }, { MOD_GMF, 0, MOD_GMF, 2, 5, NTHW_FPGA_BUS_TYPE_RAB2, 9216, 12, gmf_registers }, + { MOD_DBS, 0, MOD_DBS, 0, 11, NTHW_FPGA_BUS_TYPE_RAB2, 12832, 27, dbs_registers}, { MOD_GMF, 1, MOD_GMF, 2, 5, NTHW_FPGA_BUS_TYPE_RAB2, 9728, 12, gmf_registers }, { MOD_GPIO_PHY, 0, MOD_GPIO_PHY, 1, 0, NTHW_FPGA_BUS_TYPE_RAB0, 16386, 2, @@ -1737,5 +1919,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { }; nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { - 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 21, fpga_modules, + 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 22, fpga_modules, }; From patchwork Fri Oct 4 15:34:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145100 X-Patchwork-Delegate: ferruh.yigit@amd.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 73B1F45AAF; Fri, 4 Oct 2024 17:52:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F011F42E5D; Fri, 4 Oct 2024 17:51:09 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id A0C43427D4 for ; Fri, 4 Oct 2024 17:51:04 +0200 (CEST) Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02lp2241.outbound.protection.outlook.com [104.47.11.241]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:51:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AQ1hdWMB6c2AftmWOD9kIVdTDL/9c9NayJI5sxJiy7lGm/1QOoBr9qgitW7lep5XkxZYA/oaQcEgMSp4ZsNAPHkt7xc3CQdD1pRaVvvreax4podMhIaQ9HutopLGkbt2XYDJZp05wsbJVOep3RzJHNzefOGENpVjsaPH0vIGSOHMxKC+pAIGTQcrJOS5SHvrTlOJbcIrRQJRyW0BuGsv/+ovM7V/Fkd4Mvo9UqxfDQFnFF99Qlw93ZEgCmZThIaHJmcmDR0mMawwzaRKKXjFiNKgnSOUTonftmU46KAXx1P5xxMpnm7uTQPd8MhApWVJUc+7NpSS/ZZE4FfRma6TkA== 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=cav6N+foajbxzdVDCH6QQw+SLRiVTV/zPS93/jujSaM=; b=HdvOdYaG6ms3Usp1eMVT30r0AmvyLtdPB7U2Eeln4YLfMjAa/FLHSgl3+qiMjic0XarzgcXmBRDiBcdHxOdIgJVx8uEouunyGm2qckk554nN2/CXBVohjGp/SrEMpYcxA02c8MWixs7j/5wEiQu4kGO9SuFxj16HSkzuqWU4zLtfjM8SSEUzeFWdh26WN8e7LZtR85nsf5HhpzlJJyIfEKfOiPFQyf17he0K/9rKRH83Y90x2u1WsWQz12Snsnv6iB42aGVXp9JptS15Rozjg9xLptFBivdP09QbzzRr2KrvDItqYOINrNrT1MD3vf/WOVbljWPlt12Z1EY0lTz1mA== 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=cav6N+foajbxzdVDCH6QQw+SLRiVTV/zPS93/jujSaM=; b=NWdzZnvuLxg2pTZBYAJ68XPcwqa3LqJeVjMnoCO3N1bjeL7TFKzFMBMMr6ylhUldDYCkBQ4GIpfhvg5ARmQ4OQbdhXvBsKUfE/CxBZ+6SEbGrzPpX7VHbJZbRofVFbIsG82v38KCar2tblf1Hrye6r0gMhcNXpwjrL/0bI5v2+Y= Received: from AM0PR10CA0132.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::49) by PRAP190MB1834.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:294::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 15:36:13 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::c4) by AM0PR10CA0132.outlook.office365.com (2603:10a6:208:e6::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:13 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:13 +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, Oleksandr Kolomeiets Subject: [PATCH v1 12/31] net/ntnic: add slicer (SLC LR) flow module Date: Fri, 4 Oct 2024 17:34:35 +0200 Message-ID: <20241004153551.267935-18-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|PRAP190MB1834:EE_ X-MS-Office365-Filtering-Correlation-Id: cd7bcca0-0a66-4c82-68fc-08dce48a4744 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: Wg1dhlo3dfTYIyKMB7ENs4VqeImZ4XYd8NUVbo1QoF0dP8ZjR5p5b8ZlJ9oWcoNqH3ju5vXEuNSmOJEGlZrQ98fiovgVYZrG4YzV0KOzfvY+yt3FTpd/f/1WM0tb/4wHvoB7OtJ82y++pEiMveKnnnPVdco450g5dhKBZf8um2cgEYfqX721z+cxbKxp7v1J0+P/7qur8zyGpooedMP0oupLjM6+NfafwP77XbaTMhfyKLkvNQEMrlY1aAO2nJTxDxXM3uNW3GnEQZXa3NqgHQowctAqxyIeWwd/PvteHStdUFIOaXSdAQ6I/DTlUe7bGzBos6RtdHh6NgRNEb3VZLtKFMFP6wojvnu9UhqglPsNtJpMZBeRzXAsMkWzOYrEsASxQRl4N8bAH8cMx8gJ/AuwiRQea+/kNYXpsGmDmZer3L0xl+PDddDWf6iLtDWAg50mu7KsGQ1Q9LbcpbCGXp6IZcjyC0L+RrEnKkE4KzN4Xj7BaH56tLlkxbG46WZwoskekNgISR3PUwbRjJ90PJCA25L92WVRWmttp0eTvaP47RP6sTuUO9QscsVkU50z3KrfNx6QoYAJBA3Tan+dRX/OIm/k4WEOcRHP1Wfjx0CGqqcJVCZ9XWvZYjQbEQcsTREqRUpdhrsGJxYkSKyzeLdcNYmHheBrOTMilfs3xrIZvPD8JMwEIhNjBrzyZdmqB/wPQUHExjT5MOSGhUWsqSGtSEoxKWNV5toheYzrwfR3J/O8n96xo0XMpPb4SrXik8Vk5rL15RcmiQ/iXSMgE3OlmKUYeUR6LAdWHXcnayoTh7HolrA+m+rjbdphbGeaO6K4OFeKRQKp5NDNYpR3AL/HxS9/U66x8MH1t2vfYqklSGBmftu7VKlNcmYzBKw/aIKywkrkky40UYse8cBPLr9laQhVYj2mipVzhZEK2NzGGhBXdgMxu5YeCj0D5GSeVX7UxH9/Zve++3u5veKx/uKTZOSC1AYHDoO4ddfeGEpi45tin2p8PgW7Rinu5akKyfXnOwioZGjA5VPMF8YwwVkvZEoInolq/9XGWOwAgBniOHWvaMx/S/be3UGuw1rW+1mViPiRhqo+bz4h8vaF1ORHHSGhzdK2lOcrZG5iaSYeCTqI9JsvSRxMAXcVy/zHi7+I66dC1Q8aFsjyLLRcDd8JLn1iLfjYKLw/MbWzsKXjFGEWQLsiUVb0zKGATmP/u0vI1/LtFILuNpsncI8OSm8kZ+0cqbDGKMWipw1j/KsNeveflcS0h4NLZ1EcZSn+zDMOrLEhTBBl4J/uHy/KosDJDMU3/lolVwVBe7spM1l7sqCopw/rgdlDx1s1R76CjGTzpo9jZWj2AxIgAEBGg8CMVHy6+3PS1gjv5Fkv4uOEhj4VEKI36WeDr7BCmqSJ 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)(82310400026)(1800799024)(376014)(36860700013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: M6LK706cZRae2V9d/dlsWCcqNPLGx35tQMToEQHq049UEW+9VDbK460X7779gLMGMFVXGkbWBGDs7ovR3e24CN8sYnUYm1v1+vzdrk/30V8ahBoQRg0BJlNi2J532AeVAgJemI3CGgKcGX6fLIx1LZVVJawOXBKFQ/j1/buN8+tJxJkCFeQUIMliB4mEoHOOhT+69eZv7cWcZJ88589Fpr6l4Eh/JkebvPyvI3x1uUVdjPaJ/KcY3S6DP1Cc/5Mt4DC/pR7H3VJTBQKEV+bvgCXXqGfzGP3mztfJIq8lbY4Y66pXk47+InPs7Xdhg725IalXHSWJ0gXu5iUtHcrSXcokpwSdASRU4D6M5ZT9pjPAjMFgPHHzzy1OS6TEdiivlLmK9C8kJoq4WlqvPuNvQe81yBqDgiFUh7jFHEre3BmgSwGel+/zzkSeUf7Dt1WgMl2+SV9yXtNlSWMTaH8IxqVJmwaWpoE3O6AST98uaQlwYuzl8kwIiAklRgViea/X13RANktKtOiq3FStIgrwlULYePU5v5VrpNVFnMANbNr/G4bl7THV/xNG7N2V4xxrA+kN7BdftfK3bxpvRfBK05pAbsEW9qMgwAeya5YIk+N7oQfJ8pGtnBaQZRxNQaSH6pwbIWTj0VsJezQ0RVrk0Q== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:13.0334 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cd7bcca0-0a66-4c82-68fc-08dce48a4744 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PRAP190MB1834 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057063-311388-12685-32522-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.11.241 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZmxmZmQGYGUDTFzCIt2czcyN wwOS0l1cjAxNIiLdE80SQx0cDQONUwSak2FgB4sfibQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan20-43.eu-central-1b.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: Oleksandr Kolomeiets The Slicer for Local Retransmit module can cut of the head a packet before the packet leaves the FPGA RX pipeline. This is used when the TX pipeline is configured to add a new head in the packet. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/include/hw_mod_backend.h | 14 ++ drivers/net/ntnic/include/hw_mod_slc_lr_v2.h | 25 ++++ drivers/net/ntnic/meson.build | 1 + .../nthw/flow_api/flow_backend/flow_backend.c | 66 +++++++++ .../ntnic/nthw/flow_filter/flow_nthw_slc_lr.c | 126 ++++++++++++++++++ .../ntnic/nthw/flow_filter/flow_nthw_slc_lr.h | 54 ++++++++ .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 2 + .../nthw/supported/nthw_fpga_reg_defs_slc.h | 34 +++++ .../supported/nthw_fpga_reg_defs_slc_lr.h | 23 ++++ 10 files changed, 346 insertions(+) create mode 100644 drivers/net/ntnic/include/hw_mod_slc_lr_v2.h create mode 100644 drivers/net/ntnic/nthw/flow_filter/flow_nthw_slc_lr.c create mode 100644 drivers/net/ntnic/nthw/flow_filter/flow_nthw_slc_lr.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_slc.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_slc_lr.h diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index 84f2ed6c6a..309365f30d 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -13,6 +13,7 @@ #include "hw_mod_flm_v25.h" #include "hw_mod_km_v7.h" #include "hw_mod_qsl_v7.h" +#include "hw_mod_slc_lr_v2.h" #include "hw_mod_hsh_v5.h" #define MAX_PHYS_ADAPTERS 8 @@ -96,6 +97,13 @@ struct qsl_func_s { }; }; +struct slc_lr_func_s { + COMMON_FUNC_INFO_S; + union { + struct hw_mod_slc_lr_v2_s v2; + }; +}; + enum debug_mode_e { FLOW_BACKEND_DEBUG_MODE_NONE = 0x0000, FLOW_BACKEND_DEBUG_MODE_WRITE = 0x0001 @@ -214,6 +222,12 @@ struct flow_api_backend_ops { int (*qsl_qst_flush)(void *dev, const struct qsl_func_s *qsl, int entry, int cnt); int (*qsl_qen_flush)(void *dev, const struct qsl_func_s *qsl, int entry, int cnt); int (*qsl_unmq_flush)(void *dev, const struct qsl_func_s *qsl, int entry, int cnt); + + /* SLC LR */ + bool (*get_slc_lr_present)(void *dev); + uint32_t (*get_slc_lr_version)(void *dev); + int (*slc_lr_rcp_flush)(void *dev, const struct slc_lr_func_s *slc_lr, int category, + int cnt); }; struct flow_api_backend_s { diff --git a/drivers/net/ntnic/include/hw_mod_slc_lr_v2.h b/drivers/net/ntnic/include/hw_mod_slc_lr_v2.h new file mode 100644 index 0000000000..718a3cff27 --- /dev/null +++ b/drivers/net/ntnic/include/hw_mod_slc_lr_v2.h @@ -0,0 +1,25 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef _HW_MOD_SLC_LR_V2_H_ +#define _HW_MOD_SLC_LR_V2_H_ + +#include + +struct slc_lr_v2_rcp_s { + uint32_t head_slc_en; + uint32_t head_dyn; + int32_t head_ofs; + uint32_t tail_slc_en; + uint32_t tail_dyn; + int32_t tail_ofs; + uint32_t pcap; +}; + +struct hw_mod_slc_lr_v2_s { + struct slc_lr_v2_rcp_s *rcp; +}; + +#endif /* _HW_MOD_SLC_V2_H_ */ diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index c7c5cd997f..2c303f6980 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -53,6 +53,7 @@ sources = files( 'nthw/flow_filter/flow_nthw_info.c', 'nthw/flow_filter/flow_nthw_km.c', 'nthw/flow_filter/flow_nthw_qsl.c', + 'nthw/flow_filter/flow_nthw_slc_lr.c', 'nthw/model/nthw_fpga_model.c', 'nthw/nthw_platform.c', 'nthw/nthw_rac.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c index a2422f8b31..6188d900bb 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c @@ -12,6 +12,7 @@ #include "flow_nthw_flm.h" #include "flow_nthw_hsh.h" #include "flow_nthw_qsl.h" +#include "flow_nthw_slc_lr.h" #include "ntnic_mod_reg.h" #include "nthw_fpga_model.h" #include "hw_mod_backend.h" @@ -32,6 +33,7 @@ static struct backend_dev_s { struct flm_nthw *p_flm_nthw; struct hsh_nthw *p_hsh_nthw; struct qsl_nthw *p_qsl_nthw; + struct slc_lr_nthw *p_slc_lr_nthw; struct ifr_nthw *p_ifr_nthw; /* TPE module */ } be_devs[MAX_PHYS_ADAPTERS]; @@ -1436,6 +1438,55 @@ static int qsl_unmq_flush(void *be_dev, const struct qsl_func_s *qsl, int entry, return 0; } +/* + * SLC LR + */ + +static bool slc_lr_get_present(void *be_dev) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + return be->p_slc_lr_nthw != NULL; +} + +static uint32_t slc_lr_get_version(void *be_dev) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + return (uint32_t)((nthw_module_get_major_version(be->p_slc_lr_nthw->m_slc_lr) << 16) | + (nthw_module_get_minor_version(be->p_slc_lr_nthw->m_slc_lr) & 0xffff)); +} + +static int slc_lr_rcp_flush(void *be_dev, const struct slc_lr_func_s *slc_lr, int category, + int cnt) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, slc_lr, be->p_slc_lr_nthw); + + if (slc_lr->ver == 2) { + slc_lr_nthw_rcp_cnt(be->p_slc_lr_nthw, 1); + + for (int i = 0; i < cnt; i++) { + slc_lr_nthw_rcp_select(be->p_slc_lr_nthw, category + i); + slc_lr_nthw_rcp_head_slc_en(be->p_slc_lr_nthw, + slc_lr->v2.rcp[category + i].head_slc_en); + slc_lr_nthw_rcp_head_dyn(be->p_slc_lr_nthw, + slc_lr->v2.rcp[category + i].head_dyn); + slc_lr_nthw_rcp_head_ofs(be->p_slc_lr_nthw, + slc_lr->v2.rcp[category + i].head_ofs); + slc_lr_nthw_rcp_tail_slc_en(be->p_slc_lr_nthw, + slc_lr->v2.rcp[category + i].tail_slc_en); + slc_lr_nthw_rcp_tail_dyn(be->p_slc_lr_nthw, + slc_lr->v2.rcp[category + i].tail_dyn); + slc_lr_nthw_rcp_tail_ofs(be->p_slc_lr_nthw, + slc_lr->v2.rcp[category + i].tail_ofs); + slc_lr_nthw_rcp_pcap(be->p_slc_lr_nthw, slc_lr->v2.rcp[category + i].pcap); + slc_lr_nthw_rcp_flush(be->p_slc_lr_nthw); + } + } + + CHECK_DEBUG_OFF(slc_lr, be->p_slc_lr_nthw); + return 0; +} + /* * DBS */ @@ -1556,6 +1607,10 @@ const struct flow_api_backend_ops flow_be_iface = { qsl_qst_flush, qsl_qen_flush, qsl_unmq_flush, + + slc_lr_get_present, + slc_lr_get_version, + slc_lr_rcp_flush, }; const struct flow_api_backend_ops *bin_flow_backend_init(nthw_fpga_t *p_fpga, void **dev) @@ -1626,6 +1681,16 @@ const struct flow_api_backend_ops *bin_flow_backend_init(nthw_fpga_t *p_fpga, vo be_devs[physical_adapter_no].p_qsl_nthw = NULL; } + /* Init nthw SLC LR */ + if (slc_lr_nthw_init(NULL, p_fpga, physical_adapter_no) == 0) { + struct slc_lr_nthw *pslclrnthw = slc_lr_nthw_new(); + slc_lr_nthw_init(pslclrnthw, p_fpga, physical_adapter_no); + be_devs[physical_adapter_no].p_slc_lr_nthw = pslclrnthw; + + } else { + be_devs[physical_adapter_no].p_slc_lr_nthw = NULL; + } + be_devs[physical_adapter_no].adapter_no = physical_adapter_no; *dev = (void *)&be_devs[physical_adapter_no]; @@ -1641,6 +1706,7 @@ static void bin_flow_backend_done(void *dev) flm_nthw_delete(be_dev->p_flm_nthw); hsh_nthw_delete(be_dev->p_hsh_nthw); qsl_nthw_delete(be_dev->p_qsl_nthw); + slc_lr_nthw_delete(be_dev->p_slc_lr_nthw); } static const struct flow_backend_ops ops = { diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_slc_lr.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_slc_lr.c new file mode 100644 index 0000000000..5961df7735 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_slc_lr.c @@ -0,0 +1,126 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include + +#include "ntlog.h" + +#include "nthw_drv.h" +#include "nthw_register.h" + +#include "flow_nthw_slc_lr.h" + +void slc_lr_nthw_set_debug_mode(struct slc_lr_nthw *p, unsigned int n_debug_mode) +{ + nthw_module_set_debug_mode(p->m_slc_lr, n_debug_mode); +} + +struct slc_lr_nthw *slc_lr_nthw_new(void) +{ + struct slc_lr_nthw *p = malloc(sizeof(struct slc_lr_nthw)); + + if (p) + (void)memset(p, 0, sizeof(*p)); + + return p; +} + +void slc_lr_nthw_delete(struct slc_lr_nthw *p) +{ + if (p) { + (void)memset(p, 0, sizeof(*p)); + free(p); + } +} + +int slc_lr_nthw_init(struct slc_lr_nthw *p, nthw_fpga_t *p_fpga, int n_instance) +{ + const char *const p_adapter_id_str = p_fpga->p_fpga_info->mp_adapter_id_str; + nthw_module_t *p_mod = nthw_fpga_query_module(p_fpga, MOD_SLC_LR, n_instance); + + assert(n_instance >= 0 && n_instance < 256); + + if (p == NULL) + return p_mod == NULL ? -1 : 0; + + if (p_mod == NULL) { + NT_LOG(ERR, NTHW, "%s: Slc %d: no such instance\n", p_adapter_id_str, n_instance); + return -1; + } + + p->mp_fpga = p_fpga; + p->m_physical_adapter_no = (uint8_t)n_instance; + p->m_slc_lr = nthw_fpga_query_module(p_fpga, MOD_SLC_LR, n_instance); + + /* RCP */ + p->mp_rcp_ctrl = nthw_module_get_register(p->m_slc_lr, SLC_RCP_CTRL); + p->mp_rcp_addr = nthw_register_get_field(p->mp_rcp_ctrl, SLC_RCP_CTRL_ADR); + p->mp_rcp_cnt = nthw_register_get_field(p->mp_rcp_ctrl, SLC_RCP_CTRL_CNT); + p->mp_rcp_data = nthw_module_get_register(p->m_slc_lr, SLC_RCP_DATA); + p->mp_rcp_data_head_slc_en = + nthw_register_get_field(p->mp_rcp_data, SLC_RCP_DATA_HEAD_SLC_EN); + p->mp_rcp_data_head_dyn = nthw_register_get_field(p->mp_rcp_data, SLC_RCP_DATA_HEAD_DYN); + p->mp_rcp_data_head_ofs = nthw_register_get_field(p->mp_rcp_data, SLC_RCP_DATA_HEAD_OFS); + p->mp_rcp_data_tail_slc_en = + nthw_register_get_field(p->mp_rcp_data, SLC_RCP_DATA_TAIL_SLC_EN); + p->mp_rcp_data_tail_dyn = nthw_register_get_field(p->mp_rcp_data, SLC_RCP_DATA_TAIL_DYN); + p->mp_rcp_data_tail_ofs = nthw_register_get_field(p->mp_rcp_data, SLC_RCP_DATA_TAIL_OFS); + p->mp_rcp_data_pcap = nthw_register_get_field(p->mp_rcp_data, SLC_RCP_DATA_PCAP); + + return 0; +} + +/* RCP */ +void slc_lr_nthw_rcp_select(const struct slc_lr_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_addr, val); +} + +void slc_lr_nthw_rcp_cnt(const struct slc_lr_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_cnt, val); +} + +void slc_lr_nthw_rcp_head_slc_en(const struct slc_lr_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_head_slc_en, val); +} + +void slc_lr_nthw_rcp_head_dyn(const struct slc_lr_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_head_dyn, val); +} + +void slc_lr_nthw_rcp_head_ofs(const struct slc_lr_nthw *p, int32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_head_ofs, val); +} + +void slc_lr_nthw_rcp_tail_slc_en(const struct slc_lr_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_tail_slc_en, val); +} + +void slc_lr_nthw_rcp_tail_dyn(const struct slc_lr_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_tail_dyn, val); +} + +void slc_lr_nthw_rcp_tail_ofs(const struct slc_lr_nthw *p, int32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_tail_ofs, val); +} + +void slc_lr_nthw_rcp_pcap(const struct slc_lr_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_pcap, val); +} + +void slc_lr_nthw_rcp_flush(const struct slc_lr_nthw *p) +{ + nthw_register_flush(p->mp_rcp_ctrl, 1); + nthw_register_flush(p->mp_rcp_data, 1); +} diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_slc_lr.h b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_slc_lr.h new file mode 100644 index 0000000000..2eed32c022 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_slc_lr.h @@ -0,0 +1,54 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef __FLOW_NTHW_SLC_LR_H__ +#define __FLOW_NTHW_SLC_LR_H__ + +#include + +#include "nthw_fpga_model.h" + +struct slc_lr_nthw { + uint8_t m_physical_adapter_no; + nthw_fpga_t *mp_fpga; + + nthw_module_t *m_slc_lr; + + nthw_register_t *mp_rcp_ctrl; + nthw_field_t *mp_rcp_addr; + nthw_field_t *mp_rcp_cnt; + nthw_register_t *mp_rcp_data; + + nthw_field_t *mp_rcp_data_head_slc_en; + nthw_field_t *mp_rcp_data_head_dyn; + nthw_field_t *mp_rcp_data_head_ofs; + nthw_field_t *mp_rcp_data_tail_slc_en; + nthw_field_t *mp_rcp_data_tail_dyn; + nthw_field_t *mp_rcp_data_tail_ofs; + nthw_field_t *mp_rcp_data_pcap; +}; + +typedef struct slc_lr_nthw slc_lr_nthw_t; + +struct slc_lr_nthw *slc_lr_nthw_new(void); +void slc_lr_nthw_delete(struct slc_lr_nthw *p); +int slc_lr_nthw_init(struct slc_lr_nthw *p, nthw_fpga_t *p_fpga, int n_instance); + +int slc_lr_nthw_setup(struct slc_lr_nthw *p, int n_idx, int n_idx_cnt); +void slc_lr_nthw_set_debug_mode(struct slc_lr_nthw *p, unsigned int n_debug_mode); + +/* RCP */ +void slc_lr_nthw_rcp_select(const struct slc_lr_nthw *p, uint32_t val); +void slc_lr_nthw_rcp_cnt(const struct slc_lr_nthw *p, uint32_t val); +void slc_lr_nthw_rcp_head_slc_en(const struct slc_lr_nthw *p, uint32_t val); +void slc_lr_nthw_rcp_head_dyn(const struct slc_lr_nthw *p, uint32_t val); +void slc_lr_nthw_rcp_head_ofs(const struct slc_lr_nthw *p, int32_t val); +void slc_lr_nthw_rcp_tail_slc_en(const struct slc_lr_nthw *p, uint32_t val); +void slc_lr_nthw_rcp_tail_dyn(const struct slc_lr_nthw *p, uint32_t val); +void slc_lr_nthw_rcp_tail_ofs(const struct slc_lr_nthw *p, int32_t val); +void slc_lr_nthw_rcp_pcap(const struct slc_lr_nthw *p, uint32_t val); +void slc_lr_nthw_rcp_flush(const struct slc_lr_nthw *p); + +#endif /* __FLOW_NTHW_SLC_LR_H__ */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h index b159da7597..22682b6a5f 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h @@ -33,6 +33,7 @@ #define MOD_RAC (0xae830b42UL) #define MOD_RST9563 (0x385d6d1dUL) #define MOD_SDC (0xd2369530UL) +#define MOD_SLC_LR (0x969fc50bUL) #define MOD_IDX_COUNT (14) /* aliases - only aliases go below this point */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h index 7b99a7fbdb..f775a4b33a 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h @@ -32,6 +32,8 @@ #include "nthw_fpga_reg_defs_rac.h" #include "nthw_fpga_reg_defs_rst9563.h" #include "nthw_fpga_reg_defs_sdc.h" +#include "nthw_fpga_reg_defs_slc.h" +#include "nthw_fpga_reg_defs_slc_lr.h" /* aliases */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_slc.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_slc.h new file mode 100644 index 0000000000..11a8ef79a1 --- /dev/null +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_slc.h @@ -0,0 +1,34 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +/* + * nthw_fpga_reg_defs_slc.h + * + * Auto-generated file - do *NOT* edit + * + */ + +#ifndef _NTHW_FPGA_REG_DEFS_SLC_ +#define _NTHW_FPGA_REG_DEFS_SLC_ + +/* SLC */ +#define NTHW_MOD_SLC (0x1aef1f38UL) +#define SLC_RCP_CTRL (0xa3373b1UL) +#define SLC_RCP_CTRL_ADR (0xe64629e7UL) +#define SLC_RCP_CTRL_CNT (0xf64eb036UL) +#define SLC_RCP_DATA (0xa5e2f1a8UL) +#define SLC_RCP_DATA_HEAD_DYN (0x86b55a78UL) +#define SLC_RCP_DATA_HEAD_OFS (0x24bcd7deUL) +#define SLC_RCP_DATA_HEAD_SLC_EN (0x61cf5ef7UL) +#define SLC_RCP_DATA_PCAP (0x84909c04UL) +#define SLC_RCP_DATA_TAIL_DYN (0x85cd93a3UL) +#define SLC_RCP_DATA_TAIL_OFS (0x27c41e05UL) +#define SLC_RCP_DATA_TAIL_SLC_EN (0xa4f5112cUL) + +#endif /* _NTHW_FPGA_REG_DEFS_SLC_ */ + +/* + * Auto-generated file - do *NOT* edit + */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_slc_lr.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_slc_lr.h new file mode 100644 index 0000000000..ef1f358cb3 --- /dev/null +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_slc_lr.h @@ -0,0 +1,23 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +/* + * nthw_fpga_reg_defs_slc_lr.h + * + * Auto-generated file - do *NOT* edit + * + */ + +#ifndef _NTHW_FPGA_REG_DEFS_SLC_LR_ +#define _NTHW_FPGA_REG_DEFS_SLC_LR_ + +/* SLC_LR */ +#define NTHW_MOD_SLC_LR (0x969fc50bUL) + +#endif /* _NTHW_FPGA_REG_DEFS_SLC_LR_ */ + +/* + * Auto-generated file - do *NOT* edit + */ From patchwork Fri Oct 4 15:35:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145098 X-Patchwork-Delegate: ferruh.yigit@amd.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 807A945AAF; Fri, 4 Oct 2024 17:52:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 88ADF42D2E; Fri, 4 Oct 2024 17:51:06 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id 68D1342DE9 for ; Fri, 4 Oct 2024 17:51:01 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2105.outbound.protection.outlook.com [104.47.17.105]) by mx-outbound8-201.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:51:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vFB7ZwC1M1OL8iiGowlTctMO/Uo1zzUrap32KmaDM/LUp3n6DLvcnAL08gJ6jBR0ya1VJNzjv+OAUywyTt1z2EkScGmccs4nusGW15eIOVM61xifoESoD0asiT+qpxxIHxkmv1P9yHcYu+aH2S/aMJgDItQudmm3pfVHmwY3z8JN7SDht9vVRwFjqCyo2FCHKevvczXznldT7x5hc3Z/atT8jshkYv5WMsSUVqXQuhjPfCvpn+woxurjLv9FOlTKvVUtrdveUCmb5qy2BdU8S9nEn3GheA8qZTNB9oJanc9zFc4TE4tGgLc7Y5z6p8j8p9d1hkU/ZArW3OPQpMyfDQ== 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=ahC8wrniSgFDG0q5Hn9+dSRDNcwDAZ+ND6BQS/Fkezs=; b=GocvqAxOmaeuRbWZhuC45JztkW4e+m5NdAI6g9gyj5/4vwlOAaDsXp0THK0R0ip0Q0b5+vvYE5i4D/psd5fNFm8aCn9R3eKOmk16Hsqo273MRQLUWDZ4LHIzulVlNHJk2862zeHBFOE9Gf7LMk7e5FUsxXmtZTbpo78E+Dvln1GHhZyO+n8lDLJd1fUK3zgwsMu8BJjZ7LksvN1JZ8GTe3+BQkllu3QL7n5nny2hpAAmnSpC1GTiVBWK/Zb/lv3M4J7te2UH3+sOJgga+7V1TRTqtXPax4SZFjR94s2WK4cyCsyESrPHSooyJIC8vwDXwSvMf2xsHwkGdIGyaedcHA== 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=ahC8wrniSgFDG0q5Hn9+dSRDNcwDAZ+ND6BQS/Fkezs=; b=HHfoJ8L/Dptd9tLipyKHIVR/EIr+Z1UyxCt5RSRa6wG05LQ//p9aDDwWdvZ79UzsuU6XVTTCsaZ4lJIhIxcmFaau4nh7Qvdqi7dZRBA2tpBSU7oJTcJp1sI2HICD35KTWZnWAOdurp1HY42XdJHj3Nf4o8QYUgC5mU1SVAJs97Y= Received: from AM0PR10CA0111.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::28) by AS8P190MB1192.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:2e6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 15:36:39 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::d7) by AM0PR10CA0111.outlook.office365.com (2603:10a6:208:e6::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:39 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:39 +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 13/14] net/ntnic: add functions for releasing virt queues Date: Fri, 4 Oct 2024 17:35:07 +0200 Message-ID: <20241004153551.267935-50-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|AS8P190MB1192:EE_ X-MS-Office365-Filtering-Correlation-Id: 4fcc6ed8-274b-4002-b3b2-08dce48a56e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: zxsdI/e9IK99hU9rNkHqhlGRulkBAWOefg75j6jGKSvE1I9cpBRS+X1VNFlpV64+p/WC8iO/IiWQtxWgBgbK/3nI/IADZ3a67bai25Txijn79iKbNRONEgYCew4qgED256I/ElUWyvW3FZwM4PZHeZL/uUq28WlFUUyaqrY8c/MX+oOdkzNd7jD6k9IOcZSltDFLknKnjnbII3KgqFlKbdu6s6nNikP5R1QadA4MRFfhrLG37ymTbzyMwJS0DQXopgEN7d/662Ji1LZZnQSO6XjQeZHhtZthStV9QhmpXwX8jJudgViIMHAPBwx79XFTQg7PmBDj+7Ou5oHvpp/ueHhOvm+a3TIDuKx1WcIgKFk/e186OfvkEGKc73EhzodXU1MC4v0iDETGOhjqdiRHloPPWjdF0Y74wWZEG0gRY7JVHk07PCTCKx2pJ0ReJ9Zm0gSnCyDBkOajcDWDwkZ8dymrnGuoU3y3ZgneKOunoeJwV1OakJoM2z0FaNAGgz9XnW/bPsFBXjvqTlA/VThp1sZCpg16D9U6gi2UlSC+hP/eOAcXncdKu16azlyMwNXJJCLSpAVZFs2y2UkkFBs9io1DxHgn74dx1SeNl879LccVQ6yOnIzloLr31lgoZ3C983lB28d370AfHi2CmV2Ijj+4+haMLvqsns83QjXcBtlX4Nl4CbtEEuy0RveWpR69QH3fWuh3AifJWUFVoQtrcw+oywXgPYgM5UjtRbn/aLuPgY++5C9uy7IsTxHTTZEY1mYsO0Tiqcm/QOfkJTMInLKgjiC5t0nrL++lVMeiFkyAJC9WkowO+V2upMTQJdYpsbiCfGiJL5nO+i/cd4ZigtBGZjPb3tsoV+uK9ODgf8+kGRGGxtu2Kdd3hjXgOW5cET2Wt2MtghODnFvE1grhMArBmF/DsAKFK8zzUpO0459aI/OjLuxfNg7aO9Ju1O4ndG/1TF4IuIliq/91S5hIyuU5AYf6iUsKQ/c90LFNLmzEkWdSjYAjRwikIITBJ99HysExH3hStSHO3Wq6s98pIayQMvqvckXIoJl+Rgj1mxs5Ik6CFDr/TqWQ+e/JTSnnwRZR71Ij9L4YM4UUd97LSOWdhnTb3r3zBiECFuI2vEoCXj1fY4fG0PITqsjTH8PtCB+hjB4hkIRitoBT2JteQChfhi60GqIN8+gKQeuOBmXHhlhN0skFmIpi0+r8pUlWm6FiJ5iO7jMZYPSbjQDyx9broqxIT5V8P3qeCROsnK3maBGyH30GCgof4WFhWvURwYHt0U9OGpiVsADNrNL0/TzCYjxRJI1bABQY6D2vhgh/VtiLnRI/xPSCp/rMzIds7PPxJqVfi1uDEmW58QGkO/oKksRJtP+jZcQavE41Jo4= 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)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: LmfkOSbmBQiBaMABIuAeINxk361+G1NxBfJH2iojmj+V759Vp3FDg5vLfQUuwxdAfCS4p1f1agQdnRRmqVKS2RawXdZIq8o9jCmO9B+fofQCkEQLCTwsAHTYJtw+/WwhkYvi3a9pUJ6gnMRUzomQoNJ5YLNcpsefOZI1zzdTs9bIHIl2zbOwA6fIgZyRLIsrLf0QfiEdCPRhxleXKylw28Ev8GmWRElyqnq60+iEWMhRYb6yLpspUViLuRyZF5PhLHYPgF7Dj3ftPC4aAqbkL+Atv9gRWgscHVvsYvoXqCfwgIQTtyDtdfO7x4YEiPN+ouCrW98iM5fhn0BKtlc+NLEHLlfL6htHUICCIfPoM3YXq7DYHA4JKkCk9os1IU/kf6oFkqg3ZwBqXDN1VtpQhtQhnFYHDeojodVduRHfR+iOywO/8hk2w3Prv2D0f69WmvQCzxhr2ZS1idOJsZCgr+BRMtSZbOrXeBSzc+HkSnAF/gEz4gOS47Px5XluVt311tmBkACtpuULhpyw+qZEOJ48efWnpy1wRjhfRplfck43Xrh4grrfkXCDbWI0hl/UbyEoUiDKjSsgy5prgwzRS3Aw4CMIMaUeGQ2XL1qywi35ngMqAVa9/ut49UaT3eeHgiONc+gRJIWmok/j8RVWzA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:39.2366 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4fcc6ed8-274b-4002-b3b2-08dce48a56e2 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8P190MB1192 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057060-302249-12644-33744-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.105 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYmhsbmQGYGUNTc0Mws1dAkLT XF1Dw5JdE80cAwzcDUJC0l0dLCzMTASKk2FgB14jvKQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan16-55.eu-central-1b.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 Implemented handler busy states and shutdowns of hardware queues. Added functionality for releasing RX and TX virtual queue resources, managed and releasing packets back into the availability ring. Updated sg_ops structure to include new queue management functions. Signed-off-by: Danylo Vodopianov --- drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c | 353 ++++++++++++++++++ drivers/net/ntnic/include/ntnic_dbs.h | 4 + drivers/net/ntnic/include/ntnic_virt_queue.h | 6 + drivers/net/ntnic/nthw/dbs/nthw_dbs.c | 45 +++ 4 files changed, 408 insertions(+) diff --git a/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c b/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c index 46b4c4415c..6d7862791d 100644 --- a/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c +++ b/drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c @@ -6,6 +6,7 @@ #include #include "ntos_drv.h" +#include "nt_util.h" #include "ntnic_virt_queue.h" #include "ntnic_mod_reg.h" #include "ntlog.h" @@ -37,6 +38,26 @@ #define VIRTQ_AVAIL_F_NO_INTERRUPT 1 +#define vq_log_arg(vq, format, ...) + +/* + * Packed Ring helper macros + */ +#define PACKED(vq_type) ((vq_type) == PACKED_RING ? 1 : 0) + +#define avail_flag(vq) ((vq)->avail_wrap_count ? VIRTQ_DESC_F_AVAIL : 0) +#define used_flag_inv(vq) ((vq)->avail_wrap_count ? 0 : VIRTQ_DESC_F_USED) + +#define inc_avail(vq, num) \ + do { \ + struct nthw_virt_queue *temp_vq = (vq); \ + temp_vq->next_avail += (num); \ + if (temp_vq->next_avail >= temp_vq->queue_size) { \ + temp_vq->next_avail -= temp_vq->queue_size; \ + temp_vq->avail_wrap_count ^= 1; \ + } \ + } while (0) + struct __rte_aligned(8) virtq_avail { uint16_t flags; uint16_t idx; @@ -115,6 +136,7 @@ struct nthw_virt_queue { uint32_t host_id; uint32_t port; /* Only used by TX queues */ uint32_t virtual_port; /* Only used by TX queues */ + uint32_t header; /* * Only used by TX queues: * 0: VirtIO-Net header (12 bytes). @@ -417,6 +439,237 @@ static struct nthw_virt_queue *nthw_setup_rx_virt_queue(nthw_dbs_t *p_nthw_dbs, return &rxvq[index]; } +static int dbs_wait_hw_queue_shutdown(struct nthw_virt_queue *vq, int rx); + +static int dbs_wait_on_busy(struct nthw_virt_queue *vq, uint32_t *idle, int rx) +{ + uint32_t busy; + uint32_t queue; + int err = 0; + nthw_dbs_t *p_nthw_dbs = vq->mp_nthw_dbs; + + do { + if (rx) + err = get_rx_idle(p_nthw_dbs, idle, &queue, &busy); + + else + err = get_tx_idle(p_nthw_dbs, idle, &queue, &busy); + } while (!err && busy); + + return err; +} + +static int dbs_wait_hw_queue_shutdown(struct nthw_virt_queue *vq, int rx) +{ + int err = 0; + uint32_t idle = 0; + nthw_dbs_t *p_nthw_dbs = vq->mp_nthw_dbs; + + err = dbs_wait_on_busy(vq, &idle, rx); + + if (err) { + if (err == -ENOTSUP) { + nt_os_wait_usec(200000); + return 0; + } + + return -1; + } + + do { + if (rx) + err = set_rx_idle(p_nthw_dbs, 1, vq->index); + + else + err = set_tx_idle(p_nthw_dbs, 1, vq->index); + + if (err) + return -1; + + if (dbs_wait_on_busy(vq, &idle, rx) != 0) + return -1; + + } while (idle == 0); + + return 0; +} + +static int dbs_internal_release_rx_virt_queue(struct nthw_virt_queue *rxvq) +{ + nthw_dbs_t *p_nthw_dbs = rxvq->mp_nthw_dbs; + + if (rxvq == NULL) + return -1; + + /* Clear UW */ + rxvq->used_struct_phys_addr = NULL; + + if (set_rx_uw_data(p_nthw_dbs, rxvq->index, (uint64_t)rxvq->used_struct_phys_addr, + rxvq->host_id, 0, PACKED(rxvq->vq_type), 0, 0, 0) != 0) { + return -1; + } + + /* Disable AM */ + rxvq->am_enable = RX_AM_DISABLE; + + if (set_rx_am_data(p_nthw_dbs, + rxvq->index, + (uint64_t)rxvq->avail_struct_phys_addr, + rxvq->am_enable, + rxvq->host_id, + PACKED(rxvq->vq_type), + 0) != 0) { + return -1; + } + + /* Let the FPGA finish packet processing */ + if (dbs_wait_hw_queue_shutdown(rxvq, 1) != 0) + return -1; + + /* Clear rest of AM */ + rxvq->avail_struct_phys_addr = NULL; + rxvq->host_id = 0; + + if (set_rx_am_data(p_nthw_dbs, + rxvq->index, + (uint64_t)rxvq->avail_struct_phys_addr, + rxvq->am_enable, + rxvq->host_id, + PACKED(rxvq->vq_type), + 0) != 0) + return -1; + + /* Clear DR */ + rxvq->desc_struct_phys_addr = NULL; + + if (set_rx_dr_data(p_nthw_dbs, + rxvq->index, + (uint64_t)rxvq->desc_struct_phys_addr, + rxvq->host_id, + 0, + rxvq->header, + PACKED(rxvq->vq_type)) != 0) + return -1; + + /* Initialize queue */ + dbs_init_rx_queue(p_nthw_dbs, rxvq->index, 0, 0); + + /* Reset queue state */ + rxvq->usage = NTHW_VIRTQ_UNUSED; + rxvq->mp_nthw_dbs = p_nthw_dbs; + rxvq->index = 0; + rxvq->queue_size = 0; + + return 0; +} + +static int nthw_release_mngd_rx_virt_queue(struct nthw_virt_queue *rxvq) +{ + if (rxvq == NULL || rxvq->usage != NTHW_VIRTQ_MANAGED) + return -1; + + if (rxvq->p_virtual_addr) { + free(rxvq->p_virtual_addr); + rxvq->p_virtual_addr = NULL; + } + + return dbs_internal_release_rx_virt_queue(rxvq); +} + +static int dbs_internal_release_tx_virt_queue(struct nthw_virt_queue *txvq) +{ + nthw_dbs_t *p_nthw_dbs = txvq->mp_nthw_dbs; + + if (txvq == NULL) + return -1; + + /* Clear UW */ + txvq->used_struct_phys_addr = NULL; + + if (set_tx_uw_data(p_nthw_dbs, txvq->index, (uint64_t)txvq->used_struct_phys_addr, + txvq->host_id, 0, PACKED(txvq->vq_type), 0, 0, 0, + txvq->in_order) != 0) { + return -1; + } + + /* Disable AM */ + txvq->am_enable = TX_AM_DISABLE; + + if (set_tx_am_data(p_nthw_dbs, + txvq->index, + (uint64_t)txvq->avail_struct_phys_addr, + txvq->am_enable, + txvq->host_id, + PACKED(txvq->vq_type), + 0) != 0) { + return -1; + } + + /* Let the FPGA finish packet processing */ + if (dbs_wait_hw_queue_shutdown(txvq, 0) != 0) + return -1; + + /* Clear rest of AM */ + txvq->avail_struct_phys_addr = NULL; + txvq->host_id = 0; + + if (set_tx_am_data(p_nthw_dbs, + txvq->index, + (uint64_t)txvq->avail_struct_phys_addr, + txvq->am_enable, + txvq->host_id, + PACKED(txvq->vq_type), + 0) != 0) { + return -1; + } + + /* Clear DR */ + txvq->desc_struct_phys_addr = NULL; + txvq->port = 0; + txvq->header = 0; + + if (set_tx_dr_data(p_nthw_dbs, + txvq->index, + (uint64_t)txvq->desc_struct_phys_addr, + txvq->host_id, + 0, + txvq->port, + txvq->header, + PACKED(txvq->vq_type)) != 0) { + return -1; + } + + /* Clear QP */ + txvq->virtual_port = 0; + + if (nthw_dbs_set_tx_qp_data(p_nthw_dbs, txvq->index, txvq->virtual_port) != 0) + return -1; + + /* Initialize queue */ + dbs_init_tx_queue(p_nthw_dbs, txvq->index, 0, 0); + + /* Reset queue state */ + txvq->usage = NTHW_VIRTQ_UNUSED; + txvq->mp_nthw_dbs = p_nthw_dbs; + txvq->index = 0; + txvq->queue_size = 0; + + return 0; +} + +static int nthw_release_mngd_tx_virt_queue(struct nthw_virt_queue *txvq) +{ + if (txvq == NULL || txvq->usage != NTHW_VIRTQ_MANAGED) + return -1; + + if (txvq->p_virtual_addr) { + free(txvq->p_virtual_addr); + txvq->p_virtual_addr = NULL; + } + + return dbs_internal_release_tx_virt_queue(txvq); +} + static struct nthw_virt_queue *nthw_setup_tx_virt_queue(nthw_dbs_t *p_nthw_dbs, uint32_t index, uint16_t start_idx, @@ -844,11 +1097,111 @@ nthw_setup_mngd_tx_virt_queue(nthw_dbs_t *p_nthw_dbs, return NULL; } +/* + * Put buffers back into Avail Ring + */ +static void nthw_release_rx_packets(struct nthw_virt_queue *rxvq, uint16_t n) +{ + if (rxvq->vq_type == SPLIT_RING) { + rxvq->am_idx = (uint16_t)(rxvq->am_idx + n); + rxvq->p_avail->idx = rxvq->am_idx; + + } else if (rxvq->vq_type == PACKED_RING) { + int i; + /* + * Defer flags update on first segment - due to serialization towards HW and + * when jumbo segments are added + */ + + uint16_t first_flags = VIRTQ_DESC_F_WRITE | avail_flag(rxvq) | used_flag_inv(rxvq); + struct pvirtq_desc *first_desc = &rxvq->desc[rxvq->next_avail]; + + uint32_t len = rxvq->p_virtual_addr[0].len; /* all same size */ + + /* Optimization point: use in-order release */ + + for (i = 0; i < n; i++) { + struct pvirtq_desc *desc = &rxvq->desc[rxvq->next_avail]; + + desc->id = rxvq->next_avail; + desc->addr = (uint64_t)rxvq->p_virtual_addr[desc->id].phys_addr; + desc->len = len; + + if (i) + desc->flags = VIRTQ_DESC_F_WRITE | avail_flag(rxvq) | + used_flag_inv(rxvq); + + inc_avail(rxvq, 1); + } + + rte_rmb(); + first_desc->flags = first_flags; + } +} + +static void nthw_release_tx_packets(struct nthw_virt_queue *txvq, uint16_t n, uint16_t n_segs[]) +{ + int i; + + if (txvq->vq_type == SPLIT_RING) { + /* Valid because queue_size is always 2^n */ + uint16_t queue_mask = (uint16_t)(txvq->queue_size - 1); + + vq_log_arg(txvq, "pkts %i, avail idx %i, start at %i\n", n, txvq->am_idx, + txvq->tx_descr_avail_idx); + + for (i = 0; i < n; i++) { + int idx = txvq->am_idx & queue_mask; + txvq->p_avail->ring[idx] = txvq->tx_descr_avail_idx; + txvq->tx_descr_avail_idx = + (txvq->tx_descr_avail_idx + n_segs[i]) & queue_mask; + txvq->am_idx++; + } + + /* Make sure the ring has been updated before HW reads index update */ + rte_mb(); + txvq->p_avail->idx = txvq->am_idx; + vq_log_arg(txvq, "new avail idx %i, descr_idx %i\n", txvq->p_avail->idx, + txvq->tx_descr_avail_idx); + + } else if (txvq->vq_type == PACKED_RING) { + /* + * Defer flags update on first segment - due to serialization towards HW and + * when jumbo segments are added + */ + + uint16_t first_flags = avail_flag(txvq) | used_flag_inv(txvq); + struct pvirtq_desc *first_desc = &txvq->desc[txvq->next_avail]; + + for (i = 0; i < n; i++) { + struct pvirtq_desc *desc = &txvq->desc[txvq->next_avail]; + + desc->id = txvq->next_avail; + desc->addr = (uint64_t)txvq->p_virtual_addr[desc->id].phys_addr; + + if (i) + /* bitwise-or here because next flags may already have been setup + */ + desc->flags |= avail_flag(txvq) | used_flag_inv(txvq); + + inc_avail(txvq, 1); + } + + /* Proper read barrier before FPGA may see first flags */ + rte_rmb(); + first_desc->flags = first_flags; + } +} + static struct sg_ops_s sg_ops = { .nthw_setup_rx_virt_queue = nthw_setup_rx_virt_queue, .nthw_setup_tx_virt_queue = nthw_setup_tx_virt_queue, .nthw_setup_mngd_rx_virt_queue = nthw_setup_mngd_rx_virt_queue, + .nthw_release_mngd_rx_virt_queue = nthw_release_mngd_rx_virt_queue, .nthw_setup_mngd_tx_virt_queue = nthw_setup_mngd_tx_virt_queue, + .nthw_release_mngd_tx_virt_queue = nthw_release_mngd_tx_virt_queue, + .nthw_release_rx_packets = nthw_release_rx_packets, + .nthw_release_tx_packets = nthw_release_tx_packets, .nthw_virt_queue_init = nthw_virt_queue_init }; diff --git a/drivers/net/ntnic/include/ntnic_dbs.h b/drivers/net/ntnic/include/ntnic_dbs.h index 64947b4d8f..d70a7c445e 100644 --- a/drivers/net/ntnic/include/ntnic_dbs.h +++ b/drivers/net/ntnic/include/ntnic_dbs.h @@ -256,6 +256,10 @@ int get_rx_init(nthw_dbs_t *p, uint32_t *init, uint32_t *queue, uint32_t *busy); int set_tx_init(nthw_dbs_t *p, uint32_t start_idx, uint32_t start_ptr, uint32_t init, uint32_t queue); int get_tx_init(nthw_dbs_t *p, uint32_t *init, uint32_t *queue, uint32_t *busy); +int set_rx_idle(nthw_dbs_t *p, uint32_t idle, uint32_t queue); +int get_rx_idle(nthw_dbs_t *p, uint32_t *idle, uint32_t *queue, uint32_t *busy); +int set_tx_idle(nthw_dbs_t *p, uint32_t idle, uint32_t queue); +int get_tx_idle(nthw_dbs_t *p, uint32_t *idle, uint32_t *queue, uint32_t *busy); int set_rx_am_data(nthw_dbs_t *p, uint32_t index, uint64_t guest_physical_address, diff --git a/drivers/net/ntnic/include/ntnic_virt_queue.h b/drivers/net/ntnic/include/ntnic_virt_queue.h index d4c9a9835a..b95efabf97 100644 --- a/drivers/net/ntnic/include/ntnic_virt_queue.h +++ b/drivers/net/ntnic/include/ntnic_virt_queue.h @@ -45,8 +45,14 @@ struct __rte_aligned(8) virtq_desc { uint16_t next; }; + +/* + * Packed Ring special structures and defines + */ + /* additional packed ring flags */ #define VIRTQ_DESC_F_AVAIL (1 << 7) +#define VIRTQ_DESC_F_USED (1 << 15) /* descr phys address must be 16 byte aligned */ struct __rte_aligned(16) pvirtq_desc { diff --git a/drivers/net/ntnic/nthw/dbs/nthw_dbs.c b/drivers/net/ntnic/nthw/dbs/nthw_dbs.c index 6e1c5a5af6..89aa5428eb 100644 --- a/drivers/net/ntnic/nthw/dbs/nthw_dbs.c +++ b/drivers/net/ntnic/nthw/dbs/nthw_dbs.c @@ -485,6 +485,51 @@ int get_tx_init(nthw_dbs_t *p, uint32_t *init, uint32_t *queue, uint32_t *busy) return 0; } +int set_rx_idle(nthw_dbs_t *p, uint32_t idle, uint32_t queue) +{ + if (!p->mp_reg_rx_idle) + return -ENOTSUP; + + nthw_field_set_val32(p->mp_fld_rx_idle_idle, idle); + nthw_field_set_val32(p->mp_fld_rx_idle_queue, queue); + nthw_register_flush(p->mp_reg_rx_idle, 1); + return 0; +} + +int get_rx_idle(nthw_dbs_t *p, uint32_t *idle, uint32_t *queue, uint32_t *busy) +{ + if (!p->mp_reg_rx_idle) + return -ENOTSUP; + + *idle = nthw_field_get_updated(p->mp_fld_rx_idle_idle); + *queue = 0; + *busy = nthw_field_get_updated(p->mp_fld_rx_idle_busy); + return 0; +} + +int set_tx_idle(nthw_dbs_t *p, uint32_t idle, uint32_t queue) +{ + if (!p->mp_reg_tx_idle) + return -ENOTSUP; + + nthw_field_set_val32(p->mp_fld_tx_idle_idle, idle); + nthw_field_set_val32(p->mp_fld_tx_idle_queue, queue); + nthw_register_flush(p->mp_reg_tx_idle, 1); + return 0; +} + +int get_tx_idle(nthw_dbs_t *p, uint32_t *idle, uint32_t *queue, uint32_t *busy) +{ + if (!p->mp_reg_tx_idle) + return -ENOTSUP; + + *idle = nthw_field_get_updated(p->mp_fld_tx_idle_idle); + *queue = 0; + *busy = nthw_field_get_updated(p->mp_fld_tx_idle_busy); + return 0; +} + + static void set_rx_am_data_index(nthw_dbs_t *p, uint32_t index) { nthw_field_set_val32(p->mp_fld_rx_avail_monitor_control_adr, index); From patchwork Fri Oct 4 15:34:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145096 X-Patchwork-Delegate: ferruh.yigit@amd.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 13C9C45AAF; Fri, 4 Oct 2024 17:52:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25ECC42DD5; Fri, 4 Oct 2024 17:51:00 +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 71DF14281D for ; Fri, 4 Oct 2024 17:50:56 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2104.outbound.protection.outlook.com [104.47.17.104]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:50:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iWRWr1lJ6rAg/64po7533d/V+JmshEdQSuHax7rtLNiMBFlMF+eTA++cHwCZt9dDdeIHXtcG3oIVshSEh7y247BvHv+REt8CrvY0SEH+casoh/cdv+RoA7zws0ifI0zvC283dPakCK4SKTgezqMBjvn/jgt8Vfg1n1J/1mWBanJKIE0qB9I06EVX/I5gDw3R8KY8ngR1QNA2dyJ/gDV0TdcVqFCjtyzmEGzK2nc0Thd8akSouf+J9vbs+++vMUeK5JoAPZe22n0pSQJO/mQk1CzsghbmEv5YDgQXI1/yzhsY6TvDqsu3Z+uuRXpRClueObnjB0Zem8ZFDxOZUTrL5Q== 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=ttscVMDPpEn+9580y18nYq4Rqadu/sE8qrqMEO+w5uo=; b=N6jxYR+Kc9Xq33FmHw1uSW9hN0ZDq7yXjUhhr8AQIQaUVfDNll42vaZak+C1portL9tHtf9ehoXQcwAGq4UG5ZaKFWHq06UpnNApyPBuGiJb5XSey8V+/PZFy3ZDVJx1gVr7yUmzE3DfV8a/I2JLmY+MCI7AQ1K3LMi8ajhMJF377/Ez4PQCRAJlNL08UIR34ZG03D2bhaU8u9aipW2KQRiMBeVADCHwhnwyqQS/SRJveH48zUHX5sxW2p8x2oeRisa8NS2zawIQL6IjmueBIMhrVPS9rki6fAjH3BmKWYf0jhBHnFjZVzt5M0y45g1bo/DfeYLtIsB5dAAbrHqFvA== 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=ttscVMDPpEn+9580y18nYq4Rqadu/sE8qrqMEO+w5uo=; b=ZiXP6peBQih3hkZLIhYda2C+fwS+HtVtHUq+m2rNfEM6p9XMj6K1VsyWsxlEhj4wg4b0Pc8xB01veXLOuBFxKQ0ij9h9OhDGqXw8Hp4liZTCYCLtgGpwy8HLRFzJJGJwdM2yXg2IOk22ZdiI1fGbaeuPyUB/9EbJZ8SwyKnQ5fo= Received: from AM0PR10CA0116.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::33) by VI1P190MB0800.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:128::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 15:36:15 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::56) by AM0PR10CA0116.outlook.office365.com (2603:10a6:208:e6::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:14 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:14 +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, Oleksandr Kolomeiets Subject: [PATCH v1 14/31] net/ntnic: add header field update (HFU) flow module Date: Fri, 4 Oct 2024 17:34:37 +0200 Message-ID: <20241004153551.267935-20-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|VI1P190MB0800:EE_ X-MS-Office365-Filtering-Correlation-Id: af9c7f71-b051-429b-70bc-08dce48a484f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: /UKya500iesdLUsNJ1+b0RAl5AEPhi4tF4f8F0hLYP5lp1aITLZC7jtmad31y1v8wlKEXQPm214HslAGmexaZ6b/3rEB7CpLlNCfStCeo2NQJCFcTroKj5yLj+CJgU0UU4O1xnC2XQqIXJNs64iEsLdcl0QgGCIXlCNed9+WIkbjK2Eg/yuuinqDgC30LOKC3KYufaZFq9MPBX/V8k1VNAtMMwRa+drln+O2YBtQo7XK7dnOkkSsUdPsAqz42YDtkTjCSVpLtosxSqJUOgGsnXA8BezldUYAl/pqka8sxNl4F3BTzWfFHQeO5jeuyuIMdo1BJGylj/SO6XGMFKnNC0GbRekAMxJe3MAoCqfV6AziNf8IeRXzynQO1CP08yfctbpS0mkiwCqSPpVWfo1Ay7G7tZVLZ8eENIyGvHND9FZU6UwL2qzQDbFr6mX6V6uJgw0b5sk3kthu+DzzBZ72Y8yiBkgyQJ++BeECFzI3IwzFFhrNtA6m/Nm7q0fluB3HuSb1CwHOyORmKAbzMA2ZQxhwaud8BL4C1oQpddm4A1PsHa1EErK6ANdVObeJOBt+MQRHOxm9XVE5JISocLJCucj75KSz2ncay2KX9S9RYylVTwCeHbb1/gMTa6hZpsTaZ/axTf1jSFcYD/367Bdrfx9vC9f47nuC6InI2s3kZOwhwZ9pw6o99xM6c7XPsk/sonmVJdtvD1ed7x97tQBWxX+TkDaElqOIgZAsfSkfh5sH8dGQ34WZd6bW5vxIP7gjNRXfR9NAjo5+hH9V2WZWZofoSiW0T/wDxv8l3F5I6tRnxTM4k76aRnz8Z4td+/NOUiZUwDrzXjMGw7+yMmxoBbEQpTNDuOE2IkKAypqRiuq6E1HT6AFq7vDHaUiy/J5g48L/GSH6PtWxJq3xgKxslWcqCD7Dw5CYRmT5sH/DTGx/QMiRSCh/fOkUCw3AtSb0BuX+GGsMzJXDfvbTfFH64D1hnasUjJjG4QoVurILmkYHz4B8DCYvhBeEGDNYFhft/qN/D5sPRXf+QR0uU0szvo42DbNUxYC05VMQfgd6+9kXIfbVx59oqGQa7MYMWxlEMyOxUTSHBQ4Vps+FmqCTb/u/LwjT6ulRRpcGE5eFDe5NZlqgF5s3PvgZQQojSHHrvd3NxFpnLcduWHntBjX22bcHm19FBZA2AQIBebe4pwbv5dwa2tUIwiG7ifxxJmoxQ0rDN5H3J3RyFAGDXyNiKKgbME6V1+TAcz11sBO5cxDW5zus1uii/xxjiTdU1pqldQ3QqEfkvlhFe5iY22tNx5rxPIFZ1LK+6OyMAVMNptTi1AEuTe8b+4HiPYai1QnuDaG8Z4QjJSuXlD2G0e6si7LviFxTBFDctKScCZdWEvTL2QsrgnGMFXRrfLDYApEb 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)(36860700013)(376014)(1800799024)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Re/IU79wyZ+gElsd03C3EgYiwZlT52XDEEpcBUsif6Rnaj89MIEh7haLnRlB2AYIBlOIwLoxw0G2X7ASyFin8cuev9bC+D5YQB5a79XdHotVIgN7wW1qRqZxH1JcyErOlvnA1tsyPhahT2qGRzFabF/1m0zULUwOzJ1JAkvM0Bh6UE7ELrtMqWzBvC+tWpOKvfa7+na2z9CqsjH6mpHtY4cFXOESXiWQuLb0s4R55C6e7Wp3v+gQevkyl0/Ndxko1diGfNduMiWrKXMR4d54owyIBLyFOq9pmaN4VKBo/8aXc35UIUR+oWTzMFUvuhdWk7Z96KFm3Qnp14iGJaH9VHrd5hCHIrqh8DP/mCYghorwPzGd4hjn/39xphlotODwDmd6o30KNJlDFy4Wj0KLhMaV8NVDlmK0Qd/mvtr35BiuXtRnLKR991F7P0HpZcSF14hj9F5CFNp0mYNQNt51KBEiEe6n1MpBut8xUGoeq+ZeFisxiD8GpQdJ8McsUif01XePg6gLj+Kr/cGK0asAKBRrAuOMTGSm1yjwd7lUbRyZTKBfdX+P08M4Z7Jjz9lsFM1LTmJl8vGj+6zmn/qpmYHM4z5ccSneGpwFWIZQmSQP0BLDdcd9tp7kz53wz5Sqobf65FrIGvsuJECaThdlGw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:14.7834 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: af9c7f71-b051-429b-70bc-08dce48a484f 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1P190MB0800 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057055-311388-7260-10932-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.104 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaGlkbGQGYGUNTUzDzZwszEws zUIDnNxMw0MTklyTDFONHcxCg11SjZQqk2FgCtg5sZQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan14-151.eu-central-1a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE_7582B META: Custom Rule 7582B 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_RULE_7582B, 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: Oleksandr Kolomeiets The Header Field Update module updates protocol fields if the packets have been changed, for example length fields and next protocol fields. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/meson.build | 1 + .../nthw/flow_api/flow_backend/flow_backend.c | 13 +++ .../ntnic/nthw/flow_filter/flow_nthw_hfu.c | 99 +++++++++++++++++++ .../ntnic/nthw/flow_filter/flow_nthw_hfu.h | 54 ++++++++++ .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 1 + .../nthw/supported/nthw_fpga_reg_defs_hfu.h | 49 +++++++++ 7 files changed, 218 insertions(+) create mode 100644 drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.c create mode 100644 drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_hfu.h diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 35f7feb7be..552cbc30bf 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -48,6 +48,7 @@ sources = files( 'nthw/flow_api/flow_filter.c', 'nthw/flow_filter/flow_nthw_cat.c', 'nthw/flow_filter/flow_nthw_flm.c', + 'nthw/flow_filter/flow_nthw_hfu.c', 'nthw/flow_filter/flow_nthw_hsh.c', 'nthw/flow_filter/flow_nthw_ifr.c', 'nthw/flow_filter/flow_nthw_info.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c index e3c4c5b7cb..feb3355de3 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c @@ -10,6 +10,7 @@ #include "flow_nthw_cat.h" #include "flow_nthw_km.h" #include "flow_nthw_flm.h" +#include "flow_nthw_hfu.h" #include "flow_nthw_hsh.h" #include "flow_nthw_qsl.h" #include "flow_nthw_slc_lr.h" @@ -36,6 +37,7 @@ static struct backend_dev_s { struct qsl_nthw *p_qsl_nthw; struct slc_lr_nthw *p_slc_lr_nthw; struct pdb_nthw *p_pdb_nthw; + struct hfu_nthw *p_hfu_nthw; /* TPE module */ struct ifr_nthw *p_ifr_nthw; /* TPE module */ } be_devs[MAX_PHYS_ADAPTERS]; @@ -1783,6 +1785,16 @@ const struct flow_api_backend_ops *bin_flow_backend_init(nthw_fpga_t *p_fpga, vo be_devs[physical_adapter_no].p_pdb_nthw = NULL; } + /* Init nthw HFU */ + if (hfu_nthw_init(NULL, p_fpga, physical_adapter_no) == 0) { + struct hfu_nthw *ptr = hfu_nthw_new(); + hfu_nthw_init(ptr, p_fpga, physical_adapter_no); + be_devs[physical_adapter_no].p_hfu_nthw = ptr; + + } else { + be_devs[physical_adapter_no].p_hfu_nthw = NULL; + } + be_devs[physical_adapter_no].adapter_no = physical_adapter_no; *dev = (void *)&be_devs[physical_adapter_no]; @@ -1800,6 +1812,7 @@ static void bin_flow_backend_done(void *dev) qsl_nthw_delete(be_dev->p_qsl_nthw); slc_lr_nthw_delete(be_dev->p_slc_lr_nthw); pdb_nthw_delete(be_dev->p_pdb_nthw); + hfu_nthw_delete(be_dev->p_hfu_nthw); } static const struct flow_backend_ops ops = { diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.c new file mode 100644 index 0000000000..36d181df02 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.c @@ -0,0 +1,99 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include + +#include "ntlog.h" +#include "nthw_drv.h" +#include "nthw_register.h" + +#include "flow_nthw_hfu.h" + +struct hfu_nthw *hfu_nthw_new(void) +{ + struct hfu_nthw *p = malloc(sizeof(struct hfu_nthw)); + + if (p) + (void)memset(p, 0, sizeof(*p)); + + return p; +} + +void hfu_nthw_delete(struct hfu_nthw *p) +{ + if (p) { + (void)memset(p, 0, sizeof(*p)); + free(p); + } +} + +int hfu_nthw_init(struct hfu_nthw *p, nthw_fpga_t *p_fpga, int n_instance) +{ + const char *const p_adapter_id_str = p_fpga->p_fpga_info->mp_adapter_id_str; + nthw_module_t *p_mod = nthw_fpga_query_module(p_fpga, MOD_HFU, n_instance); + + assert(n_instance >= 0 && n_instance < 256); + + if (p == NULL) + return p_mod == NULL ? -1 : 0; + + if (p_mod == NULL) { + NT_LOG(ERR, NTHW, "%s: Hfu %d: no such instance\n", p_adapter_id_str, n_instance); + return -1; + } + + p->mp_fpga = p_fpga; + p->m_physical_adapter_no = (uint8_t)n_instance; + p->m_hfu = nthw_fpga_query_module(p_fpga, MOD_HFU, n_instance); + + p->mp_rcp_ctrl = nthw_module_get_register(p->m_hfu, HFU_RCP_CTRL); + p->mp_rcp_addr = nthw_register_get_field(p->mp_rcp_ctrl, HFU_RCP_CTRL_ADR); + p->mp_rcp_cnt = nthw_register_get_field(p->mp_rcp_ctrl, HFU_RCP_CTRL_CNT); + + p->mp_rcp_data = nthw_module_get_register(p->m_hfu, HFU_RCP_DATA); + p->mp_rcp_data_len_a_wr = nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_A_WR); + p->mp_rcp_data_len_a_ol4len = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_A_OL4LEN); + p->mp_rcp_data_len_a_pos_dyn = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_A_POS_DYN); + p->mp_rcp_data_len_a_pos_ofs = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_A_POS_OFS); + p->mp_rcp_data_len_a_add_dyn = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_A_ADD_DYN); + p->mp_rcp_data_len_a_add_ofs = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_A_ADD_OFS); + p->mp_rcp_data_len_a_sub_dyn = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_A_SUB_DYN); + p->mp_rcp_data_len_b_wr = nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_B_WR); + p->mp_rcp_data_len_b_pos_dyn = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_B_POS_DYN); + p->mp_rcp_data_len_b_pos_ofs = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_B_POS_OFS); + p->mp_rcp_data_len_b_add_dyn = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_B_ADD_DYN); + p->mp_rcp_data_len_b_add_ofs = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_B_ADD_OFS); + p->mp_rcp_data_len_b_sub_dyn = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_B_SUB_DYN); + p->mp_rcp_data_len_c_wr = nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_C_WR); + p->mp_rcp_data_len_c_pos_dyn = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_C_POS_DYN); + p->mp_rcp_data_len_c_pos_ofs = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_C_POS_OFS); + p->mp_rcp_data_len_c_add_dyn = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_C_ADD_DYN); + p->mp_rcp_data_len_c_add_ofs = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_C_ADD_OFS); + p->mp_rcp_data_len_c_sub_dyn = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_LEN_C_SUB_DYN); + p->mp_rcp_data_ttl_wr = nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_TTL_WR); + p->mp_rcp_data_ttl_pos_dyn = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_TTL_POS_DYN); + p->mp_rcp_data_ttl_pos_ofs = + nthw_register_get_field(p->mp_rcp_data, HFU_RCP_DATA_TTL_POS_OFS); + + return 0; +} diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.h b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.h new file mode 100644 index 0000000000..7a59066b92 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.h @@ -0,0 +1,54 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef __FLOW_NTHW_HFU_H__ +#define __FLOW_NTHW_HFU_H__ + +#include + +#include "nthw_fpga_model.h" + +struct hfu_nthw { + uint8_t m_physical_adapter_no; + nthw_fpga_t *mp_fpga; + + nthw_module_t *m_hfu; + + nthw_register_t *mp_rcp_ctrl; + nthw_field_t *mp_rcp_addr; + nthw_field_t *mp_rcp_cnt; + + nthw_register_t *mp_rcp_data; + nthw_field_t *mp_rcp_data_len_a_wr; + nthw_field_t *mp_rcp_data_len_a_ol4len; + nthw_field_t *mp_rcp_data_len_a_pos_dyn; + nthw_field_t *mp_rcp_data_len_a_pos_ofs; + nthw_field_t *mp_rcp_data_len_a_add_dyn; + nthw_field_t *mp_rcp_data_len_a_add_ofs; + nthw_field_t *mp_rcp_data_len_a_sub_dyn; + nthw_field_t *mp_rcp_data_len_b_wr; + nthw_field_t *mp_rcp_data_len_b_pos_dyn; + nthw_field_t *mp_rcp_data_len_b_pos_ofs; + nthw_field_t *mp_rcp_data_len_b_add_dyn; + nthw_field_t *mp_rcp_data_len_b_add_ofs; + nthw_field_t *mp_rcp_data_len_b_sub_dyn; + nthw_field_t *mp_rcp_data_len_c_wr; + nthw_field_t *mp_rcp_data_len_c_pos_dyn; + nthw_field_t *mp_rcp_data_len_c_pos_ofs; + nthw_field_t *mp_rcp_data_len_c_add_dyn; + nthw_field_t *mp_rcp_data_len_c_add_ofs; + nthw_field_t *mp_rcp_data_len_c_sub_dyn; + nthw_field_t *mp_rcp_data_ttl_wr; + nthw_field_t *mp_rcp_data_ttl_pos_dyn; + nthw_field_t *mp_rcp_data_ttl_pos_ofs; +}; + +struct hfu_nthw *hfu_nthw_new(void); +void hfu_nthw_delete(struct hfu_nthw *p); +int hfu_nthw_init(struct hfu_nthw *p, nthw_fpga_t *p_fpga, int n_instance); + +int hfu_nthw_setup(struct hfu_nthw *p, int n_idx, int n_idx_cnt); + +#endif /* __FLOW_NTHW_HFU_H__ */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h index 65c482f7c8..2d53dfdf98 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h @@ -19,6 +19,7 @@ #define MOD_GFG (0xfc423807UL) #define MOD_GMF (0x68b1d15aUL) #define MOD_GPIO_PHY (0xbbe81659UL) +#define MOD_HFU (0x4a70e72UL) #define MOD_HIF (0x7815363UL) #define MOD_HSH (0x501484bfUL) #define MOD_I2CM (0x93bc7780UL) diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h index ccb57fdd47..c49913036e 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h @@ -18,6 +18,7 @@ #include "nthw_fpga_reg_defs_gfg.h" #include "nthw_fpga_reg_defs_gmf.h" #include "nthw_fpga_reg_defs_gpio_phy.h" +#include "nthw_fpga_reg_defs_hfu.h" #include "nthw_fpga_reg_defs_hif.h" #include "nthw_fpga_reg_defs_hsh.h" #include "nthw_fpga_reg_defs_i2cm.h" diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_hfu.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_hfu.h new file mode 100644 index 0000000000..1334e55ef3 --- /dev/null +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_hfu.h @@ -0,0 +1,49 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +/* + * nthw_fpga_reg_defs_hfu.h + * + * Auto-generated file - do *NOT* edit + * + */ + +#ifndef _NTHW_FPGA_REG_DEFS_HFU_ +#define _NTHW_FPGA_REG_DEFS_HFU_ + +/* HFU */ +#define NTHW_MOD_HFU (0x4a70e72UL) +#define HFU_RCP_CTRL (0xbfa69368UL) +#define HFU_RCP_CTRL_ADR (0xa3c53608UL) +#define HFU_RCP_CTRL_CNT (0xb3cdafd9UL) +#define HFU_RCP_DATA (0x10771171UL) +#define HFU_RCP_DATA_LEN_A_ADD_DYN (0xf48e5cadUL) +#define HFU_RCP_DATA_LEN_A_ADD_OFS (0x5687d10bUL) +#define HFU_RCP_DATA_LEN_A_OL4LEN (0xb06eaffcUL) +#define HFU_RCP_DATA_LEN_A_POS_DYN (0x8d207086UL) +#define HFU_RCP_DATA_LEN_A_POS_OFS (0x2f29fd20UL) +#define HFU_RCP_DATA_LEN_A_SUB_DYN (0x4305f5d4UL) +#define HFU_RCP_DATA_LEN_A_WR (0x22d5466UL) +#define HFU_RCP_DATA_LEN_B_ADD_DYN (0xcd036068UL) +#define HFU_RCP_DATA_LEN_B_ADD_OFS (0x6f0aedceUL) +#define HFU_RCP_DATA_LEN_B_POS_DYN (0xb4ad4c43UL) +#define HFU_RCP_DATA_LEN_B_POS_OFS (0x16a4c1e5UL) +#define HFU_RCP_DATA_LEN_B_SUB_DYN (0x7a88c911UL) +#define HFU_RCP_DATA_LEN_B_WR (0x1098fb88UL) +#define HFU_RCP_DATA_LEN_C_ADD_DYN (0xda78742bUL) +#define HFU_RCP_DATA_LEN_C_ADD_OFS (0x7871f98dUL) +#define HFU_RCP_DATA_LEN_C_POS_DYN (0xa3d65800UL) +#define HFU_RCP_DATA_LEN_C_POS_OFS (0x1dfd5a6UL) +#define HFU_RCP_DATA_LEN_C_SUB_DYN (0x6df3dd52UL) +#define HFU_RCP_DATA_LEN_C_WR (0xa8249cedUL) +#define HFU_RCP_DATA_TTL_POS_DYN (0x92a70913UL) +#define HFU_RCP_DATA_TTL_POS_OFS (0x30ae84b5UL) +#define HFU_RCP_DATA_TTL_WR (0x7a1aaf7UL) + +#endif /* _NTHW_FPGA_REG_DEFS_HFU_ */ + +/* + * Auto-generated file - do *NOT* edit + */ From patchwork Fri Oct 4 15:34:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145133 X-Patchwork-Delegate: ferruh.yigit@amd.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 6C35645AAF; Fri, 4 Oct 2024 17:57:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4057442F5F; Fri, 4 Oct 2024 17:52:21 +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 25F6842E87 for ; Fri, 4 Oct 2024 17:52:18 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2105.outbound.protection.outlook.com [104.47.17.105]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:52:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cNmcU7GSa/AYiJ14dh2Qeoqj1FQdw6NvVeImOgB9coTWgexSjaitPnIGMmaJ0B8wB/4Booi2YJE+OFzmwuQgKIx3wIjBOK29v6/KH+Kiv0eZjkmSk2Zbe3Nt+hHBnxHl0OvAhhVG5ScKKtuWCFnrmfAaiX/emdCAsJNkaTYz01HKPVsidKQ+0rcgF150WSvXBCocKMktDrlkZmxhxs0LSEClfkZ4/5/oPlLpN236zDt5LiYArCxl4j0P3mrIz511Y7MOPu055lZOA2C/mZg+2ob1RMFbvnNlJu6Uh9mBPNTy3oEWYQ21AmpE9EROcNH0rF76XV+lcjXu8fRrZUuGKg== 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=LlysQ6hu+7CudenBwvzrIqDqcyKqj9C49dP3v/c3LhE=; b=SYfrRA+HfFW4roZJimewVKqrdy4dt2Axy/peiZ3gsfG7M1dJLQJ9sOF7xw+U9TKu40IErejOopV9775YEcfQ7pU5uxdjwJYQdjfxY0uIXvxnDOB4+KkBTFkzXDu0KsGxPdi5ucem51U4SPKNLuGcnU4rcO0BkK/s+q5aKzkGMGWpCLCv4XrwlKpEAnM+JzdmQtSLnslSf9ZUMK7smLxW2Fb7uqXaTDL24FXoQCtm7xIn7TwZA2aaTY5trRkezI545ER+JfUzjlrQrXpFrN2t0u4j+HNVXqCmYmajk8jXS09sWyjgo3oDQre1RdPeX8SCLlGJYakVIj2LiZoVT7PXyA== 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=LlysQ6hu+7CudenBwvzrIqDqcyKqj9C49dP3v/c3LhE=; b=fDwDYUExPqwCy8bX8kbDb3xGO1gC6Md4G78mjV+ni7Htb9lwG16PmY088JhUvdAFsHIqlrH03Ej1YlAyvwxp295/YP1tQJo11BehPDAhTuqLjwB6UQ1hk17l47uEgclCa/MX8KRMzC9O/N7sdvzAsks8Z/TJRRtnzT+CkKojGA4= Received: from AM0PR10CA0117.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::34) by AM0P190MB0644.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:199::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 15:36:15 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::56) by AM0PR10CA0117.outlook.office365.com (2603:10a6:208:e6::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:15 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:15 +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, Oleksandr Kolomeiets Subject: [PATCH v1 15/31] net/ntnic: add RPP local retransmit (RPP LR) flow module Date: Fri, 4 Oct 2024 17:34:38 +0200 Message-ID: <20241004153551.267935-21-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|AM0P190MB0644:EE_ X-MS-Office365-Filtering-Correlation-Id: c3649533-ef8c-4c38-2fa7-08dce48a48d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: LI41AwH01Y3Vgw8oQkArwwQnAcr/ISBeU2jgmiUy1p2HEq/tT8MrShKiIYbVxQbH4nPvtdG9BvrMbVAh+bpJh1O50XvaqkH47+9YBPuWUKeXXpLyiM9GGi411kROOP2AXjL5ymuxQ/5wT/lpIXWkk+BIt3vXz/U2kaDWIR6Nf+ZqW1iBOyJCAgUjdNro9C/2DuwJxWPjJLMTWxy0E+9SoDBPUFALx5J4HKZi1SmG0Q2y6P9x3nX6Mi30paSTmI1pWKAmH8esO4nOj8qrhY6R9JXzXKV6KkYUGGb9IRhq0vs4Su9sNspq44/v2SHcjycMrjN5dWhpRr8TfwfVCN1F0xk6SwcXz+fm5/v5rJmUprgoquxSkg4z2kTTAryIm6+87xr2VIQrludzerY0DPWbkj4ygRiqMpF0vPMks8iSUbeXTV9rGnDA6Yuxr6C4nRGhjgj2zRLnFvD6TFafPJmH3kvXVA+lFsutOiieVXADhtVIRQsAT27IpllbnIpeApbiDJHVDzfeI7GSJs4i0Jza99avScSGh/BykjFQY5idKoXamM9+MEmWPydZSMELaLio5UrYZDvurlFIViXs3CX1NMRY90D8Mk3w097MXueeV8F3UMEk0R4rteUmo7h22Vz1J8dhIjPkQESg8YHvlntanRjWV8/OaotFHR/iTqaHhunN5pS3wA7ZZn68OkQRD6+ZNVOYKKOpbmyYgBXs1g/WnMCFWlUCFSCzeM7/HcdvD4EDTLimC+SEyKjhlz5aAjrgzvQ2PcjHVufLDUh20Gvvc3+2J3s2JNwM6FdeSy7Wn5QvuHNhw53iH/FFsUmxOzmTgxujyy+pAa5yKX7xtRz2wsPWa2k9gsWAjIjRhAq7j718BkRoU0T5Gf+8YNo3kTaQI5fapiJQecf3s3zmOO9hIRLmCfuLNxIZ2L04U62EsZK5VvwHtYxCWqRgXNBLnRMC+dXWkVEdZAOD2YXruwk2vRNX391ueTCjUvRUoGAGppKbPFeuwZgjpkAdWZaz/WE5v2Y9i+kWkwflCK6cVDMXidgHYnCXN89R94oqZzRfD+2tCHQDInwRN9r3QcbtzBhGDPxe1yXpBAuWa7RxIjjiHtfsepy81TZMUNG/tm9WuYnFPw8zW1yOBhyR6ZM7/dvdIHHo9Z7LcyUSjYyWj7z0G7gX2+2/qHUmq3XEI4or/rqEea6KDRCu3QV7hdXL+F53yI2rhTllNXrSPt85CRS++IyKBLsPew5ldMQcFgh667rGjjEv3re5oe9Wdsh13vJXAQqHXurkXydp/LQYXSS/gKfnuA8eZ0VSMaEIKRjsy1/uRXuLgWokhApmqx7iyFEUrw9KS3aDe2zKJ202bzeMTS+pwKrotqjEqO7TjOpIah3rTDezZiQREII0jt4l1X78 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)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: rzNiQabOfiOf84ggJPzWLp3koev0PfCf5N1jbPc29kKzaE3VvhY/iJMvQMr1pepSxT196w96hySpJ0Az0I8yKPOdLWXxkupakimaFomiZDGRf9KR9U2FMOWLZUiQwqjCbzVxs/grlKIQIMrb92nEC0J+4XJzM+gnkqn3fbwTnm/J4YQAJhLoZU6UFEgSF0EwMBWJ4XXOsiUPpXozg7jhcvCD4ST78q6Gk3Wa1d3HhcfUPHUUkAAOIV7AT2+VqsmQsenPXMkWyrL9sFAJASx2WL5flHhPdAACp0i5lEIttCuwbk0CR11VgpY6/3R78fKVCy7I4ehYa1Id0yQCx/5piapvAQLdrR/6Va/pPcw8Xh0ph6CnncBh0mj6sMLt9DTSvhESKIMxf9CaUonyD+eWjl5LZJmnC7BxfVfDsoErh72Yt1P3QX2HlS9Lf4uWc+CInPIJo5h5cHbEesDwj9gQehaLy2og0oc87XLg3bxrkUUBV+63DN8pMAeQDV7n7Z9uqfZb0my2MVrk87mNQ/sb/hurQMJJBg4eHE7qfsi6RXBfvAvo7EiyCrxai4WPmOS/Uepf98tsxpTdg66a3fhKLbJ5rb6wk1k6akCit6zIS5cP9PFFIhwG+cnpoEzW6bGQp+jNsd4StzfJ7tVTRTuYxw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:15.6272 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c3649533-ef8c-4c38-2fa7-08dce48a48d0 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0P190MB0644 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057137-311388-12679-32591-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.105 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVpYWZqZAVgZQ0NgsKTnJJDHRPN kgMSnR0CTVwMzQLNnA0CDV0jzVMNVYqTYWAEJIe7pBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan13-5.eu-central-1a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, 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: Oleksandr Kolomeiets The RX Packet Process for Local Retransmit module can add bytes in the FPGA TX pipeline, which is needed when the packet increases in size. Note, this makes room for packet expansion, but the actual expansion is done by the modules. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/meson.build | 1 + .../nthw/flow_api/flow_backend/flow_backend.c | 13 ++++ .../ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c | 76 +++++++++++++++++++ .../ntnic/nthw/flow_filter/flow_nthw_rpp_lr.h | 44 +++++++++++ .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 1 + .../supported/nthw_fpga_reg_defs_rpp_lr.h | 37 +++++++++ 7 files changed, 173 insertions(+) create mode 100644 drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c create mode 100644 drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpp_lr.h diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 552cbc30bf..2dfb0d0627 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -55,6 +55,7 @@ sources = files( 'nthw/flow_filter/flow_nthw_km.c', 'nthw/flow_filter/flow_nthw_pdb.c', 'nthw/flow_filter/flow_nthw_qsl.c', + 'nthw/flow_filter/flow_nthw_rpp_lr.c', 'nthw/flow_filter/flow_nthw_slc_lr.c', 'nthw/model/nthw_fpga_model.c', 'nthw/nthw_platform.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c index feb3355de3..e2abbf0368 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c @@ -15,6 +15,7 @@ #include "flow_nthw_qsl.h" #include "flow_nthw_slc_lr.h" #include "flow_nthw_pdb.h" +#include "flow_nthw_rpp_lr.h" #include "ntnic_mod_reg.h" #include "nthw_fpga_model.h" #include "hw_mod_backend.h" @@ -38,6 +39,7 @@ static struct backend_dev_s { struct slc_lr_nthw *p_slc_lr_nthw; struct pdb_nthw *p_pdb_nthw; struct hfu_nthw *p_hfu_nthw; /* TPE module */ + struct rpp_lr_nthw *p_rpp_lr_nthw; /* TPE module */ struct ifr_nthw *p_ifr_nthw; /* TPE module */ } be_devs[MAX_PHYS_ADAPTERS]; @@ -1795,6 +1797,16 @@ const struct flow_api_backend_ops *bin_flow_backend_init(nthw_fpga_t *p_fpga, vo be_devs[physical_adapter_no].p_hfu_nthw = NULL; } + /* Init nthw RPP_LR */ + if (rpp_lr_nthw_init(NULL, p_fpga, physical_adapter_no) == 0) { + struct rpp_lr_nthw *ptr = rpp_lr_nthw_new(); + rpp_lr_nthw_init(ptr, p_fpga, physical_adapter_no); + be_devs[physical_adapter_no].p_rpp_lr_nthw = ptr; + + } else { + be_devs[physical_adapter_no].p_rpp_lr_nthw = NULL; + } + be_devs[physical_adapter_no].adapter_no = physical_adapter_no; *dev = (void *)&be_devs[physical_adapter_no]; @@ -1813,6 +1825,7 @@ static void bin_flow_backend_done(void *dev) slc_lr_nthw_delete(be_dev->p_slc_lr_nthw); pdb_nthw_delete(be_dev->p_pdb_nthw); hfu_nthw_delete(be_dev->p_hfu_nthw); + rpp_lr_nthw_delete(be_dev->p_rpp_lr_nthw); } static const struct flow_backend_ops ops = { diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c new file mode 100644 index 0000000000..84bbcbdc4f --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c @@ -0,0 +1,76 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include + +#include "ntlog.h" +#include "nthw_drv.h" +#include "nthw_register.h" + +#include "flow_nthw_rpp_lr.h" + +struct rpp_lr_nthw *rpp_lr_nthw_new(void) +{ + struct rpp_lr_nthw *p = malloc(sizeof(struct rpp_lr_nthw)); + + if (p) + (void)memset(p, 0, sizeof(*p)); + + return p; +} + +void rpp_lr_nthw_delete(struct rpp_lr_nthw *p) +{ + if (p) { + (void)memset(p, 0, sizeof(*p)); + free(p); + } +} + +int rpp_lr_nthw_init(struct rpp_lr_nthw *p, nthw_fpga_t *p_fpga, int n_instance) +{ + const char *const p_adapter_id_str = p_fpga->p_fpga_info->mp_adapter_id_str; + nthw_module_t *p_mod = nthw_fpga_query_module(p_fpga, MOD_RPP_LR, n_instance); + + assert(n_instance >= 0 && n_instance < 256); + + if (p == NULL) + return p_mod == NULL ? -1 : 0; + + if (p_mod == NULL) { + NT_LOG(ERR, NTHW, "%s: RppLr %d: no such instance\n", p_adapter_id_str, + n_instance); + return -1; + } + + p->mp_fpga = p_fpga; + p->m_physical_adapter_no = (uint8_t)n_instance; + p->m_rpp_lr = nthw_fpga_query_module(p_fpga, MOD_RPP_LR, n_instance); + + p->mp_rcp_ctrl = nthw_module_get_register(p->m_rpp_lr, RPP_LR_RCP_CTRL); + p->mp_rcp_addr = nthw_register_get_field(p->mp_rcp_ctrl, RPP_LR_RCP_CTRL_ADR); + p->mp_rcp_cnt = nthw_register_get_field(p->mp_rcp_ctrl, RPP_LR_RCP_CTRL_CNT); + p->mp_rcp_data = nthw_module_get_register(p->m_rpp_lr, RPP_LR_RCP_DATA); + p->mp_rcp_data_exp = nthw_register_get_field(p->mp_rcp_data, RPP_LR_RCP_DATA_EXP); + + p->mp_ifr_rcp_ctrl = nthw_module_query_register(p->m_rpp_lr, RPP_LR_IFR_RCP_CTRL); + p->mp_ifr_rcp_addr = + nthw_register_query_field(p->mp_ifr_rcp_ctrl, RPP_LR_IFR_RCP_CTRL_ADR); + p->mp_ifr_rcp_cnt = nthw_register_query_field(p->mp_ifr_rcp_ctrl, RPP_LR_IFR_RCP_CTRL_CNT); + p->mp_ifr_rcp_data = nthw_module_query_register(p->m_rpp_lr, RPP_LR_IFR_RCP_DATA); + p->mp_ifr_rcp_data_ipv4_en = + nthw_register_query_field(p->mp_ifr_rcp_data, RPP_LR_IFR_RCP_DATA_IPV4_EN); + p->mp_ifr_rcp_data_ipv6_en = + nthw_register_query_field(p->mp_ifr_rcp_data, RPP_LR_IFR_RCP_DATA_IPV6_EN); + p->mp_ifr_rcp_data_mtu = + nthw_register_query_field(p->mp_ifr_rcp_data, RPP_LR_IFR_RCP_DATA_MTU); + p->mp_ifr_rcp_data_ipv4_df_drop = + nthw_register_query_field(p->mp_ifr_rcp_data, RPP_LR_IFR_RCP_DATA_IPV4_DF_DROP); + p->mp_ifr_rcp_data_ipv6_drop = + nthw_register_query_field(p->mp_ifr_rcp_data, RPP_LR_IFR_RCP_DATA_IPV6_DROP); + + return 0; +} diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.h b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.h new file mode 100644 index 0000000000..509e46fc48 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.h @@ -0,0 +1,44 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef __FLOW_NTHW_RPP_LR_H__ +#define __FLOW_NTHW_RPP_LR_H__ + +#include + +#include "nthw_fpga_model.h" + +struct rpp_lr_nthw { + uint8_t m_physical_adapter_no; + nthw_fpga_t *mp_fpga; + + nthw_module_t *m_rpp_lr; + + nthw_register_t *mp_rcp_ctrl; + nthw_field_t *mp_rcp_addr; + nthw_field_t *mp_rcp_cnt; + + nthw_register_t *mp_rcp_data; + nthw_field_t *mp_rcp_data_exp; + + nthw_register_t *mp_ifr_rcp_ctrl; + nthw_field_t *mp_ifr_rcp_addr; + nthw_field_t *mp_ifr_rcp_cnt; + + nthw_register_t *mp_ifr_rcp_data; + nthw_field_t *mp_ifr_rcp_data_ipv4_en; + nthw_field_t *mp_ifr_rcp_data_ipv6_en; + nthw_field_t *mp_ifr_rcp_data_mtu; + nthw_field_t *mp_ifr_rcp_data_ipv4_df_drop; + nthw_field_t *mp_ifr_rcp_data_ipv6_drop; +}; + +struct rpp_lr_nthw *rpp_lr_nthw_new(void); +void rpp_lr_nthw_delete(struct rpp_lr_nthw *p); +int rpp_lr_nthw_init(struct rpp_lr_nthw *p, nthw_fpga_t *p_fpga, int n_instance); + +int rpp_lr_nthw_setup(struct rpp_lr_nthw *p, int n_idx, int n_idx_cnt); + +#endif /* __FLOW_NTHW_RPP_LR_H__ */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h index 2d53dfdf98..f1d055a36e 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h @@ -33,6 +33,7 @@ #define MOD_PDB (0xa7771bffUL) #define MOD_QSL (0x448ed859UL) #define MOD_RAC (0xae830b42UL) +#define MOD_RPP_LR (0xba7f945cUL) #define MOD_RST9563 (0x385d6d1dUL) #define MOD_SDC (0xd2369530UL) #define MOD_SLC_LR (0x969fc50bUL) diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h index c49913036e..c39901ce39 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h @@ -32,6 +32,7 @@ #include "nthw_fpga_reg_defs_pdb.h" #include "nthw_fpga_reg_defs_qsl.h" #include "nthw_fpga_reg_defs_rac.h" +#include "nthw_fpga_reg_defs_rpp_lr.h" #include "nthw_fpga_reg_defs_rst9563.h" #include "nthw_fpga_reg_defs_sdc.h" #include "nthw_fpga_reg_defs_slc.h" diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpp_lr.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpp_lr.h new file mode 100644 index 0000000000..f84cdf5939 --- /dev/null +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpp_lr.h @@ -0,0 +1,37 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +/* + * nthw_fpga_reg_defs_rpp_lr.h + * + * Auto-generated file - do *NOT* edit + * + */ + +#ifndef _NTHW_FPGA_REG_DEFS_RPP_LR_ +#define _NTHW_FPGA_REG_DEFS_RPP_LR_ + +/* RPP_LR */ +#define NTHW_MOD_RPP_LR (0xba7f945cUL) +#define RPP_LR_IFR_RCP_CTRL (0xce88594UL) +#define RPP_LR_IFR_RCP_CTRL_ADR (0x4b4cc068UL) +#define RPP_LR_IFR_RCP_CTRL_CNT (0x5b4459b9UL) +#define RPP_LR_IFR_RCP_DATA (0xa339078dUL) +#define RPP_LR_IFR_RCP_DATA_IPV4_DF_DROP (0xee1d681fUL) +#define RPP_LR_IFR_RCP_DATA_IPV4_EN (0xfe386131UL) +#define RPP_LR_IFR_RCP_DATA_IPV6_DROP (0x41f324ffUL) +#define RPP_LR_IFR_RCP_DATA_IPV6_EN (0x5431a9baUL) +#define RPP_LR_IFR_RCP_DATA_MTU (0x871a2322UL) +#define RPP_LR_RCP_CTRL (0xf3395d47UL) +#define RPP_LR_RCP_CTRL_ADR (0x4916a944UL) +#define RPP_LR_RCP_CTRL_CNT (0x591e3095UL) +#define RPP_LR_RCP_DATA (0x5ce8df5eUL) +#define RPP_LR_RCP_DATA_EXP (0x578ca035UL) + +#endif /* _NTHW_FPGA_REG_DEFS_RPP_LR_ */ + +/* + * Auto-generated file - do *NOT* edit + */ From patchwork Fri Oct 4 15:34:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145134 X-Patchwork-Delegate: ferruh.yigit@amd.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 A3AFE45AAF; Fri, 4 Oct 2024 17:58:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 771CD42F81; Fri, 4 Oct 2024 17:52:23 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id 17A4642E84 for ; Fri, 4 Oct 2024 17:52:20 +0200 (CEST) Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03lp2232.outbound.protection.outlook.com [104.47.51.232]) by mx-outbound8-201.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:52:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZvBZVIRfwtXFoT2i0XdVNZuLD1tFcN4LPaLrIz/jx2hCdDNKxGApbZL398aWNLL9msPqCeMQyhqKGlq0kZRCWsW8WYIBtISXeO3VhG/DvKCYO+2qg2kZ72fDoP874qB8l7G72NgjQggjdwqGBYSeu4E3TRNG01MnHOi6+dJNH/ueIHGU7g8dXZg/22w8B8jXnhhToIn9iT0nMVWzIY8wZuz3u3gAKp5hNV0Cq0LzmAju/1Ljs+TZGNtGSyAYA3AZHIVQr+SH0QqPnlvSeyoKLmrC8KqMS7cJyDgZx4QI3u+WDoZjC2AfQsO+nzxaPoCSWYRfeXn7qJxJ/0kGApiBog== 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=MgqqTEDvbxf5p0XpsaqXF430vmRHUeWGS7OoPanx0HU=; b=gbGsyAl2IHfBzKSDEcYJvatoG+4JkbGD7IUZoID7YrSGMFIcDHT9sqOCK8MiXT9gu4O/w2rWRVwn75y4Vf2A0D2iQBaHdZP2kHov9xTZRtVza1E8we0YKEIUrjIf60cS9NcqAdmHX9xNUb6Ld88tQe7te5lFdGBW53vM5TANT/5njq7rL2Pgj165D5EW9b3Hf+h4Jsy+DGSWRksIVYoG/p96uUEfi0MVdgmRNPxMBS8BhpTcxgQlJeOZRyNlXh07IOhR1uOQsoEh4NCClG4u7ZnrxKrddGaq5R43Bk/2opl5b0pXpIf5BNT7p4u2RKwS/AswHC7EkT5z4x0fErqnoA== 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=MgqqTEDvbxf5p0XpsaqXF430vmRHUeWGS7OoPanx0HU=; b=MO8GSJ3Odz2gsrQHJLcq7hLq6bPzIiuCj/M7VUVo4LekpzpS4aGSUMcX2PveGRbwB4DDnyzitHh2cx1gZpQCHubRJZZYvrs6qXzwpRVm31k9ykXXCP+fWTW0LiXMPu1NQndWLUmzy43NdGcicLFC3z+ni0gGd9/cvafxONC2y4Y= Received: from AM0PR10CA0114.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::31) by VE1P190MB1007.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:1a8::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.21; Fri, 4 Oct 2024 15:36:16 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::85) by AM0PR10CA0114.outlook.office365.com (2603:10a6:208:e6::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:16 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:16 +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, Oleksandr Kolomeiets Subject: [PATCH v1 16/31] net/ntnic: add copier (Tx CPY) flow module Date: Fri, 4 Oct 2024 17:34:39 +0200 Message-ID: <20241004153551.267935-22-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|VE1P190MB1007:EE_ X-MS-Office365-Filtering-Correlation-Id: 74a059e4-f7a6-4fcb-dd67-08dce48a491e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: r7vJjuloFaHpoNSdgwkFlxShf5ElBX5BlYISFGQbYLSZGXdvR5j+KM0ZlPjXG1MI42OblYJdr7waC9+ZzIMOlRPoywrCXPA6oRwGv95nC6HCa16wwe0E/B+suBRs398jAVhLRarNW12AX7heR4kfCAANYvwIRk1pn0PsKq+oW14QBJDlh45gGVkMp89k8ivg4b5aEnO/0NPzFvwLrJGtYhRnh2tIuNNOD/R2pzWvJt1WaRV8Al3fQs9Jauow7qqueae30rMQV7pNWVpZKXUFlNGGRNFy1aGuMcCCNMtzPA62UoOzI9MtAveEeI67wv+Eniwhl3ZFt0jGnZm7EbHCpsvR0g/pnK1TDNvVzvfNMNN+GQpPTrkbo+Yl9u2BO3ekx978/Hod6yVNs1VhSjFIGc+UKCtPEzXF7VP7wS1Ui3Wb23C+UkGKkkpD6E7m128y0mTKFEB+PH2ib5/eeMNg4i2Zs6PWz1xYiTeoG2QtA55quv2l3elTT3Sqec3eAlverGQiRvXAEVahdq/boZ4xvciUrQV+zk6rTzsA9kZX3L5N2QqnrYI/YdPJjeSvgSJFOAw+neZ1hM1Hqp4N9IFvyx15vxWOtv5nsqz21+0FMrhTyVCvmEvMY796Oz+l7ZXgHsNOHmXfPjWGJJ7aBrTaekh2f4aCNBIQlNFBF1U1mc1pKinFkcTSufQlNetUeWmeMlOHo7ZxFIXjan51BRsTwDtpEgAwjnU5GAKVGftvsBTHOq3P9WyhhNAsze1ODwiRuh4+GlYq7IvR6Y66fNOge8t6FQ5JSc5/07VkZ5CG7jNCfYHmKs9eWy1/mwoZN79F8xY+mwa/uEB6CQNXn0bz41z+7PuwnkmLBDZ3DL7IuDFh1bHIjNErT5IoI5oShbtDfygq3ChM5sJ7T9Ou+hxLpJzrhwLaX2WF5HVSI2jo6/9kUZtYVUI37M1vFty/hX+GDanlS+JTvUaN0Ks4fmtWspavi97qYizf1EGmRmPEUZy/OHMOrnem933xqsjoLCqpRwZLq6mNuT/PnVqQRf5qyN08ABShJr5IzHlOdZ279NEEUDTMMw1ZKWx0WyaFzn/aEEYTTbLC0JjarYSuPXVLX+OxlLY3ppPYSjl17l1wVeXDsfZhzNWHxNctKBCy1DsFdm0TokvcOJyWp+0eFpuI4Awxf8Hfd4t3sVe/pH2VHUuPSkwwCyCSwG+Syjz5Zu0BgZIRjh51F4dSwl4zdtrv6CwGNNUtj1U+yXWihs2th4fIg38ZmMIZn9yX6r7m9LBxsCDYAZi61Rx/BodqQhNIoQKGQ7IM5NLOP9jSSMhcAMFVRyhErJNy/O5Lk73DdtelwqnHIutQH5z32Gso5VZ0CGrlMXKAUqrr6YD+aaYwV8QYXPsYwbbGwTYR3umIxPRi 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)(36860700013)(82310400026)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: yA35156rYSQ8lG1EMsl/mYE/g5WzBcfi/BX3+MwYSq3bHuF6cTlLEqdDhL3QYUw9ARYzz1Xmi/K1ssx6z0gy8q+VjKAQvIVOA+IdH3CskEBIH2dDKSCCjJfApstX2uju36XN9F4UpuC3QPo9m/7WzG7T8fskHf2bFvbQh3jDftgsgsD1aQyULaP2hud4IdiH1ueyXkEQnwsjvlZziOcZ5lJ1SOxqIwZB7ANgmF7p4tOrVKwcfuefgzNIYMsESi9p6ggb5ImjHKyrykVDKqCbzXxfAj+D5gWeUtsnSvknkvWgSqPa9QZttgzw3c58iUld9krpppVrQjaRwl+751KAQzKjld3VJbmAtceXL3+sJI8GN3Ra+hP+YHjOF66XGMXOhy0IBy9uj0ZwA1YjQlq4t+Cm7QPRUPpeA5I+3PthdX/cZJWqn+oM8sur9a1IR+zKYPyKH5Qe/lhfP5XamU+6bqZHQx9WvL7OD+oNmMpHsLHGng6R+S/MIrBfrzlMc95Zqv+glWJg4YIhS6Sflk61nfhhiB7MtdqDDO2cs6jM17xVksVnWEigvjEujBR+RaqJRBQL5K9M+3SL6UzKIsehcRNdYnl7Do0q6AtnVL3KlqQCPdzzwX/V5DzfuYefa/MjHzr5M/5uUvzeVc3X3r8uiA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:16.1428 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 74a059e4-f7a6-4fcb-dd67-08dce48a491e 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1P190MB1007 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057135-302249-12641-33931-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.51.232 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkYmFmZGQGYGUNTS0jTRMCXZzC Qp2TTN2NDEzMjMyNQwzTgtKSnNwNzAUKk2FgAGmOD6QgAAAA== X-BESS-Outbound-Spam-Score: 1.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259495 [from cloudscan12-63.eu-central-1a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound 0.50 BSF_RULE_7582B META: Custom Rule 7582B X-BESS-Outbound-Spam-Status: SCORE=1.00 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND, BSF_RULE_7582B 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: Oleksandr Kolomeiets The TX Copy module writes data to packet fields based on the lookup performed by the FLM module. This is used for NAT and can support other actions based on the RTE action MODIFY_FIELD. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/meson.build | 1 + .../nthw/flow_api/flow_backend/flow_backend.c | 13 + .../ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c | 339 ++++++++++++++++++ .../ntnic/nthw/flow_filter/flow_nthw_tx_cpy.h | 49 +++ .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 2 + .../nthw/supported/nthw_fpga_reg_defs_cpy.h | 113 ++++++ .../supported/nthw_fpga_reg_defs_tx_cpy.h | 23 ++ 8 files changed, 541 insertions(+) create mode 100644 drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c create mode 100644 drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_cpy.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_cpy.h diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 2dfb0d0627..3c00203e34 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -57,6 +57,7 @@ sources = files( 'nthw/flow_filter/flow_nthw_qsl.c', 'nthw/flow_filter/flow_nthw_rpp_lr.c', 'nthw/flow_filter/flow_nthw_slc_lr.c', + 'nthw/flow_filter/flow_nthw_tx_cpy.c', 'nthw/model/nthw_fpga_model.c', 'nthw/nthw_platform.c', 'nthw/nthw_rac.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c index e2abbf0368..af1e8ce3a4 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c @@ -16,6 +16,7 @@ #include "flow_nthw_slc_lr.h" #include "flow_nthw_pdb.h" #include "flow_nthw_rpp_lr.h" +#include "flow_nthw_tx_cpy.h" #include "ntnic_mod_reg.h" #include "nthw_fpga_model.h" #include "hw_mod_backend.h" @@ -40,6 +41,7 @@ static struct backend_dev_s { struct pdb_nthw *p_pdb_nthw; struct hfu_nthw *p_hfu_nthw; /* TPE module */ struct rpp_lr_nthw *p_rpp_lr_nthw; /* TPE module */ + struct tx_cpy_nthw *p_tx_cpy_nthw; /* TPE module */ struct ifr_nthw *p_ifr_nthw; /* TPE module */ } be_devs[MAX_PHYS_ADAPTERS]; @@ -1807,6 +1809,16 @@ const struct flow_api_backend_ops *bin_flow_backend_init(nthw_fpga_t *p_fpga, vo be_devs[physical_adapter_no].p_rpp_lr_nthw = NULL; } + /* Init nthw TX_CPY */ + if (tx_cpy_nthw_init(NULL, p_fpga, physical_adapter_no) == 0) { + struct tx_cpy_nthw *ptr = tx_cpy_nthw_new(); + tx_cpy_nthw_init(ptr, p_fpga, physical_adapter_no); + be_devs[physical_adapter_no].p_tx_cpy_nthw = ptr; + + } else { + be_devs[physical_adapter_no].p_tx_cpy_nthw = NULL; + } + be_devs[physical_adapter_no].adapter_no = physical_adapter_no; *dev = (void *)&be_devs[physical_adapter_no]; @@ -1826,6 +1838,7 @@ static void bin_flow_backend_done(void *dev) pdb_nthw_delete(be_dev->p_pdb_nthw); hfu_nthw_delete(be_dev->p_hfu_nthw); rpp_lr_nthw_delete(be_dev->p_rpp_lr_nthw); + tx_cpy_nthw_delete(be_dev->p_tx_cpy_nthw); } static const struct flow_backend_ops ops = { diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c new file mode 100644 index 0000000000..197baae334 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c @@ -0,0 +1,339 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include + +#include "ntlog.h" +#include "nthw_drv.h" +#include "nthw_register.h" + +#include "flow_nthw_tx_cpy.h" + +struct tx_cpy_nthw *tx_cpy_nthw_new(void) +{ + struct tx_cpy_nthw *p = malloc(sizeof(struct tx_cpy_nthw)); + + if (p) + (void)memset(p, 0, sizeof(*p)); + + return p; +} + +void tx_cpy_nthw_delete(struct tx_cpy_nthw *p) +{ + if (p) { + free(p->m_writers); + (void)memset(p, 0, sizeof(*p)); + free(p); + } +} + +int tx_cpy_nthw_init(struct tx_cpy_nthw *p, nthw_fpga_t *p_fpga, int n_instance) +{ + const char *const p_adapter_id_str = p_fpga->p_fpga_info->mp_adapter_id_str; + nthw_module_t *p_mod = nthw_fpga_query_module(p_fpga, MOD_TX_CPY, n_instance); + + assert(n_instance >= 0 && n_instance < 256); + + if (p == NULL) + return p_mod == NULL ? -1 : 0; + + if (p_mod == NULL) { + NT_LOG(ERR, NTHW, "%s: TxCpy %d: no such instance\n", p_adapter_id_str, + n_instance); + return -1; + } + + p->mp_fpga = p_fpga; + p->m_physical_adapter_no = (uint8_t)n_instance; + p->m_tx_cpy = nthw_fpga_query_module(p_fpga, MOD_TX_CPY, n_instance); + + const int writers_cnt = nthw_fpga_get_product_param(p->mp_fpga, NT_TX_CPY_WRITERS, 0); + + if (writers_cnt < 1) + return -1; + + p->m_writers_cnt = (unsigned int)writers_cnt; + p->m_writers = calloc(p->m_writers_cnt, sizeof(struct tx_cpy_writers_s)); + + if (p->m_writers == NULL) + return -1; + + const int variant = nthw_fpga_get_product_param(p->mp_fpga, NT_TX_CPY_VARIANT, 0); + + switch (p->m_writers_cnt) { + default: + case 6: + p->m_writers[5].mp_writer_ctrl = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER5_CTRL); + p->m_writers[5].mp_writer_ctrl_addr = + nthw_register_get_field(p->m_writers[5].mp_writer_ctrl, + CPY_WRITER5_CTRL_ADR); + p->m_writers[5].mp_writer_ctrl_cnt = + nthw_register_get_field(p->m_writers[5].mp_writer_ctrl, + CPY_WRITER5_CTRL_CNT); + p->m_writers[5].mp_writer_data = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER5_DATA); + p->m_writers[5].mp_writer_data_reader_select = + nthw_register_get_field(p->m_writers[5].mp_writer_data, + CPY_WRITER5_DATA_READER_SELECT); + p->m_writers[5].mp_writer_data_dyn = + nthw_register_get_field(p->m_writers[5].mp_writer_data, + CPY_WRITER5_DATA_DYN); + p->m_writers[5].mp_writer_data_ofs = + nthw_register_get_field(p->m_writers[5].mp_writer_data, + CPY_WRITER5_DATA_OFS); + p->m_writers[5].mp_writer_data_len = + nthw_register_get_field(p->m_writers[5].mp_writer_data, + CPY_WRITER5_DATA_LEN); + + if (variant != 0) { + p->m_writers[5].mp_writer_data_mask_pointer = + nthw_register_get_field(p->m_writers[5].mp_writer_data, + CPY_WRITER5_DATA_MASK_POINTER); + p->m_writers[5].mp_writer_mask_ctrl = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER5_MASK_CTRL); + p->m_writers[5].mp_writer_mask_ctrl_addr = + nthw_register_get_field(p->m_writers[5].mp_writer_mask_ctrl, + CPY_WRITER5_MASK_CTRL_ADR); + p->m_writers[5].mp_writer_mask_ctrl_cnt = + nthw_register_get_field(p->m_writers[5].mp_writer_mask_ctrl, + CPY_WRITER5_MASK_CTRL_CNT); + p->m_writers[5].mp_writer_mask_data = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER5_MASK_DATA); + p->m_writers[5].mp_writer_mask_data_byte_mask = + nthw_register_get_field(p->m_writers[5].mp_writer_mask_data, + CPY_WRITER5_MASK_DATA_BYTE_MASK); + } + + /* Fallthrough */ + case 5: + p->m_writers[4].mp_writer_ctrl = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER4_CTRL); + p->m_writers[4].mp_writer_ctrl_addr = + nthw_register_get_field(p->m_writers[4].mp_writer_ctrl, + CPY_WRITER4_CTRL_ADR); + p->m_writers[4].mp_writer_ctrl_cnt = + nthw_register_get_field(p->m_writers[4].mp_writer_ctrl, + CPY_WRITER4_CTRL_CNT); + p->m_writers[4].mp_writer_data = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER4_DATA); + p->m_writers[4].mp_writer_data_reader_select = + nthw_register_get_field(p->m_writers[4].mp_writer_data, + CPY_WRITER4_DATA_READER_SELECT); + p->m_writers[4].mp_writer_data_dyn = + nthw_register_get_field(p->m_writers[4].mp_writer_data, + CPY_WRITER4_DATA_DYN); + p->m_writers[4].mp_writer_data_ofs = + nthw_register_get_field(p->m_writers[4].mp_writer_data, + CPY_WRITER4_DATA_OFS); + p->m_writers[4].mp_writer_data_len = + nthw_register_get_field(p->m_writers[4].mp_writer_data, + CPY_WRITER4_DATA_LEN); + + if (variant != 0) { + p->m_writers[4].mp_writer_data_mask_pointer = + nthw_register_get_field(p->m_writers[4].mp_writer_data, + CPY_WRITER4_DATA_MASK_POINTER); + p->m_writers[4].mp_writer_mask_ctrl = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER4_MASK_CTRL); + p->m_writers[4].mp_writer_mask_ctrl_addr = + nthw_register_get_field(p->m_writers[4].mp_writer_mask_ctrl, + CPY_WRITER4_MASK_CTRL_ADR); + p->m_writers[4].mp_writer_mask_ctrl_cnt = + nthw_register_get_field(p->m_writers[4].mp_writer_mask_ctrl, + CPY_WRITER4_MASK_CTRL_CNT); + p->m_writers[4].mp_writer_mask_data = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER4_MASK_DATA); + p->m_writers[4].mp_writer_mask_data_byte_mask = + nthw_register_get_field(p->m_writers[4].mp_writer_mask_data, + CPY_WRITER4_MASK_DATA_BYTE_MASK); + } + + /* Fallthrough */ + case 4: + p->m_writers[3].mp_writer_ctrl = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER3_CTRL); + p->m_writers[3].mp_writer_ctrl_addr = + nthw_register_get_field(p->m_writers[3].mp_writer_ctrl, + CPY_WRITER3_CTRL_ADR); + p->m_writers[3].mp_writer_ctrl_cnt = + nthw_register_get_field(p->m_writers[3].mp_writer_ctrl, + CPY_WRITER3_CTRL_CNT); + p->m_writers[3].mp_writer_data = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER3_DATA); + p->m_writers[3].mp_writer_data_reader_select = + nthw_register_get_field(p->m_writers[3].mp_writer_data, + CPY_WRITER3_DATA_READER_SELECT); + p->m_writers[3].mp_writer_data_dyn = + nthw_register_get_field(p->m_writers[3].mp_writer_data, + CPY_WRITER3_DATA_DYN); + p->m_writers[3].mp_writer_data_ofs = + nthw_register_get_field(p->m_writers[3].mp_writer_data, + CPY_WRITER3_DATA_OFS); + p->m_writers[3].mp_writer_data_len = + nthw_register_get_field(p->m_writers[3].mp_writer_data, + CPY_WRITER3_DATA_LEN); + + if (variant != 0) { + p->m_writers[3].mp_writer_data_mask_pointer = + nthw_register_get_field(p->m_writers[3].mp_writer_data, + CPY_WRITER3_DATA_MASK_POINTER); + p->m_writers[3].mp_writer_mask_ctrl = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER3_MASK_CTRL); + p->m_writers[3].mp_writer_mask_ctrl_addr = + nthw_register_get_field(p->m_writers[3].mp_writer_mask_ctrl, + CPY_WRITER3_MASK_CTRL_ADR); + p->m_writers[3].mp_writer_mask_ctrl_cnt = + nthw_register_get_field(p->m_writers[3].mp_writer_mask_ctrl, + CPY_WRITER3_MASK_CTRL_CNT); + p->m_writers[3].mp_writer_mask_data = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER3_MASK_DATA); + p->m_writers[3].mp_writer_mask_data_byte_mask = + nthw_register_get_field(p->m_writers[3].mp_writer_mask_data, + CPY_WRITER3_MASK_DATA_BYTE_MASK); + } + + /* Fallthrough */ + case 3: + p->m_writers[2].mp_writer_ctrl = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER2_CTRL); + p->m_writers[2].mp_writer_ctrl_addr = + nthw_register_get_field(p->m_writers[2].mp_writer_ctrl, + CPY_WRITER2_CTRL_ADR); + p->m_writers[2].mp_writer_ctrl_cnt = + nthw_register_get_field(p->m_writers[2].mp_writer_ctrl, + CPY_WRITER2_CTRL_CNT); + p->m_writers[2].mp_writer_data = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER2_DATA); + p->m_writers[2].mp_writer_data_reader_select = + nthw_register_get_field(p->m_writers[2].mp_writer_data, + CPY_WRITER2_DATA_READER_SELECT); + p->m_writers[2].mp_writer_data_dyn = + nthw_register_get_field(p->m_writers[2].mp_writer_data, + CPY_WRITER2_DATA_DYN); + p->m_writers[2].mp_writer_data_ofs = + nthw_register_get_field(p->m_writers[2].mp_writer_data, + CPY_WRITER2_DATA_OFS); + p->m_writers[2].mp_writer_data_len = + nthw_register_get_field(p->m_writers[2].mp_writer_data, + CPY_WRITER2_DATA_LEN); + + if (variant != 0) { + p->m_writers[2].mp_writer_data_mask_pointer = + nthw_register_get_field(p->m_writers[2].mp_writer_data, + CPY_WRITER2_DATA_MASK_POINTER); + p->m_writers[2].mp_writer_mask_ctrl = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER2_MASK_CTRL); + p->m_writers[2].mp_writer_mask_ctrl_addr = + nthw_register_get_field(p->m_writers[2].mp_writer_mask_ctrl, + CPY_WRITER2_MASK_CTRL_ADR); + p->m_writers[2].mp_writer_mask_ctrl_cnt = + nthw_register_get_field(p->m_writers[2].mp_writer_mask_ctrl, + CPY_WRITER2_MASK_CTRL_CNT); + p->m_writers[2].mp_writer_mask_data = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER2_MASK_DATA); + p->m_writers[2].mp_writer_mask_data_byte_mask = + nthw_register_get_field(p->m_writers[2].mp_writer_mask_data, + CPY_WRITER2_MASK_DATA_BYTE_MASK); + } + + /* Fallthrough */ + case 2: + p->m_writers[1].mp_writer_ctrl = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER1_CTRL); + p->m_writers[1].mp_writer_ctrl_addr = + nthw_register_get_field(p->m_writers[1].mp_writer_ctrl, + CPY_WRITER1_CTRL_ADR); + p->m_writers[1].mp_writer_ctrl_cnt = + nthw_register_get_field(p->m_writers[1].mp_writer_ctrl, + CPY_WRITER1_CTRL_CNT); + p->m_writers[1].mp_writer_data = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER1_DATA); + p->m_writers[1].mp_writer_data_reader_select = + nthw_register_get_field(p->m_writers[1].mp_writer_data, + CPY_WRITER1_DATA_READER_SELECT); + p->m_writers[1].mp_writer_data_dyn = + nthw_register_get_field(p->m_writers[1].mp_writer_data, + CPY_WRITER1_DATA_DYN); + p->m_writers[1].mp_writer_data_ofs = + nthw_register_get_field(p->m_writers[1].mp_writer_data, + CPY_WRITER1_DATA_OFS); + p->m_writers[1].mp_writer_data_len = + nthw_register_get_field(p->m_writers[1].mp_writer_data, + CPY_WRITER1_DATA_LEN); + + if (variant != 0) { + p->m_writers[1].mp_writer_data_mask_pointer = + nthw_register_get_field(p->m_writers[1].mp_writer_data, + CPY_WRITER1_DATA_MASK_POINTER); + p->m_writers[1].mp_writer_mask_ctrl = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER1_MASK_CTRL); + p->m_writers[1].mp_writer_mask_ctrl_addr = + nthw_register_get_field(p->m_writers[1].mp_writer_mask_ctrl, + CPY_WRITER1_MASK_CTRL_ADR); + p->m_writers[1].mp_writer_mask_ctrl_cnt = + nthw_register_get_field(p->m_writers[1].mp_writer_mask_ctrl, + CPY_WRITER1_MASK_CTRL_CNT); + p->m_writers[1].mp_writer_mask_data = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER1_MASK_DATA); + p->m_writers[1].mp_writer_mask_data_byte_mask = + nthw_register_get_field(p->m_writers[1].mp_writer_mask_data, + CPY_WRITER1_MASK_DATA_BYTE_MASK); + } + + /* Fallthrough */ + case 1: + p->m_writers[0].mp_writer_ctrl = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER0_CTRL); + p->m_writers[0].mp_writer_ctrl_addr = + nthw_register_get_field(p->m_writers[0].mp_writer_ctrl, + CPY_WRITER0_CTRL_ADR); + p->m_writers[0].mp_writer_ctrl_cnt = + nthw_register_get_field(p->m_writers[0].mp_writer_ctrl, + CPY_WRITER0_CTRL_CNT); + p->m_writers[0].mp_writer_data = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER0_DATA); + p->m_writers[0].mp_writer_data_reader_select = + nthw_register_get_field(p->m_writers[0].mp_writer_data, + CPY_WRITER0_DATA_READER_SELECT); + p->m_writers[0].mp_writer_data_dyn = + nthw_register_get_field(p->m_writers[0].mp_writer_data, + CPY_WRITER0_DATA_DYN); + p->m_writers[0].mp_writer_data_ofs = + nthw_register_get_field(p->m_writers[0].mp_writer_data, + CPY_WRITER0_DATA_OFS); + p->m_writers[0].mp_writer_data_len = + nthw_register_get_field(p->m_writers[0].mp_writer_data, + CPY_WRITER0_DATA_LEN); + + if (variant != 0) { + p->m_writers[0].mp_writer_data_mask_pointer = + nthw_register_get_field(p->m_writers[0].mp_writer_data, + CPY_WRITER0_DATA_MASK_POINTER); + p->m_writers[0].mp_writer_mask_ctrl = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER0_MASK_CTRL); + p->m_writers[0].mp_writer_mask_ctrl_addr = + nthw_register_get_field(p->m_writers[0].mp_writer_mask_ctrl, + CPY_WRITER0_MASK_CTRL_ADR); + p->m_writers[0].mp_writer_mask_ctrl_cnt = + nthw_register_get_field(p->m_writers[0].mp_writer_mask_ctrl, + CPY_WRITER0_MASK_CTRL_CNT); + p->m_writers[0].mp_writer_mask_data = + nthw_module_get_register(p->m_tx_cpy, CPY_WRITER0_MASK_DATA); + p->m_writers[0].mp_writer_mask_data_byte_mask = + nthw_register_get_field(p->m_writers[0].mp_writer_mask_data, + CPY_WRITER0_MASK_DATA_BYTE_MASK); + } + + break; + + case 0: + return -1; + } + + return 0; +} diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.h b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.h new file mode 100644 index 0000000000..801b47b0bb --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.h @@ -0,0 +1,49 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef __FLOW_NTHW_TX_CPY_H__ +#define __FLOW_NTHW_TX_CPY_H__ + +#include + +#include "nthw_fpga_model.h" + +struct tx_cpy_writers_s { + nthw_register_t *mp_writer_ctrl; + nthw_field_t *mp_writer_ctrl_addr; + nthw_field_t *mp_writer_ctrl_cnt; + + nthw_register_t *mp_writer_data; + nthw_field_t *mp_writer_data_reader_select; + nthw_field_t *mp_writer_data_dyn; + nthw_field_t *mp_writer_data_ofs; + nthw_field_t *mp_writer_data_len; + nthw_field_t *mp_writer_data_mask_pointer; + + nthw_register_t *mp_writer_mask_ctrl; + nthw_field_t *mp_writer_mask_ctrl_addr; + nthw_field_t *mp_writer_mask_ctrl_cnt; + + nthw_register_t *mp_writer_mask_data; + nthw_field_t *mp_writer_mask_data_byte_mask; +}; + +struct tx_cpy_nthw { + uint8_t m_physical_adapter_no; + nthw_fpga_t *mp_fpga; + + nthw_module_t *m_tx_cpy; + + unsigned int m_writers_cnt; + struct tx_cpy_writers_s *m_writers; +}; + +struct tx_cpy_nthw *tx_cpy_nthw_new(void); +void tx_cpy_nthw_delete(struct tx_cpy_nthw *p); +int tx_cpy_nthw_init(struct tx_cpy_nthw *p, nthw_fpga_t *p_fpga, int n_instance); + +int tx_cpy_nthw_setup(struct tx_cpy_nthw *p, int n_idx, int n_idx_cnt); + +#endif /* __FLOW_NTHW_TX_CPY_H__ */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h index f1d055a36e..d93d9d3816 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h @@ -37,6 +37,7 @@ #define MOD_RST9563 (0x385d6d1dUL) #define MOD_SDC (0xd2369530UL) #define MOD_SLC_LR (0x969fc50bUL) +#define MOD_TX_CPY (0x60acf217UL) #define MOD_IDX_COUNT (14) /* aliases - only aliases go below this point */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h index c39901ce39..d58d10c438 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h @@ -14,6 +14,7 @@ #define _NTHW_FPGA_REG_DEFS_ #include "nthw_fpga_reg_defs_cat.h" +#include "nthw_fpga_reg_defs_cpy.h" #include "nthw_fpga_reg_defs_flm.h" #include "nthw_fpga_reg_defs_gfg.h" #include "nthw_fpga_reg_defs_gmf.h" @@ -37,6 +38,7 @@ #include "nthw_fpga_reg_defs_sdc.h" #include "nthw_fpga_reg_defs_slc.h" #include "nthw_fpga_reg_defs_slc_lr.h" +#include "nthw_fpga_reg_defs_tx_cpy.h" /* aliases */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_cpy.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_cpy.h new file mode 100644 index 0000000000..55fd5704b9 --- /dev/null +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_cpy.h @@ -0,0 +1,113 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +/* + * nthw_fpga_reg_defs_cpy.h + * + * Auto-generated file - do *NOT* edit + * + */ + +#ifndef _NTHW_FPGA_REG_DEFS_CPY_ +#define _NTHW_FPGA_REG_DEFS_CPY_ + +/* CPY */ +#define NTHW_MOD_CPY (0x1ddc186fUL) +#define CPY_PACKET_READER0_CTRL (0x59359b7UL) +#define CPY_PACKET_READER0_CTRL_ADR (0xc84f1475UL) +#define CPY_PACKET_READER0_CTRL_CNT (0xd8478da4UL) +#define CPY_PACKET_READER0_DATA (0xaa42dbaeUL) +#define CPY_PACKET_READER0_DATA_DYN (0x34037b11UL) +#define CPY_PACKET_READER0_DATA_OFS (0x960af6b7UL) +#define CPY_WRITER0_CTRL (0xe9b3268eUL) +#define CPY_WRITER0_CTRL_ADR (0x26f906c2UL) +#define CPY_WRITER0_CTRL_CNT (0x36f19f13UL) +#define CPY_WRITER0_DATA (0x4662a497UL) +#define CPY_WRITER0_DATA_DYN (0xdab569a6UL) +#define CPY_WRITER0_DATA_LEN (0x32d16543UL) +#define CPY_WRITER0_DATA_MASK_POINTER (0x64db2b2dUL) +#define CPY_WRITER0_DATA_OFS (0x78bce400UL) +#define CPY_WRITER0_DATA_READER_SELECT (0x63a38cf9UL) +#define CPY_WRITER0_MASK_CTRL (0xed52c5f9UL) +#define CPY_WRITER0_MASK_CTRL_ADR (0x3bbdf6aaUL) +#define CPY_WRITER0_MASK_CTRL_CNT (0x2bb56f7bUL) +#define CPY_WRITER0_MASK_DATA (0x428347e0UL) +#define CPY_WRITER0_MASK_DATA_BYTE_MASK (0xd1d0e256UL) +#define CPY_WRITER1_CTRL (0x22eff52bUL) +#define CPY_WRITER1_CTRL_ADR (0xc93b6dfcUL) +#define CPY_WRITER1_CTRL_CNT (0xd933f42dUL) +#define CPY_WRITER1_DATA (0x8d3e7732UL) +#define CPY_WRITER1_DATA_DYN (0x35770298UL) +#define CPY_WRITER1_DATA_LEN (0xdd130e7dUL) +#define CPY_WRITER1_DATA_MASK_POINTER (0xb339ab75UL) +#define CPY_WRITER1_DATA_OFS (0x977e8f3eUL) +#define CPY_WRITER1_DATA_READER_SELECT (0x6c4b7bfUL) +#define CPY_WRITER1_MASK_CTRL (0x2cdc1a39UL) +#define CPY_WRITER1_MASK_CTRL_ADR (0x82462d42UL) +#define CPY_WRITER1_MASK_CTRL_CNT (0x924eb493UL) +#define CPY_WRITER1_MASK_DATA (0x830d9820UL) +#define CPY_WRITER1_MASK_DATA_BYTE_MASK (0x4e0a61c8UL) +#define CPY_WRITER2_CTRL (0xa47b8785UL) +#define CPY_WRITER2_CTRL_ADR (0x220cd6ffUL) +#define CPY_WRITER2_CTRL_CNT (0x32044f2eUL) +#define CPY_WRITER2_DATA (0xbaa059cUL) +#define CPY_WRITER2_DATA_DYN (0xde40b99bUL) +#define CPY_WRITER2_DATA_LEN (0x3624b57eUL) +#define CPY_WRITER2_DATA_MASK_POINTER (0x106f2ddcUL) +#define CPY_WRITER2_DATA_OFS (0x7c49343dUL) +#define CPY_WRITER2_DATA_READER_SELECT (0xa96dfa75UL) +#define CPY_WRITER2_MASK_CTRL (0xb53e7c38UL) +#define CPY_WRITER2_MASK_CTRL_ADR (0x933b473bUL) +#define CPY_WRITER2_MASK_CTRL_CNT (0x8333deeaUL) +#define CPY_WRITER2_MASK_DATA (0x1aeffe21UL) +#define CPY_WRITER2_MASK_DATA_BYTE_MASK (0x3514e32bUL) +#define CPY_WRITER3_CTRL (0x6f275420UL) +#define CPY_WRITER3_CTRL_ADR (0xcdcebdc1UL) +#define CPY_WRITER3_CTRL_CNT (0xddc62410UL) +#define CPY_WRITER3_DATA (0xc0f6d639UL) +#define CPY_WRITER3_DATA_DYN (0x3182d2a5UL) +#define CPY_WRITER3_DATA_LEN (0xd9e6de40UL) +#define CPY_WRITER3_DATA_MASK_POINTER (0xc78dad84UL) +#define CPY_WRITER3_DATA_OFS (0x938b5f03UL) +#define CPY_WRITER3_DATA_READER_SELECT (0xcc0ac133UL) +#define CPY_WRITER3_MASK_CTRL (0x74b0a3f8UL) +#define CPY_WRITER3_MASK_CTRL_ADR (0x2ac09cd3UL) +#define CPY_WRITER3_MASK_CTRL_CNT (0x3ac80502UL) +#define CPY_WRITER3_MASK_DATA (0xdb6121e1UL) +#define CPY_WRITER3_MASK_DATA_BYTE_MASK (0xaace60b5UL) +#define CPY_WRITER4_CTRL (0x72226498UL) +#define CPY_WRITER4_CTRL_ADR (0x2f12a6b8UL) +#define CPY_WRITER4_CTRL_CNT (0x3f1a3f69UL) +#define CPY_WRITER4_DATA (0xddf3e681UL) +#define CPY_WRITER4_DATA_DYN (0xd35ec9dcUL) +#define CPY_WRITER4_DATA_LEN (0x3b3ac539UL) +#define CPY_WRITER4_DATA_MASK_POINTER (0x8db326cfUL) +#define CPY_WRITER4_DATA_OFS (0x7157447aUL) +#define CPY_WRITER4_DATA_READER_SELECT (0x2d4e67a0UL) +#define CPY_WRITER4_MASK_CTRL (0x5d8bb67bUL) +#define CPY_WRITER4_MASK_CTRL_ADR (0xb1c193c9UL) +#define CPY_WRITER4_MASK_CTRL_CNT (0xa1c90a18UL) +#define CPY_WRITER4_MASK_DATA (0xf25a3462UL) +#define CPY_WRITER4_MASK_DATA_BYTE_MASK (0xc329e6edUL) +#define CPY_WRITER5_CTRL (0xb97eb73dUL) +#define CPY_WRITER5_CTRL_ADR (0xc0d0cd86UL) +#define CPY_WRITER5_CTRL_CNT (0xd0d85457UL) +#define CPY_WRITER5_DATA (0x16af3524UL) +#define CPY_WRITER5_DATA_DYN (0x3c9ca2e2UL) +#define CPY_WRITER5_DATA_LEN (0xd4f8ae07UL) +#define CPY_WRITER5_DATA_MASK_POINTER (0x5a51a697UL) +#define CPY_WRITER5_DATA_OFS (0x9e952f44UL) +#define CPY_WRITER5_DATA_READER_SELECT (0x48295ce6UL) +#define CPY_WRITER5_MASK_CTRL (0x9c0569bbUL) +#define CPY_WRITER5_MASK_CTRL_ADR (0x83a4821UL) +#define CPY_WRITER5_MASK_CTRL_CNT (0x1832d1f0UL) +#define CPY_WRITER5_MASK_DATA (0x33d4eba2UL) +#define CPY_WRITER5_MASK_DATA_BYTE_MASK (0x5cf36573UL) + +#endif /* _NTHW_FPGA_REG_DEFS_CPY_ */ + +/* + * Auto-generated file - do *NOT* edit + */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_cpy.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_cpy.h new file mode 100644 index 0000000000..1fb71bf483 --- /dev/null +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_cpy.h @@ -0,0 +1,23 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +/* + * nthw_fpga_reg_defs_tx_cpy.h + * + * Auto-generated file - do *NOT* edit + * + */ + +#ifndef _NTHW_FPGA_REG_DEFS_TX_CPY_ +#define _NTHW_FPGA_REG_DEFS_TX_CPY_ + +/* TX_CPY */ +#define NTHW_MOD_TX_CPY (0x60acf217UL) + +#endif /* _NTHW_FPGA_REG_DEFS_TX_CPY_ */ + +/* + * Auto-generated file - do *NOT* edit + */ From patchwork Fri Oct 4 15:34:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145122 X-Patchwork-Delegate: ferruh.yigit@amd.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 AA1AB45AAF; Fri, 4 Oct 2024 17:56:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CCFCA42F1B; Fri, 4 Oct 2024 17:51:52 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id 0FA5E42EDA for ; Fri, 4 Oct 2024 17:51:49 +0200 (CEST) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03lp2172.outbound.protection.outlook.com [104.47.51.172]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:51:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MUNcuHKFZHRXaWWWEQFFsqjzPKRwvcfj9tzc4ngGN3dO3cKcddmfM2KW5ucE2EuXAEhYECZFZvPamNAbYKBePta5gniQNg0WQATqKM4PueWLdEnKGg6IY0gtvMuZMwV0oj8uqc+yfj8b3ZcooQgcDLUWY09rEjesu9xThsbTRyiPRX+Ob9WfQcuTSBDk7CTooGujLchHtrx/uAAIbYMtNdgauA29yJivJAM+vyQ5TqcOD/CybpeB45wltspf/fIpcZh4aOGisn8xLIXwH5puqs1/RD6KJaK4ydYdfNN0Y70EA2qeP1HLwaHglOzZTIb+3KHPAfkEGbfZM0HJGHwLww== 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=F6OSx5zMTi+YG1t1pCGRnGsdIQpSWnmxLS4iCDqEEXQ=; b=TqJjtSvGpka972rGjBkPv8YbfAXBLL4KYmfyHW8iOrWNlgdFd3aCyUQH03Hdhx3ysIHXO3m6vNmLndfwPlSVz5KFLx08eXkINdz6pk0ZI8Wwe5vBoCblpGmu/itZ+7qkgQGytkRcB5H4d28AgIpU4f+Ncyy4qZfKWVoToJplA6Dm+IwbrYVngkZ0Omex3NJhWiio+aNLsdxHzIuNclpMM83a5GrtP9G9+9ObIWpT83WAQ//qqpgYlfPPp4FJwbv7sUet6kN0jl/UQIN+nqYwQiLMjKmIbSfLjT9TFp0E4x57xrZCszxfEha9qJWGbtiugb4csUsbk+sBMqzR3R+KNw== 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=F6OSx5zMTi+YG1t1pCGRnGsdIQpSWnmxLS4iCDqEEXQ=; b=Nd52C2ElVZIOTtp1Ufxt2jVbcKMbgBeTZKbcpqLVNi5qn9+Gheca3pz6QTc3ZnlgWSHxnMzmDCA4D99NDtvw3Lnei6/dbtGHkErphAH/nQIY9IeJE/eS7bVHwGWIH4cu6ZzU7Mvctyhyh7i2tqcc8pn6lgQmcY/2T5IuzsjZWho= Received: from AM0PR10CA0106.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::23) by DBAP190MB1016.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:1b0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.30; Fri, 4 Oct 2024 15:36:17 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::ae) by AM0PR10CA0106.outlook.office365.com (2603:10a6:208:e6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:17 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:17 +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, Oleksandr Kolomeiets Subject: [PATCH v1 17/31] net/ntnic: add checksum update (CSU) flow module Date: Fri, 4 Oct 2024 17:34:40 +0200 Message-ID: <20241004153551.267935-23-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|DBAP190MB1016:EE_ X-MS-Office365-Filtering-Correlation-Id: a1e16735-0a19-47d4-11cc-08dce48a49b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: Ulx0X/+XnCxnQ9mN/qUMNdpi8EhNWgKxDWiJyf+mim1bzv9Y2tzyTRV/w20vS6NE3eEQ5taQ0AR4i8fTQp7EmWkIHLewyD7jl2CLUdzGpP2oNcw9fBA7nzYvSd4/P6lZHaJkpxr4aytIRpj3fPKKYO8FmKznZG88MoPvu3ObKcm0FI+m4QkFbWquiWzhJ6slYD7Sd+aWSPidWzTorAs1plrGCJo9+VyCXuNbErC9A6SBzL4PUbvFkaEx3gZlic8C6yg5gYcrzztlazpEn2uqStKb+onUbZC3LyiDK10YmiZPyQUeQ8Sg+k+lTJk0EnmzmZ98bLYe4iTK7TuKHXs70pjQuYCs8UDxsShSs2VZUNSF+LjFF2bidovNQsQdy6qKnTjcj7xB9uwaM2u86YTg5ymmY8CTPba2LzuXsfuXmNy5yTVkW4KLAQkdYLQMKTx/4yeO6uEr4yY7MNc2ELjzVD2CVCeaTsTpzdqzuvQQVKRYnx8lLPYGrnlRs3JhTu+Xcg3NBNRNpqI4ScccRwLncP6/tUVWijMqWz3nmIf1/1zNXo89NXjD1CQmb9oD24OTCH28UZhCyehZ9DTFiZeffmKvgxTvk4Q/HWvKEtz4LXOCJyyexrmcNbX8sdS0gvgnPI7VPEoDjNsLhQEA0/GoEDM2CIspFsOzA5N3oBih1kAmCwlyvY89ZtRg2BFNtYf0dSSQ72DKmJaQXd7Nr4l/Z4WjaImHN73BED2Fjnmop0YFzEL3NRyuYiwI9m8EkEW7f2Z/Op7WL/F6jrh54YHFp+frl0ml60HT9xhd/cvfaHI1Mf1uMlatc5hddJHOixxBEnN5HMy7SlvcNOpdhSGB0J/83+e7LWyjEi60i8UK8KFv2454EXuOhVhS4DqUjWDlB4K5mc4nAHHgrJ+sCIJSFHUdKzqhvKW8SWeJ4RCkBamLjL5D1/GDWXU1SpiRrxsQFpeuCUb3IdhKsy2azCVBVctcynnlEFz93Jiw9MZZLw2jr2Wfz1UwoZrUC6pYkCuFJsQTp/Gwo953vN9w/Io0FpwfvddZMieTSl8jxYdEQ5vwsDoFIFHU6gBrX18WSGjkINvzjxD6s4tcIQx/aXy3SMfpJH0y04EGMWXA5xddag7GmPOOVDvpSjTEuL3muj7BT61iItxEuWbPwpwkIrd5OWoTDljs4sAcegnRHe6swlStZ9tvtJOdjPTMqiEaYWTpWIur9yYjj7werVVbvLvWlvb+ziLqSbNf2oAwkHQ0/ES1zZ29z1haRcwaYeHrHHFsPsH10ry/T4a2WlTiJmlzp5I3OGBOx09azsbD6pLhpxdHFJQhSYW/uGtLHE4rmeha9357oRlZUASUBegIM6GW7sbqpj2qrtXEKpwg7R/ouU2RfvNyy2Yv3DUIc/G164GO 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)(376014)(82310400026)(36860700013)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: aossDeCeMIJNDVWfVsKFtMfIqiMU/N4Wg0ZEVVaCOygU6gHH18ntNS2ijmBAt4xiIaLSxyE1QFX/Sk/xKL5LISRXU4udeF8R6I/HG25/J7j3VZS2X2oUaZwS5KeKrBHGHr53ZXDf0p/HwCEKchNHd4IXIu50aJxeX4Qj3wkeCmQ9UOnWGWkLyakUaC10q7j+R5b3H1Ya/0mPY+OhCTGpo2XCnYzq++Ce+8W6BFTCKU5EQWWryoCEhVL7wgue7ALO6EHVTW6msPTmUAOeDe63x6Z3bbr/rnTInJZgeNhTFmwmGpY0+Kh3nQ2L7G2gXv9F53hz4jei1k43TqP7ISYcW3fkSbBVrZf5Qw8kC4BcJbaPIuV58EfaRr5itEcJdRMPJ0/yWUI4FuKahVrZTlFCrVhnAk8c+tgyFU2HaM6GhMXupKUlNQcfUecmqGJPIAIZ7iHtcjeHYISaZU0qJpatWGYyy9HWALEc0GFjsaejLqUYzYNYF2D6ucq4eFITf2oLCZ3IjqeU1t2kX4bTi6stCef/vwLe7YGSluPwrpEeYepr8E1qmyQ3wfh1qEgOq5mel5yz1ZOcQadJOGbzFdpdPPzU85l1yqWMNCPE3B5gVmJDmF6HiWIa9hUuE7n7o8ZtCg2Wk8tuclmp37SakzMmfw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:17.0647 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a1e16735-0a19-47d4-11cc-08dce48a49b5 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAP190MB1016 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057107-311388-12689-32564-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.51.172 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVhYmBpZAVgZQ0MzSMM3UwjgtMd kiOTXNKNU8yTIpOcnSwjjJ1NTMwMxQqTYWAJLU++pBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259495 [from cloudscan14-151.eu-central-1a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound 0.50 BSF_RULE_7582B META: Custom Rule 7582B X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND, BSF_RULE_7582B 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: Oleksandr Kolomeiets The Checksum Update module updates the checksums of packets that has been modified in any way. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/meson.build | 1 + .../nthw/flow_api/flow_backend/flow_backend.c | 13 ++++ .../ntnic/nthw/flow_filter/flow_nthw_csu.c | 62 +++++++++++++++++++ .../ntnic/nthw/flow_filter/flow_nthw_csu.h | 35 +++++++++++ .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 1 + .../nthw/supported/nthw_fpga_reg_defs_csu.h | 31 ++++++++++ 7 files changed, 144 insertions(+) create mode 100644 drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.c create mode 100644 drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_csu.h diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 3c00203e34..cc5e6fe100 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -47,6 +47,7 @@ sources = files( 'nthw/flow_api/flow_backend/flow_backend.c', 'nthw/flow_api/flow_filter.c', 'nthw/flow_filter/flow_nthw_cat.c', + 'nthw/flow_filter/flow_nthw_csu.c', 'nthw/flow_filter/flow_nthw_flm.c', 'nthw/flow_filter/flow_nthw_hfu.c', 'nthw/flow_filter/flow_nthw_hsh.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c index af1e8ce3a4..c12a3204bc 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c @@ -8,6 +8,7 @@ #include "flow_nthw_info.h" #include "flow_nthw_ifr.h" #include "flow_nthw_cat.h" +#include "flow_nthw_csu.h" #include "flow_nthw_km.h" #include "flow_nthw_flm.h" #include "flow_nthw_hfu.h" @@ -42,6 +43,7 @@ static struct backend_dev_s { struct hfu_nthw *p_hfu_nthw; /* TPE module */ struct rpp_lr_nthw *p_rpp_lr_nthw; /* TPE module */ struct tx_cpy_nthw *p_tx_cpy_nthw; /* TPE module */ + struct csu_nthw *p_csu_nthw; /* TPE module */ struct ifr_nthw *p_ifr_nthw; /* TPE module */ } be_devs[MAX_PHYS_ADAPTERS]; @@ -1819,6 +1821,16 @@ const struct flow_api_backend_ops *bin_flow_backend_init(nthw_fpga_t *p_fpga, vo be_devs[physical_adapter_no].p_tx_cpy_nthw = NULL; } + /* Init nthw CSU */ + if (csu_nthw_init(NULL, p_fpga, physical_adapter_no) == 0) { + struct csu_nthw *ptr = csu_nthw_new(); + csu_nthw_init(ptr, p_fpga, physical_adapter_no); + be_devs[physical_adapter_no].p_csu_nthw = ptr; + + } else { + be_devs[physical_adapter_no].p_csu_nthw = NULL; + } + be_devs[physical_adapter_no].adapter_no = physical_adapter_no; *dev = (void *)&be_devs[physical_adapter_no]; @@ -1836,6 +1848,7 @@ static void bin_flow_backend_done(void *dev) qsl_nthw_delete(be_dev->p_qsl_nthw); slc_lr_nthw_delete(be_dev->p_slc_lr_nthw); pdb_nthw_delete(be_dev->p_pdb_nthw); + csu_nthw_delete(be_dev->p_csu_nthw); hfu_nthw_delete(be_dev->p_hfu_nthw); rpp_lr_nthw_delete(be_dev->p_rpp_lr_nthw); tx_cpy_nthw_delete(be_dev->p_tx_cpy_nthw); diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.c new file mode 100644 index 0000000000..21efc62eda --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.c @@ -0,0 +1,62 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include + +#include "ntlog.h" +#include "nthw_drv.h" +#include "nthw_register.h" + +#include "flow_nthw_csu.h" + +struct csu_nthw *csu_nthw_new(void) +{ + struct csu_nthw *p = malloc(sizeof(struct csu_nthw)); + + if (p) + (void)memset(p, 0, sizeof(*p)); + + return p; +} + +void csu_nthw_delete(struct csu_nthw *p) +{ + if (p) { + (void)memset(p, 0, sizeof(*p)); + free(p); + } +} + +int csu_nthw_init(struct csu_nthw *p, nthw_fpga_t *p_fpga, int n_instance) +{ + const char *const p_adapter_id_str = p_fpga->p_fpga_info->mp_adapter_id_str; + nthw_module_t *p_mod = nthw_fpga_query_module(p_fpga, MOD_CSU, n_instance); + + assert(n_instance >= 0 && n_instance < 256); + + if (p == NULL) + return p_mod == NULL ? -1 : 0; + + if (p_mod == NULL) { + NT_LOG(ERR, NTHW, "%s: Csu %d: no such instance\n", p_adapter_id_str, n_instance); + return -1; + } + + p->mp_fpga = p_fpga; + p->m_physical_adapter_no = (uint8_t)n_instance; + p->m_csu = p_mod; + + p->mp_rcp_ctrl = nthw_module_get_register(p->m_csu, CSU_RCP_CTRL); + p->mp_rcp_ctrl_adr = nthw_register_get_field(p->mp_rcp_ctrl, CSU_RCP_CTRL_ADR); + p->mp_rcp_ctrl_cnt = nthw_register_get_field(p->mp_rcp_ctrl, CSU_RCP_CTRL_CNT); + p->mp_rcp_data = nthw_module_get_register(p->m_csu, CSU_RCP_DATA); + p->mp_rcp_data_ol3_cmd = nthw_register_get_field(p->mp_rcp_data, CSU_RCP_DATA_OL3_CMD); + p->mp_rcp_data_ol4_cmd = nthw_register_get_field(p->mp_rcp_data, CSU_RCP_DATA_OL4_CMD); + p->mp_rcp_data_il3_cmd = nthw_register_get_field(p->mp_rcp_data, CSU_RCP_DATA_IL3_CMD); + p->mp_rcp_data_il4_cmd = nthw_register_get_field(p->mp_rcp_data, CSU_RCP_DATA_IL4_CMD); + + return 0; +} diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.h b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.h new file mode 100644 index 0000000000..e5986a1a9b --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.h @@ -0,0 +1,35 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef _FLOW_NTHW_CSU_H_ +#define _FLOW_NTHW_CSU_H_ + +#include + +#include "nthw_fpga_model.h" + +struct csu_nthw { + uint8_t m_physical_adapter_no; + nthw_fpga_t *mp_fpga; + + nthw_module_t *m_csu; + + nthw_register_t *mp_rcp_ctrl; + nthw_field_t *mp_rcp_ctrl_adr; + nthw_field_t *mp_rcp_ctrl_cnt; + nthw_register_t *mp_rcp_data; + nthw_field_t *mp_rcp_data_ol3_cmd; + nthw_field_t *mp_rcp_data_ol4_cmd; + nthw_field_t *mp_rcp_data_il3_cmd; + nthw_field_t *mp_rcp_data_il4_cmd; +}; + +struct csu_nthw *csu_nthw_new(void); +void csu_nthw_delete(struct csu_nthw *p); +int csu_nthw_init(struct csu_nthw *p, nthw_fpga_t *p_fpga, int n_instance); + +int csu_nthw_setup(struct csu_nthw *p, int n_idx, int n_idx_cnt); + +#endif /* _FLOW_NTHW_CSU_H_ */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h index d93d9d3816..14e031dc69 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h @@ -15,6 +15,7 @@ #define MOD_UNKNOWN (0L)/* Unknown/uninitialized - keep this as the first element */ #define MOD_CAT (0x30b447c2UL) +#define MOD_CSU (0x3f470787UL) #define MOD_FLM (0xe7ba53a4UL) #define MOD_GFG (0xfc423807UL) #define MOD_GMF (0x68b1d15aUL) diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h index d58d10c438..6eebab65a2 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h @@ -15,6 +15,7 @@ #include "nthw_fpga_reg_defs_cat.h" #include "nthw_fpga_reg_defs_cpy.h" +#include "nthw_fpga_reg_defs_csu.h" #include "nthw_fpga_reg_defs_flm.h" #include "nthw_fpga_reg_defs_gfg.h" #include "nthw_fpga_reg_defs_gmf.h" diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_csu.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_csu.h new file mode 100644 index 0000000000..a67f1c392e --- /dev/null +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_csu.h @@ -0,0 +1,31 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +/* + * nthw_fpga_reg_defs_csu.h + * + * Auto-generated file - do *NOT* edit + * + */ + +#ifndef _NTHW_FPGA_REG_DEFS_CSU_ +#define _NTHW_FPGA_REG_DEFS_CSU_ + +/* CSU */ +#define NTHW_MOD_CSU (0x3f470787UL) +#define CSU_RCP_CTRL (0x11955fefUL) +#define CSU_RCP_CTRL_ADR (0x8efb3c71UL) +#define CSU_RCP_CTRL_CNT (0x9ef3a5a0UL) +#define CSU_RCP_DATA (0xbe44ddf6UL) +#define CSU_RCP_DATA_IL3_CMD (0xdbac8e0dUL) +#define CSU_RCP_DATA_IL4_CMD (0x698c521dUL) +#define CSU_RCP_DATA_OL3_CMD (0xb87cbb37UL) +#define CSU_RCP_DATA_OL4_CMD (0xa5c6727UL) + +#endif /* _NTHW_FPGA_REG_DEFS_CSU_ */ + +/* + * Auto-generated file - do *NOT* edit + */ From patchwork Fri Oct 4 15:34:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145087 X-Patchwork-Delegate: ferruh.yigit@amd.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 A336245AAF; Fri, 4 Oct 2024 17:50:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8ACE94279F; Fri, 4 Oct 2024 17:50:36 +0200 (CEST) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id 1244042797 for ; Fri, 4 Oct 2024 17:50:34 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2168.outbound.protection.outlook.com [104.47.17.168]) by mx-outbound22-159.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:50:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gC2HqFI/ERlwFm3JipHEGOgMe/PKpOpWkccT1Z2OO8GnlgIdfkLzk8NOE8v0jIAh2H/maSrro2JBVIAlYO7hnsYguVi4mYB7DsFRB43Xm4bEnia2fWUIxoiRfSIL2LUTYWWDTAGmYFqvpFBTBzB/vxsfFTTO56HDryyO56/84zyrWoCUmlEUd3TFAc1vYNoRLNGqXsFEh10UMfy0R9q3d9Nnt2Ewce6HyEl+BQyv6pzmcoZzADxqvjbaD75ctylJJS4+oeDR9vU7oFvHj1UvP8GP88fzGGP09DKIIrIsFyb/DNTuRyFXG0jvMDdX8DrLyTyWeD7rcVksrW5wOi7R2g== 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=iC2fEP617U9Ale0rtyGA8Ykji7USJBbdrpOBtr5suaw=; b=orfvU3ybxoSHco6oxOPRmUl/ESrLQWjRfLeR3cfd4396HYjtZffFLxI9jkaTuw5pA5VAy1DIhYOjPjItfAuZ685aJ6bnnEPupbfGTyKWJlqp3xkdDAq1YK/8khDTmBCXPM7pVQE0mqrnQdMkg4f7umyXiJA6ssNkF6bGZs0yi6Hu1WL8O8wdJWEP5mRccCfLyCVZ/Eg0j5BEqrie1qR/nSmDBazKpu+xdzo4hPJyUlSmfj/mJkRpWwvx2mLxzrP2QCpSX5UIg7lKPqjGfoqibvTRpGtM2OMvntlQ9K0F2j2Usn1tJpdnAoxda54rS1XG1KOT0Eh+gC7rpOFWMfKbcA== 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=iC2fEP617U9Ale0rtyGA8Ykji7USJBbdrpOBtr5suaw=; b=ouaSOMaPA9Ub6E0BqgfxEtz4LyUoLmWMRXw3HSYdL4qleRlS5X6GvdZBDVaAXwaCq20wR5cHbUpeT7fD50pjm4Je8guyZwfrGPWGXgeKNObCsK443kCfbAhqcIHIrsf61fdc65KkQzwFUUkI5ARrKmPrj/zxrHffhedXDPGhk2c= Received: from AM0PR10CA0115.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::32) by GVXP190MB1846.EURP190.PROD.OUTLOOK.COM (2603:10a6:150:3e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 15:36:18 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::88) by AM0PR10CA0115.outlook.office365.com (2603:10a6:208:e6::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:17 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:17 +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, Oleksandr Kolomeiets Subject: [PATCH v1 18/31] net/ntnic: add insert (Tx INS) flow module Date: Fri, 4 Oct 2024 17:34:41 +0200 Message-ID: <20241004153551.267935-24-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|GVXP190MB1846:EE_ X-MS-Office365-Filtering-Correlation-Id: 366572e8-2d52-451e-f92c-08dce48a4a1d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: E6nq70I7G1AfVBZGWVCjqoydj3y/pdqd+1ayZm5LzWRw3zdWde0dvOgS8+mAzO3L58qhsPRC25YS6JQvMsL8Txt55ekPLjTI4ZU//3cSXXJZv59YV6sVkaCzwMuRWjfxRyWgUVjNnnu3d5/ULuMH2AoyqyIRvukVoQOJ+34/4i8YLBlEX9U6XyKZPOzIxfXGcu3Kt8acEMU5oZG5IkHZSH0bfZzSledU8CXJ71Lzn2YKahHh8Z2PhzoJc9QXh2lZlVmdRo2QR/ADeaLQYHXXkarJsigpjCXGSA66qNlMc6ce8T2TXMc7k7ypNV9AZ9O3W/glqixtfszw9GN+KKUVR+s7D8Xzz2muv0v+V+1tUplq3qdMa7l6QmvfdYfhuumgv09/OPTrIdoQ5zhIcA6HTYaJcf+aL2Nv+iUx5FTzizi8qT+C80tv8VxOS/leazYc0vd20l4ziq9K3bA2BKmzXLNgkp0CDewilgcO+GEgKJJkkJNqEGvXWV1i4KLwXZuiuOoPs4UgeGt3y5jjE2BGbkavh8MFPZCNQPBSWQfCg9Y3pz8DQHWQjKTKtl2SZjeGK2mxjozMnB5rw1tIbjrgBF5UhnEYGDbbKi6+GsL4jjp1tGujcJDnBzTruGQsapQ3R3jot0hMundrikv2Na3Itvai2Sn/lMtZbqi2BSJKALxboRUVPjW+hB5/8amJoh8EkZda788TsMNBAyn1qa+CoToUiB/YDWf21l1e6OIPXv+GBeaiY/+q9WY0SEf9TXr4WpGt9kJtOQPAd9wzt4BSKVPT0yI08j+UIijZENoHRjoeN0ZoWkDIJ6YB9V6MqOL1qgM+mbBlCco8EF9FihS2VAHadQ2iTxFLbm4krPOwefe7Zvu6Q4SbkQP/+s+3gp0R407Gtt4nCwoOwV0cE/5czhS833swEwm5EjmZycFR9JOAGtqBgYRe0dxGpU4Gu/Vs3igpk4ghaRH6NRF60V9seJm+3c1pPVyQzry/ncUCyDxAlqmXHxv4Vkljti4733kkU8W4Iu9thtAD2jr8pHM+oQLtNigBe5fFXNINpUOnGLj9TEKHHQx4jAbZU5wcFXzl4FDI0irJJoJciMCycTmz5b70RmlshcqBPYgxpFa9SLc66+qmyJqNvm6SLl2HOiuV/4+Ih1KiW325mQLtZsr3w0A2xmWOzAdhWnpX9tRx/UB/Ve/xMushfiKz5hxskyvrQnepFfYdFF0jZfvg7u1tpGKyoeQJKJpmZSJmmZjWXZebMJNs0hUxnIK1D0hdJfpwpmYVbjIjsDADVrILN1IBpUJheW8nJtpJipTTf5WUzUvQOqVXOvDmyxnJ3u2lcXw31v9OAOzKiIRqlDp0dBnjGXSMec/3301NWdHjn5MnUlmFLDBQQRZqy7K0V6p6gcqE 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)(82310400026)(1800799024)(376014)(36860700013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 0tXu4Xg3zjxqZ/uFQPUhnM7SZPVdEixQ4SNNLGiCKlqlYIRDLxkqGGTbMY5fEm6bSeBfQhrTZx/Vuhzt7SfHpgp+a6unKHSkpT2LC5hG6k8sD7briYU9GmREy6Wa87vSuvrhhSZ0F6ziDGjZ+Q8pzDcpriiG5uKCPjkqjKRZbNCH0I2t9shsDfCWYct0qZ42buUb78yN2lghWESU70lXoE7ZZUdNb53XlKeaFUYQZ7g1j9kCqOV7Uiaeuv1BQwxIRfb+kdbUi0shvkp44IDmD7Wdn6O8+0yAEN7f1wXZB5GNb6vi/KidVur/VavSVfAkIC8k60AMcyzN280v9nuICLgq55BN9EhPLnRNQ7bFAQqsZ4OeoOH3Czmp14pL+lzc7S9PoFdnp3SkpaxQgYim0CoMW7nX7yuWFT4u5BUq6ArEmhaKZqWi0waFBSbeiZ9qcgletXnEWZJJdtPtv4wX7R10SwqTeSHuQXIY9RW6KLKkJdj+Q0pK/uvJRwHQ/R3a7dwJ5MsQuoCMmyjFWYC/cXQktOX/1L3B7MOKY/3v6E8sJ+j0T8AST0HCdEGqpVbbin2NdFXQ/wT88M3wQhmdf6PK+CaIW3rkTAnw1UGdqPiIwLFrEK3+xCjFEnYOCbIFOjDLuE+X8SoWnyBtYkHpaw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:17.8147 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 366572e8-2d52-451e-f92c-08dce48a4a1d 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXP190MB1846 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057032-305791-12647-35994-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.168 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVpbG5oZAVgZQ0NDQIMnE2Cwlyc DI1MTEJDEl2cAsKdXcPCkxKcXUNDFNqTYWAPYdeH9BAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan20-7.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, 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: Oleksandr Kolomeiets he TX Inserter module injects zeros into an offset of a packet, effectively expanding the packet. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/meson.build | 1 + .../nthw/flow_api/flow_backend/flow_backend.c | 13 ++++ .../ntnic/nthw/flow_filter/flow_nthw_tx_ins.c | 62 +++++++++++++++++++ .../ntnic/nthw/flow_filter/flow_nthw_tx_ins.h | 35 +++++++++++ .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 2 + .../nthw/supported/nthw_fpga_reg_defs_ins.h | 30 +++++++++ .../supported/nthw_fpga_reg_defs_tx_ins.h | 23 +++++++ 8 files changed, 167 insertions(+) create mode 100644 drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.c create mode 100644 drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_ins.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_ins.h diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index cc5e6fe100..7e0900f0eb 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -59,6 +59,7 @@ sources = files( 'nthw/flow_filter/flow_nthw_rpp_lr.c', 'nthw/flow_filter/flow_nthw_slc_lr.c', 'nthw/flow_filter/flow_nthw_tx_cpy.c', + 'nthw/flow_filter/flow_nthw_tx_ins.c', 'nthw/model/nthw_fpga_model.c', 'nthw/nthw_platform.c', 'nthw/nthw_rac.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c index c12a3204bc..1b4c6d6b4d 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c @@ -18,6 +18,7 @@ #include "flow_nthw_pdb.h" #include "flow_nthw_rpp_lr.h" #include "flow_nthw_tx_cpy.h" +#include "flow_nthw_tx_ins.h" #include "ntnic_mod_reg.h" #include "nthw_fpga_model.h" #include "hw_mod_backend.h" @@ -43,6 +44,7 @@ static struct backend_dev_s { struct hfu_nthw *p_hfu_nthw; /* TPE module */ struct rpp_lr_nthw *p_rpp_lr_nthw; /* TPE module */ struct tx_cpy_nthw *p_tx_cpy_nthw; /* TPE module */ + struct tx_ins_nthw *p_tx_ins_nthw; /* TPE module */ struct csu_nthw *p_csu_nthw; /* TPE module */ struct ifr_nthw *p_ifr_nthw; /* TPE module */ } be_devs[MAX_PHYS_ADAPTERS]; @@ -1831,6 +1833,16 @@ const struct flow_api_backend_ops *bin_flow_backend_init(nthw_fpga_t *p_fpga, vo be_devs[physical_adapter_no].p_csu_nthw = NULL; } + /* Init nthw TX_INS */ + if (tx_ins_nthw_init(NULL, p_fpga, physical_adapter_no) == 0) { + struct tx_ins_nthw *ptr = tx_ins_nthw_new(); + tx_ins_nthw_init(ptr, p_fpga, physical_adapter_no); + be_devs[physical_adapter_no].p_tx_ins_nthw = ptr; + + } else { + be_devs[physical_adapter_no].p_tx_ins_nthw = NULL; + } + be_devs[physical_adapter_no].adapter_no = physical_adapter_no; *dev = (void *)&be_devs[physical_adapter_no]; @@ -1852,6 +1864,7 @@ static void bin_flow_backend_done(void *dev) hfu_nthw_delete(be_dev->p_hfu_nthw); rpp_lr_nthw_delete(be_dev->p_rpp_lr_nthw); tx_cpy_nthw_delete(be_dev->p_tx_cpy_nthw); + tx_ins_nthw_delete(be_dev->p_tx_ins_nthw); } static const struct flow_backend_ops ops = { diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.c new file mode 100644 index 0000000000..5d9867981e --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.c @@ -0,0 +1,62 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include + +#include "ntlog.h" +#include "nthw_drv.h" +#include "nthw_register.h" + +#include "flow_nthw_tx_ins.h" + +struct tx_ins_nthw *tx_ins_nthw_new(void) +{ + struct tx_ins_nthw *p = malloc(sizeof(struct tx_ins_nthw)); + + if (p) + (void)memset(p, 0, sizeof(*p)); + + return p; +} + +void tx_ins_nthw_delete(struct tx_ins_nthw *p) +{ + if (p) { + (void)memset(p, 0, sizeof(*p)); + free(p); + } +} + +int tx_ins_nthw_init(struct tx_ins_nthw *p, nthw_fpga_t *p_fpga, int n_instance) +{ + const char *const p_adapter_id_str = p_fpga->p_fpga_info->mp_adapter_id_str; + nthw_module_t *p_mod = nthw_fpga_query_module(p_fpga, MOD_TX_INS, n_instance); + + assert(n_instance >= 0 && n_instance < 256); + + if (p == NULL) + return p_mod == NULL ? -1 : 0; + + if (p_mod == NULL) { + NT_LOG(ERR, NTHW, "%s: TxIns %d: no such instance\n", p_adapter_id_str, + n_instance); + return -1; + } + + p->mp_fpga = p_fpga; + p->m_physical_adapter_no = (uint8_t)n_instance; + p->m_tx_ins = nthw_fpga_query_module(p_fpga, MOD_TX_INS, n_instance); + + p->mp_rcp_ctrl = nthw_module_get_register(p->m_tx_ins, INS_RCP_CTRL); + p->mp_rcp_addr = nthw_register_get_field(p->mp_rcp_ctrl, INS_RCP_CTRL_ADR); + p->mp_rcp_cnt = nthw_register_get_field(p->mp_rcp_ctrl, INS_RCP_CTRL_CNT); + p->mp_rcp_data = nthw_module_get_register(p->m_tx_ins, INS_RCP_DATA); + p->mp_rcp_data_dyn = nthw_register_get_field(p->mp_rcp_data, INS_RCP_DATA_DYN); + p->mp_rcp_data_ofs = nthw_register_get_field(p->mp_rcp_data, INS_RCP_DATA_OFS); + p->mp_rcp_data_len = nthw_register_get_field(p->mp_rcp_data, INS_RCP_DATA_LEN); + + return 0; +} diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.h b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.h new file mode 100644 index 0000000000..4e7c4133da --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.h @@ -0,0 +1,35 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef __FLOW_NTHW_TX_INS_H__ +#define __FLOW_NTHW_TX_INS_H__ + +#include + +#include "nthw_fpga_model.h" + +struct tx_ins_nthw { + uint8_t m_physical_adapter_no; + nthw_fpga_t *mp_fpga; + + nthw_module_t *m_tx_ins; + + nthw_register_t *mp_rcp_ctrl; + nthw_field_t *mp_rcp_addr; + nthw_field_t *mp_rcp_cnt; + + nthw_register_t *mp_rcp_data; + nthw_field_t *mp_rcp_data_dyn; + nthw_field_t *mp_rcp_data_ofs; + nthw_field_t *mp_rcp_data_len; +}; + +struct tx_ins_nthw *tx_ins_nthw_new(void); +void tx_ins_nthw_delete(struct tx_ins_nthw *p); +int tx_ins_nthw_init(struct tx_ins_nthw *p, nthw_fpga_t *p_fpga, int n_instance); + +int tx_ins_nthw_setup(struct tx_ins_nthw *p, int n_idx, int n_idx_cnt); + +#endif /* __FLOW_NTHW_TX_INS_H__ */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h index 14e031dc69..0d5385a313 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h @@ -39,6 +39,7 @@ #define MOD_SDC (0xd2369530UL) #define MOD_SLC_LR (0x969fc50bUL) #define MOD_TX_CPY (0x60acf217UL) +#define MOD_TX_INS (0x59afa100UL) #define MOD_IDX_COUNT (14) /* aliases - only aliases go below this point */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h index 6eebab65a2..605196e30e 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h @@ -26,6 +26,7 @@ #include "nthw_fpga_reg_defs_i2cm.h" #include "nthw_fpga_reg_defs_ifr.h" #include "nthw_fpga_reg_defs_iic.h" +#include "nthw_fpga_reg_defs_ins.h" #include "nthw_fpga_reg_defs_km.h" #include "nthw_fpga_reg_defs_mac_pcs.h" #include "nthw_fpga_reg_defs_pcie3.h" @@ -40,6 +41,7 @@ #include "nthw_fpga_reg_defs_slc.h" #include "nthw_fpga_reg_defs_slc_lr.h" #include "nthw_fpga_reg_defs_tx_cpy.h" +#include "nthw_fpga_reg_defs_tx_ins.h" /* aliases */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_ins.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_ins.h new file mode 100644 index 0000000000..8aaef2a8f6 --- /dev/null +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_ins.h @@ -0,0 +1,30 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +/* + * nthw_fpga_reg_defs_ins.h + * + * Auto-generated file - do *NOT* edit + * + */ + +#ifndef _NTHW_FPGA_REG_DEFS_INS_ +#define _NTHW_FPGA_REG_DEFS_INS_ + +/* INS */ +#define NTHW_MOD_INS (0x24df4b78UL) +#define INS_RCP_CTRL (0x93de4e05UL) +#define INS_RCP_CTRL_ADR (0x3ae620a8UL) +#define INS_RCP_CTRL_CNT (0x2aeeb979UL) +#define INS_RCP_DATA (0x3c0fcc1cUL) +#define INS_RCP_DATA_DYN (0xc6aa4fccUL) +#define INS_RCP_DATA_LEN (0x2ece4329UL) +#define INS_RCP_DATA_OFS (0x64a3c26aUL) + +#endif /* _NTHW_FPGA_REG_DEFS_INS_ */ + +/* + * Auto-generated file - do *NOT* edit + */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_ins.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_ins.h new file mode 100644 index 0000000000..26635bd0a2 --- /dev/null +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_ins.h @@ -0,0 +1,23 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +/* + * nthw_fpga_reg_defs_tx_ins.h + * + * Auto-generated file - do *NOT* edit + * + */ + +#ifndef _NTHW_FPGA_REG_DEFS_TX_INS_ +#define _NTHW_FPGA_REG_DEFS_TX_INS_ + +/* TX_INS */ +#define NTHW_MOD_TX_INS (0x59afa100UL) + +#endif /* _NTHW_FPGA_REG_DEFS_TX_INS_ */ + +/* + * Auto-generated file - do *NOT* edit + */ From patchwork Fri Oct 4 15:34:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145102 X-Patchwork-Delegate: ferruh.yigit@amd.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 799EF45AAF; Fri, 4 Oct 2024 17:53:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2493542E72; Fri, 4 Oct 2024 17:51:13 +0200 (CEST) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id 3F2BE42E4D for ; Fri, 4 Oct 2024 17:51:08 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2107.outbound.protection.outlook.com [104.47.18.107]) by mx-outbound22-159.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:51:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dUqFZwLRtnGF5/JECJcE6c/FwcH/AsYIwVJbHZV/NDoFYcF91vLhbkGf/EaVuUE499ClZVoIEFnwUf45tz2AaCoQXeWzKE7WiG52S0xe7vy21k6eNY1/dRVS2Fg7t26Sw+Mrje80m4llRmcc2FjPVzUTauDrPID8ePkk2d04wH/KnjNC6vtXla7kATSRGjVO11Hcw711XLutWj+fXGUfiwD7rnWrzwfjYir6Kt7hS9PiCniJewe5IYrHhK6Pub7TlAdgmVBhdMFbgWd1aKH6VftXX7D2XozcTYPl6QlWADYBc1UIS/ler07ymHnpqiGCDggQH2HNCsRF0xxHncmrAQ== 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=jF2FVyjxx+zIGsZCDF6Zg/2umha0Lr/WrEu9Gcb9oV4=; b=PDWESqMlEt+U7NbzjgRv2LasVcJzwNcVvDjZW43fzdOyqpn8w2hwATG6tuD2e13C0ib/8dmh/ZX9oskefaogd861Bp+QJWtDYFVl1INycPNUUtysV5EY/Yb9ms4HmaQxI5+it5bhuSPDwLCeTdTYrsfdb+D3CB+80+WSLTeu5X/Qo4qv8N25MiorQEZnJrXT8JYndckIAfTOvgwbgRGD4pVL1vt1dqEgpEsiokqgwJ3it6dtBSBuQX5GVxQWBhYd1phyMHRaWccZspfJ+P8WwEXeE4fo5dZEKr1gKGaoloqpAoy1HoRPJxLsdQPb41pDXY+EROx5dzr3uARmSCF3sA== 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=jF2FVyjxx+zIGsZCDF6Zg/2umha0Lr/WrEu9Gcb9oV4=; b=KrrNkKq8KpDHBeodIA9+iMOlWjHHY7sOMbhWTtix3ze+SBXgVEEdfnLT7nn3XZ3zc3MfQe8GyBbTbxhk3qHAO/v5hPvTNC4N/nJxLMn6PSjq3Cj9OGXN9o7r5dPxlS7sj918PjgBPmim3wgUNRQh73x14YWwprjsges31QdIkEs= Received: from AM0PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::18) by DU0P190MB1804.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:34c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 15:36:19 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::d2) by AM0PR10CA0101.outlook.office365.com (2603:10a6:208:e6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:19 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:18 +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, Oleksandr Kolomeiets Subject: [PATCH v1 19/31] net/ntnic: add replacer (Tx RPL) flow module Date: Fri, 4 Oct 2024 17:34:42 +0200 Message-ID: <20241004153551.267935-25-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|DU0P190MB1804:EE_ X-MS-Office365-Filtering-Correlation-Id: d29504a6-b096-4ef9-8fe6-08dce48a4ab6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: G1jdddaIwJuvfKSYMPkUd2B3YyB9wWWei+lnXFrYOGoS0I6A2IqEm4xJ6JjLhy38+eLJbXkTMRRlQ6PSmn5NQjomK/Gy7YUG19vPDBasEtcnm3fh/cd0gjDAy4j1LELSXTD0ly8tDyGjmPx+unLofyLDPu4BEhPzqWzZw21hQK4zrliXvI4R2bN2JVlY0a8Zlm2fl/iNz1wC59l6qYHCdoM1yjbHFCs3lSzmGEtj1FrBlqoY68xTpZLO+cYEAtDo0Ju7fKjcPiDKnUzL1QbkQy2Ws4oykbeLVYRWTemYR76lEADcXPAONkKsyLOz64KJ8jcAZsAEl1OG6gD55iXFZfqKTu9TGicnxzWF1gtK8KjoSycHcqWTinVJQe9nmw1zdDv625k8Gc9Q9ugEDFoB/SfP2glaGV+ePH6qi3Kkvvx6sHrHvVx60oS107i6B6vdgtUWTmrTwmOwRMIIAzQb6N3MSmP444yCFc9xX2fbK8uATzUdXZ8yuQJsrrRjfOYFNyFbSGHh8Mi7XJ53XHVsKi02qNNPKkTNuxscsdZnA+g2H1aY7lO92aL6+mmKICzPy1zCi7SSZZs/ZSnyjCdSzfIbV/jR1mW90VwB+eAaHFBJ2y+4zuFDZCROgietlxKlv0SzKinjm47PBGlUNqHvEMOJqdjQcC5s+oPL82bb1roJ8CSdlkqKtbYSzz8T2OOAHo1ybwJfXVTVDfPom15TRltRe9gLahOk2JhtCdeo57AC+dRE8OSnL5sM5J/2io/W42pMD6NOJ1pH/hSn3Wsr6Eh9FD8d8molfL3YburbjURuDpWUaFyJ+sMaYWL0IYLkNSKExP7ZH0lhPFre3LcoO6TqQp9GYzzuyIPKSFS8rcWvYORCFLrh1RoBtxW13islN79AnE5WMNkd5f0zABmRTDgtbfZf1WwNAkHiVuo5Ty1bSiY2HXmb1Z2zuvkx3aij5OA7O4JzdcwjVguNhXljXoi0c6sI0SVJE79sN6HYYqzNxEYWm4OzwwwMdSUDKfjr9kwLJF7Zu8p5AeAH+hXr3orvH7s4zFA2YUvY+RY+ga0Oj7FVlmIc0rwPCWZ23uFs/DMiirpFK6L9pICjqQyKYF+gtua2nqPb7GvaWTAVG351Hz+HY2axh6kVmns8NSvX7E9N1yIELhEJeN4VAn6xJqK1VivB4UPB41sXMOXl8BHPmwNcwIM5E65hCm+kTLdCCkYuNtjztchr5cxmRcR17Wl6r+BmO3UIGQ9m/To3seZDV1vD+aNcT39VAg2XsCOQn/xIxVy7FJTH0YejUzOkEO9MzE9+SpCEcjMmB3mhr5gJkEyqJOZAFszwRRkVHTQ22cjRLQwWrYvylb2SLz0HXZW/BpElQhhru4QLXABKLwo= 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)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: aDmKcBgwO6IzYYjYbVnSgxSVMWmSIeAuEImFpSNSdwwnUTo3uJEa33+beAgCeHMSneZoeK7fKzCqfqaLokdLB+br0ZdybpfRI8PHQgMD/TcHctlSQtSSrFCR1nfKS0wGVDoA10TflPPEDDcCDrhWV39rFzdCR8Rwm43a13iOjGIo0rpH4aADn9WsvrZfhZKABH3pnJ19IqKLrGhxyc0VH0z03FcYKpcDjltOYCuoMD0HYcIqH7hPANaNpYgtoOKkBENMU0o9McCpk0unKHFLtiwHCASMrEctQaEYW84825FEuQBQ2RHAOyom+DUXP4b6JnemW/zym3/UuMkIwHrlL4mcY78KpK/7bv3iVAsLJD5TwhHOoweCwjFDgvaXKgqF+m8TxIpJcbElFzMT0sXTZ7iDnXad7RPQAq/I0h7dVMVbAvWhkS+g1tznvUX0F66FwhhFU3rlRb05bOJppwSglZW/pgFBNAwuIW88c3vR1uE270D1aQdUdasLwIJU+U10Nv6tyjE15eFSEAXkqYSxqs7JweI4QxyjTcfELkoaIzWNwv7rFaa8BCdiheBQ2XL+gRkF2N/SE8ryxXPNJWkOpi8wZO6Q05DII9tTA4suOuNn4NUjGrBvDBmPBcw0D/tHVKx3jjGPs/p7feu+HZ5TeQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:18.8147 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d29504a6-b096-4ef9-8fe6-08dce48a4ab6 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0P190MB1804 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057067-305791-12644-36021-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.18.107 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaGpqamQGYGUNTS3MA80SIl2d wg2cTIMNU01SQ50SzNyCzFLDUlLSkpWak2FgDAyvrpQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan12-63.eu-central-1a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, 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: Oleksandr Kolomeiets The TX Replacer module can replace a range of bytes in a packet. The replacing data is stored in a table in the module and will often contain tunnel data. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/meson.build | 1 + .../nthw/flow_api/flow_backend/flow_backend.c | 13 ++++ .../ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c | 78 +++++++++++++++++++ .../ntnic/nthw/flow_filter/flow_nthw_tx_rpl.h | 52 +++++++++++++ .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 2 + .../nthw/supported/nthw_fpga_reg_defs_rpl.h | 43 ++++++++++ .../supported/nthw_fpga_reg_defs_tx_rpl.h | 23 ++++++ 8 files changed, 213 insertions(+) create mode 100644 drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c create mode 100644 drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpl.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_rpl.h diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 7e0900f0eb..e236b82b36 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -60,6 +60,7 @@ sources = files( 'nthw/flow_filter/flow_nthw_slc_lr.c', 'nthw/flow_filter/flow_nthw_tx_cpy.c', 'nthw/flow_filter/flow_nthw_tx_ins.c', + 'nthw/flow_filter/flow_nthw_tx_rpl.c', 'nthw/model/nthw_fpga_model.c', 'nthw/nthw_platform.c', 'nthw/nthw_rac.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c index 1b4c6d6b4d..f093bfb8bb 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c @@ -19,6 +19,7 @@ #include "flow_nthw_rpp_lr.h" #include "flow_nthw_tx_cpy.h" #include "flow_nthw_tx_ins.h" +#include "flow_nthw_tx_rpl.h" #include "ntnic_mod_reg.h" #include "nthw_fpga_model.h" #include "hw_mod_backend.h" @@ -45,6 +46,7 @@ static struct backend_dev_s { struct rpp_lr_nthw *p_rpp_lr_nthw; /* TPE module */ struct tx_cpy_nthw *p_tx_cpy_nthw; /* TPE module */ struct tx_ins_nthw *p_tx_ins_nthw; /* TPE module */ + struct tx_rpl_nthw *p_tx_rpl_nthw; /* TPE module */ struct csu_nthw *p_csu_nthw; /* TPE module */ struct ifr_nthw *p_ifr_nthw; /* TPE module */ } be_devs[MAX_PHYS_ADAPTERS]; @@ -1843,6 +1845,16 @@ const struct flow_api_backend_ops *bin_flow_backend_init(nthw_fpga_t *p_fpga, vo be_devs[physical_adapter_no].p_tx_ins_nthw = NULL; } + /* Init nthw TX_RPL */ + if (tx_rpl_nthw_init(NULL, p_fpga, physical_adapter_no) == 0) { + struct tx_rpl_nthw *ptr = tx_rpl_nthw_new(); + tx_rpl_nthw_init(ptr, p_fpga, physical_adapter_no); + be_devs[physical_adapter_no].p_tx_rpl_nthw = ptr; + + } else { + be_devs[physical_adapter_no].p_tx_rpl_nthw = NULL; + } + be_devs[physical_adapter_no].adapter_no = physical_adapter_no; *dev = (void *)&be_devs[physical_adapter_no]; @@ -1865,6 +1877,7 @@ static void bin_flow_backend_done(void *dev) rpp_lr_nthw_delete(be_dev->p_rpp_lr_nthw); tx_cpy_nthw_delete(be_dev->p_tx_cpy_nthw); tx_ins_nthw_delete(be_dev->p_tx_ins_nthw); + tx_rpl_nthw_delete(be_dev->p_tx_rpl_nthw); } static const struct flow_backend_ops ops = { diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c new file mode 100644 index 0000000000..65fc1a9c5e --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c @@ -0,0 +1,78 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include + +#include "ntlog.h" +#include "nthw_drv.h" +#include "nthw_register.h" + +#include "flow_nthw_tx_rpl.h" + +struct tx_rpl_nthw *tx_rpl_nthw_new(void) +{ + struct tx_rpl_nthw *p = malloc(sizeof(struct tx_rpl_nthw)); + + if (p) + (void)memset(p, 0, sizeof(*p)); + + return p; +} + +void tx_rpl_nthw_delete(struct tx_rpl_nthw *p) +{ + if (p) { + (void)memset(p, 0, sizeof(*p)); + free(p); + } +} + +int tx_rpl_nthw_init(struct tx_rpl_nthw *p, nthw_fpga_t *p_fpga, int n_instance) +{ + const char *const p_adapter_id_str = p_fpga->p_fpga_info->mp_adapter_id_str; + nthw_module_t *p_mod = nthw_fpga_query_module(p_fpga, MOD_TX_RPL, n_instance); + + assert(n_instance >= 0 && n_instance < 256); + + if (p == NULL) + return p_mod == NULL ? -1 : 0; + + if (p_mod == NULL) { + NT_LOG(ERR, NTHW, "%s: TxRpl %d: no such instance\n", p_adapter_id_str, + n_instance); + return -1; + } + + p->mp_fpga = p_fpga; + p->m_physical_adapter_no = (uint8_t)n_instance; + p->m_tx_rpl = nthw_fpga_query_module(p_fpga, MOD_TX_RPL, n_instance); + + p->mp_rcp_ctrl = nthw_module_get_register(p->m_tx_rpl, RPL_RCP_CTRL); + p->mp_rcp_ctrl_addr = nthw_register_get_field(p->mp_rcp_ctrl, RPL_RCP_CTRL_ADR); + p->mp_rcp_ctrl_cnt = nthw_register_get_field(p->mp_rcp_ctrl, RPL_RCP_CTRL_CNT); + p->mp_rcp_data = nthw_module_get_register(p->m_tx_rpl, RPL_RCP_DATA); + p->mp_rcp_data_dyn = nthw_register_get_field(p->mp_rcp_data, RPL_RCP_DATA_DYN); + p->mp_rcp_data_ofs = nthw_register_get_field(p->mp_rcp_data, RPL_RCP_DATA_OFS); + p->mp_rcp_data_len = nthw_register_get_field(p->mp_rcp_data, RPL_RCP_DATA_LEN); + p->mp_rcp_data_rpl_ptr = nthw_register_get_field(p->mp_rcp_data, RPL_RCP_DATA_RPL_PTR); + p->mp_rcp_data_ext_prio = nthw_register_get_field(p->mp_rcp_data, RPL_RCP_DATA_EXT_PRIO); + p->mp_rcp_data_eth_type_wr = + nthw_register_query_field(p->mp_rcp_data, RPL_RCP_DATA_ETH_TYPE_WR); + + p->mp_ext_ctrl = nthw_module_get_register(p->m_tx_rpl, RPL_EXT_CTRL); + p->mp_ext_ctrl_addr = nthw_register_get_field(p->mp_ext_ctrl, RPL_EXT_CTRL_ADR); + p->mp_ext_ctrl_cnt = nthw_register_get_field(p->mp_ext_ctrl, RPL_EXT_CTRL_CNT); + p->mp_ext_data = nthw_module_get_register(p->m_tx_rpl, RPL_EXT_DATA); + p->mp_ext_data_rpl_ptr = nthw_register_get_field(p->mp_ext_data, RPL_EXT_DATA_RPL_PTR); + + p->mp_rpl_ctrl = nthw_module_get_register(p->m_tx_rpl, RPL_RPL_CTRL); + p->mp_rpl_ctrl_addr = nthw_register_get_field(p->mp_rpl_ctrl, RPL_RPL_CTRL_ADR); + p->mp_rpl_ctrl_cnt = nthw_register_get_field(p->mp_rpl_ctrl, RPL_RPL_CTRL_CNT); + p->mp_rpl_data = nthw_module_get_register(p->m_tx_rpl, RPL_RPL_DATA); + p->mp_rpl_data_value = nthw_register_get_field(p->mp_rpl_data, RPL_RPL_DATA_VALUE); + + return 0; +} diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.h b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.h new file mode 100644 index 0000000000..7425021692 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.h @@ -0,0 +1,52 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef __FLOW_NTHW_TX_RPL_H__ +#define __FLOW_NTHW_TX_RPL_H__ + +#include + +#include "nthw_fpga_model.h" + +struct tx_rpl_nthw { + uint8_t m_physical_adapter_no; + nthw_fpga_t *mp_fpga; + + nthw_module_t *m_tx_rpl; + + nthw_register_t *mp_rcp_ctrl; + nthw_field_t *mp_rcp_ctrl_addr; + nthw_field_t *mp_rcp_ctrl_cnt; + + nthw_register_t *mp_rcp_data; + nthw_field_t *mp_rcp_data_dyn; + nthw_field_t *mp_rcp_data_ofs; + nthw_field_t *mp_rcp_data_len; + nthw_field_t *mp_rcp_data_rpl_ptr; + nthw_field_t *mp_rcp_data_ext_prio; + nthw_field_t *mp_rcp_data_eth_type_wr; + + nthw_register_t *mp_ext_ctrl; + nthw_field_t *mp_ext_ctrl_addr; + nthw_field_t *mp_ext_ctrl_cnt; + + nthw_register_t *mp_ext_data; + nthw_field_t *mp_ext_data_rpl_ptr; + + nthw_register_t *mp_rpl_ctrl; + nthw_field_t *mp_rpl_ctrl_addr; + nthw_field_t *mp_rpl_ctrl_cnt; + + nthw_register_t *mp_rpl_data; + nthw_field_t *mp_rpl_data_value; +}; + +struct tx_rpl_nthw *tx_rpl_nthw_new(void); +void tx_rpl_nthw_delete(struct tx_rpl_nthw *p); +int tx_rpl_nthw_init(struct tx_rpl_nthw *p, nthw_fpga_t *p_fpga, int n_instance); + +int tx_rpl_nthw_setup(struct tx_rpl_nthw *p, int n_idx, int n_idx_cnt); + +#endif /* __FLOW_NTHW_TX_RPL_H__ */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h index 0d5385a313..51b2d99c01 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h @@ -40,6 +40,7 @@ #define MOD_SLC_LR (0x969fc50bUL) #define MOD_TX_CPY (0x60acf217UL) #define MOD_TX_INS (0x59afa100UL) +#define MOD_TX_RPL (0x1095dfbbUL) #define MOD_IDX_COUNT (14) /* aliases - only aliases go below this point */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h index 605196e30e..8fa41eb7ea 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h @@ -35,6 +35,7 @@ #include "nthw_fpga_reg_defs_pdb.h" #include "nthw_fpga_reg_defs_qsl.h" #include "nthw_fpga_reg_defs_rac.h" +#include "nthw_fpga_reg_defs_rpl.h" #include "nthw_fpga_reg_defs_rpp_lr.h" #include "nthw_fpga_reg_defs_rst9563.h" #include "nthw_fpga_reg_defs_sdc.h" @@ -42,6 +43,7 @@ #include "nthw_fpga_reg_defs_slc_lr.h" #include "nthw_fpga_reg_defs_tx_cpy.h" #include "nthw_fpga_reg_defs_tx_ins.h" +#include "nthw_fpga_reg_defs_tx_rpl.h" /* aliases */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpl.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpl.h new file mode 100644 index 0000000000..a163ffc45e --- /dev/null +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpl.h @@ -0,0 +1,43 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +/* + * nthw_fpga_reg_defs_rpl.h + * + * Auto-generated file - do *NOT* edit + * + */ + +#ifndef _NTHW_FPGA_REG_DEFS_RPL_ +#define _NTHW_FPGA_REG_DEFS_RPL_ + +/* RPL */ +#define NTHW_MOD_RPL (0x6de535c3UL) +#define RPL_EXT_CTRL (0x4c47804fUL) +#define RPL_EXT_CTRL_ADR (0xe391ddadUL) +#define RPL_EXT_CTRL_CNT (0xf399447cUL) +#define RPL_EXT_DATA (0xe3960256UL) +#define RPL_EXT_DATA_RPL_PTR (0xa8e4d0d9UL) +#define RPL_RCP_CTRL (0xc471325fUL) +#define RPL_RCP_CTRL_ADR (0x1f2d3a2bUL) +#define RPL_RCP_CTRL_CNT (0xf25a3faUL) +#define RPL_RCP_DATA (0x6ba0b046UL) +#define RPL_RCP_DATA_DYN (0xe361554fUL) +#define RPL_RCP_DATA_ETH_TYPE_WR (0xfc7f05c1UL) +#define RPL_RCP_DATA_EXT_PRIO (0xcd2ae9d1UL) +#define RPL_RCP_DATA_LEN (0xb0559aaUL) +#define RPL_RCP_DATA_OFS (0x4168d8e9UL) +#define RPL_RCP_DATA_RPL_PTR (0x3000a098UL) +#define RPL_RPL_CTRL (0xe65376ecUL) +#define RPL_RPL_CTRL_ADR (0x15abf987UL) +#define RPL_RPL_CTRL_CNT (0x5a36056UL) +#define RPL_RPL_DATA (0x4982f4f5UL) +#define RPL_RPL_DATA_VALUE (0x60951eb4UL) + +#endif /* _NTHW_FPGA_REG_DEFS_RPL_ */ + +/* + * Auto-generated file - do *NOT* edit + */ diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_rpl.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_rpl.h new file mode 100644 index 0000000000..8c46079cd5 --- /dev/null +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tx_rpl.h @@ -0,0 +1,23 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +/* + * nthw_fpga_reg_defs_tx_rpl.h + * + * Auto-generated file - do *NOT* edit + * + */ + +#ifndef _NTHW_FPGA_REG_DEFS_TX_RPL_ +#define _NTHW_FPGA_REG_DEFS_TX_RPL_ + +/* TX_RPL */ +#define NTHW_MOD_TX_RPL (0x1095dfbbUL) + +#endif /* _NTHW_FPGA_REG_DEFS_TX_RPL_ */ + +/* + * Auto-generated file - do *NOT* edit + */ From patchwork Fri Oct 4 15:34:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145130 X-Patchwork-Delegate: ferruh.yigit@amd.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 285A845AAF; Fri, 4 Oct 2024 17:57:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2287842F99; Fri, 4 Oct 2024 17:52:09 +0200 (CEST) Received: from egress-ip42b.ess.de.barracuda.com (egress-ip42b.ess.de.barracuda.com [18.185.115.246]) by mails.dpdk.org (Postfix) with ESMTP id 9C26D42F43 for ; Fri, 4 Oct 2024 17:52:05 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2171.outbound.protection.outlook.com [104.47.17.171]) by mx-outbound22-159.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:52:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=b3gFLDZXqszzpKy4GH8LiiI3k+LXa+HxALpVd46xwgwf5T3A4intMEtnBGJF5StA3DTg8f9a2sI/MbM74qCHSbW/fFGlyiPIwFgEcuA+uTeuzvnvgta0vepXdq9K/Nek6K0woT8ruwdddFDe9SnZKxBlO5cPF5tE96Js40C/jqX4aR8s7ejGwIVzWxdV8iokyDEIRoJU8ZXKwUhqZA7ppql707ZkCH6axcdWrppN5xY7bhiujzwq/cLjR83c1Em/mD/uvf3bvWtZpjlGkx2nYOM65ikI8P7H3tSZbWfDNY+zZgAOp/pTiQpbje9N5iRlNp080Vv5p99k9cgXEqDwtQ== 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=L0Y4Jm3us5b6rZH42wvVYA0U9jNbIVin2oF0cAFYR4I=; b=Ob90CVWs4x+FrXT07Ao9L8pq948CnKrpKga+RRkW0/VAXKzqZQAb6CzBdZxZn0EbjnvZLJ4i617ssCGwlCTePA3mqhCHfxMlPkMOU/iOQRA0Nfi4+GxExVURShsBBj5NWD9ln3rSHzMVdq9WlFzxaxTe3vigEAQ7xQT8XjDTSShgyf2GfrNzdRmRg+iSdL0qpLXTDv/onpeI4gxsX6UhuJ15pStMhCfNkkCNWB4OUnrTOLfRY5sLeXV29HLrck+pDX8oneRUmwAkHvnNh8mQrJKSlNEOEnBoS++EXI1S8CtmN0s3gtx1pE7E6s02faU6g8u5t8o8B61YAzz5HFvy4A== 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=L0Y4Jm3us5b6rZH42wvVYA0U9jNbIVin2oF0cAFYR4I=; b=G2jtV1kDbYJ8e5xf8bvQZga7zXnd/ZJ1Rf6jBAVBr8QGNN0uJqv6YVxGmsvpLvOLmDdmZxIVreE2VgeHSC+1LaVIOqT6Uo+ICaALwBcp+Uz0oLiuOVje5/ya2EwJB+q3C+dbW2i3ZqyscmJmDOQHFN+Z5OcXKwwWKW1Kne3sidI= Received: from AM0PR10CA0115.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::32) by DB8P190MB0633.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:fd::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 15:36:20 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::4) by AM0PR10CA0115.outlook.office365.com (2603:10a6:208:e6::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:20 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:20 +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 Subject: [PATCH v1 20/31] net/ntnic: add Tx Packet Editor (TPE) flow module Date: Fri, 4 Oct 2024 17:34:43 +0200 Message-ID: <20241004153551.267935-26-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|DB8P190MB0633:EE_ X-MS-Office365-Filtering-Correlation-Id: 6cb6c94a-036f-4d76-23bc-08dce48a4b8d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: yOl+grfsfFCQoVvJSohknTTHTVtGNtfF7ClzHbUGEc88V4YigAeuwVFQZahV178ToCakq9FLOM26E1IHdwYnrw2lQlV/2WqCLuZBhFhi2w5ERh2QKknQ6V3gTwzvxlTrPW5RM7Bff7F8R+YdZoD9wAJrDfVMTFNu/iLE0IOxh3r18ays59/cppvHL1Ty53wqzqu/jlZM8jD4vV7nCqLEIWow4xzdd/fyemCFtX4lnuE3cQcEAUZSGecCzuybht+0+7sQ6JAYSDmg5uSKCYQQRFPVyR7HbcQrCeIXjgUDE+1RXCZipTIjRpV3Om8Z7ZIxfV+jVMtRRcvLr5K9V0g5OPVebk+hMg/IZL90boKaw1lx3z7RKFtcM6hop/gIs82ln6jkdC2jflzshjtHjxiFY9tiw1+kCeBHWY7bjFGTC9NuJU4de2NP4Nks1wSFEPKZiHpHrOt+mOVErkPCBAgB19A2pNrftPkP4it77DgFPwhOjRoP52dJP7LdgLEMt9PRbplGOvYEW/tk2NT/+PTD9N263BQeVup/L3GWy8ctaW3+vUJ/9fhyhMhaGQqL9/C6vC+f6BLP0iqzUqo8+tg+C1cD0sgOY98Y3ABB4I5ntfafa24el2Iqud5lcu/v3as+Xgz81jeshEjliu7IAogPEMdsNGx+RXegcBjX4Gj7hlbdDkLWhuRySDWvfekztYSQzW1gxXzosgfqaE9xsFwF9SIC/BNmnrCOcD0ppZJUbJ8CmsLLMngots13bMN0Dtf4VO+JZD+XivCUQaiyGo3plwhz0jhYzV2tNww3AzKv4KgpLE7FPrXUq6Px08J+rmxTw+NYEvNuzXLxL1fPeeb5DujH9zMfo90ezESIl7A6/CO6lLRIyoLtKQ89ZJLxhsnb3XjBsm4qWZ+1kk0pNAf68gw8f6/FKHlbCzbH62THAlVYA2OXQrwM9O8iCRxGwVtHv7gtHv3tnI3Qnh5bZFtNXO7uTRl/ud0/Iv/o9jsvdhcus+OpbrzSeWkFUX3A8NyibaKCMt7KK1f9vd+xaraRBxBLDCsN9Jze/Raqh0e4lAZIf7tmAUPLZ5P9dvjsECbfFckmn5wAdpBE5uMBRyKlQAGAs0U8MTKCgm0N+ivsRwEWmW4ShE+N2Du0GI+V5N2CgSv6mczsmlTEO2hER+vgjXrEjn2PiIrTA+gnfs0yl07ORf9XSq8Ol0+5JVMjIz2zGOK4VKXpvVJ2rh4V4BQ75Y/pyH7eRr4Yo62wB++elX0o5d6WqZfaxnd7n0RW4GZ83MmZM1Iy4UvgOodrQ+bvtb6M+DZEOmnLmsMmoXzJDxjGZSnbXxK7EJckpw7JBcVTQMAIDnxbOtYq2pMF8d95SoFEg6REh5+QVAgHnUHndZQGwIsmxHVSYVWOnQWBiT2N 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)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: RBwsTxVEXYASqtwEBZTlBgF4TUKA32VyTES4U93YA4kWlvgBKOF4syo0QL6kFwjMvuBF4CGfL3olC7dhpq/utECmbIoGwEozPj40sXtmvifeo6sEk5idwPonlKAPdIvYJlkEjo2J9ATmwAcAr8XjzqAhhKbIhZ/q3JoQL0GhO3WYE29v/Pmto/yo/MePrcXYXuVJyxMvBjMjq0of6mF0BZpWvyb0mFmvtrXqDA7gSwgejH2T3omO1zHtCec+IOVsN9/fwu0X4YT0YldoHilkVWGKINhsPE+ZcmRqVcv5xjARJIc9rXsHcc+ZH+0MxBPYk/6JD8/k+hswcYjPjOuEPZ4Fo8tWaeOxsgiKgQMo/ckcONe2ytvHWCBCMaz4YCcernl0fqgxokxT3pvGIDA7w1+R3W8O8waCyCvowjAG3SSfW2qX2BfMf2gejysT/eW5ry50slwxBLqcqTyFlMIAmUOewbgamw9YoWybpuxgur35KjSgcF2zg912bnwPYa3cOZfALPKqO6pb6iwwJLariNDE/Vkk8aMS2DWOTmlzuBlyny5OVM10iCqOkb+eU9duLSv0obGIUNI6rcKE7XwPY/KB7Qv6yQRRMAvvk/ZE8bcW9evJ5bAexWt06zRm8e86Y2XPFNUmkaz+0XL5QukXVA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:20.2366 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6cb6c94a-036f-4d76-23bc-08dce48a4b8d 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8P190MB0633 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057122-305791-12647-36076-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.171 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViYWRmYmQGYGUNTU3CI1xSzFOD U5OS01xdTIMtnIMDXN1NLANDnJODHJVKk2FgDRrgtIQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan12-63.eu-central-1a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, 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 The TX Packet Editor is a software abstraction module, that keeps track of the handful of FPGA modules that are used to edit packets in the TX pipeline. Signed-off-by: Serhii Iliushyk --- drivers/net/ntnic/include/hw_mod_backend.h | 27 ++ drivers/net/ntnic/include/hw_mod_tpe_v3.h | 126 ++++++ .../nthw/flow_api/flow_backend/flow_backend.c | 364 ++++++++++++++++++ .../ntnic/nthw/flow_filter/flow_nthw_csu.c | 79 ++++ .../ntnic/nthw/flow_filter/flow_nthw_csu.h | 9 + .../ntnic/nthw/flow_filter/flow_nthw_hfu.c | 131 +++++++ .../ntnic/nthw/flow_filter/flow_nthw_hfu.h | 30 ++ .../ntnic/nthw/flow_filter/flow_nthw_ifr.c | 55 +++ .../ntnic/nthw/flow_filter/flow_nthw_ifr.h | 11 + .../ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c | 81 ++++ .../ntnic/nthw/flow_filter/flow_nthw_rpp_lr.h | 17 + .../ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c | 49 +++ .../ntnic/nthw/flow_filter/flow_nthw_tx_cpy.h | 10 + .../ntnic/nthw/flow_filter/flow_nthw_tx_ins.c | 36 ++ .../ntnic/nthw/flow_filter/flow_nthw_tx_ins.h | 9 + .../ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c | 94 +++++ .../ntnic/nthw/flow_filter/flow_nthw_tx_rpl.h | 22 ++ 17 files changed, 1150 insertions(+) create mode 100644 drivers/net/ntnic/include/hw_mod_tpe_v3.h diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index 3ea2fefc53..29c33306d1 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -16,6 +16,7 @@ #include "hw_mod_pdb_v9.h" #include "hw_mod_slc_lr_v2.h" #include "hw_mod_hsh_v5.h" +#include "hw_mod_tpe_v3.h" #define MAX_PHYS_ADAPTERS 8 @@ -114,6 +115,18 @@ struct pdb_func_s { }; }; +struct tpe_func_s { + COMMON_FUNC_INFO_S; + uint32_t nb_rcp_categories; + uint32_t nb_ifr_categories; + uint32_t nb_cpy_writers; + uint32_t nb_rpl_depth; + uint32_t nb_rpl_ext_categories; + union { + struct hw_mod_tpe_v3_s v3; + }; +}; + enum debug_mode_e { FLOW_BACKEND_DEBUG_MODE_NONE = 0x0000, FLOW_BACKEND_DEBUG_MODE_WRITE = 0x0001 @@ -244,6 +257,20 @@ struct flow_api_backend_ops { uint32_t (*get_pdb_version)(void *dev); int (*pdb_rcp_flush)(void *dev, const struct pdb_func_s *pdb, int category, int cnt); int (*pdb_config_flush)(void *dev, const struct pdb_func_s *pdb); + + /* TPE */ + bool (*get_tpe_present)(void *dev); + uint32_t (*get_tpe_version)(void *dev); + int (*tpe_rpp_rcp_flush)(void *dev, const struct tpe_func_s *tpe, int index, int cnt); + int (*tpe_rpp_ifr_rcp_flush)(void *dev, const struct tpe_func_s *tpe, int index, int cnt); + int (*tpe_ifr_rcp_flush)(void *dev, const struct tpe_func_s *tpe, int index, int cnt); + int (*tpe_ins_rcp_flush)(void *dev, const struct tpe_func_s *tpe, int index, int cnt); + int (*tpe_rpl_rcp_flush)(void *dev, const struct tpe_func_s *tpe, int index, int cnt); + int (*tpe_rpl_ext_flush)(void *dev, const struct tpe_func_s *tpe, int index, int cnt); + int (*tpe_rpl_rpl_flush)(void *dev, const struct tpe_func_s *tpe, int index, int cnt); + int (*tpe_cpy_rcp_flush)(void *dev, const struct tpe_func_s *tpe, int index, int cnt); + int (*tpe_hfu_rcp_flush)(void *dev, const struct tpe_func_s *tpe, int index, int cnt); + int (*tpe_csu_rcp_flush)(void *dev, const struct tpe_func_s *tpe, int index, int cnt); }; struct flow_api_backend_s { diff --git a/drivers/net/ntnic/include/hw_mod_tpe_v3.h b/drivers/net/ntnic/include/hw_mod_tpe_v3.h new file mode 100644 index 0000000000..87710d8b35 --- /dev/null +++ b/drivers/net/ntnic/include/hw_mod_tpe_v3.h @@ -0,0 +1,126 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef _HW_MOD_TPE_V3_H_ +#define _HW_MOD_TPE_V3_H_ + +#include + +struct tpe_v1_rpp_v0_rcp_s { + uint32_t exp; +}; + +struct tpe_v1_ins_v1_rcp_s { + uint32_t dyn; + uint32_t ofs; + uint32_t len; +}; + +struct tpe_v3_rpl_v4_rcp_s { + uint32_t dyn; + uint32_t ofs; + uint32_t len; + uint32_t rpl_ptr; + uint32_t ext_prio; + uint32_t eth_type_wr; +}; + +struct tpe_v1_rpl_v2_ext_s { + uint32_t rpl_ptr; + uint32_t meta_rpl_len; /* SW only */ +}; + +struct tpe_v1_rpl_v2_rpl_s { + uint32_t value[4]; +}; + +struct tpe_v1_cpy_v1_rcp_s { + uint32_t reader_select; + uint32_t dyn; + uint32_t ofs; + uint32_t len; +}; + +struct tpe_v1_hfu_v1_rcp_s { + uint32_t len_a_wr; + uint32_t len_a_outer_l4_len; + uint32_t len_a_pos_dyn; + uint32_t len_a_pos_ofs; + uint32_t len_a_add_dyn; + uint32_t len_a_add_ofs; + uint32_t len_a_sub_dyn; + + uint32_t len_b_wr; + uint32_t len_b_pos_dyn; + uint32_t len_b_pos_ofs; + uint32_t len_b_add_dyn; + uint32_t len_b_add_ofs; + uint32_t len_b_sub_dyn; + + uint32_t len_c_wr; + uint32_t len_c_pos_dyn; + uint32_t len_c_pos_ofs; + uint32_t len_c_add_dyn; + uint32_t len_c_add_ofs; + uint32_t len_c_sub_dyn; + + uint32_t ttl_wr; + uint32_t ttl_pos_dyn; + uint32_t ttl_pos_ofs; + + uint32_t cs_inf; + uint32_t l3_prt; + uint32_t l3_frag; + uint32_t tunnel; + uint32_t l4_prt; + uint32_t outer_l3_ofs; + uint32_t outer_l4_ofs; + uint32_t inner_l3_ofs; + uint32_t inner_l4_ofs; +}; + +struct tpe_v1_csu_v0_rcp_s { + uint32_t ol3_cmd; + uint32_t ol4_cmd; + uint32_t il3_cmd; + uint32_t il4_cmd; +}; + +struct tpe_v2_rpp_v1_ifr_rcp_s { + uint32_t ipv4_en; + uint32_t ipv4_df_drop; + uint32_t ipv6_en; + uint32_t ipv6_drop; + uint32_t mtu; +}; + +struct tpe_v2_ifr_v1_rcp_s { + uint32_t ipv4_en; + uint32_t ipv4_df_drop; + uint32_t ipv6_en; + uint32_t ipv6_drop; + uint32_t mtu; +}; + +struct hw_mod_tpe_v3_s { + struct tpe_v1_rpp_v0_rcp_s *rpp_rcp; + + struct tpe_v1_ins_v1_rcp_s *ins_rcp; + + struct tpe_v3_rpl_v4_rcp_s *rpl_rcp; + struct tpe_v1_rpl_v2_ext_s *rpl_ext; + struct tpe_v1_rpl_v2_rpl_s *rpl_rpl; + + struct tpe_v1_cpy_v1_rcp_s *cpy_rcp; + + struct tpe_v1_hfu_v1_rcp_s *hfu_rcp; + + struct tpe_v1_csu_v0_rcp_s *csu_rcp; + + struct tpe_v2_rpp_v1_ifr_rcp_s *rpp_ifr_rcp; + struct tpe_v2_ifr_v1_rcp_s *ifr_rcp; +}; + +#endif /* _HW_MOD_TPE_V3_H_ */ diff --git a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c index f093bfb8bb..ff359e1713 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_backend/flow_backend.c @@ -1576,6 +1576,357 @@ static int pdb_config_flush(void *be_dev, const struct pdb_func_s *pdb) return 0; } +/* + * TPE + */ + +static bool tpe_get_present(void *be_dev) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + return be->p_csu_nthw != NULL && be->p_hfu_nthw != NULL && be->p_rpp_lr_nthw != NULL && + be->p_tx_cpy_nthw != NULL && be->p_tx_ins_nthw != NULL && + be->p_tx_rpl_nthw != NULL; +} + +static uint32_t tpe_get_version(void *be_dev) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + + const uint32_t csu_version = + (uint32_t)((nthw_module_get_major_version(be->p_csu_nthw->m_csu) << 16) | + (nthw_module_get_minor_version(be->p_csu_nthw->m_csu) & 0xffff)); + + const uint32_t hfu_version = + (uint32_t)((nthw_module_get_major_version(be->p_hfu_nthw->m_hfu) << 16) | + (nthw_module_get_minor_version(be->p_hfu_nthw->m_hfu) & 0xffff)); + + const uint32_t rpp_lr_version = + (uint32_t)((nthw_module_get_major_version(be->p_rpp_lr_nthw->m_rpp_lr) << 16) | + (nthw_module_get_minor_version(be->p_rpp_lr_nthw->m_rpp_lr) & 0xffff)); + + const uint32_t tx_cpy_version = + (uint32_t)((nthw_module_get_major_version(be->p_tx_cpy_nthw->m_tx_cpy) << 16) | + (nthw_module_get_minor_version(be->p_tx_cpy_nthw->m_tx_cpy) & 0xffff)); + + const uint32_t tx_ins_version = + (uint32_t)((nthw_module_get_major_version(be->p_tx_ins_nthw->m_tx_ins) << 16) | + (nthw_module_get_minor_version(be->p_tx_ins_nthw->m_tx_ins) & 0xffff)); + + const uint32_t tx_rpl_version = + (uint32_t)((nthw_module_get_major_version(be->p_tx_rpl_nthw->m_tx_rpl) << 16) | + (nthw_module_get_minor_version(be->p_tx_rpl_nthw->m_tx_rpl) & 0xffff)); + + /* + * we have to support 9563-55-28 and 9563-55-30 + * so check for INS ver 0.1 and RPL ver 0.2 or for INS ver 0.2 and RPL ver 0.4 + */ + if (csu_version == 0 && hfu_version == 2 && rpp_lr_version >= 1 && tx_cpy_version == 2 && + ((tx_ins_version == 1 && tx_rpl_version == 2) || + (tx_ins_version == 2 && tx_rpl_version == 4))) { + return 3; + } + + if (csu_version == 0 && hfu_version == 2 && rpp_lr_version >= 1 && tx_cpy_version == 4 && + ((tx_ins_version == 1 && tx_rpl_version == 2) || + (tx_ins_version == 2 && tx_rpl_version == 4))) { + return 3; + } + + assert(false); + return 0; +} + +static int tpe_rpp_rcp_flush(void *be_dev, const struct tpe_func_s *rpp_lr, int index, int cnt) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, rpp_lr, be->p_rpp_lr_nthw); + + if (rpp_lr->ver >= 1) { + rpp_lr_nthw_rcp_cnt(be->p_rpp_lr_nthw, 1); + + for (int i = 0; i < cnt; i++) { + rpp_lr_nthw_rcp_select(be->p_rpp_lr_nthw, index + i); + rpp_lr_nthw_rcp_exp(be->p_rpp_lr_nthw, rpp_lr->v3.rpp_rcp[index + i].exp); + rpp_lr_nthw_rcp_flush(be->p_rpp_lr_nthw); + } + } + + CHECK_DEBUG_OFF(rpp_lr, be->p_rpp_lr_nthw); + return 0; +} + +static int tpe_rpp_ifr_rcp_flush(void *be_dev, const struct tpe_func_s *rpp_lr, int index, int cnt) +{ + int res = 0; + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, rpp_lr, be->p_rpp_lr_nthw); + + if (rpp_lr->ver >= 2) { + rpp_lr_nthw_ifr_rcp_cnt(be->p_rpp_lr_nthw, 1); + + for (int i = 0; i < cnt; i++) { + rpp_lr_nthw_ifr_rcp_select(be->p_rpp_lr_nthw, index + i); + rpp_lr_nthw_ifr_rcp_ipv4_en(be->p_rpp_lr_nthw, + rpp_lr->v3.rpp_ifr_rcp[index + i].ipv4_en); + rpp_lr_nthw_ifr_rcp_ipv4_df_drop(be->p_rpp_lr_nthw, + rpp_lr->v3.rpp_ifr_rcp[index + i] + .ipv4_df_drop); + rpp_lr_nthw_ifr_rcp_ipv6_en(be->p_rpp_lr_nthw, + rpp_lr->v3.rpp_ifr_rcp[index + i].ipv6_en); + rpp_lr_nthw_ifr_rcp_ipv6_drop(be->p_rpp_lr_nthw, + rpp_lr->v3.rpp_ifr_rcp[index + i].ipv6_drop); + rpp_lr_nthw_ifr_rcp_mtu(be->p_rpp_lr_nthw, + rpp_lr->v3.rpp_ifr_rcp[index + i].mtu); + rpp_lr_nthw_ifr_rcp_flush(be->p_rpp_lr_nthw); + } + + } else { + res = -1; + } + + CHECK_DEBUG_OFF(rpp_lr, be->p_rpp_lr_nthw); + return res; +} + +static int tpe_ifr_rcp_flush(void *be_dev, const struct tpe_func_s *ifr, int index, int cnt) +{ + int res = 0; + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, ifr, be->p_ifr_nthw); + + if (ifr->ver >= 2) { + ifr_nthw_rcp_cnt(be->p_ifr_nthw, 1); + + for (int i = 0; i < cnt; i++) { + ifr_nthw_rcp_select(be->p_ifr_nthw, index + i); + ifr_nthw_rcp_ipv4_en(be->p_ifr_nthw, ifr->v3.ifr_rcp[index + i].ipv4_en); + ifr_nthw_rcp_ipv4_df_drop(be->p_ifr_nthw, + ifr->v3.ifr_rcp[index + i].ipv4_df_drop); + ifr_nthw_rcp_ipv6_en(be->p_ifr_nthw, ifr->v3.ifr_rcp[index + i].ipv6_en); + ifr_nthw_rcp_ipv6_drop(be->p_ifr_nthw, + ifr->v3.ifr_rcp[index + i].ipv6_drop); + ifr_nthw_rcp_mtu(be->p_ifr_nthw, ifr->v3.ifr_rcp[index + i].mtu); + ifr_nthw_rcp_flush(be->p_ifr_nthw); + } + + } else { + res = -1; + } + + CHECK_DEBUG_OFF(ifr, be->p_ifr_nthw); + return res; +} + +static int tpe_ins_rcp_flush(void *be_dev, const struct tpe_func_s *tx_ins, int index, int cnt) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, tx_ins, be->p_tx_ins_nthw); + + if (tx_ins->ver >= 1) { + tx_ins_nthw_rcp_cnt(be->p_tx_ins_nthw, 1); + + for (int i = 0; i < cnt; i++) { + tx_ins_nthw_rcp_select(be->p_tx_ins_nthw, index + i); + tx_ins_nthw_rcp_dyn(be->p_tx_ins_nthw, tx_ins->v3.ins_rcp[index + i].dyn); + tx_ins_nthw_rcp_ofs(be->p_tx_ins_nthw, tx_ins->v3.ins_rcp[index + i].ofs); + tx_ins_nthw_rcp_len(be->p_tx_ins_nthw, tx_ins->v3.ins_rcp[index + i].len); + tx_ins_nthw_rcp_flush(be->p_tx_ins_nthw); + } + } + + CHECK_DEBUG_OFF(tx_ins, be->p_tx_ins_nthw); + return 0; +} + +static int tpe_rpl_rcp_flush(void *be_dev, const struct tpe_func_s *tx_rpl, int index, int cnt) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, tx_rpl, be->p_tx_rpl_nthw); + + if (tx_rpl->ver >= 1) { + tx_rpl_nthw_rcp_cnt(be->p_tx_rpl_nthw, 1); + + for (int i = 0; i < cnt; i++) { + tx_rpl_nthw_rcp_select(be->p_tx_rpl_nthw, index + i); + tx_rpl_nthw_rcp_dyn(be->p_tx_rpl_nthw, tx_rpl->v3.rpl_rcp[index + i].dyn); + tx_rpl_nthw_rcp_ofs(be->p_tx_rpl_nthw, tx_rpl->v3.rpl_rcp[index + i].ofs); + tx_rpl_nthw_rcp_len(be->p_tx_rpl_nthw, tx_rpl->v3.rpl_rcp[index + i].len); + tx_rpl_nthw_rcp_rpl_ptr(be->p_tx_rpl_nthw, + tx_rpl->v3.rpl_rcp[index + i].rpl_ptr); + tx_rpl_nthw_rcp_ext_prio(be->p_tx_rpl_nthw, + tx_rpl->v3.rpl_rcp[index + i].ext_prio); + + if (tx_rpl->ver >= 3) { + tx_rpl_nthw_rcp_eth_type_wr(be->p_tx_rpl_nthw, + tx_rpl->v3.rpl_rcp[index + i] + .eth_type_wr); + } + + tx_rpl_nthw_rcp_flush(be->p_tx_rpl_nthw); + } + } + + CHECK_DEBUG_OFF(tx_rpl, be->p_tx_rpl_nthw); + return 0; +} + +static int tpe_rpl_ext_flush(void *be_dev, const struct tpe_func_s *tx_rpl, int index, int cnt) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, tx_rpl, be->p_tx_rpl_nthw); + + if (tx_rpl->ver >= 1) { + tx_rpl_nthw_ext_cnt(be->p_tx_rpl_nthw, 1); + + for (int i = 0; i < cnt; i++) { + tx_rpl_nthw_ext_select(be->p_tx_rpl_nthw, index + i); + tx_rpl_nthw_ext_rpl_ptr(be->p_tx_rpl_nthw, + tx_rpl->v3.rpl_ext[index + i].rpl_ptr); + tx_rpl_nthw_ext_flush(be->p_tx_rpl_nthw); + } + } + + CHECK_DEBUG_OFF(tx_rpl, be->p_tx_rpl_nthw); + return 0; +} + +static int tpe_rpl_rpl_flush(void *be_dev, const struct tpe_func_s *tx_rpl, int index, int cnt) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, tx_rpl, be->p_tx_rpl_nthw); + + if (tx_rpl->ver >= 1) { + tx_rpl_nthw_rpl_cnt(be->p_tx_rpl_nthw, 1); + + for (int i = 0; i < cnt; i++) { + tx_rpl_nthw_rpl_select(be->p_tx_rpl_nthw, index + i); + tx_rpl_nthw_rpl_value(be->p_tx_rpl_nthw, + tx_rpl->v3.rpl_rpl[index + i].value); + tx_rpl_nthw_rpl_flush(be->p_tx_rpl_nthw); + } + } + + CHECK_DEBUG_OFF(tx_rpl, be->p_tx_rpl_nthw); + return 0; +} + +static int tpe_cpy_rcp_flush(void *be_dev, const struct tpe_func_s *tx_cpy, int index, int cnt) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + unsigned int wr_index = -1; + + CHECK_DEBUG_ON(be, tx_cpy, be->p_tx_cpy_nthw); + + if (tx_cpy->ver >= 1) { + for (int i = 0; i < cnt; i++) { + if (wr_index != (index + i) / tx_cpy->nb_rcp_categories) { + wr_index = (index + i) / tx_cpy->nb_rcp_categories; + tx_cpy_nthw_writer_cnt(be->p_tx_cpy_nthw, wr_index, 1); + } + + tx_cpy_nthw_writer_select(be->p_tx_cpy_nthw, wr_index, + (index + i) % tx_cpy->nb_rcp_categories); + tx_cpy_nthw_writer_reader_select(be->p_tx_cpy_nthw, wr_index, + tx_cpy->v3.cpy_rcp[index + i] + .reader_select); + tx_cpy_nthw_writer_dyn(be->p_tx_cpy_nthw, wr_index, + tx_cpy->v3.cpy_rcp[index + i].dyn); + tx_cpy_nthw_writer_ofs(be->p_tx_cpy_nthw, wr_index, + tx_cpy->v3.cpy_rcp[index + i].ofs); + tx_cpy_nthw_writer_len(be->p_tx_cpy_nthw, wr_index, + tx_cpy->v3.cpy_rcp[index + i].len); + tx_cpy_nthw_writer_flush(be->p_tx_cpy_nthw, wr_index); + } + } + + CHECK_DEBUG_OFF(tx_cpy, be->p_tx_cpy_nthw); + return 0; +} + +static int tpe_hfu_rcp_flush(void *be_dev, const struct tpe_func_s *hfu, int index, int cnt) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, hfu, be->p_hfu_nthw); + + if (hfu->ver >= 1) { + hfu_nthw_rcp_cnt(be->p_hfu_nthw, 1); + + for (int i = 0; i < cnt; i++) { + hfu_nthw_rcp_select(be->p_hfu_nthw, index + i); + hfu_nthw_rcp_len_a_wr(be->p_hfu_nthw, hfu->v3.hfu_rcp[index + i].len_a_wr); + hfu_nthw_rcp_len_a_ol4len(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].len_a_outer_l4_len); + hfu_nthw_rcp_len_a_pos_dyn(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].len_a_pos_dyn); + hfu_nthw_rcp_len_a_pos_ofs(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].len_a_pos_ofs); + hfu_nthw_rcp_len_a_add_dyn(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].len_a_add_dyn); + hfu_nthw_rcp_len_a_add_ofs(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].len_a_add_ofs); + hfu_nthw_rcp_len_a_sub_dyn(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].len_a_sub_dyn); + hfu_nthw_rcp_len_b_wr(be->p_hfu_nthw, hfu->v3.hfu_rcp[index + i].len_b_wr); + hfu_nthw_rcp_len_b_pos_dyn(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].len_b_pos_dyn); + hfu_nthw_rcp_len_b_pos_ofs(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].len_b_pos_ofs); + hfu_nthw_rcp_len_b_add_dyn(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].len_b_add_dyn); + hfu_nthw_rcp_len_b_add_ofs(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].len_b_add_ofs); + hfu_nthw_rcp_len_b_sub_dyn(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].len_b_sub_dyn); + hfu_nthw_rcp_len_c_wr(be->p_hfu_nthw, hfu->v3.hfu_rcp[index + i].len_c_wr); + hfu_nthw_rcp_len_c_pos_dyn(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].len_c_pos_dyn); + hfu_nthw_rcp_len_c_pos_ofs(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].len_c_pos_ofs); + hfu_nthw_rcp_len_c_add_dyn(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].len_c_add_dyn); + hfu_nthw_rcp_len_c_add_ofs(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].len_c_add_ofs); + hfu_nthw_rcp_len_c_sub_dyn(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].len_c_sub_dyn); + hfu_nthw_rcp_ttl_wr(be->p_hfu_nthw, hfu->v3.hfu_rcp[index + i].ttl_wr); + hfu_nthw_rcp_ttl_pos_dyn(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].ttl_pos_dyn); + hfu_nthw_rcp_ttl_pos_ofs(be->p_hfu_nthw, + hfu->v3.hfu_rcp[index + i].ttl_pos_ofs); + hfu_nthw_rcp_flush(be->p_hfu_nthw); + } + } + + CHECK_DEBUG_OFF(hfu, be->p_hfu_nthw); + return 0; +} + +static int tpe_csu_rcp_flush(void *be_dev, const struct tpe_func_s *csu, int index, int cnt) +{ + struct backend_dev_s *be = (struct backend_dev_s *)be_dev; + CHECK_DEBUG_ON(be, csu, be->p_csu_nthw); + + if (csu->ver >= 1) { + csu_nthw_rcp_cnt(be->p_csu_nthw, 1); + + for (int i = 0; i < cnt; i++) { + csu_nthw_rcp_select(be->p_csu_nthw, index + i); + csu_nthw_rcp_outer_l3_cmd(be->p_csu_nthw, + csu->v3.csu_rcp[index + i].ol3_cmd); + csu_nthw_rcp_outer_l4_cmd(be->p_csu_nthw, + csu->v3.csu_rcp[index + i].ol4_cmd); + csu_nthw_rcp_inner_l3_cmd(be->p_csu_nthw, + csu->v3.csu_rcp[index + i].il3_cmd); + csu_nthw_rcp_inner_l4_cmd(be->p_csu_nthw, + csu->v3.csu_rcp[index + i].il4_cmd); + csu_nthw_rcp_flush(be->p_csu_nthw); + } + } + + CHECK_DEBUG_OFF(csu, be->p_csu_nthw); + return 0; +} + /* * DBS */ @@ -1705,6 +2056,19 @@ const struct flow_api_backend_ops flow_be_iface = { pdb_get_version, pdb_rcp_flush, pdb_config_flush, + + tpe_get_present, + tpe_get_version, + tpe_rpp_rcp_flush, + tpe_rpp_ifr_rcp_flush, + tpe_ifr_rcp_flush, + tpe_ins_rcp_flush, + tpe_rpl_rcp_flush, + tpe_rpl_ext_flush, + tpe_rpl_rpl_flush, + tpe_cpy_rcp_flush, + tpe_hfu_rcp_flush, + tpe_csu_rcp_flush, }; const struct flow_api_backend_ops *bin_flow_backend_init(nthw_fpga_t *p_fpga, void **dev) diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.c index 21efc62eda..f92f322d07 100644 --- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.c +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.c @@ -12,6 +12,11 @@ #include "flow_nthw_csu.h" +void csu_nthw_set_debug_mode(struct csu_nthw *p, unsigned int n_debug_mode) +{ + nthw_module_set_debug_mode(p->m_csu, n_debug_mode); +} + struct csu_nthw *csu_nthw_new(void) { struct csu_nthw *p = malloc(sizeof(struct csu_nthw)); @@ -60,3 +65,77 @@ int csu_nthw_init(struct csu_nthw *p, nthw_fpga_t *p_fpga, int n_instance) return 0; } + +void csu_nthw_rcp_select(const struct csu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_ctrl_adr, val); +} + +void csu_nthw_rcp_cnt(const struct csu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_ctrl_cnt, val); +} + +void csu_nthw_rcp_outer_l3_cmd(const struct csu_nthw *p, uint32_t val) +{ + /* + * Select L3 calc method for outer layer3. + * 0: Do not touch checksum field. + * 1: Check, but do not touch checksum field. + * 2: Insert checksum header value for BAD checksum. + * 3: Insert checksum header value for GOOD checksum. + */ + nthw_field_set_val32(p->mp_rcp_data_ol3_cmd, val); +} + +void csu_nthw_rcp_outer_l4_cmd(const struct csu_nthw *p, uint32_t val) +{ + /* + * Select L4 calc method for outer layer4. + * 0: Do not touch checksum field. + * 1: Check, but do not touch checksum field. + * 2: Insert checksum header value for BAD checksum. + * 3: Insert checksum header value for GOOD checksum. + * 4: Set UDP checksum value of ZERO for both IPv4/IPv6, set good checksum for TCP. + * 5: Set UDP checksum value of ZERO for IPv4, set good checksum for TCP. + * 6: Set UDP checksum value of ZERO for outer tunnel when tunnel is IPv4/IPv6 and UDP, + * otherwise GOOD checksum. 7: Set UDP checksum value of ZERO for outer tunnel when tunnel + * is IPv4 and UDP, otherwise GOOD checksum. + */ + nthw_field_set_val32(p->mp_rcp_data_ol4_cmd, val); +} + +void csu_nthw_rcp_inner_l3_cmd(const struct csu_nthw *p, uint32_t val) +{ + /* + * Select L3 calc method for inner layer3 (tunneled). + * 0: Do not touch checksum field. + * 1: Check, but do not touch checksum field. + * 2: Insert checksum header value for BAD checksum. + * 3: Insert checksum header value for GOOD checksum. + */ + nthw_field_set_val32(p->mp_rcp_data_il3_cmd, val); +} + +void csu_nthw_rcp_inner_l4_cmd(const struct csu_nthw *p, uint32_t val) +{ + /* + * Select L4 calc method for inner layer4 (tunneled). + * 0: Do not touch checksum field. + * 1: Check, but do not touch checksum field. + * 2: Insert checksum header value for BAD checksum. + * 3: Insert checksum header value for GOOD checksum. + * 4: Set UDP checksum value of ZERO for both IPv4/IPv6, set good checksum for TCP. + * 5: Set UDP checksum value of ZERO for IPv4, set good checksum for TCP. + * 6: Set UDP checksum value of ZERO for outer tunnel when tunnel is IPv4/IPv6 and UDP, + * otherwise GOOD checksum. 7: Set UDP checksum value of ZERO for outer tunnel when tunnel + * is IPv4 and UDP, otherwise GOOD checksum. + */ + nthw_field_set_val32(p->mp_rcp_data_il4_cmd, val); +} + +void csu_nthw_rcp_flush(const struct csu_nthw *p) +{ + nthw_register_flush(p->mp_rcp_ctrl, 1); + nthw_register_flush(p->mp_rcp_data, 1); +} diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.h b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.h index e5986a1a9b..91a0926318 100644 --- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.h +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.h @@ -31,5 +31,14 @@ void csu_nthw_delete(struct csu_nthw *p); int csu_nthw_init(struct csu_nthw *p, nthw_fpga_t *p_fpga, int n_instance); int csu_nthw_setup(struct csu_nthw *p, int n_idx, int n_idx_cnt); +void csu_nthw_set_debug_mode(struct csu_nthw *p, unsigned int n_debug_mode); + +void csu_nthw_rcp_select(const struct csu_nthw *p, uint32_t val); +void csu_nthw_rcp_cnt(const struct csu_nthw *p, uint32_t val); +void csu_nthw_rcp_outer_l3_cmd(const struct csu_nthw *p, uint32_t val); +void csu_nthw_rcp_outer_l4_cmd(const struct csu_nthw *p, uint32_t val); +void csu_nthw_rcp_inner_l3_cmd(const struct csu_nthw *p, uint32_t val); +void csu_nthw_rcp_inner_l4_cmd(const struct csu_nthw *p, uint32_t val); +void csu_nthw_rcp_flush(const struct csu_nthw *p); #endif /* _FLOW_NTHW_CSU_H_ */ diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.c index 36d181df02..fcb4003aed 100644 --- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.c +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.c @@ -12,6 +12,11 @@ #include "flow_nthw_hfu.h" +void hfu_nthw_set_debug_mode(struct hfu_nthw *p, unsigned int n_debug_mode) +{ + nthw_module_set_debug_mode(p->m_hfu, n_debug_mode); +} + struct hfu_nthw *hfu_nthw_new(void) { struct hfu_nthw *p = malloc(sizeof(struct hfu_nthw)); @@ -97,3 +102,129 @@ int hfu_nthw_init(struct hfu_nthw *p, nthw_fpga_t *p_fpga, int n_instance) return 0; } + +void hfu_nthw_rcp_select(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_addr, val); +} + +void hfu_nthw_rcp_cnt(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_cnt, val); +} + +void hfu_nthw_rcp_len_a_wr(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_a_wr, val); +} + +void hfu_nthw_rcp_len_a_ol4len(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_a_ol4len, val); +} + +void hfu_nthw_rcp_len_a_pos_dyn(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_a_pos_dyn, val); +} + +void hfu_nthw_rcp_len_a_pos_ofs(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_a_pos_ofs, val); +} + +void hfu_nthw_rcp_len_a_add_dyn(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_a_add_dyn, val); +} + +void hfu_nthw_rcp_len_a_add_ofs(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_a_add_ofs, val); +} + +void hfu_nthw_rcp_len_a_sub_dyn(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_a_sub_dyn, val); +} + +void hfu_nthw_rcp_len_b_wr(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_b_wr, val); +} + +void hfu_nthw_rcp_len_b_pos_dyn(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_b_pos_dyn, val); +} + +void hfu_nthw_rcp_len_b_pos_ofs(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_b_pos_ofs, val); +} + +void hfu_nthw_rcp_len_b_add_dyn(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_b_add_dyn, val); +} + +void hfu_nthw_rcp_len_b_add_ofs(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_b_add_ofs, val); +} + +void hfu_nthw_rcp_len_b_sub_dyn(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_b_sub_dyn, val); +} + +void hfu_nthw_rcp_len_c_wr(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_c_wr, val); +} + +void hfu_nthw_rcp_len_c_pos_dyn(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_c_pos_dyn, val); +} + +void hfu_nthw_rcp_len_c_pos_ofs(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_c_pos_ofs, val); +} + +void hfu_nthw_rcp_len_c_add_dyn(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_c_add_dyn, val); +} + +void hfu_nthw_rcp_len_c_add_ofs(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_c_add_ofs, val); +} + +void hfu_nthw_rcp_len_c_sub_dyn(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len_c_sub_dyn, val); +} + +void hfu_nthw_rcp_ttl_wr(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_ttl_wr, val); +} + +void hfu_nthw_rcp_ttl_pos_dyn(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_ttl_pos_dyn, val); +} + +void hfu_nthw_rcp_ttl_pos_ofs(const struct hfu_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_ttl_pos_ofs, val); +} + +void hfu_nthw_rcp_flush(const struct hfu_nthw *p) +{ + nthw_register_flush(p->mp_rcp_ctrl, 1); + nthw_register_flush(p->mp_rcp_data, 1); +} diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.h b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.h index 7a59066b92..77002a639e 100644 --- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.h +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.h @@ -50,5 +50,35 @@ void hfu_nthw_delete(struct hfu_nthw *p); int hfu_nthw_init(struct hfu_nthw *p, nthw_fpga_t *p_fpga, int n_instance); int hfu_nthw_setup(struct hfu_nthw *p, int n_idx, int n_idx_cnt); +void hfu_nthw_set_debug_mode(struct hfu_nthw *p, unsigned int n_debug_mode); + +/* RCP */ +void hfu_nthw_rcp_select(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_cnt(const struct hfu_nthw *p, uint32_t val); + +void hfu_nthw_rcp_len_a_wr(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_a_ol4len(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_a_pos_dyn(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_a_pos_ofs(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_a_add_dyn(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_a_add_ofs(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_a_sub_dyn(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_b_wr(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_b_pos_dyn(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_b_pos_ofs(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_b_add_dyn(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_b_add_ofs(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_b_sub_dyn(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_c_wr(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_c_pos_dyn(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_c_pos_ofs(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_c_add_dyn(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_c_add_ofs(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_len_c_sub_dyn(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_ttl_wr(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_ttl_pos_dyn(const struct hfu_nthw *p, uint32_t val); +void hfu_nthw_rcp_ttl_pos_ofs(const struct hfu_nthw *p, uint32_t val); + +void hfu_nthw_rcp_flush(const struct hfu_nthw *p); #endif /* __FLOW_NTHW_HFU_H__ */ diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_ifr.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_ifr.c index 849c599e32..e6bb4329da 100644 --- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_ifr.c +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_ifr.c @@ -12,6 +12,11 @@ #include "flow_nthw_ifr.h" +void ifr_nthw_set_debug_mode(struct ifr_nthw *p, unsigned int n_debug_mode) +{ + nthw_module_set_debug_mode(p->m_ifr, n_debug_mode); +} + struct ifr_nthw *ifr_nthw_new(void) { struct ifr_nthw *p = malloc(sizeof(struct ifr_nthw)); @@ -66,3 +71,53 @@ int ifr_nthw_init(struct ifr_nthw *p, nthw_fpga_t *p_fpga, int n_instance) return 0; } + +void ifr_nthw_rcp_select(const struct ifr_nthw *p, uint32_t val) +{ + assert(p->mp_rcp_addr); + nthw_field_set_val32(p->mp_rcp_addr, val); +} + +void ifr_nthw_rcp_cnt(const struct ifr_nthw *p, uint32_t val) +{ + assert(p->mp_rcp_cnt); + nthw_field_set_val32(p->mp_rcp_cnt, val); +} + +void ifr_nthw_rcp_ipv4_en(const struct ifr_nthw *p, uint32_t val) +{ + if (p->mp_rcp_data_ipv4_en) + nthw_field_set_val32(p->mp_rcp_data_ipv4_en, val); +} + +void ifr_nthw_rcp_ipv4_df_drop(const struct ifr_nthw *p, uint32_t val) +{ + if (p->mp_rcp_data_ipv4_df_drop) + nthw_field_set_val32(p->mp_rcp_data_ipv4_df_drop, val); +} + +void ifr_nthw_rcp_ipv6_en(const struct ifr_nthw *p, uint32_t val) +{ + if (p->mp_rcp_data_ipv6_en) + nthw_field_set_val32(p->mp_rcp_data_ipv6_en, val); +} + +void ifr_nthw_rcp_ipv6_drop(const struct ifr_nthw *p, uint32_t val) +{ + if (p->mp_rcp_data_ipv6_drop) + nthw_field_set_val32(p->mp_rcp_data_ipv6_drop, val); +} + +void ifr_nthw_rcp_mtu(const struct ifr_nthw *p, uint32_t val) +{ + assert(p->mp_rcp_data_mtu); + nthw_field_set_val32(p->mp_rcp_data_mtu, val); +} + +void ifr_nthw_rcp_flush(const struct ifr_nthw *p) +{ + assert(p->mp_rcp_ctrl); + assert(p->mp_rcp_data); + nthw_register_flush(p->mp_rcp_ctrl, 1); + nthw_register_flush(p->mp_rcp_data, 1); +} diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_ifr.h b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_ifr.h index 439aafbfbc..6751a599aa 100644 --- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_ifr.h +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_ifr.h @@ -39,5 +39,16 @@ struct ifr_nthw *ifr_nthw_new(void); int ifr_nthw_init(struct ifr_nthw *p, nthw_fpga_t *p_fpga, int n_instance); int ifr_nthw_setup(struct ifr_nthw *p, int n_idx, int n_idx_cnt); +void ifr_nthw_set_debug_mode(struct ifr_nthw *p, unsigned int n_debug_mode); + +/* IFR */ +void ifr_nthw_rcp_select(const struct ifr_nthw *p, uint32_t val); +void ifr_nthw_rcp_cnt(const struct ifr_nthw *p, uint32_t val); +void ifr_nthw_rcp_ipv4_en(const struct ifr_nthw *p, uint32_t val); +void ifr_nthw_rcp_ipv4_df_drop(const struct ifr_nthw *p, uint32_t val); +void ifr_nthw_rcp_ipv6_en(const struct ifr_nthw *p, uint32_t val); +void ifr_nthw_rcp_ipv6_drop(const struct ifr_nthw *p, uint32_t val); +void ifr_nthw_rcp_mtu(const struct ifr_nthw *p, uint32_t val); +void ifr_nthw_rcp_flush(const struct ifr_nthw *p); #endif /* __FLOW_NTHW_IFR_H__ */ diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c index 84bbcbdc4f..6cdc2dea37 100644 --- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c @@ -12,6 +12,11 @@ #include "flow_nthw_rpp_lr.h" +void rpp_lr_nthw_set_debug_mode(struct rpp_lr_nthw *p, unsigned int n_debug_mode) +{ + nthw_module_set_debug_mode(p->m_rpp_lr, n_debug_mode); +} + struct rpp_lr_nthw *rpp_lr_nthw_new(void) { struct rpp_lr_nthw *p = malloc(sizeof(struct rpp_lr_nthw)); @@ -74,3 +79,79 @@ int rpp_lr_nthw_init(struct rpp_lr_nthw *p, nthw_fpga_t *p_fpga, int n_instance) return 0; } + +void rpp_lr_nthw_rcp_select(const struct rpp_lr_nthw *p, uint32_t val) +{ + assert(p->mp_rcp_addr); + nthw_field_set_val32(p->mp_rcp_addr, val); +} + +void rpp_lr_nthw_rcp_cnt(const struct rpp_lr_nthw *p, uint32_t val) +{ + assert(p->mp_rcp_cnt); + nthw_field_set_val32(p->mp_rcp_cnt, val); +} + +void rpp_lr_nthw_rcp_exp(const struct rpp_lr_nthw *p, uint32_t val) +{ + assert(p->mp_rcp_data_exp); + nthw_field_set_val32(p->mp_rcp_data_exp, val); +} + +void rpp_lr_nthw_rcp_flush(const struct rpp_lr_nthw *p) +{ + assert(p->mp_rcp_ctrl); + assert(p->mp_rcp_data); + nthw_register_flush(p->mp_rcp_ctrl, 1); + nthw_register_flush(p->mp_rcp_data, 1); +} + +void rpp_lr_nthw_ifr_rcp_select(const struct rpp_lr_nthw *p, uint32_t val) +{ + assert(p->mp_ifr_rcp_addr); + nthw_field_set_val32(p->mp_ifr_rcp_addr, val); +} + +void rpp_lr_nthw_ifr_rcp_cnt(const struct rpp_lr_nthw *p, uint32_t val) +{ + assert(p->mp_ifr_rcp_cnt); + nthw_field_set_val32(p->mp_ifr_rcp_cnt, val); +} + +void rpp_lr_nthw_ifr_rcp_ipv4_en(const struct rpp_lr_nthw *p, uint32_t val) +{ + if (p->mp_ifr_rcp_data_ipv4_en) + nthw_field_set_val32(p->mp_ifr_rcp_data_ipv4_en, val); +} + +void rpp_lr_nthw_ifr_rcp_ipv4_df_drop(const struct rpp_lr_nthw *p, uint32_t val) +{ + if (p->mp_ifr_rcp_data_ipv4_df_drop) + nthw_field_set_val32(p->mp_ifr_rcp_data_ipv4_df_drop, val); +} + +void rpp_lr_nthw_ifr_rcp_ipv6_en(const struct rpp_lr_nthw *p, uint32_t val) +{ + if (p->mp_ifr_rcp_data_ipv6_en) + nthw_field_set_val32(p->mp_ifr_rcp_data_ipv6_en, val); +} + +void rpp_lr_nthw_ifr_rcp_ipv6_drop(const struct rpp_lr_nthw *p, uint32_t val) +{ + if (p->mp_ifr_rcp_data_ipv6_drop) + nthw_field_set_val32(p->mp_ifr_rcp_data_ipv6_drop, val); +} + +void rpp_lr_nthw_ifr_rcp_mtu(const struct rpp_lr_nthw *p, uint32_t val) +{ + assert(p->mp_ifr_rcp_data_mtu); + nthw_field_set_val32(p->mp_ifr_rcp_data_mtu, val); +} + +void rpp_lr_nthw_ifr_rcp_flush(const struct rpp_lr_nthw *p) +{ + assert(p->mp_ifr_rcp_ctrl); + assert(p->mp_ifr_rcp_data); + nthw_register_flush(p->mp_ifr_rcp_ctrl, 1); + nthw_register_flush(p->mp_ifr_rcp_data, 1); +} diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.h b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.h index 509e46fc48..bdb2e5fa54 100644 --- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.h +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.h @@ -40,5 +40,22 @@ void rpp_lr_nthw_delete(struct rpp_lr_nthw *p); int rpp_lr_nthw_init(struct rpp_lr_nthw *p, nthw_fpga_t *p_fpga, int n_instance); int rpp_lr_nthw_setup(struct rpp_lr_nthw *p, int n_idx, int n_idx_cnt); +void rpp_lr_nthw_set_debug_mode(struct rpp_lr_nthw *p, unsigned int n_debug_mode); + +/* RCP */ +void rpp_lr_nthw_rcp_select(const struct rpp_lr_nthw *p, uint32_t val); +void rpp_lr_nthw_rcp_cnt(const struct rpp_lr_nthw *p, uint32_t val); +void rpp_lr_nthw_rcp_exp(const struct rpp_lr_nthw *p, uint32_t val); +void rpp_lr_nthw_rcp_flush(const struct rpp_lr_nthw *p); + +/* RCP IFR */ +void rpp_lr_nthw_ifr_rcp_select(const struct rpp_lr_nthw *p, uint32_t val); +void rpp_lr_nthw_ifr_rcp_cnt(const struct rpp_lr_nthw *p, uint32_t val); +void rpp_lr_nthw_ifr_rcp_ipv4_en(const struct rpp_lr_nthw *p, uint32_t val); +void rpp_lr_nthw_ifr_rcp_ipv4_df_drop(const struct rpp_lr_nthw *p, uint32_t val); +void rpp_lr_nthw_ifr_rcp_ipv6_en(const struct rpp_lr_nthw *p, uint32_t val); +void rpp_lr_nthw_ifr_rcp_ipv6_drop(const struct rpp_lr_nthw *p, uint32_t val); +void rpp_lr_nthw_ifr_rcp_mtu(const struct rpp_lr_nthw *p, uint32_t val); +void rpp_lr_nthw_ifr_rcp_flush(const struct rpp_lr_nthw *p); #endif /* __FLOW_NTHW_RPP_LR_H__ */ diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c index 197baae334..9ba8b97701 100644 --- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c @@ -12,6 +12,11 @@ #include "flow_nthw_tx_cpy.h" +void tx_cpy_nthw_set_debug_mode(struct tx_cpy_nthw *p, unsigned int n_debug_mode) +{ + nthw_module_set_debug_mode(p->m_tx_cpy, n_debug_mode); +} + struct tx_cpy_nthw *tx_cpy_nthw_new(void) { struct tx_cpy_nthw *p = malloc(sizeof(struct tx_cpy_nthw)); @@ -337,3 +342,47 @@ int tx_cpy_nthw_init(struct tx_cpy_nthw *p, nthw_fpga_t *p_fpga, int n_instance) return 0; } + +void tx_cpy_nthw_writer_select(const struct tx_cpy_nthw *p, unsigned int index, uint32_t val) +{ + assert(index < p->m_writers_cnt); + nthw_field_set_val32(p->m_writers[index].mp_writer_ctrl_addr, val); +} + +void tx_cpy_nthw_writer_cnt(const struct tx_cpy_nthw *p, unsigned int index, uint32_t val) +{ + assert(index < p->m_writers_cnt); + nthw_field_set_val32(p->m_writers[index].mp_writer_ctrl_cnt, val); +} + +void tx_cpy_nthw_writer_reader_select(const struct tx_cpy_nthw *p, unsigned int index, + uint32_t val) +{ + assert(index < p->m_writers_cnt); + nthw_field_set_val32(p->m_writers[index].mp_writer_data_reader_select, val); +} + +void tx_cpy_nthw_writer_dyn(const struct tx_cpy_nthw *p, unsigned int index, uint32_t val) +{ + assert(index < p->m_writers_cnt); + nthw_field_set_val32(p->m_writers[index].mp_writer_data_dyn, val); +} + +void tx_cpy_nthw_writer_ofs(const struct tx_cpy_nthw *p, unsigned int index, uint32_t val) +{ + assert(index < p->m_writers_cnt); + nthw_field_set_val32(p->m_writers[index].mp_writer_data_ofs, val); +} + +void tx_cpy_nthw_writer_len(const struct tx_cpy_nthw *p, unsigned int index, uint32_t val) +{ + assert(index < p->m_writers_cnt); + nthw_field_set_val32(p->m_writers[index].mp_writer_data_len, val); +} + +void tx_cpy_nthw_writer_flush(const struct tx_cpy_nthw *p, unsigned int index) +{ + assert(index < p->m_writers_cnt); + nthw_register_flush(p->m_writers[index].mp_writer_ctrl, 1); + nthw_register_flush(p->m_writers[index].mp_writer_data, 1); +} diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.h b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.h index 801b47b0bb..c1094c09a9 100644 --- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.h +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.h @@ -45,5 +45,15 @@ void tx_cpy_nthw_delete(struct tx_cpy_nthw *p); int tx_cpy_nthw_init(struct tx_cpy_nthw *p, nthw_fpga_t *p_fpga, int n_instance); int tx_cpy_nthw_setup(struct tx_cpy_nthw *p, int n_idx, int n_idx_cnt); +void tx_cpy_nthw_set_debug_mode(struct tx_cpy_nthw *p, unsigned int n_debug_mode); + +void tx_cpy_nthw_writer_select(const struct tx_cpy_nthw *p, unsigned int index, uint32_t val); +void tx_cpy_nthw_writer_cnt(const struct tx_cpy_nthw *p, unsigned int index, uint32_t val); +void tx_cpy_nthw_writer_reader_select(const struct tx_cpy_nthw *p, unsigned int index, + uint32_t val); +void tx_cpy_nthw_writer_dyn(const struct tx_cpy_nthw *p, unsigned int index, uint32_t val); +void tx_cpy_nthw_writer_ofs(const struct tx_cpy_nthw *p, unsigned int index, uint32_t val); +void tx_cpy_nthw_writer_len(const struct tx_cpy_nthw *p, unsigned int index, uint32_t val); +void tx_cpy_nthw_writer_flush(const struct tx_cpy_nthw *p, unsigned int index); #endif /* __FLOW_NTHW_TX_CPY_H__ */ diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.c index 5d9867981e..d27752444c 100644 --- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.c +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.c @@ -12,6 +12,11 @@ #include "flow_nthw_tx_ins.h" +void tx_ins_nthw_set_debug_mode(struct tx_ins_nthw *p, unsigned int n_debug_mode) +{ + nthw_module_set_debug_mode(p->m_tx_ins, n_debug_mode); +} + struct tx_ins_nthw *tx_ins_nthw_new(void) { struct tx_ins_nthw *p = malloc(sizeof(struct tx_ins_nthw)); @@ -60,3 +65,34 @@ int tx_ins_nthw_init(struct tx_ins_nthw *p, nthw_fpga_t *p_fpga, int n_instance) return 0; } + +void tx_ins_nthw_rcp_select(const struct tx_ins_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_addr, val); +} + +void tx_ins_nthw_rcp_cnt(const struct tx_ins_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_cnt, val); +} + +void tx_ins_nthw_rcp_dyn(const struct tx_ins_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_dyn, val); +} + +void tx_ins_nthw_rcp_ofs(const struct tx_ins_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_ofs, val); +} + +void tx_ins_nthw_rcp_len(const struct tx_ins_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len, val); +} + +void tx_ins_nthw_rcp_flush(const struct tx_ins_nthw *p) +{ + nthw_register_flush(p->mp_rcp_ctrl, 1); + nthw_register_flush(p->mp_rcp_data, 1); +} diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.h b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.h index 4e7c4133da..b87b9dcac3 100644 --- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.h +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.h @@ -31,5 +31,14 @@ void tx_ins_nthw_delete(struct tx_ins_nthw *p); int tx_ins_nthw_init(struct tx_ins_nthw *p, nthw_fpga_t *p_fpga, int n_instance); int tx_ins_nthw_setup(struct tx_ins_nthw *p, int n_idx, int n_idx_cnt); +void tx_ins_nthw_set_debug_mode(struct tx_ins_nthw *p, unsigned int n_debug_mode); + +/* RCP */ +void tx_ins_nthw_rcp_select(const struct tx_ins_nthw *p, uint32_t val); +void tx_ins_nthw_rcp_cnt(const struct tx_ins_nthw *p, uint32_t val); +void tx_ins_nthw_rcp_dyn(const struct tx_ins_nthw *p, uint32_t val); +void tx_ins_nthw_rcp_ofs(const struct tx_ins_nthw *p, uint32_t val); +void tx_ins_nthw_rcp_len(const struct tx_ins_nthw *p, uint32_t val); +void tx_ins_nthw_rcp_flush(const struct tx_ins_nthw *p); #endif /* __FLOW_NTHW_TX_INS_H__ */ diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c index 65fc1a9c5e..a3a7554f16 100644 --- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c @@ -12,6 +12,11 @@ #include "flow_nthw_tx_rpl.h" +void tx_rpl_nthw_set_debug_mode(struct tx_rpl_nthw *p, unsigned int n_debug_mode) +{ + nthw_module_set_debug_mode(p->m_tx_rpl, n_debug_mode); +} + struct tx_rpl_nthw *tx_rpl_nthw_new(void) { struct tx_rpl_nthw *p = malloc(sizeof(struct tx_rpl_nthw)); @@ -76,3 +81,92 @@ int tx_rpl_nthw_init(struct tx_rpl_nthw *p, nthw_fpga_t *p_fpga, int n_instance) return 0; } + +void tx_rpl_nthw_rcp_select(const struct tx_rpl_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_ctrl_addr, val); +} + +void tx_rpl_nthw_rcp_cnt(const struct tx_rpl_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_ctrl_cnt, val); +} + +void tx_rpl_nthw_rcp_dyn(const struct tx_rpl_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_dyn, val); +} + +void tx_rpl_nthw_rcp_ofs(const struct tx_rpl_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_ofs, val); +} + +void tx_rpl_nthw_rcp_len(const struct tx_rpl_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_len, val); +} + +void tx_rpl_nthw_rcp_rpl_ptr(const struct tx_rpl_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_rpl_ptr, val); +} + +void tx_rpl_nthw_rcp_ext_prio(const struct tx_rpl_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rcp_data_ext_prio, val); +} + +void tx_rpl_nthw_rcp_eth_type_wr(const struct tx_rpl_nthw *p, uint32_t val) +{ + assert(p->mp_rcp_data_eth_type_wr); + nthw_field_set_val32(p->mp_rcp_data_eth_type_wr, val); +} + +void tx_rpl_nthw_rcp_flush(const struct tx_rpl_nthw *p) +{ + nthw_register_flush(p->mp_rcp_ctrl, 1); + nthw_register_flush(p->mp_rcp_data, 1); +} + +void tx_rpl_nthw_ext_select(const struct tx_rpl_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_ext_ctrl_addr, val); +} + +void tx_rpl_nthw_ext_cnt(const struct tx_rpl_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_ext_ctrl_cnt, val); +} + +void tx_rpl_nthw_ext_rpl_ptr(const struct tx_rpl_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_ext_data_rpl_ptr, val); +} + +void tx_rpl_nthw_ext_flush(const struct tx_rpl_nthw *p) +{ + nthw_register_flush(p->mp_ext_ctrl, 1); + nthw_register_flush(p->mp_ext_data, 1); +} + +void tx_rpl_nthw_rpl_select(const struct tx_rpl_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rpl_ctrl_addr, val); +} + +void tx_rpl_nthw_rpl_cnt(const struct tx_rpl_nthw *p, uint32_t val) +{ + nthw_field_set_val32(p->mp_rpl_ctrl_cnt, val); +} + +void tx_rpl_nthw_rpl_value(const struct tx_rpl_nthw *p, const uint32_t *val) +{ + nthw_field_set_val(p->mp_rpl_data_value, val, 4); +} + +void tx_rpl_nthw_rpl_flush(const struct tx_rpl_nthw *p) +{ + nthw_register_flush(p->mp_rpl_ctrl, 1); + nthw_register_flush(p->mp_rpl_data, 1); +} diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.h b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.h index 7425021692..f743b418f0 100644 --- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.h +++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.h @@ -48,5 +48,27 @@ void tx_rpl_nthw_delete(struct tx_rpl_nthw *p); int tx_rpl_nthw_init(struct tx_rpl_nthw *p, nthw_fpga_t *p_fpga, int n_instance); int tx_rpl_nthw_setup(struct tx_rpl_nthw *p, int n_idx, int n_idx_cnt); +void tx_rpl_nthw_set_debug_mode(struct tx_rpl_nthw *p, unsigned int n_debug_mode); + +/* RCP */ +void tx_rpl_nthw_rcp_select(const struct tx_rpl_nthw *p, uint32_t val); +void tx_rpl_nthw_rcp_cnt(const struct tx_rpl_nthw *p, uint32_t val); +void tx_rpl_nthw_rcp_dyn(const struct tx_rpl_nthw *p, uint32_t val); +void tx_rpl_nthw_rcp_ofs(const struct tx_rpl_nthw *p, uint32_t val); +void tx_rpl_nthw_rcp_len(const struct tx_rpl_nthw *p, uint32_t val); +void tx_rpl_nthw_rcp_rpl_ptr(const struct tx_rpl_nthw *p, uint32_t val); +void tx_rpl_nthw_rcp_ext_prio(const struct tx_rpl_nthw *p, uint32_t val); +void tx_rpl_nthw_rcp_eth_type_wr(const struct tx_rpl_nthw *p, uint32_t val); +void tx_rpl_nthw_rcp_flush(const struct tx_rpl_nthw *p); + +void tx_rpl_nthw_ext_select(const struct tx_rpl_nthw *p, uint32_t val); +void tx_rpl_nthw_ext_cnt(const struct tx_rpl_nthw *p, uint32_t val); +void tx_rpl_nthw_ext_rpl_ptr(const struct tx_rpl_nthw *p, uint32_t val); +void tx_rpl_nthw_ext_flush(const struct tx_rpl_nthw *p); + +void tx_rpl_nthw_rpl_select(const struct tx_rpl_nthw *p, uint32_t val); +void tx_rpl_nthw_rpl_cnt(const struct tx_rpl_nthw *p, uint32_t val); +void tx_rpl_nthw_rpl_value(const struct tx_rpl_nthw *p, const uint32_t *val); +void tx_rpl_nthw_rpl_flush(const struct tx_rpl_nthw *p); #endif /* __FLOW_NTHW_TX_RPL_H__ */ From patchwork Fri Oct 4 15:34:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145128 X-Patchwork-Delegate: ferruh.yigit@amd.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 DA44B45AAF; Fri, 4 Oct 2024 17:57:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B63BC42F6F; Fri, 4 Oct 2024 17:52:05 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id 553AA42F53 for ; Fri, 4 Oct 2024 17:52:01 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2176.outbound.protection.outlook.com [104.47.17.176]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:51:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CqzeBIPb8xIXs10R+1Mn00o5sDVXQG4uI/y3IwCwGoPwYUP1VW7DB/l0zBRkLQ6s7aEe1C4l2Apbi9m20prYSE7EwUsTbAEiOLht+EiUMCHicZc36pqSlodEWZr6zAc2TQK6WwVVoSZitHrJTK/E5NPVpCu4z9249wYLRsqKyBmBtD5sJD7B+5O13sGGeNxPeYPaeMmngNbkMV298i8BEjPf7puIbCASHIoN8JsiFLebAUDIFMi00yy2vUox/0bUvzFda6586DstH1zaGLnySU0eQm2xaniLwfq05s+kRyD5Fzg6xqGWmxIjC+Ei1DzRGRIhdoRrio7pTQbxyfMpIg== 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=7fSrAPbIXCZWRqzpYyQASISpbewcK9OD37S8nc/SOqg=; b=a63ERhRXqhOog/KU2ABLKgm3sQ8yV04rd+U8+lchF9Ctm/6tesgryJzsLAtFMxHc8NCEGzgfDPNTOP4uWfBHc0ntsbE7YKNjyIcQuv+1iqclnok1XEhkuHkMKsLUgSODrMCUnqpaMSq9KJesbdjj/wV77DLzvEiBkX844appw1mRnvsyNy37xBlSkkJJfKKTq0Siy8b2FM5Jq/gXI6VqJi6w1HN3fdszUyq/SXmAdno1+ENwd4eqJQjf5sMltCj/9UN9tW8ACoyLMRwRcdhw8R0J7y3rYl5JVY5v61RCKlLZyKNe6oeibJH2SdOgeELhu2YZD3Ih52fAoVgCvChDeQ== 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=7fSrAPbIXCZWRqzpYyQASISpbewcK9OD37S8nc/SOqg=; b=XPd7twDSJolbWachXoVbxKmUwzg+bQnFtIHJ0aVn+LDP0mSJNZjVuxTywFvZEp3L/DkUDm8tIjRtS3jIH8r3nm+O6IGQrV9yM8lAFnsiKAVeJmsUdadbh45UkJZ82M8cd/4V4a9PW79MnN60ESmTA/EbDP7YdzioKSaBDFYRVxQ= Received: from AM0PR10CA0106.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::23) by PA4P190MB1118.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:109::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.20; Fri, 4 Oct 2024 15:36:21 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::3e) by AM0PR10CA0106.outlook.office365.com (2603:10a6:208:e6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:21 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:21 +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, Oleksandr Kolomeiets Subject: [PATCH v1 21/31] net/ntnic: add base init and deinit of the NT flow API Date: Fri, 4 Oct 2024 17:34:44 +0200 Message-ID: <20241004153551.267935-27-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|PA4P190MB1118:EE_ X-MS-Office365-Filtering-Correlation-Id: 10d2c3d3-5a0f-46a5-bba2-08dce48a4c06 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: nhwMIDs8ycdhiiUQ0JxQeTqDjeBEjGs8jyws7uiwEzCn2367dxsq1eBSmIyCfl/dwDLh2hah4PtdvX4AxnU2zdovRsWx1/ZVK8IrqbFXZ20xHySn85MaqRY+OiuGrR/wNwuZiIevpN+xhV2N8Qu4oU6Y8jEPnHwAYlwOURMLJYcO5rPl/pLeKpvVN70xoxVSFkYugtSKsZvSdKvCC3hDZgvQ+9vjNjiXKRr9M7iiJR/JxZ8OpLppYNzSQXGYBrpcg1C8iUMgPTMrVVdhWgoO1f2Hg+X5sG0NeDag5WudIzFBC9ZBRUo1EnzMsYDc7EjvuHGdMmtBf2KWrphB1ZU2St9c6lgrZou8PJ7dSnf3JAOSBQkZFz3XRxE4Hy/SdhAX6CpCZ08jClHWkAAJvavjEddgDhQbsA+0nCU4RLYAr8TOVOqBeKObFpCOIBDZW94w3Mn08x4USDnhE05XDejqz+OTYRwxeo4T7Ew9I33vvgAd+6cGNAGfKkYRI/mmQ5VoV8yyOvu+ZwVZR5A0CV8NR0m8vnhlXHAzhxdrQu+azrRJbEdpBKLy55nwd0KixAFfzPqah/3DUxpY/quwKoyZDw8MKrNGOhS1wjgk9el6QgUdmQ0CC4VdIK2Uw22WNhE5tlirv4LtfanD4qinnL3P7BllnxbJqF4Y5h18KR1Y6lxIyAfPqz4x5oEq7WPJRQeX9dSQwzfxnkjiUXcMDKZ0MoKAGeMKXUX7htF8STtVhyrbP/O1cIP+Is1n6AY1Q8Im/i77qihzLhduHM4l3ImcX2rmZrPNm3Bjb0pWvWPSYWQApfQ3iJQNyDByESqH7Xubsnp4DecE9AWABgzZ3hhqAzaUtydZ3t6XFCsgMSFHK9G7GO5xlCzrqet511udsHwBm5xuljS3AvoOfKnbxtu5CyFbAW9TvEsd6Wc7wTocFPd2hISqnJ8HsjNc+AC13Iligw24EeEC1jLQQWmUR2sfuSuGOxMNAmNUrdr69IzBqdG+and+MIjqN8EvjMvEUN0gvA4gYS95SHGt842RlhX3omOLRItOCN0fbLuvkHx27N4ZVEBBmjvAgydDFqeBvOl9uvz/b8VgFnwUkMx2jjAZq4ctEYA2R1HIh0DiObUW2poCVxnOTZVdWbMoj2dHq8tIto/hRz/LE6iVDaMqXR3404KS4ABLujZyEIGbsqkPbcL0ZUVnMu0YC+6BsL5LN3d46EGvHS2PfnOv1y/rC1IDceAzR4efLRZJYnX6HQH6Wjmx0o27LSQ1i7eE8TwRPLvA5r5IlFGLaW2dugDeRMviBMLDntbmBmL1prnRyafQicP3uBxBZpiZnct335RQEipIVJwGnnHt0rM79sEkBeJ4xCKiZSRhgt25uAXkTxE1+gC1aFaWUdtWAexBnmHjkRgi 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)(376014)(82310400026)(36860700013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 9la3xKFl0NGlKKHSxnqYO8hZTQkRWXsGIMPBH7dFCnOcYdxb9ewNvUpABHrkxYmLzgQostmton+zTXORGkbf0yUsa4rSUzbgGNZG2NrPEmKiIOFNhAtK/MXVTh/ei+vIJmFZtXpVSbQ05OiuqZRIC288VDzJijaperitn59djsxGxs+CIwSayEjTgSIjbskbigZPRnlBoUrViSqlT56UK7+fmMeDgvDVAi+HmypC1+DOStZjFZU8BxJmniEHQq3SGrRuwpRcm3xc8L41ev/llmBckGaAAiRrmRfMj88yav5lm0DyYdu5FtFn1DKGvkBLd3SLv8l1mCaGBT2/AeF2ygVSEvkpoP2LJCxLdGLcEW6cJX48S8jOU6ywUpR2bh5dun5x88idd0mxR9HzDMrYf2xYLC9HOoMSHr0w9LMF2KmR1RAQf9b+Swgn/t18nTOAxFQDHXRsP7tjdeApBErvg7UwAeGVLsTqvJmtn8HpR60k7XDkpPiOOKsPkYJKa74CEA7O/5bSq93jxyBfyravEz2JyaknuRB/K3udzM9FMuUTZC1AoEEe9xjOq19iqrhRAZvIqJUK4dSI1bSAiJhb0ebHoYO3iPnAEAcjt5uu4NubP7epj2I6PFd5a/DcKjHgnhyja5px33VtSg33GJPN7A== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:21.0178 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 10d2c3d3-5a0f-46a5-bba2-08dce48a4c06 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4P190MB1118 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057119-311388-12685-32575-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.176 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVobmhiZGQGYGUNTEJCUt1cLUMM UsxSDRIMU4Mc0kOS3RyMjMxDQ1NcnAUqk2FgDeqWUbQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan16-215.eu-central-1b.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: Oleksandr Kolomeiets Add basic API for initialization resources required by flow filter API Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/include/flow_api.h | 82 ++++++ drivers/net/ntnic/include/flow_api_engine.h | 43 +++ drivers/net/ntnic/include/hw_mod_backend.h | 3 + .../ntnic/include/stream_binary_flow_api.h | 22 ++ drivers/net/ntnic/meson.build | 2 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 245 ++++++++++++++++++ .../ntnic/nthw/flow_api/flow_api_nic_setup.h | 6 + drivers/net/ntnic/nthw/flow_api/flow_filter.c | 17 +- drivers/net/ntnic/nthw/flow_api/flow_kcc.c | 19 ++ drivers/net/ntnic/nthw/flow_api/flow_km.c | 19 ++ 10 files changed, 453 insertions(+), 5 deletions(-) create mode 100644 drivers/net/ntnic/include/flow_api_engine.h create mode 100644 drivers/net/ntnic/include/stream_binary_flow_api.h create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_kcc.c create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_km.c diff --git a/drivers/net/ntnic/include/flow_api.h b/drivers/net/ntnic/include/flow_api.h index 6a2277c2ca..bad1f72868 100644 --- a/drivers/net/ntnic/include/flow_api.h +++ b/drivers/net/ntnic/include/flow_api.h @@ -6,14 +6,96 @@ #ifndef _FLOW_API_H_ #define _FLOW_API_H_ +#include + #include "ntlog.h" +#include "flow_api_engine.h" #include "hw_mod_backend.h" +#include "stream_binary_flow_api.h" + +/* + * Flow NIC and Eth port device management + */ + +struct hw_mod_resource_s { + uint8_t *alloc_bm; /* allocation bitmap */ + uint32_t *ref; /* reference counter for each resource element */ + uint32_t resource_count;/* number of total available entries */ +}; + +/* + * Device Management API + */ +int flow_delete_eth_dev(struct flow_eth_dev *eth_dev); + +struct flow_eth_dev { + /* NIC that owns this port device */ + struct flow_nic_dev *ndev; + /* NIC port id */ + uint8_t port; + + /* 0th for exception */ + struct flow_queue_id_s rx_queue[FLOW_MAX_QUEUES + 1]; + + /* VSWITCH has exceptions sent on queue 0 per design */ + int num_queues; + + struct flow_eth_dev *next; +}; /* registered NIC backends */ struct flow_nic_dev { + struct hw_mod_resource_s res[RES_COUNT];/* raw NIC resource allocation table */ + void *km_res_handle; + void *kcc_res_handle; + + uint32_t flow_unique_id_counter; + /* linked list of all flows created on this NIC */ + struct flow_handle *flow_base; + /* NIC backend API */ struct flow_api_backend_s be; + /* linked list of created eth-port devices on this NIC */ + struct flow_eth_dev *eth_base; + pthread_mutex_t mtx; + + /* next NIC linked list */ + struct flow_nic_dev *next; }; +/* + * Resources + */ + +extern const char *dbg_res_descr[]; + +#define flow_nic_unset_bit(arr, x) \ + do { \ + size_t _temp_x = (x); \ + arr[_temp_x / 8] &= (uint8_t)(~(1 << (_temp_x % 8))); \ + } while (0) + +#define flow_nic_is_bit_set(arr, x) \ + ({ \ + size_t _temp_x = (x); \ + (arr[_temp_x / 8] & (uint8_t)(1 << (_temp_x % 8))); \ + }) + +#define flow_nic_mark_resource_unused(_ndev, res_type, index) \ + do { \ + typeof(res_type) _temp_res_type = (res_type); \ + size_t _temp_index = (index); \ + NT_LOG(DBG, FILTER, "mark resource unused: %s idx %zu\n", \ + dbg_res_descr[_temp_res_type], _temp_index); \ + flow_nic_unset_bit((_ndev)->res[_temp_res_type].alloc_bm, _temp_index); \ + } while (0) + +#define flow_nic_is_resource_used(_ndev, res_type, index) \ + (!!flow_nic_is_bit_set((_ndev)->res[res_type].alloc_bm, index)) + +void flow_nic_free_resource(struct flow_nic_dev *ndev, enum res_type_e res_type, int idx); + +int flow_nic_deref_resource(struct flow_nic_dev *ndev, enum res_type_e res_type, int index); + #endif diff --git a/drivers/net/ntnic/include/flow_api_engine.h b/drivers/net/ntnic/include/flow_api_engine.h new file mode 100644 index 0000000000..724b68c3e8 --- /dev/null +++ b/drivers/net/ntnic/include/flow_api_engine.h @@ -0,0 +1,43 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef _FLOW_API_ENGINE_H_ +#define _FLOW_API_ENGINE_H_ + +/* + * Resource management + * These are free resources in FPGA + * Other FPGA memory lists are linked to one of these + * and will implicitly follow them + */ +enum res_type_e { + RES_QUEUE, + RES_CAT_CFN, + RES_CAT_COT, + RES_CAT_EXO, + RES_CAT_LEN, + RES_KM_FLOW_TYPE, + RES_KM_CATEGORY, + RES_HSH_RCP, + RES_PDB_RCP, + RES_QSL_RCP, + RES_QSL_QST, + RES_SLC_LR_RCP, + + RES_FLM_FLOW_TYPE, + RES_FLM_RCP, + RES_TPE_RCP, + RES_TPE_EXT, + RES_TPE_RPL, + RES_SCRUB_RCP, + RES_COUNT, + RES_INVALID +}; + +void km_free_ndev_resource_management(void **handle); + +void kcc_free_ndev_resource_management(void **handle); + +#endif /* _FLOW_API_ENGINE_H_ */ diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index 29c33306d1..3c6c15c896 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -8,6 +8,8 @@ #include +#include "ntlog.h" + #include "hw_mod_cat_v18.h" #include "hw_mod_cat_v21.h" #include "hw_mod_flm_v25.h" @@ -275,6 +277,7 @@ struct flow_api_backend_ops { struct flow_api_backend_s { void *be_dev; + const struct flow_api_backend_ops *iface; }; #endif /* _HW_MOD_BACKEND_H_ */ diff --git a/drivers/net/ntnic/include/stream_binary_flow_api.h b/drivers/net/ntnic/include/stream_binary_flow_api.h new file mode 100644 index 0000000000..10529b8843 --- /dev/null +++ b/drivers/net/ntnic/include/stream_binary_flow_api.h @@ -0,0 +1,22 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef _STREAM_BINARY_FLOW_API_H_ +#define _STREAM_BINARY_FLOW_API_H_ + +/* + * Flow frontend for binary programming interface + */ + +#define FLOW_MAX_QUEUES 128 + +struct flow_queue_id_s { + int id; + int hw_id; +}; + +struct flow_eth_dev; /* port device */ + +#endif /* _STREAM_BINARY_FLOW_API_H_ */ diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index e236b82b36..15549e1c94 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -46,6 +46,8 @@ sources = files( 'nthw/flow_api/flow_api.c', 'nthw/flow_api/flow_backend/flow_backend.c', 'nthw/flow_api/flow_filter.c', + 'nthw/flow_api/flow_kcc.c', + 'nthw/flow_api/flow_km.c', 'nthw/flow_filter/flow_nthw_cat.c', 'nthw/flow_filter/flow_nthw_csu.c', 'nthw/flow_filter/flow_nthw_flm.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index 9671a20e0b..92b8d083e0 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -3,11 +3,256 @@ * Copyright(c) 2023 Napatech A/S */ +#include "flow_api_engine.h" #include "flow_api_nic_setup.h" #include "ntnic_mod_reg.h" #include "flow_filter.h" +const char *dbg_res_descr[] = { + /* RES_QUEUE */ "RES_QUEUE", + /* RES_CAT_CFN */ "RES_CAT_CFN", + /* RES_CAT_COT */ "RES_CAT_COT", + /* RES_CAT_EXO */ "RES_CAT_EXO", + /* RES_CAT_LEN */ "RES_CAT_LEN", + /* RES_KM_FLOW_TYPE */ "RES_KM_FLOW_TYPE", + /* RES_KM_CATEGORY */ "RES_KM_CATEGORY", + /* RES_HSH_RCP */ "RES_HSH_RCP", + /* RES_PDB_RCP */ "RES_PDB_RCP", + /* RES_QSL_RCP */ "RES_QSL_RCP", + /* RES_QSL_LTX */ "RES_QSL_LTX", + /* RES_QSL_QST */ "RES_QSL_QST", + /* RES_SLC_LR_RCP */ "RES_SLC_LR_RCP", + /* RES_FLM_FLOW_TYPE */ "RES_FLM_FLOW_TYPE", + /* RES_FLM_RCP */ "RES_FLM_RCP", + /* RES_TPE_RCP */ "RES_TPE_RCP", + /* RES_TPE_EXT */ "RES_TPE_EXT", + /* RES_TPE_RPL */ "RES_TPE_RPL", + /* RES_COUNT */ "RES_COUNT", + /* RES_INVALID */ "RES_INVALID" +}; + +static struct flow_nic_dev *dev_base; +static pthread_mutex_t base_mtx = PTHREAD_MUTEX_INITIALIZER; + +void flow_nic_free_resource(struct flow_nic_dev *ndev, enum res_type_e res_type, int idx) +{ + flow_nic_mark_resource_unused(ndev, res_type, idx); +} + +int flow_nic_deref_resource(struct flow_nic_dev *ndev, enum res_type_e res_type, int index) +{ + NT_LOG(DBG, FILTER, "De-reference resource %s idx %i (before ref cnt %i)\n", + dbg_res_descr[res_type], index, ndev->res[res_type].ref[index]); + assert(flow_nic_is_resource_used(ndev, res_type, index)); + assert(ndev->res[res_type].ref[index]); + /* deref */ + ndev->res[res_type].ref[index]--; + + if (!ndev->res[res_type].ref[index]) + flow_nic_free_resource(ndev, res_type, index); + + return !!ndev->res[res_type].ref[index];/* if 0 resource has been freed */ +} + +/* + * Device Management API + */ + +static int nic_remove_eth_port_dev(struct flow_nic_dev *ndev, struct flow_eth_dev *eth_dev) +{ + struct flow_eth_dev *dev = ndev->eth_base, *prev = NULL; + + while (dev) { + if (dev == eth_dev) { + if (prev) + prev->next = dev->next; + + else + ndev->eth_base = dev->next; + + return 0; + } + + prev = dev; + dev = dev->next; + } + + return -1; +} + +static void flow_ndev_reset(struct flow_nic_dev *ndev) +{ + /* Delete all eth-port devices created on this NIC device */ + while (ndev->eth_base) + flow_delete_eth_dev(ndev->eth_base); + + km_free_ndev_resource_management(&ndev->km_res_handle); + kcc_free_ndev_resource_management(&ndev->kcc_res_handle); + + ndev->flow_unique_id_counter = 0; + +#ifdef FLOW_DEBUG + /* + * free all resources default allocated, initially for this NIC DEV + * Is not really needed since the bitmap will be freed in a sec. Therefore + * only in debug mode + */ + + /* Check if all resources has been released */ + NT_LOG(DBG, FILTER, "Delete NIC DEV Adaptor %i\n", ndev->adapter_no); + + for (unsigned int i = 0; i < RES_COUNT; i++) { + int err = 0; +#if defined(FLOW_DEBUG) + NT_LOG(DBG, FILTER, "RES state for: %s\n", dbg_res_descr[i]); +#endif + + for (unsigned int ii = 0; ii < ndev->res[i].resource_count; ii++) { + int ref = ndev->res[i].ref[ii]; + int used = flow_nic_is_resource_used(ndev, i, ii); + + if (ref || used) { + NT_LOG(DBG, FILTER, " [%i]: ref cnt %i, used %i\n", ii, ref, + used); + err = 1; + } + } + + if (err) + NT_LOG(DBG, FILTER, "ERROR - some resources not freed\n"); + } + +#endif +} + +int flow_delete_eth_dev(struct flow_eth_dev *eth_dev) +{ + struct flow_nic_dev *ndev = eth_dev->ndev; + + if (!ndev) { + /* Error invalid nic device */ + return -1; + } + + NT_LOG(DBG, FILTER, "Delete eth-port device %p, port %i\n", eth_dev, eth_dev->port); + +#ifdef FLOW_DEBUG + ndev->be.iface->set_debug_mode(ndev->be.be_dev, FLOW_BACKEND_DEBUG_MODE_WRITE); +#endif + + /* delete all created flows from this device */ + pthread_mutex_lock(&ndev->mtx); + +#ifdef FLOW_DEBUG + ndev->be.iface->set_debug_mode(ndev->be.be_dev, FLOW_BACKEND_DEBUG_MODE_NONE); +#endif + +#ifndef SCATTER_GATHER + + /* free rx queues */ + for (int i = 0; i < eth_dev->num_queues; i++) { + ndev->be.iface->free_rx_queue(ndev->be.be_dev, eth_dev->rx_queue[i].hw_id); + flow_nic_deref_resource(ndev, RES_QUEUE, eth_dev->rx_queue[i].id); + } + +#endif + + /* take eth_dev out of ndev list */ + if (nic_remove_eth_port_dev(ndev, eth_dev) != 0) + NT_LOG(ERR, FILTER, "ERROR : eth_dev %p not found\n", eth_dev); + + pthread_mutex_unlock(&ndev->mtx); + + /* free eth_dev */ + free(eth_dev); + + return 0; +} + +/* + * Flow API NIC Setup + * Flow backend creation function - register and initialize common backend API to FPA modules + */ + +static void done_resource_elements(struct flow_nic_dev *ndev, enum res_type_e res_type) +{ + assert(ndev); + + if (ndev->res[res_type].alloc_bm) + free(ndev->res[res_type].alloc_bm); +} + +static int list_remove_flow_nic(struct flow_nic_dev *ndev) +{ + pthread_mutex_lock(&base_mtx); + struct flow_nic_dev *nic_dev = dev_base, *prev = NULL; + + while (nic_dev) { + if (nic_dev == ndev) { + if (prev) + prev->next = nic_dev->next; + + else + dev_base = nic_dev->next; + + pthread_mutex_unlock(&base_mtx); + return 0; + } + + prev = nic_dev; + nic_dev = nic_dev->next; + } + + pthread_mutex_unlock(&base_mtx); + return -1; +} + +struct flow_nic_dev *flow_api_create(uint8_t adapter_no, const struct flow_api_backend_ops *be_if, + void *be_dev) +{ + (void)adapter_no; + + if (!be_if || be_if->version != 1) { + NT_LOG(DBG, FILTER, "ERR: %s\n", __func__); + return NULL; + } + + struct flow_nic_dev *ndev = calloc(1, sizeof(struct flow_nic_dev)); + + if (!ndev) { + NT_LOG(ERR, FILTER, "ERROR: calloc failed\n"); + return NULL; + } + + /* + * To dump module initialization writes use + * FLOW_BACKEND_DEBUG_MODE_WRITE + * then remember to set it ...NONE afterwards again + */ + be_if->set_debug_mode(be_dev, FLOW_BACKEND_DEBUG_MODE_NONE); + + return ndev; +} + +int flow_api_done(struct flow_nic_dev *ndev) +{ + NT_LOG(DBG, FILTER, "FLOW API DONE\n"); + + if (ndev) { + flow_ndev_reset(ndev); + + /* delete resource management allocations for this ndev */ + for (int i = 0; i < RES_COUNT; i++) + done_resource_elements(ndev, i); + + list_remove_flow_nic(ndev); + free(ndev); + } + + return 0; +} + void *flow_api_get_be_dev(struct flow_nic_dev *ndev) { if (!ndev) { diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api_nic_setup.h b/drivers/net/ntnic/nthw/flow_api/flow_api_nic_setup.h index da083f050a..eeb070c569 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api_nic_setup.h +++ b/drivers/net/ntnic/nthw/flow_api/flow_api_nic_setup.h @@ -9,6 +9,12 @@ #include "hw_mod_backend.h" #include "flow_api.h" +/* + * Flow capable NIC backend - creating flow api instance for adapter nr (backend) + */ +struct flow_nic_dev *flow_api_create(uint8_t adapter_no, const struct flow_api_backend_ops *be_if, + void *be_dev); +int flow_api_done(struct flow_nic_dev *dev); void *flow_api_get_be_dev(struct flow_nic_dev *dev); #endif /* __FLOW_API_NIC_SETUP_H__ */ diff --git a/drivers/net/ntnic/nthw/flow_api/flow_filter.c b/drivers/net/ntnic/nthw/flow_api/flow_filter.c index e822ba7df9..69e5972f5d 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_filter.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_filter.c @@ -9,10 +9,8 @@ int flow_filter_init(nthw_fpga_t *p_fpga, struct flow_nic_dev **p_flow_device, int adapter_no) { - (void)p_flow_device; - (void)adapter_no; - void *be_dev = NULL; + struct flow_nic_dev *flow_nic; const struct flow_backend_ops *flow_backend_ops = get_flow_backend_ops(); @@ -22,8 +20,17 @@ int flow_filter_init(nthw_fpga_t *p_fpga, struct flow_nic_dev **p_flow_device, i } NT_LOG(DBG, FILTER, "Initializing flow filter api\n"); - flow_backend_ops->bin_flow_backend_init(p_fpga, &be_dev); + const struct flow_api_backend_ops *iface = + flow_backend_ops->bin_flow_backend_init(p_fpga, &be_dev); + + flow_nic = flow_api_create((uint8_t)adapter_no, iface, be_dev); + + if (!flow_nic) { + *p_flow_device = NULL; + return -1; + } + *p_flow_device = flow_nic; return 0; } @@ -31,7 +38,7 @@ int flow_filter_done(struct flow_nic_dev *dev) { void *be_dev = flow_api_get_be_dev(dev); - int res = 0; + int res = flow_api_done(dev); if (be_dev) { const struct flow_backend_ops *flow_backend_ops = get_flow_backend_ops(); diff --git a/drivers/net/ntnic/nthw/flow_api/flow_kcc.c b/drivers/net/ntnic/nthw/flow_api/flow_kcc.c new file mode 100644 index 0000000000..dc5e5474c1 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/flow_kcc.c @@ -0,0 +1,19 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include + +#include "hw_mod_backend.h" +#include "flow_api_engine.h" + +void kcc_free_ndev_resource_management(void **handle) +{ + if (*handle) { + free(*handle); + NT_LOG(DBG, FILTER, "Free NIC DEV KCC-CAM record manager\n"); + } + + *handle = NULL; +} diff --git a/drivers/net/ntnic/nthw/flow_api/flow_km.c b/drivers/net/ntnic/nthw/flow_api/flow_km.c new file mode 100644 index 0000000000..1ba7ed7da2 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/flow_km.c @@ -0,0 +1,19 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include + +#include "hw_mod_backend.h" +#include "flow_api_engine.h" + +void km_free_ndev_resource_management(void **handle) +{ + if (*handle) { + free(*handle); + NT_LOG(DBG, FILTER, "Free NIC DEV CAM and TCAM record manager\n"); + } + + *handle = NULL; +} From patchwork Fri Oct 4 15:34:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145088 X-Patchwork-Delegate: ferruh.yigit@amd.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 D9B1245AAF; Fri, 4 Oct 2024 17:50:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 84C30427B4; Fri, 4 Oct 2024 17:50:43 +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 D978042795 for ; Fri, 4 Oct 2024 17:50:40 +0200 (CEST) Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03lp2232.outbound.protection.outlook.com [104.47.51.232]) by mx-outbound8-201.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:50:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=e5SsLYBOmbg7VehmqQWO/2IOBgr+QVajy/AENI0yErsWJ3qwFldTfzL5CNT4r+pZgFTt+Z6yaBpz8JU6nZK05EtLRm68qce1V3A823KrMD8OR035VQO8whYqYQWGkacx54tegCXevodhH91Jc1mTo20fEBSN14UXqpbSLAve16EyU21trdh6AarlzwA1voZBH+DqOKy5pnTS8tVy+DTwb5WyFyjgVd917aN/5pFTjHjRd56vFG2jxWg7QFUtcnX67c8vz83crpUZHncyDjvw3+Lyop/Zu80mvkN9XCbajfhbONOS7ciLhK8dABkNrdd7BJZP4Lj0E+RxYuW4F05oRQ== 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=VAAQmsL0Xr8mDnXFvKQjmWbX1D4zhGJa39Bu5wcbjis=; b=Im+RNZaqZ/Nuc3C2OXNi1OCtuaeqATlVj0st3m4aMDX4ofbc6K5vq2GSVh+R/TSY3bry+SeEBlIAA/DhwuXs1ZSoRvo4cyfhD+SPyDW3QqP4Ct2001MbfZp6Be5N4vBLpPtKCjUWHil359qi82pzJmsvSCRD/pH6zi961kPZKstW+oZFI+xrXIByGhSd55lgG12hSQBErGGuAS5ndVZS26hiANAkFQL6U72Mn89r+SzID9giBmJJ5mbz+hDKUPV3pDRg0a+s/mjfcJ4miwcXalxVm7GjJAQM6hJnYhxycBga6vKOSzW6SWCuwhnAV4zHF4TITLouk0Jda/+LN8SrvQ== 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=VAAQmsL0Xr8mDnXFvKQjmWbX1D4zhGJa39Bu5wcbjis=; b=RyehPj/3K1bHLR7iSv/9MaAXDOz1kVtjOZ+3WRrAcT6gysuRY0RsIWYLd5XC6Qi0FexNHHz7A75ahZP5Mars2qmxJEVaYCcbeIqgX3H2+uupvILQl+YNLLddBSNUqIwzu294LAGGpBudsuDGibo7Suhi/e+HX+NGmYarYxbGD3M= Received: from AM0PR10CA0100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::17) by DB9P190MB1940.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:397::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 15:36:22 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::a6) by AM0PR10CA0100.outlook.office365.com (2603:10a6:208:e6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:21 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:21 +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, Oleksandr Kolomeiets Subject: [PATCH v1 22/31] net/ntnic: add base init and deinit the NT flow backend Date: Fri, 4 Oct 2024 17:34:45 +0200 Message-ID: <20241004153551.267935-28-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|DB9P190MB1940:EE_ X-MS-Office365-Filtering-Correlation-Id: a7875738-c447-42d0-7c24-08dce48a4c68 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: qnyVkGJy9EU8FaF7RqP32UkJMdM7sqgUT6j7G3/Dym3MBG//cDVbrv0ysXx5+AQx3y3DmA/M+wkrlICvxmUqhk5kUI+j2GOBSkY+wMdcdOSnh8ZDPvJziR+s9iZ4z9qWhRtDN0ymP9ua+psAO2xvJJQ0GoJtQAiCAzypZ1hmhHTHT7r+Hooas+iiLr0Q6Pcc4jokAS+jXtm8AO8a1Sg4s2TqkY9hIkyTGS0RCS6pkNgZCnfu7wfVrPQvDcenKvo1kgZXfSMe026Ay/Ap33hivBykCHJF572zqAMMTvCXzJ2rz6axGfpE8B2qCZ/1W9g6WEF2JsBCDmbOz5yCpLxSZzFX2rkWd/xHr0EJ0U6n9/YQFeRvY8kBaMMDBnb/UTryheYwA5FglVH7Ftug1Q6lnXT1Y4hzTr3wYzpd2LcWsMJjL/yt17AXHGQbPt8whVb+BAAabfheaihlc2FBP9/Qkd0/1cmKbvsDVOEjEM/mz6Fr1httdxo+mC0kReL99yADW3cWqL04BnnWmnqV7fugGr8aOnKEYhSGtxkeHQGE9vwsAno58gvJs7i9bwSq42EfJ3f9ZoYJWKyC976GqJ4GvicKVecaaCyOOUCXTFUi0MYHeakQvDatCL0CCGRl7vwzE3ZTCr5UVFeJscmxWXGQOvEdrWeICKaonZaCgzkPNDwG4VNEuv7QgP4f31jyMSrUvqrcnMYZZuiRIdfvMk0t7TEy2AawIz5B7UiAImWQjsWfpLwGXRvoDCZK4f3cmXqTnCkJIamqPwUFRTgyPXGNGoOpD+gxKOzdgWLPtbtUHwKoInuft+TuhO08vmCWz7AhoKAbPmEiXZL+yGPXq7pvEbJrPr8/ap1NTtnZm1VrBDRqINKa4hzOolxzFeqOXCYE+r9ZiToNbrCkBhsC3fMyiTfoyyRtOS6fclCAXlL2KJ6rLhf2CFhyuNPAbJlQbqfXyyyAwF40PiCAi8fyA97RAfml+DMBycWgSKL566bz9gyreZxMI612QeiEbm1EL+gVULwEJ+wnAo24xG4tKvAKu0wfCBTKjiPUkLxWw++YcgmT/KKZ0HU4FLQQX7WWweFHIQWuDYjKINWEbARuQqluIcl5BOUmFjpHqkaQkv6VjSSYL8J3rSESKDy/nikPuoHcq9ks0uRK3hAdVMuWaFOullUVNLO7Ny0tLFejPBzJYFpl9e6NRbqlbAHXoUN45QrlFnLTuOvLl72Ppes06mwjpA177l3NsiQsdwDJeAUrTH/Z8qM9nD6UcF6fCV1wKIpT+05zmsW487CTFwiDDgluuucl53kZsNz2o4gyHOcN7XOS/JXZdwYriF162iqnb8swP+idmZxLq9WyZIa5c/Mk6VvK7FIVpepv68fOpy0o8hTLLd75sVo2LQ3gKnhdOgX4 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)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Cmj1VbfnGJJKoRLo/660ujd7Gb/CagWpAxcZ18KXyfjjkpw43sch6uET/1upDXsifvcU6zQinfEhwPg603kZZIJXkOWUVtyOxR+px0jNyZfiG+0hSSC4TwWBtD28OCHUPHIXI4MuCaDly7hZuHZ6lERWpSda43BQfmhy0GmC0vYfyC1KFsrnVPX3SY4r4TqFQs8kmpfm+6zFxhQaKak7f+ccrevIyuIReCkUeV1LIagr+oAHVrQvjM/vRr9FPyYWayhaGIJ03rdNfTvyGiC810SeTJ5cGoEifeh0b1/2vO2Cc/Uu8n6DPZ5mYXMhlllIMKv7wkXOLG3+JyfHL2ZmpYAqetGBL3LNc4Z3HPG38uHTH6bEEg3nYEUNXPlj02V85kTrIRkn04oLccgAitII/GuCNOogDRoN97/Hf0Qr8sow28ORTD2/kSNOG+9vxfL7hZtd9Qc6h/HJGdbAwk0Xo39Ow89yGh1qCEY7W2OQvr+Q1FDJTI+gxFR/4TFhmZLIoCWqaLVcrMq6QWW+LzxUWeDCgJmjkuzU8EFOp3Y/aPVf29XiZK5OBIWRvRlvgZyDb8vB+W9Rp8FiWJgGQL2tdqSv29f41lJ0PWlk9GDa8MIKwLbMnPvaNCp3oZ6gStWGiUgGtBc2BBFGql4f2LNy0g== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:21.6428 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a7875738-c447-42d0-7c24-08dce48a4c68 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9P190MB1940 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057039-302249-12644-33726-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.51.232 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmbm5qZAVgZQ0CI1xcI8xdIiJd XSxCIx2cTYItHEMNnYLNnU1NzCNCVJqTYWAMqFdQpBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan20-43.eu-central-1b.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: Oleksandr Kolomeiets Add basic implementation of the NT flow backend API Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/include/flow_api.h | 3 + drivers/net/ntnic/include/flow_api_engine.h | 5 ++ drivers/net/ntnic/include/hw_mod_backend.h | 12 ++++ drivers/net/ntnic/meson.build | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 64 +++++++++++++++++++ .../nthw/flow_api/hw_mod/hw_mod_backend.c | 28 ++++++++ 6 files changed, 113 insertions(+) create mode 100644 drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c diff --git a/drivers/net/ntnic/include/flow_api.h b/drivers/net/ntnic/include/flow_api.h index bad1f72868..b5194ffa8d 100644 --- a/drivers/net/ntnic/include/flow_api.h +++ b/drivers/net/ntnic/include/flow_api.h @@ -46,6 +46,9 @@ struct flow_eth_dev { /* registered NIC backends */ struct flow_nic_dev { + uint8_t adapter_no; /* physical adapter no in the host system */ + uint16_t ports; /* number of in-ports addressable on this NIC */ + struct hw_mod_resource_s res[RES_COUNT];/* raw NIC resource allocation table */ void *km_res_handle; void *kcc_res_handle; diff --git a/drivers/net/ntnic/include/flow_api_engine.h b/drivers/net/ntnic/include/flow_api_engine.h index 724b68c3e8..db5e6fe09d 100644 --- a/drivers/net/ntnic/include/flow_api_engine.h +++ b/drivers/net/ntnic/include/flow_api_engine.h @@ -6,6 +6,11 @@ #ifndef _FLOW_API_ENGINE_H_ #define _FLOW_API_ENGINE_H_ +/* + * Resource management + */ +#define BIT_CONTAINER_8_ALIGN(x) (((x) + 7) / 8) + /* * Resource management * These are free resources in FPGA diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index 3c6c15c896..f47153cbb6 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -278,6 +278,18 @@ struct flow_api_backend_ops { struct flow_api_backend_s { void *be_dev; const struct flow_api_backend_ops *iface; + + /* NIC attributes */ + unsigned int num_phy_ports; + unsigned int num_rx_ports; + + /* flow filter resource capacities */ + unsigned int max_categories; + unsigned int max_queues; }; +int flow_api_backend_init(struct flow_api_backend_s *dev, const struct flow_api_backend_ops *iface, + void *be_dev); +int flow_api_backend_done(struct flow_api_backend_s *dev); + #endif /* _HW_MOD_BACKEND_H_ */ diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 15549e1c94..57d1ded2a7 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -48,6 +48,7 @@ sources = files( 'nthw/flow_api/flow_filter.c', 'nthw/flow_api/flow_kcc.c', 'nthw/flow_api/flow_km.c', + 'nthw/flow_api/hw_mod/hw_mod_backend.c', 'nthw/flow_filter/flow_nthw_cat.c', 'nthw/flow_filter/flow_nthw_csu.c', 'nthw/flow_filter/flow_nthw_flm.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index 92b8d083e0..4bab8983c9 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -175,6 +175,24 @@ int flow_delete_eth_dev(struct flow_eth_dev *eth_dev) * Flow backend creation function - register and initialize common backend API to FPA modules */ +static int init_resource_elements(struct flow_nic_dev *ndev, enum res_type_e res_type, + uint32_t count) +{ + assert(ndev->res[res_type].alloc_bm == NULL); + /* allocate bitmap and ref counter */ + ndev->res[res_type].alloc_bm = + calloc(1, BIT_CONTAINER_8_ALIGN(count) + count * sizeof(uint32_t)); + + if (ndev->res[res_type].alloc_bm) { + ndev->res[res_type].ref = + (uint32_t *)&ndev->res[res_type].alloc_bm[BIT_CONTAINER_8_ALIGN(count)]; + ndev->res[res_type].resource_count = count; + return 0; + } + + return -1; +} + static void done_resource_elements(struct flow_nic_dev *ndev, enum res_type_e res_type) { assert(ndev); @@ -183,6 +201,14 @@ static void done_resource_elements(struct flow_nic_dev *ndev, enum res_type_e re free(ndev->res[res_type].alloc_bm); } +static void list_insert_flow_nic(struct flow_nic_dev *ndev) +{ + pthread_mutex_lock(&base_mtx); + ndev->next = dev_base; + dev_base = ndev; + pthread_mutex_unlock(&base_mtx); +} + static int list_remove_flow_nic(struct flow_nic_dev *ndev) { pthread_mutex_lock(&base_mtx); @@ -232,7 +258,44 @@ struct flow_nic_dev *flow_api_create(uint8_t adapter_no, const struct flow_api_b */ be_if->set_debug_mode(be_dev, FLOW_BACKEND_DEBUG_MODE_NONE); + if (flow_api_backend_init(&ndev->be, be_if, be_dev) != 0) + goto err_exit; + + ndev->adapter_no = adapter_no; + + ndev->ports = (uint16_t)((ndev->be.num_rx_ports > 256) ? 256 : ndev->be.num_rx_ports); + + /* + * Free resources in NIC must be managed by this module + * Get resource sizes and create resource manager elements + */ + if (init_resource_elements(ndev, RES_QUEUE, ndev->be.max_queues)) + goto err_exit; + + if (init_resource_elements(ndev, RES_CAT_COT, ndev->be.max_categories)) + goto err_exit; + + if (init_resource_elements(ndev, RES_SLC_LR_RCP, ndev->be.max_categories)) + goto err_exit; + + /* may need IPF, COR */ + + /* check all defined has been initialized */ + for (int i = 0; i < RES_COUNT; i++) + assert(ndev->res[i].alloc_bm); + + pthread_mutex_init(&ndev->mtx, NULL); + list_insert_flow_nic(ndev); + return ndev; + +err_exit: + + if (ndev) + flow_api_done(ndev); + + NT_LOG(DBG, FILTER, "ERR: %s\n", __func__); + return NULL; } int flow_api_done(struct flow_nic_dev *ndev) @@ -246,6 +309,7 @@ int flow_api_done(struct flow_nic_dev *ndev) for (int i = 0; i < RES_COUNT; i++) done_resource_elements(ndev, i); + flow_api_backend_done(&ndev->be); list_remove_flow_nic(ndev); free(ndev); } diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c new file mode 100644 index 0000000000..5966dc6e8c --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c @@ -0,0 +1,28 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include "hw_mod_backend.h" + +int flow_api_backend_init(struct flow_api_backend_s *dev, + const struct flow_api_backend_ops *iface, + void *be_dev) +{ + assert(dev); + dev->iface = iface; + dev->be_dev = be_dev; + dev->num_phy_ports = iface->get_nb_phy_port(be_dev); + dev->num_rx_ports = iface->get_nb_rx_port(be_dev); + dev->max_categories = iface->get_nb_categories(be_dev); + dev->max_queues = iface->get_nb_queues(be_dev); + + return 0; +} + +int flow_api_backend_done(struct flow_api_backend_s *dev) +{ + (void)dev; + + return 0; +} From patchwork Fri Oct 4 15:34:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145135 X-Patchwork-Delegate: ferruh.yigit@amd.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 01E9345AAF; Fri, 4 Oct 2024 17:58:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E64DF42FBF; Fri, 4 Oct 2024 17:52:24 +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 69F9642FAB for ; Fri, 4 Oct 2024 17:52:21 +0200 (CEST) Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03lp2110.outbound.protection.outlook.com [104.47.30.110]) by mx-outbound8-201.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:52:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ke1tgzt9ksSGjTjVs63WgseFgkqLTm48XYde08hvr07OE87ZjXlK/2bBPmOWQWYjD7GEE1QAXhLyHNT5ggB7QKi1VkdGsbiQUeXbRcHLsc6Cyr3d2H1yiOJDL7sr44MbNCeGpYxFW4OHDCbFpX/oFvXSKFzvxmWGN1748Pe3+Az5EoCjkFrrD4PkwxpaWUXv/71Z8pmprMyykwkUlhSp/deQ9QGzkRdRl20jiTYQ/xbsqAM9eBlx1iRtwvLtBzU5ksrsCIFdaVWIwLLUuH5EW1qXAhwZeEgBiDUFF9eLRF+CQW2c6xCsyEtctJvvi98YZJdCIA7dC2hSRNbr/YbXNg== 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=3wIrZJT9WYJXNESClHtRwjztB/BUwFhUnLnUqFp9sBo=; b=qA2mkqb0wNuQNbA88XHFgEL7cthkgESMYosPEiB5mXVEBDv+0B8fhDWaQe+3SWgrYCTpIXJj8RI/2JX8JyU7Urs0/vDGPhODaoZsnZRG4cqTm38vRvZaJV5h6ptBD076rY41yer8WYmtr91PLG4XM37jtchQj0x8GHGypZHHluaRf1t7RO6Fe9EpzH5t++ltkHdexFRf7M7tN4oRCVCh9gXkTSCzB7/wqa22dvqemSmRKoXLg7nzrfthTlLvXW5S4+6+S+y2KF0TTcdHh3c5pVeHCUKbHmN6/XcAN6q21gznLX+XJJD9SKl/VoyDMYAzS/eUQO/WomEAwSfKq03weg== 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=3wIrZJT9WYJXNESClHtRwjztB/BUwFhUnLnUqFp9sBo=; b=BKSbGN0ygg0wjRIP7TiKehbHF/ZO+14uNtStIBO/EdagILQqyFSwrAENnlajuiAnJeYlTyAa2IBLa/1WEgUND0ym0hw0eWXelCiSQcvCMPaMW8OGS77Uqf8nkTRMDMqD2OqkSoiQAWoRQGMQemEulgthCElhRTvyLJmBGSO4OhM= Received: from AM0PR10CA0107.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::24) by DB9P190MB1988.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:39b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 15:36:22 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::ad) by AM0PR10CA0107.outlook.office365.com (2603:10a6:208:e6::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:22 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:22 +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, Oleksandr Kolomeiets Subject: [PATCH v1 23/31] net/ntnic: add categorizer (CAT) FPGA module Date: Fri, 4 Oct 2024 17:34:46 +0200 Message-ID: <20241004153551.267935-29-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|DB9P190MB1988:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b7f5bdf-2c15-4d28-4f89-08dce48a4cdd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?1tdtEP3OKNSmiV/NSE4B2rafWG6oOaJ?= =?utf-8?q?2bNGZmL8Tiik9ZFHwHdg6DvNIaQDOJwQZpQa1L7AbywcrB0tmePOvj+7e5TaOYwcB?= =?utf-8?q?53N5bQ3yw6gP/M79E7vk9WLpEJfD6KIgQLlJVI8LaaIi2b3kbrCbBVRbt1CCaQwpa?= =?utf-8?q?PI0Dre50MMa6g7O+WvBEFwdq+tOHq54slodd/wjXcazOI3hMeCilhj7k2G4f/tKZs?= =?utf-8?q?Rg50smk/UKMpvOICVXJbi22IKLHQ5IPLT4budgOiTJuP9G2T6eO2Jz4kx9NSoHk7o?= =?utf-8?q?RKSn3Oz0dyAXituGLJGchLDuHaFjRfQnUSq39emjlGaStxUsprRtZCu6423rzo4An?= =?utf-8?q?SRlc68r3p5OZ+HxhaqGb07dfU2uN3L7Vyxu7TrUqtsKmbRg02IjCqG0GuIKPQJcd2?= =?utf-8?q?ojJJSncn/l3ivlDm1yrZzpZuoV09ytgWwkrSytMN83VGKrqaiKy8FKNL3rgqypc+h?= =?utf-8?q?pqj8oFfyelrbG2XbqTDKVlA0wtscPWB7SyZVbjDmG30cSuK2Vs66PkgXaZmVs3piH?= =?utf-8?q?dIyX2hy23iMTSxT+r5ROOLDkOvwpXwM9teqUVOrCwgHhaa2PufPMZ2AbOcB6L7l+I?= =?utf-8?q?kaLZjbOFa2vZ5+jWu5/jdf6VIqHiHsMWj223Pp+KIDSGeNiqg6+2/PJCqj1hNdaki?= =?utf-8?q?6VXo811ykTyUEHviL7OjWrmoHqvKbqUnUEiPPOCbWVUizWXjl+AbUU3/RaPCWjdM8?= =?utf-8?q?IQUYMkCCQIPj854CEgesmKnfzx1ZBMqWsQRRjvSVOZtO2OTD/tTHbWGBcHfsEsdwQ?= =?utf-8?q?Fpw7ZB9/Xb4jwxo9Cb8sUnFn/EGMA6ONvJA+OnaAZhAoC0jz1RxtUdslQ5CCRF/ML?= =?utf-8?q?iSeOc5BFa3qUlfhhEgvoSWqxI1jZOcCq1SlF4hk7Oz94woPz7R1R5DYnaowX9h7NQ?= =?utf-8?q?RVqVbNfGCFWs2hhV3x3ZFpMKYXylt+GibOMTZ2/Qn9ceWbdfORJvAdxy6xbTNfgHD?= =?utf-8?q?B5wxeixuOHmPBFueWLxDpKs9aOZvLAQmuACRYjgPnYkReu/lr1jQE3o56ypk7SPOi?= =?utf-8?q?zDuZWIw4Qnvw34URZH7wKbjxTOxCCOaEyeCfFuJOUzeftnzpGK0Fw1bQJBhzOeZr+?= =?utf-8?q?saBi7Q7KgeiM6uUhoLiWlai0vEclzh1a9f+6agZQiqXYcN0LNpudquQjI+fO1UuUZ?= =?utf-8?q?zLdDNWULhjI1Z2QFRDweMwsvY6hzf+sn1ncz2pZsEV6hLb0dSmRGCQ/68ecb3q1E4?= =?utf-8?q?udGZNH8IGCZRXCtDKJ02RKkBvba4iQbn1cf/EOZnhVIi+AfXjDpX37/IREiQ8myNy?= =?utf-8?q?4wDp6ULnbIHniZuhqjCWhXKAKMuSrdFbFhCjC/8Gs3FEFKWOT8V37XXpV21LP+SVE?= =?utf-8?q?gI9Npga5jpMO?= 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)(82310400026)(36860700013)(1800799024)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: sJWta4htTIPqcinLOZMh/kcgUnGugYFlKZqwT1FHtQkp8+IpBxaXNpYB7/P2LTwm+l1k90cJ88GI0PbT43fx595N4mc/9bX3tu8NsaFE+H+t3aAdUTtAJQTuotDZKVihPQiviWL8bIMj+672sdiU2QyGU/S9on/oA5BsLWf4VnZr0lRriWIDrnGfz/O+aRqiB6IVdN1ue6txAWh3cN1JL5cKAw8MJn3gF3sWJEbW1McYRs/RhQD2w51KfE2t8dVQnV0RzKAYnyJnudFzO2T7Mt765qjKStLuNRbN2Kkk94UYHnh+on+reQZhHkO8Pz3J9bkXOmyLWTL3JqVoslSaonhDtg9eZFvSEYzH6Iusj61XVu5ovTmfCThqV7XEF0JEViVr8xjx42STeDKCI4mW3oScQNeQGDVlzw49VGR7Bfa2OqzqHxsJiZjriWvrxiXOCiOHauwe3jSDWYaAhZdpn/a+Z2oCINq1hSUkq7qpDeQMQPVEUYlVjTUM5wbS1CAW1I8nA1Pf/EtYjfCB0oLtjqqOU9tzjpnv8iB8KEx+1ANxcNwlsALTUfXDrrsD01DcVhuhYlFydjbbnpRLa6EYXXGcFH3GJCJMCJj6sbY6A/yCkvgLJ/zs7FUApevPBFw1mvK1o9DpKO6+jjDgdakeaQ== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:22.4241 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5b7f5bdf-2c15-4d28-4f89-08dce48a4cdd 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9P190MB1988 X-BESS-ID: 1728057117-302249-12644-33795-4 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.30.110 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqYmpsbGQGYGUDQx2djCxMw4Kc XUNDXJzDLJyDLFOMk4zcgyMS050dzCUKk2FgAwvMfkQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan21-181.eu-central-1b.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: Oleksandr Kolomeiets The Categorizer module’s main purpose is to is select the behavior of other modules in the FPGA pipeline depending on a protocol check. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/include/hw_mod_backend.h | 205 ++++ drivers/net/ntnic/meson.build | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 15 + .../nthw/flow_api/hw_mod/hw_mod_backend.c | 109 +- .../ntnic/nthw/flow_api/hw_mod/hw_mod_cat.c | 985 ++++++++++++++++++ .../supported/nthw_fpga_9563_055_049_0000.c | 264 ++++- 6 files changed, 1577 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_cat.c diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index f47153cbb6..20b10faf5e 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -22,12 +22,116 @@ #define MAX_PHYS_ADAPTERS 8 +#define VER_MAJOR(ver) (((ver) >> 16) & 0xffff) +#define VER_MINOR(ver) ((ver) & 0xffff) + +struct flow_api_backend_s; +struct common_func_s; + +void *callocate_mod(struct common_func_s *mod, int sets, ...); +void zero_module_cache(struct common_func_s *mod); + +#define ALL_ENTRIES -1000 + +#define INDEX_TOO_LARGE (NT_LOG(INF, FILTER, "ERROR:%s: Index too large\n", __func__), -2) + +#define WORD_OFF_TOO_LARGE (NT_LOG(INF, FILTER, "ERROR:%s: Word offset too large\n", __func__), -3) + +#define UNSUP_FIELD \ + (NT_LOG(INF, FILTER, "ERROR:%s: Unsupported field in NIC module\n", __func__), -5) + +#define UNSUP_VER \ + (NT_LOG(INF, FILTER, "ERROR:%s: Unsupported NIC module: %s ver %i.%i\n", __func__, _MOD_, \ + VER_MAJOR(_VER_), VER_MINOR(_VER_)), \ + -4) + +#define COUNT_ERROR(_RESOURCE_) \ + (NT_LOG(INF, FILTER, \ + "ERROR:%s: Insufficient resource [ %s ] : NIC module: %s ver %i.%i\n", __func__, \ + #_RESOURCE_, _MOD_, VER_MAJOR(_VER_), VER_MINOR(_VER_)), \ + -4) + +#define NOT_FOUND 0xffffffff + +enum { + EXTRA_INDEXES +}; + +#define GET(cached_val, val) ({ *(val) = *(cached_val); }) + +#define SET(cached_val, val) ({ *(cached_val) = *(val); }) + +#define GET_SET(cached_val, val) \ + do { \ + uint32_t *temp_val = (val); \ + typeof(cached_val) *temp_cached_val = &(cached_val); \ + if (get) \ + GET(temp_cached_val, temp_val); \ + else \ + SET(temp_cached_val, temp_val); \ + } while (0) + +#define GET_SIGNED(cached_val, val) ({ *(val) = (uint32_t)(*(cached_val)); }) + +#define SET_SIGNED(cached_val, val) ({ *(cached_val) = (int32_t)(*(val)); }) + +#define GET_SET_SIGNED(cached_val, val) \ + do { \ + uint32_t *temp_val = (val); \ + typeof(cached_val) *temp_cached_val = &(cached_val); \ + if (get) \ + GET_SIGNED(temp_cached_val, temp_val); \ + else \ + SET_SIGNED(temp_cached_val, temp_val); \ + } while (0) + +#define FIND_EQUAL_INDEX(be_module_reg, type, idx, start, nb_elements) \ + do { \ + typeof(be_module_reg) *temp_be_module = \ + (typeof(be_module_reg) *)be_module_reg; \ + typeof(idx) tmp_idx = (idx); \ + typeof(nb_elements) tmp_nb_elements = (nb_elements); \ + unsigned int start_idx = (unsigned int)(start); \ + *value = NOT_FOUND; \ + for (unsigned int i = start_idx; i < tmp_nb_elements; i++) { \ + if ((unsigned int)(tmp_idx) == i) \ + continue; \ + if (memcmp(&temp_be_module[tmp_idx], &temp_be_module[i], sizeof(type)) == \ + 0) { \ + *value = i; \ + break; \ + } \ + } \ + } while (0) + +#define DO_COMPARE_INDEXS(be_module_reg, type, idx, cmp_idx) \ + do { \ + typeof(be_module_reg) *temp_be_module = &(be_module_reg); \ + typeof(idx) tmp_idx = (idx); \ + typeof(cmp_idx) tmp_cmp_idx = (cmp_idx); \ + if ((unsigned int)(tmp_idx) != (unsigned int)(tmp_cmp_idx)) { \ + (void)memcmp(temp_be_module + tmp_idx, &temp_be_module[tmp_cmp_idx], \ + sizeof(type)); \ + } \ + } while (0) + +enum km_flm_if_select_e { + KM_FLM_IF_FIRST = 0, + KM_FLM_IF_SECOND = 1 +}; + +#define FIELD_START_INDEX 100 + #define COMMON_FUNC_INFO_S \ int ver; \ void *base; \ unsigned int alloced_size; \ int debug +struct common_func_s { + COMMON_FUNC_INFO_S; +}; + struct cat_func_s { COMMON_FUNC_INFO_S; uint32_t nb_cat_funcs; @@ -48,6 +152,104 @@ struct cat_func_s { struct hw_mod_cat_v21_s v21; }; }; +enum hw_cat_e { + /* + * functions initial CAT v18 + */ + /* 00 */ HW_CAT_CFN_SET_ALL_DEFAULTS = 0, + /* 01 */ HW_CAT_CFN_PRESET_ALL, + /* 02 */ HW_CAT_CFN_COMPARE, + /* 03 */ HW_CAT_CFN_FIND, + /* 04 */ HW_CAT_CFN_COPY_FROM, + /* 05 */ HW_CAT_COT_PRESET_ALL, + /* 06 */ HW_CAT_COT_COMPARE, + /* 07 */ HW_CAT_COT_FIND, + /* 08 */ HW_CAT_COT_COPY_FROM, + /* fields */ + /* 00 */ HW_CAT_CFN_ENABLE = FIELD_START_INDEX, + /* 01 */ HW_CAT_CFN_INV, + /* 02 */ HW_CAT_CFN_PTC_INV, + /* 03 */ HW_CAT_CFN_PTC_ISL, + /* 04 */ HW_CAT_CFN_PTC_CFP, + /* 05 */ HW_CAT_CFN_PTC_MAC, + /* 06 */ HW_CAT_CFN_PTC_L2, + /* 07 */ HW_CAT_CFN_PTC_VNTAG, + /* 08 */ HW_CAT_CFN_PTC_VLAN, + /* 09 */ HW_CAT_CFN_PTC_MPLS, + /* 10 */ HW_CAT_CFN_PTC_L3, + /* 11 */ HW_CAT_CFN_PTC_FRAG, + /* 12 */ HW_CAT_CFN_PTC_IP_PROT, + /* 13 */ HW_CAT_CFN_PTC_L4, + /* 14 */ HW_CAT_CFN_PTC_TUNNEL, + /* 15 */ HW_CAT_CFN_PTC_TNL_L2, + /* 16 */ HW_CAT_CFN_PTC_TNL_VLAN, + /* 17 */ HW_CAT_CFN_PTC_TNL_MPLS, + /* 18 */ HW_CAT_CFN_PTC_TNL_L3, + /* 19 */ HW_CAT_CFN_PTC_TNL_FRAG, + /* 20 */ HW_CAT_CFN_PTC_TNL_IP_PROT, + /* 21 */ HW_CAT_CFN_PTC_TNL_L4, + /* 22 */ HW_CAT_CFN_ERR_INV, + /* 23 */ HW_CAT_CFN_ERR_CV, + /* 24 */ HW_CAT_CFN_ERR_FCS, + /* 25 */ HW_CAT_CFN_ERR_TRUNC, + /* 26 */ HW_CAT_CFN_ERR_L3_CS, + /* 27 */ HW_CAT_CFN_ERR_L4_CS, + /* 28 */ HW_CAT_CFN_MAC_PORT, + /* 29 */ HW_CAT_CFN_PM_CMP, + /* 30 */ HW_CAT_CFN_PM_DCT, + /* 31 */ HW_CAT_CFN_PM_EXT_INV, + /* 32 */ HW_CAT_CFN_PM_CMB, + /* 33 */ HW_CAT_CFN_PM_AND_INV, + /* 34 */ HW_CAT_CFN_PM_OR_INV, + /* 35 */ HW_CAT_CFN_PM_INV, + /* 36 */ HW_CAT_CFN_LC, + /* 37 */ HW_CAT_CFN_LC_INV, + /* 38 */ HW_CAT_CFN_KM0_OR, + /* 39 */ HW_CAT_CFN_KM1_OR, + /* 40 */ HW_CAT_KCE_ENABLE_BM, + /* 41 */ HW_CAT_KCS_CATEGORY, + /* 42 */ HW_CAT_FTE_ENABLE_BM, + /* 43 */ HW_CAT_CTE_ENABLE_BM, + /* 44 */ HW_CAT_CTS_CAT_A, + /* 45 */ HW_CAT_CTS_CAT_B, + /* 46 */ HW_CAT_COT_COLOR, + /* 47 */ HW_CAT_COT_KM, + /* 48 */ HW_CAT_CCT_COLOR, + /* 49 */ HW_CAT_CCT_KM, + /* 50 */ HW_CAT_KCC_KEY, + /* 51 */ HW_CAT_KCC_CATEGORY, + /* 52 */ HW_CAT_KCC_ID, + /* 53 */ HW_CAT_EXO_DYN, + /* 54 */ HW_CAT_EXO_OFS, + /* 55 */ HW_CAT_RCK_DATA, + /* 56 */ HW_CAT_LEN_LOWER, + /* 57 */ HW_CAT_LEN_UPPER, + /* 58 */ HW_CAT_LEN_DYN1, + /* 59 */ HW_CAT_LEN_DYN2, + /* 60 */ HW_CAT_LEN_INV, + /* 61 */ HW_CAT_CFN_ERR_TNL_L3_CS, + /* 62 */ HW_CAT_CFN_ERR_TNL_L4_CS, + /* 63 */ HW_CAT_CFN_ERR_TTL_EXP, + /* 64 */ HW_CAT_CFN_ERR_TNL_TTL_EXP, +}; + +bool hw_mod_cat_present(struct flow_api_backend_s *be); +int hw_mod_cat_alloc(struct flow_api_backend_s *be); +void hw_mod_cat_free(struct flow_api_backend_s *be); +int hw_mod_cat_reset(struct flow_api_backend_s *be); +int hw_mod_cat_cfn_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_cat_cfn_set(struct flow_api_backend_s *be, enum hw_cat_e field, int index, int word_off, + uint32_t value); + +int hw_mod_cat_cte_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_cat_cts_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_cat_cot_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_cat_cct_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_cat_kcc_flush(struct flow_api_backend_s *be, int start_idx, int count); + +int hw_mod_cat_exo_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_cat_rck_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_cat_len_flush(struct flow_api_backend_s *be, int start_idx, int count); struct km_func_s { COMMON_FUNC_INFO_S; @@ -279,6 +481,9 @@ struct flow_api_backend_s { void *be_dev; const struct flow_api_backend_ops *iface; + /* flow filter FPGA modules */ + struct cat_func_s cat; + /* NIC attributes */ unsigned int num_phy_ports; unsigned int num_rx_ports; diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 57d1ded2a7..3d394f9bad 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -49,6 +49,7 @@ sources = files( 'nthw/flow_api/flow_kcc.c', 'nthw/flow_api/flow_km.c', 'nthw/flow_api/hw_mod/hw_mod_backend.c', + 'nthw/flow_api/hw_mod/hw_mod_cat.c', 'nthw/flow_filter/flow_nthw_cat.c', 'nthw/flow_filter/flow_nthw_csu.c', 'nthw/flow_filter/flow_nthw_flm.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index 4bab8983c9..3b1d7c5850 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -272,12 +272,27 @@ struct flow_nic_dev *flow_api_create(uint8_t adapter_no, const struct flow_api_b if (init_resource_elements(ndev, RES_QUEUE, ndev->be.max_queues)) goto err_exit; + if (init_resource_elements(ndev, RES_CAT_CFN, ndev->be.cat.nb_cat_funcs)) + goto err_exit; + if (init_resource_elements(ndev, RES_CAT_COT, ndev->be.max_categories)) goto err_exit; + if (init_resource_elements(ndev, RES_CAT_EXO, ndev->be.cat.nb_pm_ext)) + goto err_exit; + + if (init_resource_elements(ndev, RES_CAT_LEN, ndev->be.cat.nb_len)) + goto err_exit; + + if (init_resource_elements(ndev, RES_KM_FLOW_TYPE, ndev->be.cat.nb_flow_types)) + goto err_exit; + if (init_resource_elements(ndev, RES_SLC_LR_RCP, ndev->be.max_categories)) goto err_exit; + if (init_resource_elements(ndev, RES_FLM_FLOW_TYPE, ndev->be.cat.nb_flow_types)) + goto err_exit; + /* may need IPF, COR */ /* check all defined has been initialized */ diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c index 5966dc6e8c..33fb4df126 100644 --- a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c @@ -5,6 +5,79 @@ #include "hw_mod_backend.h" +#include +#include + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) + +static const struct { + const char *name; + int (*allocate)(struct flow_api_backend_s *be); + void (*free)(struct flow_api_backend_s *be); + int (*reset)(struct flow_api_backend_s *be); + bool (*present)(struct flow_api_backend_s *be); +} module[] = { + { "CAT", hw_mod_cat_alloc, hw_mod_cat_free, hw_mod_cat_reset, hw_mod_cat_present }, +}; +#define MOD_COUNT (ARRAY_SIZE(module)) + +void *callocate_mod(struct common_func_s *mod, int sets, ...) +{ +#define MAX_SETS 38 + void *base = NULL; + void **plist[MAX_SETS]; + int len[MAX_SETS]; + int offs[MAX_SETS]; + unsigned int total_bytes = 0; + int cnt, elem_size; + + assert(sets <= MAX_SETS); + assert(sets > 0); + + va_list args; + va_start(args, sets); + + for (int i = 0; i < sets; i++) { + plist[i] = va_arg(args, void *); + cnt = va_arg(args, int); + elem_size = va_arg(args, int); + offs[i] = EXTRA_INDEXES * elem_size; + len[i] = offs[i] + cnt * elem_size; + total_bytes += len[i]; + } + + if (total_bytes > 0) { + base = calloc(1, total_bytes); + + if (base) { + char *p_b = (char *)base; + + for (int i = 0; i < sets; i++) { + *plist[i] = (void *)((char *)p_b + offs[i]); + p_b += len[i]; + } + + } else { + NT_LOG(ERR, FILTER, "ERROR: module memory allocation failed\n"); + } + + } else { + NT_LOG(ERR, FILTER, "ERROR: module request to allocate 0 bytes of memory\n"); + } + + va_end(args); + + mod->base = base; + mod->alloced_size = total_bytes; + + return base; +} + +void zero_module_cache(struct common_func_s *mod) +{ + memset(mod->base, 0, mod->alloced_size); +} + int flow_api_backend_init(struct flow_api_backend_s *dev, const struct flow_api_backend_ops *iface, void *be_dev) @@ -17,12 +90,46 @@ int flow_api_backend_init(struct flow_api_backend_s *dev, dev->max_categories = iface->get_nb_categories(be_dev); dev->max_queues = iface->get_nb_queues(be_dev); + NT_LOG(DBG, + FILTER, + "*************** FLOW REGISTER MODULES AND INITIALIZE - SET ALL TO DEFAULT *****************\n"); + + /* + * Create Cache and SW, version independent, NIC module representation + */ + for (unsigned int mod = 0; mod < MOD_COUNT; mod++) { + if (!module[mod].present(dev)) + continue; + + if (module[mod].allocate(dev) == 0 && module[mod].reset(dev) == 0) { + /* OK */ + continue; + } + + NT_LOG(ERR, + FILTER, + "ERROR: Initialization of NIC module failed : [ %s ]\n", + module[mod].name); + flow_api_backend_done(dev); + NT_LOG(ERR, + FILTER, + "*************** Failed to create Binary Flow API *******************\n"); + NT_LOG(ERR, + FILTER, + "******** ERROR ERROR: Binary Flow API will not be available ********\n"); + NT_LOG(ERR, + FILTER, + "********************************************************************\n"); + return -1; + } + return 0; } int flow_api_backend_done(struct flow_api_backend_s *dev) { - (void)dev; + for (unsigned int mod = 0; mod < MOD_COUNT; mod++) + module[mod].free(dev); return 0; } diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_cat.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_cat.c new file mode 100644 index 0000000000..0c1f37db2b --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_cat.c @@ -0,0 +1,985 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include +#include + +#include "hw_mod_backend.h" + +#define _MOD_ "CAT" +#define _VER_ be->cat.ver + +static int hw_mod_cat_kce_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num, + int km_if_id, int start_idx, int count); +static int hw_mod_cat_kcs_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num, + int km_if_id, int start_idx, int count); +static int hw_mod_cat_fte_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num, + int km_if_id, int start_idx, int count); + +bool hw_mod_cat_present(struct flow_api_backend_s *be) +{ + return be->iface->get_cat_present(be->be_dev); +} + +int hw_mod_cat_alloc(struct flow_api_backend_s *be) +{ + _VER_ = be->iface->get_cat_version(be->be_dev); + NT_LOG(DBG, FILTER, "CAT MODULE VERSION %i.%i\n", VER_MAJOR(_VER_), VER_MINOR(_VER_)); + + int nb = be->iface->get_nb_cat_funcs(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(cat_funcs); + + be->cat.nb_cat_funcs = (uint32_t)nb; + + nb = be->iface->get_nb_km_flow_types(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(km_flow_types); + + be->cat.nb_flow_types = (uint32_t)nb; + + nb = be->iface->get_nb_pm_ext(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(pm_ext); + + be->cat.nb_pm_ext = (uint32_t)nb; + + nb = be->iface->get_nb_len(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(len); + + be->cat.nb_len = (uint32_t)nb; + + nb = be->iface->get_kcc_size(be->be_dev); + + if (nb < 0) + return COUNT_ERROR(kcc_size); + + be->cat.kcc_size = (uint32_t)nb; + + nb = be->iface->get_kcc_banks(be->be_dev); + + if (nb < 0) + return COUNT_ERROR(kcc_banks); + + be->cat.kcc_banks = (uint32_t)nb; + + nb = be->iface->get_nb_cat_km_if_cnt(be->be_dev); + + if (nb < 0) + return COUNT_ERROR(km_if_count); + + be->cat.km_if_count = (uint32_t)nb; + + int idx = be->iface->get_nb_cat_km_if_m0(be->be_dev); + be->cat.km_if_m0 = idx; + + idx = be->iface->get_nb_cat_km_if_m1(be->be_dev); + be->cat.km_if_m1 = idx; + + if (be->cat.kcc_banks) + be->cat.kcc_records = be->cat.kcc_size / be->cat.kcc_banks; + + else + be->cat.kcc_records = 0; + + be->cat.kcc_id_bit_size = 10; + + switch (_VER_) { + case 18: + be->cat.cts_num = 11; + + if (!callocate_mod((struct common_func_s *)&be->cat, 12, &be->cat.v18.cfn, + be->cat.nb_cat_funcs, sizeof(struct cat_v18_cfn_s), + &be->cat.v18.kce, (be->cat.nb_cat_funcs / 8), + sizeof(struct cat_v18_kce_s), &be->cat.v18.kcs, + be->cat.nb_cat_funcs, sizeof(struct cat_v18_kcs_s), + &be->cat.v18.fte, + (be->cat.nb_cat_funcs / 8) * be->cat.nb_flow_types * 2, + sizeof(struct cat_v18_fte_s), + + &be->cat.v18.cte, be->cat.nb_cat_funcs, + sizeof(struct cat_v18_cte_s), &be->cat.v18.cts, + be->cat.nb_cat_funcs * ((be->cat.cts_num + 1) / 2), + sizeof(struct cat_v18_cts_s), &be->cat.v18.cot, + be->max_categories, sizeof(struct cat_v18_cot_s), + + &be->cat.v18.cct, be->max_categories * 4, + sizeof(struct cat_v18_cct_s), &be->cat.v18.exo, + be->cat.nb_pm_ext, sizeof(struct cat_v18_exo_s), + &be->cat.v18.rck, be->cat.nb_pm_ext * 64, + sizeof(struct cat_v18_rck_s), &be->cat.v18.len, be->cat.nb_len, + sizeof(struct cat_v18_len_s), &be->cat.v18.kcc_cam, + be->cat.kcc_size, sizeof(struct cat_v18_kcc_s))) + return -1; + + break; + + /* end case 18 */ + case 21: + be->cat.cts_num = 11; + + if (!callocate_mod((struct common_func_s *)&be->cat, 12, &be->cat.v21.cfn, + be->cat.nb_cat_funcs, sizeof(struct cat_v21_cfn_s), + &be->cat.v21.kce, (be->cat.nb_cat_funcs / 8), + sizeof(struct cat_v21_kce_s), &be->cat.v21.kcs, + be->cat.nb_cat_funcs, sizeof(struct cat_v21_kcs_s), + &be->cat.v21.fte, + (be->cat.nb_cat_funcs / 8) * be->cat.nb_flow_types * 4, + sizeof(struct cat_v21_fte_s), + + &be->cat.v21.cte, be->cat.nb_cat_funcs, + sizeof(struct cat_v18_cte_s), &be->cat.v21.cts, + be->cat.nb_cat_funcs * ((be->cat.cts_num + 1) / 2), + sizeof(struct cat_v18_cts_s), &be->cat.v21.cot, + be->max_categories, sizeof(struct cat_v18_cot_s), + + &be->cat.v21.cct, be->max_categories * 4, + sizeof(struct cat_v18_cct_s), &be->cat.v21.exo, + be->cat.nb_pm_ext, sizeof(struct cat_v18_exo_s), + &be->cat.v21.rck, be->cat.nb_pm_ext * 64, + sizeof(struct cat_v18_rck_s), &be->cat.v21.len, be->cat.nb_len, + sizeof(struct cat_v18_len_s), &be->cat.v21.kcc_cam, + be->cat.kcc_size, sizeof(struct cat_v18_kcc_s))) + return -1; + + break; + + /* end case 21 */ + default: + return UNSUP_VER; + } + + return 0; +} + +void hw_mod_cat_free(struct flow_api_backend_s *be) +{ + if (be->cat.base) { + free(be->cat.base); + be->cat.base = NULL; + } +} + +static int cfn_reset(struct flow_api_backend_s *be, int i) +{ + int err = hw_mod_cat_cfn_set(be, HW_CAT_CFN_PRESET_ALL, i, 0, 0); + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_ISL, i, 0, + 0xffffffff); /* accept both ISL or not ISL */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_CFP, i, 0, + 0xffffffff); /* accept both CFP or not CFP */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_MAC, i, 0, 0xffffffff); /* accept all MACs */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_L2, i, 0, 0xffffffff); /* accept all L2 prot */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_VNTAG, i, 0, 0xffffffff); /* accept all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_VLAN, i, 0, 0xffffffff); /* accept all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_MPLS, i, 0, 0xffffffff); /* accept all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_L3, i, 0, 0xffffffff); /* accept all L3 prot */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_FRAG, i, 0, 0xffffffff); /* accept all fragments */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_IP_PROT, i, 0, + 0xffffffff); /* IP prot check disabled */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_L4, i, 0, 0xffffffff); /* accept all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_TUNNEL, i, 0, 0xffffffff);/* accept all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_TNL_L2, i, 0, 0xffffffff);/* accept all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_TNL_VLAN, i, 0, 0xffffffff); /* accept all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_TNL_MPLS, i, 0, 0xffffffff); /* accept all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_TNL_L3, i, 0, 0xffffffff);/* accept all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_TNL_FRAG, i, 0, 0xffffffff); /* accept all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_TNL_IP_PROT, i, 0, + 0xffffffff); /* inner IP prot check disabled */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PTC_TNL_L4, i, 0, 0xffffffff);/* accept all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_ERR_CV, i, 0, 3); /* accept all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_ERR_FCS, i, 0, 3); /* accept all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_ERR_TRUNC, i, 0, + 0xffffffff); /* accept all truncations */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_ERR_L3_CS, i, 0, 3); /* accept all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_ERR_L4_CS, i, 0, 3); /* accept all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_PM_OR_INV, i, 0, 1); + hw_mod_cat_cfn_set(be, HW_CAT_CFN_LC_INV, i, 0, 1); + hw_mod_cat_cfn_set(be, HW_CAT_CFN_KM0_OR, i, 0, 0xffffffff); /* or all */ + + if (_VER_ >= 21) { + hw_mod_cat_cfn_set(be, HW_CAT_CFN_KM1_OR, i, 0, 0xffffffff); /* or all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_ERR_TNL_L3_CS, i, 0, 0xffffffff); /* or all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_ERR_TNL_L4_CS, i, 0, 0xffffffff); /* or all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_ERR_TTL_EXP, i, 0, 0xffffffff); /* or all */ + hw_mod_cat_cfn_set(be, HW_CAT_CFN_ERR_TNL_TTL_EXP, i, 0, 0xffffffff); /* or all */ + } + + return err; +} + +int hw_mod_cat_reset(struct flow_api_backend_s *be) +{ + /* Zero entire cache area */ + zero_module_cache((struct common_func_s *)(&be->cat)); + + NT_LOG(DBG, FILTER, "INIT CAT CFN\n"); + + if (hw_mod_cat_cfn_flush(be, 0, ALL_ENTRIES)) + return -1; + + if (_VER_ <= 18) { + NT_LOG(DBG, FILTER, "INIT CAT KCE\n"); + + if (hw_mod_cat_kce_flush(be, KM_FLM_IF_FIRST, 0, 0, ALL_ENTRIES)) + return -1; + + NT_LOG(DBG, FILTER, "INIT CAT KCS\n"); + + if (hw_mod_cat_kcs_flush(be, KM_FLM_IF_FIRST, 0, 0, ALL_ENTRIES)) + return -1; + + NT_LOG(DBG, FILTER, "INIT CAT FTE\n"); + + if (hw_mod_cat_fte_flush(be, KM_FLM_IF_FIRST, 0, 0, ALL_ENTRIES)) + return -1; + + } else { + NT_LOG(DBG, FILTER, "INIT CAT KCE 0\n"); + + if (hw_mod_cat_kce_flush(be, KM_FLM_IF_FIRST, be->cat.km_if_m0, 0, ALL_ENTRIES)) + return -1; + + NT_LOG(DBG, FILTER, "INIT CAT KCS 0\n"); + + if (hw_mod_cat_kcs_flush(be, KM_FLM_IF_FIRST, be->cat.km_if_m0, 0, ALL_ENTRIES)) + return -1; + + NT_LOG(DBG, FILTER, "INIT CAT FTE 0\n"); + + if (hw_mod_cat_fte_flush(be, KM_FLM_IF_FIRST, be->cat.km_if_m0, 0, ALL_ENTRIES)) + return -1; + + if (be->cat.km_if_count > 1) { + NT_LOG(DBG, FILTER, "INIT CAT KCE 1\n"); + + if (hw_mod_cat_kce_flush(be, KM_FLM_IF_SECOND, be->cat.km_if_m1, 0, + ALL_ENTRIES)) + return -1; + + NT_LOG(DBG, FILTER, "INIT CAT KCS 1\n"); + + if (hw_mod_cat_kcs_flush(be, KM_FLM_IF_SECOND, be->cat.km_if_m1, 0, + ALL_ENTRIES)) + return -1; + + NT_LOG(DBG, FILTER, "INIT CAT FTE 1\n"); + + if (hw_mod_cat_fte_flush(be, KM_FLM_IF_SECOND, be->cat.km_if_m1, 0, + ALL_ENTRIES)) + return -1; + } + } + + NT_LOG(DBG, FILTER, "INIT CAT CTE\n"); + + if (hw_mod_cat_cte_flush(be, 0, ALL_ENTRIES)) + return -1; + + NT_LOG(DBG, FILTER, "INIT CAT CTS\n"); + + if (hw_mod_cat_cts_flush(be, 0, ALL_ENTRIES)) + return -1; + + NT_LOG(DBG, FILTER, "INIT CAT COT\n"); + + if (hw_mod_cat_cot_flush(be, 0, ALL_ENTRIES)) + return -1; + + NT_LOG(DBG, FILTER, "INIT CAT CCT\n"); + + if (hw_mod_cat_cct_flush(be, 0, ALL_ENTRIES)) + return -1; + + NT_LOG(DBG, FILTER, "INIT CAT EXO\n"); + + if (hw_mod_cat_exo_flush(be, 0, ALL_ENTRIES)) + return -1; + + NT_LOG(DBG, FILTER, "INIT CAT RCK\n"); + + if (hw_mod_cat_rck_flush(be, 0, ALL_ENTRIES)) + return -1; + + NT_LOG(DBG, FILTER, "INIT CAT LEN\n"); + + if (hw_mod_cat_len_flush(be, 0, ALL_ENTRIES)) + return -1; + + if (be->cat.kcc_size) { + NT_LOG(DBG, FILTER, "INIT CAT KCC\n"); + + if (hw_mod_cat_kcc_flush(be, 0, ALL_ENTRIES)) + return -1; + } + + return 0; +} + +int hw_mod_cat_cfn_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + switch (count) { + case ALL_ENTRIES: + if (start_idx != 0) + return INDEX_TOO_LARGE; + + return be->iface->cat_cfn_flush(be->be_dev, &be->cat, start_idx, + be->cat.nb_cat_funcs); + + default: + if ((unsigned int)(start_idx + count) > be->cat.nb_cat_funcs) + return INDEX_TOO_LARGE; + + return be->iface->cat_cfn_flush(be->be_dev, &be->cat, start_idx, count); + } +} + +static int hw_mod_cat_cfn_mod(struct flow_api_backend_s *be, enum hw_cat_e field, int index, + int word_off, uint32_t *value, int get) +{ + if ((unsigned int)index >= be->cat.nb_cat_funcs) + return INDEX_TOO_LARGE; + + switch (_VER_) { + case 18: + switch (field) { + case HW_CAT_CFN_SET_ALL_DEFAULTS: + if (get) + return UNSUP_FIELD; + + return cfn_reset(be, index); + + case HW_CAT_CFN_PRESET_ALL: + if (get) + return UNSUP_FIELD; + + memset(&be->cat.v18.cfn[index], (uint8_t)*value, + sizeof(struct cat_v18_cfn_s)); + break; + + case HW_CAT_CFN_COMPARE: + if (!get) + return UNSUP_FIELD; + + if ((unsigned int)word_off >= be->cat.nb_cat_funcs) + return INDEX_TOO_LARGE; + + DO_COMPARE_INDEXS(be->cat.v18.cfn, struct cat_v18_cfn_s, index, word_off); + break; + + case HW_CAT_CFN_FIND: + if (!get) + return UNSUP_FIELD; + + if ((unsigned int)word_off >= be->cat.nb_cat_funcs) + return INDEX_TOO_LARGE; + + FIND_EQUAL_INDEX(be->cat.v18.cfn, struct cat_v18_cfn_s, index, word_off, + be->cat.nb_cat_funcs); + break; + + case HW_CAT_CFN_ENABLE: + GET_SET(be->cat.v18.cfn[index].enable, value); + break; + + case HW_CAT_CFN_INV: + GET_SET(be->cat.v18.cfn[index].inv, value); + break; + + case HW_CAT_CFN_PTC_INV: + GET_SET(be->cat.v18.cfn[index].ptc_inv, value); + break; + + case HW_CAT_CFN_PTC_ISL: + GET_SET(be->cat.v18.cfn[index].ptc_isl, value); + break; + + case HW_CAT_CFN_PTC_CFP: + GET_SET(be->cat.v18.cfn[index].ptc_cfp, value); + break; + + case HW_CAT_CFN_PTC_MAC: + GET_SET(be->cat.v18.cfn[index].ptc_mac, value); + break; + + case HW_CAT_CFN_PTC_L2: + GET_SET(be->cat.v18.cfn[index].ptc_l2, value); + break; + + case HW_CAT_CFN_PTC_VNTAG: + GET_SET(be->cat.v18.cfn[index].ptc_vntag, value); + break; + + case HW_CAT_CFN_PTC_VLAN: + GET_SET(be->cat.v18.cfn[index].ptc_vlan, value); + break; + + case HW_CAT_CFN_PTC_MPLS: + GET_SET(be->cat.v18.cfn[index].ptc_mpls, value); + break; + + case HW_CAT_CFN_PTC_L3: + GET_SET(be->cat.v18.cfn[index].ptc_l3, value); + break; + + case HW_CAT_CFN_PTC_FRAG: + GET_SET(be->cat.v18.cfn[index].ptc_frag, value); + break; + + case HW_CAT_CFN_PTC_IP_PROT: + GET_SET(be->cat.v18.cfn[index].ptc_ip_prot, value); + break; + + case HW_CAT_CFN_PTC_L4: + GET_SET(be->cat.v18.cfn[index].ptc_l4, value); + break; + + case HW_CAT_CFN_PTC_TUNNEL: + GET_SET(be->cat.v18.cfn[index].ptc_tunnel, value); + break; + + case HW_CAT_CFN_PTC_TNL_L2: + GET_SET(be->cat.v18.cfn[index].ptc_tnl_l2, value); + break; + + case HW_CAT_CFN_PTC_TNL_VLAN: + GET_SET(be->cat.v18.cfn[index].ptc_tnl_vlan, value); + break; + + case HW_CAT_CFN_PTC_TNL_MPLS: + GET_SET(be->cat.v18.cfn[index].ptc_tnl_mpls, value); + break; + + case HW_CAT_CFN_PTC_TNL_L3: + GET_SET(be->cat.v18.cfn[index].ptc_tnl_l3, value); + break; + + case HW_CAT_CFN_PTC_TNL_FRAG: + GET_SET(be->cat.v18.cfn[index].ptc_tnl_frag, value); + break; + + case HW_CAT_CFN_PTC_TNL_IP_PROT: + GET_SET(be->cat.v18.cfn[index].ptc_tnl_ip_prot, value); + break; + + case HW_CAT_CFN_PTC_TNL_L4: + GET_SET(be->cat.v18.cfn[index].ptc_tnl_l4, value); + break; + + case HW_CAT_CFN_ERR_INV: + GET_SET(be->cat.v18.cfn[index].err_inv, value); + break; + + case HW_CAT_CFN_ERR_CV: + GET_SET(be->cat.v18.cfn[index].err_cv, value); + break; + + case HW_CAT_CFN_ERR_FCS: + GET_SET(be->cat.v18.cfn[index].err_fcs, value); + break; + + case HW_CAT_CFN_ERR_TRUNC: + GET_SET(be->cat.v18.cfn[index].err_trunc, value); + break; + + case HW_CAT_CFN_ERR_L3_CS: + GET_SET(be->cat.v18.cfn[index].err_l3_cs, value); + break; + + case HW_CAT_CFN_ERR_L4_CS: + GET_SET(be->cat.v18.cfn[index].err_l4_cs, value); + break; + + case HW_CAT_CFN_MAC_PORT: + GET_SET(be->cat.v18.cfn[index].mac_port, value); + break; + + case HW_CAT_CFN_PM_CMP: + if (word_off > 1) + return WORD_OFF_TOO_LARGE; + + GET_SET(be->cat.v18.cfn[index].pm_cmp[word_off], value); + break; + + case HW_CAT_CFN_PM_DCT: + GET_SET(be->cat.v18.cfn[index].pm_dct, value); + break; + + case HW_CAT_CFN_PM_EXT_INV: + GET_SET(be->cat.v18.cfn[index].pm_ext_inv, value); + break; + + case HW_CAT_CFN_PM_CMB: + GET_SET(be->cat.v18.cfn[index].pm_cmb, value); + break; + + case HW_CAT_CFN_PM_AND_INV: + GET_SET(be->cat.v18.cfn[index].pm_and_inv, value); + break; + + case HW_CAT_CFN_PM_OR_INV: + GET_SET(be->cat.v18.cfn[index].pm_or_inv, value); + break; + + case HW_CAT_CFN_PM_INV: + GET_SET(be->cat.v18.cfn[index].pm_inv, value); + break; + + case HW_CAT_CFN_LC: + GET_SET(be->cat.v18.cfn[index].lc, value); + break; + + case HW_CAT_CFN_LC_INV: + GET_SET(be->cat.v18.cfn[index].lc_inv, value); + break; + + case HW_CAT_CFN_KM0_OR: + GET_SET(be->cat.v18.cfn[index].km_or, value); + break; + + default: + return UNSUP_FIELD; + } + + break; + + /* end case 18 */ + case 21: + switch (field) { + case HW_CAT_CFN_SET_ALL_DEFAULTS: + if (get) + return UNSUP_FIELD; + + return cfn_reset(be, index); + + case HW_CAT_CFN_PRESET_ALL: + if (get) + return UNSUP_FIELD; + + memset(&be->cat.v21.cfn[index], (uint8_t)*value, + sizeof(struct cat_v21_cfn_s)); + break; + + case HW_CAT_CFN_COMPARE: + if (!get) + return UNSUP_FIELD; + + if ((unsigned int)word_off >= be->cat.nb_cat_funcs) + return INDEX_TOO_LARGE; + + DO_COMPARE_INDEXS(be->cat.v21.cfn, struct cat_v21_cfn_s, index, word_off); + break; + + case HW_CAT_CFN_FIND: + if (!get) + return UNSUP_FIELD; + + if ((unsigned int)word_off >= be->cat.nb_cat_funcs) + return INDEX_TOO_LARGE; + + FIND_EQUAL_INDEX(be->cat.v21.cfn, struct cat_v21_cfn_s, index, word_off, + be->cat.nb_cat_funcs); + break; + + case HW_CAT_CFN_COPY_FROM: + if (get) + return UNSUP_FIELD; + + memcpy(&be->cat.v21.cfn[index], &be->cat.v21.cfn[*value], + sizeof(struct cat_v21_cfn_s)); + break; + + case HW_CAT_CFN_ENABLE: + GET_SET(be->cat.v21.cfn[index].enable, value); + break; + + case HW_CAT_CFN_INV: + GET_SET(be->cat.v21.cfn[index].inv, value); + break; + + case HW_CAT_CFN_PTC_INV: + GET_SET(be->cat.v21.cfn[index].ptc_inv, value); + break; + + case HW_CAT_CFN_PTC_ISL: + GET_SET(be->cat.v21.cfn[index].ptc_isl, value); + break; + + case HW_CAT_CFN_PTC_CFP: + GET_SET(be->cat.v21.cfn[index].ptc_cfp, value); + break; + + case HW_CAT_CFN_PTC_MAC: + GET_SET(be->cat.v21.cfn[index].ptc_mac, value); + break; + + case HW_CAT_CFN_PTC_L2: + GET_SET(be->cat.v21.cfn[index].ptc_l2, value); + break; + + case HW_CAT_CFN_PTC_VNTAG: + GET_SET(be->cat.v21.cfn[index].ptc_vntag, value); + break; + + case HW_CAT_CFN_PTC_VLAN: + GET_SET(be->cat.v21.cfn[index].ptc_vlan, value); + break; + + case HW_CAT_CFN_PTC_MPLS: + GET_SET(be->cat.v21.cfn[index].ptc_mpls, value); + break; + + case HW_CAT_CFN_PTC_L3: + GET_SET(be->cat.v21.cfn[index].ptc_l3, value); + break; + + case HW_CAT_CFN_PTC_FRAG: + GET_SET(be->cat.v21.cfn[index].ptc_frag, value); + break; + + case HW_CAT_CFN_PTC_IP_PROT: + GET_SET(be->cat.v21.cfn[index].ptc_ip_prot, value); + break; + + case HW_CAT_CFN_PTC_L4: + GET_SET(be->cat.v21.cfn[index].ptc_l4, value); + break; + + case HW_CAT_CFN_PTC_TUNNEL: + GET_SET(be->cat.v21.cfn[index].ptc_tunnel, value); + break; + + case HW_CAT_CFN_PTC_TNL_L2: + GET_SET(be->cat.v21.cfn[index].ptc_tnl_l2, value); + break; + + case HW_CAT_CFN_PTC_TNL_VLAN: + GET_SET(be->cat.v21.cfn[index].ptc_tnl_vlan, value); + break; + + case HW_CAT_CFN_PTC_TNL_MPLS: + GET_SET(be->cat.v21.cfn[index].ptc_tnl_mpls, value); + break; + + case HW_CAT_CFN_PTC_TNL_L3: + GET_SET(be->cat.v21.cfn[index].ptc_tnl_l3, value); + break; + + case HW_CAT_CFN_PTC_TNL_FRAG: + GET_SET(be->cat.v21.cfn[index].ptc_tnl_frag, value); + break; + + case HW_CAT_CFN_PTC_TNL_IP_PROT: + GET_SET(be->cat.v21.cfn[index].ptc_tnl_ip_prot, value); + break; + + case HW_CAT_CFN_PTC_TNL_L4: + GET_SET(be->cat.v21.cfn[index].ptc_tnl_l4, value); + break; + + case HW_CAT_CFN_ERR_INV: + GET_SET(be->cat.v21.cfn[index].err_inv, value); + break; + + case HW_CAT_CFN_ERR_CV: + GET_SET(be->cat.v21.cfn[index].err_cv, value); + break; + + case HW_CAT_CFN_ERR_FCS: + GET_SET(be->cat.v21.cfn[index].err_fcs, value); + break; + + case HW_CAT_CFN_ERR_TRUNC: + GET_SET(be->cat.v21.cfn[index].err_trunc, value); + break; + + case HW_CAT_CFN_ERR_L3_CS: + GET_SET(be->cat.v21.cfn[index].err_l3_cs, value); + break; + + case HW_CAT_CFN_ERR_L4_CS: + GET_SET(be->cat.v21.cfn[index].err_l4_cs, value); + break; + + case HW_CAT_CFN_ERR_TNL_L3_CS: + GET_SET(be->cat.v21.cfn[index].err_tnl_l3_cs, value); + break; + + case HW_CAT_CFN_ERR_TNL_L4_CS: + GET_SET(be->cat.v21.cfn[index].err_tnl_l4_cs, value); + break; + + case HW_CAT_CFN_ERR_TTL_EXP: + GET_SET(be->cat.v21.cfn[index].err_ttl_exp, value); + break; + + case HW_CAT_CFN_ERR_TNL_TTL_EXP: + GET_SET(be->cat.v21.cfn[index].err_tnl_ttl_exp, value); + break; + + case HW_CAT_CFN_MAC_PORT: + GET_SET(be->cat.v21.cfn[index].mac_port, value); + break; + + case HW_CAT_CFN_PM_CMP: + if (word_off > 1) + return WORD_OFF_TOO_LARGE; + + GET_SET(be->cat.v21.cfn[index].pm_cmp[word_off], value); + break; + + case HW_CAT_CFN_PM_DCT: + GET_SET(be->cat.v21.cfn[index].pm_dct, value); + break; + + case HW_CAT_CFN_PM_EXT_INV: + GET_SET(be->cat.v21.cfn[index].pm_ext_inv, value); + break; + + case HW_CAT_CFN_PM_CMB: + GET_SET(be->cat.v21.cfn[index].pm_cmb, value); + break; + + case HW_CAT_CFN_PM_AND_INV: + GET_SET(be->cat.v21.cfn[index].pm_and_inv, value); + break; + + case HW_CAT_CFN_PM_OR_INV: + GET_SET(be->cat.v21.cfn[index].pm_or_inv, value); + break; + + case HW_CAT_CFN_PM_INV: + GET_SET(be->cat.v21.cfn[index].pm_inv, value); + break; + + case HW_CAT_CFN_LC: + GET_SET(be->cat.v21.cfn[index].lc, value); + break; + + case HW_CAT_CFN_LC_INV: + GET_SET(be->cat.v21.cfn[index].lc_inv, value); + break; + + case HW_CAT_CFN_KM0_OR: + GET_SET(be->cat.v21.cfn[index].km0_or, value); + break; + + case HW_CAT_CFN_KM1_OR: + GET_SET(be->cat.v21.cfn[index].km1_or, value); + break; + + default: + return UNSUP_FIELD; + } + + break; + + /* end case 21 */ + + default: + return UNSUP_VER; + } + + return 0; +} + +int hw_mod_cat_cfn_set(struct flow_api_backend_s *be, enum hw_cat_e field, int index, int word_off, + uint32_t value) +{ + return hw_mod_cat_cfn_mod(be, field, index, word_off, &value, 0); +} + +static inline int find_km_flm_module_interface_index(struct flow_api_backend_s *be, + enum km_flm_if_select_e if_num, int km_if_id) +{ + int km_if_idx; + + if (_VER_ == 18) { + km_if_idx = 0; + + } else { + if (if_num == KM_FLM_IF_SECOND) + if (be->cat.km_if_m1 == km_if_id) + km_if_idx = 1; + + else + return UNSUP_FIELD; + + else if (be->cat.km_if_m0 == km_if_id) + km_if_idx = 0; + + else if (be->cat.km_if_m1 == km_if_id) + km_if_idx = 1; + + else + return UNSUP_FIELD; + } + + return km_if_idx; +} + +/* + * KCE + */ + +static int hw_mod_cat_kce_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num, + int km_if_id, int start_idx, int count) +{ + /* writes 8 bits - one for each cfn - at a time */ + if (count == ALL_ENTRIES) + count = be->cat.nb_cat_funcs / 8; + + if ((unsigned int)(start_idx + count) > (be->cat.nb_cat_funcs / 8)) + return INDEX_TOO_LARGE; + + /* find KM module */ + int km_if_idx = find_km_flm_module_interface_index(be, if_num, km_if_id); + + if (km_if_idx < 0) + return km_if_idx; + + return be->iface->cat_kce_flush(be->be_dev, &be->cat, km_if_idx, start_idx, count); +} + +/* + * KCS + */ +static int hw_mod_cat_kcs_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num, + int km_if_id, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->cat.nb_cat_funcs; + + if ((unsigned int)(start_idx + count) > be->cat.nb_cat_funcs) + return INDEX_TOO_LARGE; + + /* find KM module */ + int km_if_idx = find_km_flm_module_interface_index(be, if_num, km_if_id); + + if (km_if_idx < 0) + return km_if_idx; + + return be->iface->cat_kcs_flush(be->be_dev, &be->cat, km_if_idx, start_idx, count); +} + +/* + * FTE + */ +static int hw_mod_cat_fte_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num, + int km_if_id, int start_idx, int count) +{ + const uint32_t key_cnt = (_VER_ >= 20) ? 4 : 2; + + if (count == ALL_ENTRIES) + count = be->cat.nb_cat_funcs / 8 * be->cat.nb_flow_types * key_cnt; + + if ((unsigned int)(start_idx + count) > + (be->cat.nb_cat_funcs / 8 * be->cat.nb_flow_types * key_cnt)) { + return INDEX_TOO_LARGE; + } + + /* find KM module */ + int km_if_idx = find_km_flm_module_interface_index(be, if_num, km_if_id); + + if (km_if_idx < 0) + return km_if_idx; + + return be->iface->cat_fte_flush(be->be_dev, &be->cat, km_if_idx, start_idx, count); +} + +int hw_mod_cat_cte_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->cat.nb_cat_funcs; + + if ((unsigned int)(start_idx + count) > be->cat.nb_cat_funcs) + return INDEX_TOO_LARGE; + + return be->iface->cat_cte_flush(be->be_dev, &be->cat, start_idx, count); +} + +int hw_mod_cat_cts_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + int addr_size = (_VER_ < 15) ? 8 : ((be->cat.cts_num + 1) / 2); + + if (count == ALL_ENTRIES) + count = be->cat.nb_cat_funcs * addr_size; + + if ((unsigned int)(start_idx + count) > (be->cat.nb_cat_funcs * addr_size)) + return INDEX_TOO_LARGE; + + return be->iface->cat_cts_flush(be->be_dev, &be->cat, start_idx, count); +} + +int hw_mod_cat_cot_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->max_categories; + + if ((unsigned int)(start_idx + count) > be->max_categories) + return INDEX_TOO_LARGE; + + return be->iface->cat_cot_flush(be->be_dev, &be->cat, start_idx, count); +} + +int hw_mod_cat_cct_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->cat.nb_cat_funcs * 4; + + if ((unsigned int)(start_idx + count) > be->cat.nb_cat_funcs * 4) + return INDEX_TOO_LARGE; + + return be->iface->cat_cct_flush(be->be_dev, &be->cat, start_idx, count); +} + +int hw_mod_cat_kcc_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->cat.kcc_size; + + if ((unsigned int)(start_idx + count) > be->cat.kcc_size) + return INDEX_TOO_LARGE; + + return be->iface->cat_kcc_flush(be->be_dev, &be->cat, start_idx, count); +} + +int hw_mod_cat_exo_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->cat.nb_pm_ext; + + if ((unsigned int)(start_idx + count) > be->cat.nb_pm_ext) + return INDEX_TOO_LARGE; + + return be->iface->cat_exo_flush(be->be_dev, &be->cat, start_idx, count); +} + +int hw_mod_cat_rck_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->cat.nb_pm_ext * 64; + + if ((unsigned int)(start_idx + count) > (be->cat.nb_pm_ext * 64)) + return INDEX_TOO_LARGE; + + return be->iface->cat_rck_flush(be->be_dev, &be->cat, start_idx, count); +} + +int hw_mod_cat_len_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->cat.nb_len; + + if ((unsigned int)(start_idx + count) > be->cat.nb_len) + return INDEX_TOO_LARGE; + + return be->iface->cat_len_flush(be->be_dev, &be->cat, start_idx, count); +} diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c index cbebcff541..4efd5aa2f8 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c @@ -9,6 +9,267 @@ #include "nthw_register.h" +static nthw_fpga_field_init_s cat_cct_ctrl_fields[] = { + { CAT_CCT_CTRL_ADR, 8, 0, 0x0000 }, + { CAT_CCT_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_cct_data_fields[] = { + { CAT_CCT_DATA_COLOR, 32, 0, 0x0000 }, + { CAT_CCT_DATA_KM, 4, 32, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_cfn_ctrl_fields[] = { + { CAT_CFN_CTRL_ADR, 6, 0, 0x0000 }, + { CAT_CFN_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_cfn_data_fields[] = { + { CAT_CFN_DATA_ENABLE, 1, 0, 0x0000 }, + { CAT_CFN_DATA_ERR_CV, 2, 99, 0x0000 }, + { CAT_CFN_DATA_ERR_FCS, 2, 101, 0x0000 }, + { CAT_CFN_DATA_ERR_INV, 1, 98, 0x0000 }, + { CAT_CFN_DATA_ERR_L3_CS, 2, 105, 0x0000 }, + { CAT_CFN_DATA_ERR_L4_CS, 2, 107, 0x0000 }, + { CAT_CFN_DATA_ERR_TNL_L3_CS, 2, 109, 0x0000 }, + { CAT_CFN_DATA_ERR_TNL_L4_CS, 2, 111, 0x0000 }, + { CAT_CFN_DATA_ERR_TNL_TTL_EXP, 2, 115, 0x0000 }, + { CAT_CFN_DATA_ERR_TRUNC, 2, 103, 0x0000 }, + { CAT_CFN_DATA_ERR_TTL_EXP, 2, 113, 0x0000 }, + { CAT_CFN_DATA_INV, 1, 1, 0x0000 }, + { CAT_CFN_DATA_KM0_OR, 3, 173, 0x0000 }, + { CAT_CFN_DATA_KM1_OR, 3, 176, 0x0000 }, + { CAT_CFN_DATA_LC, 8, 164, 0x0000 }, + { CAT_CFN_DATA_LC_INV, 1, 172, 0x0000 }, + { CAT_CFN_DATA_MAC_PORT, 2, 117, 0x0000 }, + { CAT_CFN_DATA_PM_AND_INV, 1, 161, 0x0000 }, + { CAT_CFN_DATA_PM_CMB, 4, 157, 0x0000 }, + { CAT_CFN_DATA_PM_CMP, 32, 119, 0x0000 }, + { CAT_CFN_DATA_PM_DCT, 2, 151, 0x0000 }, + { CAT_CFN_DATA_PM_EXT_INV, 4, 153, 0x0000 }, + { CAT_CFN_DATA_PM_INV, 1, 163, 0x0000 }, + { CAT_CFN_DATA_PM_OR_INV, 1, 162, 0x0000 }, + { CAT_CFN_DATA_PTC_CFP, 2, 5, 0x0000 }, + { CAT_CFN_DATA_PTC_FRAG, 4, 36, 0x0000 }, + { CAT_CFN_DATA_PTC_INV, 1, 2, 0x0000 }, + { CAT_CFN_DATA_PTC_IP_PROT, 8, 40, 0x0000 }, + { CAT_CFN_DATA_PTC_ISL, 2, 3, 0x0000 }, + { CAT_CFN_DATA_PTC_L2, 7, 12, 0x0000 }, + { CAT_CFN_DATA_PTC_L3, 3, 33, 0x0000 }, + { CAT_CFN_DATA_PTC_L4, 5, 48, 0x0000 }, + { CAT_CFN_DATA_PTC_MAC, 5, 7, 0x0000 }, + { CAT_CFN_DATA_PTC_MPLS, 8, 25, 0x0000 }, + { CAT_CFN_DATA_PTC_TNL_FRAG, 4, 81, 0x0000 }, + { CAT_CFN_DATA_PTC_TNL_IP_PROT, 8, 85, 0x0000 }, + { CAT_CFN_DATA_PTC_TNL_L2, 2, 64, 0x0000 }, + { CAT_CFN_DATA_PTC_TNL_L3, 3, 78, 0x0000 }, + { CAT_CFN_DATA_PTC_TNL_L4, 5, 93, 0x0000 }, + { CAT_CFN_DATA_PTC_TNL_MPLS, 8, 70, 0x0000 }, + { CAT_CFN_DATA_PTC_TNL_VLAN, 4, 66, 0x0000 }, + { CAT_CFN_DATA_PTC_TUNNEL, 11, 53, 0x0000 }, + { CAT_CFN_DATA_PTC_VLAN, 4, 21, 0x0000 }, + { CAT_CFN_DATA_PTC_VNTAG, 2, 19, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_cot_ctrl_fields[] = { + { CAT_COT_CTRL_ADR, 6, 0, 0x0000 }, + { CAT_COT_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_cot_data_fields[] = { + { CAT_COT_DATA_COLOR, 32, 0, 0x0000 }, + { CAT_COT_DATA_KM, 4, 32, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_cte_ctrl_fields[] = { + { CAT_CTE_CTRL_ADR, 6, 0, 0x0000 }, + { CAT_CTE_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_cte_data_fields[] = { + { CAT_CTE_DATA_COL_ENABLE, 1, 0, 0x0000 }, { CAT_CTE_DATA_COR_ENABLE, 1, 1, 0x0000 }, + { CAT_CTE_DATA_EPP_ENABLE, 1, 9, 0x0000 }, { CAT_CTE_DATA_HSH_ENABLE, 1, 2, 0x0000 }, + { CAT_CTE_DATA_HST_ENABLE, 1, 8, 0x0000 }, { CAT_CTE_DATA_IPF_ENABLE, 1, 4, 0x0000 }, + { CAT_CTE_DATA_MSK_ENABLE, 1, 7, 0x0000 }, { CAT_CTE_DATA_PDB_ENABLE, 1, 6, 0x0000 }, + { CAT_CTE_DATA_QSL_ENABLE, 1, 3, 0x0000 }, { CAT_CTE_DATA_SLC_ENABLE, 1, 5, 0x0000 }, + { CAT_CTE_DATA_TPE_ENABLE, 1, 10, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_cts_ctrl_fields[] = { + { CAT_CTS_CTRL_ADR, 9, 0, 0x0000 }, + { CAT_CTS_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_cts_data_fields[] = { + { CAT_CTS_DATA_CAT_A, 6, 0, 0x0000 }, + { CAT_CTS_DATA_CAT_B, 6, 6, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_dct_ctrl_fields[] = { + { CAT_DCT_CTRL_ADR, 13, 0, 0x0000 }, + { CAT_DCT_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_dct_data_fields[] = { + { CAT_DCT_DATA_RES, 16, 0, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_dct_sel_fields[] = { + { CAT_DCT_SEL_LU, 2, 0, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_exo_ctrl_fields[] = { + { CAT_EXO_CTRL_ADR, 2, 0, 0x0000 }, + { CAT_EXO_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_exo_data_fields[] = { + { CAT_EXO_DATA_DYN, 5, 0, 0x0000 }, + { CAT_EXO_DATA_OFS, 11, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_fte0_ctrl_fields[] = { + { CAT_FTE0_CTRL_ADR, 9, 0, 0x0000 }, + { CAT_FTE0_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_fte0_data_fields[] = { + { CAT_FTE0_DATA_ENABLE, 8, 0, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_fte1_ctrl_fields[] = { + { CAT_FTE1_CTRL_ADR, 9, 0, 0x0000 }, + { CAT_FTE1_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_fte1_data_fields[] = { + { CAT_FTE1_DATA_ENABLE, 8, 0, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_join_fields[] = { + { CAT_JOIN_J1, 2, 0, 0x0000 }, + { CAT_JOIN_J2, 1, 8, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_kcc_ctrl_fields[] = { + { CAT_KCC_CTRL_ADR, 11, 0, 0x0000 }, + { CAT_KCC_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_kcc_data_fields[] = { + { CAT_KCC_DATA_CATEGORY, 8, 64, 0x0000 }, + { CAT_KCC_DATA_ID, 12, 72, 0x0000 }, + { CAT_KCC_DATA_KEY, 64, 0, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_kce0_ctrl_fields[] = { + { CAT_KCE0_CTRL_ADR, 3, 0, 0x0000 }, + { CAT_KCE0_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_kce0_data_fields[] = { + { CAT_KCE0_DATA_ENABLE, 8, 0, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_kce1_ctrl_fields[] = { + { CAT_KCE1_CTRL_ADR, 3, 0, 0x0000 }, + { CAT_KCE1_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_kce1_data_fields[] = { + { CAT_KCE1_DATA_ENABLE, 8, 0, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_kcs0_ctrl_fields[] = { + { CAT_KCS0_CTRL_ADR, 6, 0, 0x0000 }, + { CAT_KCS0_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_kcs0_data_fields[] = { + { CAT_KCS0_DATA_CATEGORY, 6, 0, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_kcs1_ctrl_fields[] = { + { CAT_KCS1_CTRL_ADR, 6, 0, 0x0000 }, + { CAT_KCS1_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_kcs1_data_fields[] = { + { CAT_KCS1_DATA_CATEGORY, 6, 0, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_len_ctrl_fields[] = { + { CAT_LEN_CTRL_ADR, 3, 0, 0x0000 }, + { CAT_LEN_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_len_data_fields[] = { + { CAT_LEN_DATA_DYN1, 5, 28, 0x0000 }, { CAT_LEN_DATA_DYN2, 5, 33, 0x0000 }, + { CAT_LEN_DATA_INV, 1, 38, 0x0000 }, { CAT_LEN_DATA_LOWER, 14, 0, 0x0000 }, + { CAT_LEN_DATA_UPPER, 14, 14, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_rck_ctrl_fields[] = { + { CAT_RCK_CTRL_ADR, 8, 0, 0x0000 }, + { CAT_RCK_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s cat_rck_data_fields[] = { + { CAT_RCK_DATA_CM0U, 1, 1, 0x0000 }, { CAT_RCK_DATA_CM1U, 1, 5, 0x0000 }, + { CAT_RCK_DATA_CM2U, 1, 9, 0x0000 }, { CAT_RCK_DATA_CM3U, 1, 13, 0x0000 }, + { CAT_RCK_DATA_CM4U, 1, 17, 0x0000 }, { CAT_RCK_DATA_CM5U, 1, 21, 0x0000 }, + { CAT_RCK_DATA_CM6U, 1, 25, 0x0000 }, { CAT_RCK_DATA_CM7U, 1, 29, 0x0000 }, + { CAT_RCK_DATA_CML0, 1, 0, 0x0000 }, { CAT_RCK_DATA_CML1, 1, 4, 0x0000 }, + { CAT_RCK_DATA_CML2, 1, 8, 0x0000 }, { CAT_RCK_DATA_CML3, 1, 12, 0x0000 }, + { CAT_RCK_DATA_CML4, 1, 16, 0x0000 }, { CAT_RCK_DATA_CML5, 1, 20, 0x0000 }, + { CAT_RCK_DATA_CML6, 1, 24, 0x0000 }, { CAT_RCK_DATA_CML7, 1, 28, 0x0000 }, + { CAT_RCK_DATA_SEL0, 1, 2, 0x0000 }, { CAT_RCK_DATA_SEL1, 1, 6, 0x0000 }, + { CAT_RCK_DATA_SEL2, 1, 10, 0x0000 }, { CAT_RCK_DATA_SEL3, 1, 14, 0x0000 }, + { CAT_RCK_DATA_SEL4, 1, 18, 0x0000 }, { CAT_RCK_DATA_SEL5, 1, 22, 0x0000 }, + { CAT_RCK_DATA_SEL6, 1, 26, 0x0000 }, { CAT_RCK_DATA_SEL7, 1, 30, 0x0000 }, + { CAT_RCK_DATA_SEU0, 1, 3, 0x0000 }, { CAT_RCK_DATA_SEU1, 1, 7, 0x0000 }, + { CAT_RCK_DATA_SEU2, 1, 11, 0x0000 }, { CAT_RCK_DATA_SEU3, 1, 15, 0x0000 }, + { CAT_RCK_DATA_SEU4, 1, 19, 0x0000 }, { CAT_RCK_DATA_SEU5, 1, 23, 0x0000 }, + { CAT_RCK_DATA_SEU6, 1, 27, 0x0000 }, { CAT_RCK_DATA_SEU7, 1, 31, 0x0000 }, +}; + +static nthw_fpga_register_init_s cat_registers[] = { + { CAT_CCT_CTRL, 30, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_cct_ctrl_fields }, + { CAT_CCT_DATA, 31, 36, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_cct_data_fields }, + { CAT_CFN_CTRL, 10, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_cfn_ctrl_fields }, + { CAT_CFN_DATA, 11, 179, NTHW_FPGA_REG_TYPE_WO, 0, 44, cat_cfn_data_fields }, + { CAT_COT_CTRL, 28, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_cot_ctrl_fields }, + { CAT_COT_DATA, 29, 36, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_cot_data_fields }, + { CAT_CTE_CTRL, 24, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_cte_ctrl_fields }, + { CAT_CTE_DATA, 25, 11, NTHW_FPGA_REG_TYPE_WO, 0, 11, cat_cte_data_fields }, + { CAT_CTS_CTRL, 26, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_cts_ctrl_fields }, + { CAT_CTS_DATA, 27, 12, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_cts_data_fields }, + { CAT_DCT_CTRL, 6, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_dct_ctrl_fields }, + { CAT_DCT_DATA, 7, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1, cat_dct_data_fields }, + { CAT_DCT_SEL, 4, 2, NTHW_FPGA_REG_TYPE_WO, 0, 1, cat_dct_sel_fields }, + { CAT_EXO_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_exo_ctrl_fields }, + { CAT_EXO_DATA, 1, 27, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_exo_data_fields }, + { CAT_FTE0_CTRL, 16, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_fte0_ctrl_fields }, + { CAT_FTE0_DATA, 17, 8, NTHW_FPGA_REG_TYPE_WO, 0, 1, cat_fte0_data_fields }, + { CAT_FTE1_CTRL, 22, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_fte1_ctrl_fields }, + { CAT_FTE1_DATA, 23, 8, NTHW_FPGA_REG_TYPE_WO, 0, 1, cat_fte1_data_fields }, + { CAT_JOIN, 5, 9, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_join_fields }, + { CAT_KCC_CTRL, 32, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_kcc_ctrl_fields }, + { CAT_KCC_DATA, 33, 84, NTHW_FPGA_REG_TYPE_WO, 0, 3, cat_kcc_data_fields }, + { CAT_KCE0_CTRL, 12, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_kce0_ctrl_fields }, + { CAT_KCE0_DATA, 13, 8, NTHW_FPGA_REG_TYPE_WO, 0, 1, cat_kce0_data_fields }, + { CAT_KCE1_CTRL, 18, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_kce1_ctrl_fields }, + { CAT_KCE1_DATA, 19, 8, NTHW_FPGA_REG_TYPE_WO, 0, 1, cat_kce1_data_fields }, + { CAT_KCS0_CTRL, 14, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_kcs0_ctrl_fields }, + { CAT_KCS0_DATA, 15, 6, NTHW_FPGA_REG_TYPE_WO, 0, 1, cat_kcs0_data_fields }, + { CAT_KCS1_CTRL, 20, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_kcs1_ctrl_fields }, + { CAT_KCS1_DATA, 21, 6, NTHW_FPGA_REG_TYPE_WO, 0, 1, cat_kcs1_data_fields }, + { CAT_LEN_CTRL, 8, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_len_ctrl_fields }, + { CAT_LEN_DATA, 9, 39, NTHW_FPGA_REG_TYPE_WO, 0, 5, cat_len_data_fields }, + { CAT_RCK_CTRL, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cat_rck_ctrl_fields }, + { CAT_RCK_DATA, 3, 32, NTHW_FPGA_REG_TYPE_WO, 0, 32, cat_rck_data_fields }, +}; + static nthw_fpga_field_init_s gfg_burstsize0_fields[] = { { GFG_BURSTSIZE0_VAL, 24, 0, 0 }, }; @@ -1037,6 +1298,7 @@ static nthw_fpga_register_init_s rst9563_registers[] = { }; static nthw_fpga_module_init_s fpga_modules[] = { + { MOD_CAT, 0, MOD_CAT, 0, 21, NTHW_FPGA_BUS_TYPE_RAB1, 768, 34, cat_registers }, { MOD_GFG, 0, MOD_GFG, 1, 1, NTHW_FPGA_BUS_TYPE_RAB2, 8704, 10, gfg_registers }, { MOD_GMF, 0, MOD_GMF, 2, 5, NTHW_FPGA_BUS_TYPE_RAB2, 9216, 12, gmf_registers }, { MOD_GMF, 1, MOD_GMF, 2, 5, NTHW_FPGA_BUS_TYPE_RAB2, 9728, 12, gmf_registers }, @@ -1226,5 +1488,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { }; nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { - 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 15, fpga_modules, + 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 16, fpga_modules, }; From patchwork Fri Oct 4 15:34:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145105 X-Patchwork-Delegate: ferruh.yigit@amd.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 9504A45AAF; Fri, 4 Oct 2024 17:53:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 64FD242E1C; Fri, 4 Oct 2024 17:51:22 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id 83B6642E61 for ; Fri, 4 Oct 2024 17:51:19 +0200 (CEST) Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02lp2233.outbound.protection.outlook.com [104.47.11.233]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:51:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GujeYeW46E6354o3nuoXNNRSVEaZkOB1EbfPzUXMISu2Xj4mX95IvOY/3EHNUDGdnYBfJADoRJdzxvlzw4TOwSzvtwmVqj2LgUC594w/Ntt6TMwcWxwToGwtY+d7z01L7LFwO/JXpnEZHcguJIhpCVKvfwLaiYIPxnc6MNIFG+KNYoxQgQ1A0Cv3PsI/muHFmpw59Z2X6Ubn12fA42s7a791Wkg8yiQft+CGx4QtvWp2WvaVQjeNKDXIArZBDl3YxtSSMkFlec+FZzqQSgA1BysLboCV9By3GfwEf3jNmD8PKlbQjBSa81o08r9oObnWMiQIji0r/1nXzmAWES6YXQ== 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=Wy54q0lzHvpFc3r5FD4ZOx7NlDBUeBqeAYIsEc/Ea50=; b=E5WP3CHSfRPXvgs8ZQSMt8Owjo4Cefo32hME3xYuaXlWegPGHvNW0jLSkU/eYyo/uFlK/Kvk0ATBlpWH8kG/7uVlr612tqsVPKHU836RHJBL7MsMrVPlsnEiGg9SnkG/7PHYNxLgAnzQ9aSaZllaextze6YcUL+ae1qVnuSwDIM2ynutfIuZbvA5ceFbP/N00VFRED7gS/0kGaJaHeuxuDiArILFc0i0i8UxgN4pgC8r5z9lE/i5XQFYzY3TPIe+q5iPOBwGSf0ALNzCg910bqUky/MJdwdlQAii2N+85XZ7Mj1wt0RajiIa6eDv+eLx0fRp1i7fbop1tns9PEEdaQ== 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=Wy54q0lzHvpFc3r5FD4ZOx7NlDBUeBqeAYIsEc/Ea50=; b=i7vpq6IYpFb1/luyIZTCLDj2bsocjXSkAdnHfC+XHaLFxI83b9noOIuylNI6e1qZxfCh0PlkIdsJ5uUXEswKDtHZunPXBLyl5kx9Z99dzhLrbldiNWcQ2kjI9XAWLT6gRMPedd3NwD0xwas1JCU/11jvgzQ/aPeHhQiZT4g5+Qc= Received: from AM0PR10CA0109.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::26) by VI1P190MB0704.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:12a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 15:36:23 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::cf) by AM0PR10CA0109.outlook.office365.com (2603:10a6:208:e6::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:23 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:23 +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, Oleksandr Kolomeiets Subject: [PATCH v1 24/31] net/ntnic: add key match (KM) FPGA module Date: Fri, 4 Oct 2024 17:34:47 +0200 Message-ID: <20241004153551.267935-30-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|VI1P190MB0704:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c37a99f-851b-4e86-9987-08dce48a4d48 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: ddAPGivxQkp1S1dw3ma0f1h/N0KsVSWhWSTUAD12K9i8zttPE420HcfdRtxdhYm7zOEtAImqSwW67cT3S44LKEM9kdXfx0D5MDGuTArFeD3tVx3tUhSO/b4L/wJeLITBzHpUVS+InYJN1Jd93tW2XERmFlnwoy+C6ZPxd5ZLfKDTcNWUPqz37BQHk2nMhFkSFGNfe4AN2RrEWkjnXDuhV9cZqLUhlioPxfHmVW1k6VHkOEZgDMsPEEOiNwaZZ0xamSj2iN32FZCySBVE0IkOQuIkQUzJ8UPKkL1emhiWBQi8yegruSPotlgAIlo6rHgnlLGh/LTHPGni8Ulnm4sWyYaw8Zb8K3MaqbXiFiXgOPjBY/lFFQ/T8OTUJ+JmYWFFmxiOWQIu9AS4FmrB1sNvidtom1TyjXkFRg42UjGjkKwqWOIJLCZYFh5noeUiRnaYt2s7bfMK3LkGq1YTzWrAuOOkLHGYS3mEAUSXMDl0Jx17WXagB2wOKvbENbltf6hNp2z5s1EmLxBzNNS7fKaWO7/N1jonPzNAWeOI+Dd2s2pvl0TbPLdoIcnwkxi2HtU6FElOM2IBhDH0wwtgapIwXg6E9bsu4DEQpmpsXoV2/xojltsSwfgY7KwocWjcPnzYGQipmmZSAoE/RRyJZJL8iFnvHxlTtDxkBzwCUEFSBUAsciXOLzK/FONDIjEDfXYg2xj2jDMR774eTePnV8X54XBEE2d9zn2JhXdIF8PykpPJn+G72rwjSbA+AechlovIVB4wkqXv5I6AkWc2/0CHgX59goznr78jHqiO2ifW14KORKYZ3bioJqlXx2ti6/WDBDfWyfnG8asw416WTLJfLF8wkPEx3jl/Z2OSmHNXyiGFsCFqMUSPdA1JRlze82IuiDCnMeD/EpGfIGRnDlyBlu/mMW8cRjNJbPKyr+VcrcsxEI34XPRTjskKXYYYHXPSxny2EGzRnq+MB3AmWMDnNRAqbro8KCd6guhjI//ws/0bqk0rXQIMN/N8DpqBHXO0j3jm5P/04AXsWHtr8Uj3iejdpk7uY3EFAALbSF0ZLcHeW71cdAgsfmvjtw9kCv2EnJ4569zF5XGHYZlmNZCiuRwA2dU2x9HOxE9BepaNxgE9fFgtIOSm96d828O5QsKCAsuGgPKLdq1FE0D0+YPBD2ssZnbl/Kjh4se4/LtSZy2nvfbSzaqfw/rkzMBoHH6/ztpNCRNMHYdxqFpEFNHxphNGHbIjlJz4qeZb+xU4kEweBDu3lH2/sJXiyAFCB/61dDDNheCYwabrO3nozdVurxfXMeDVDiKYdhARMvfpweZVNzDREs+TKhz+aYEu6b4bQL/EP9iCLOWjQWsfNGzmrc13xhSmb7ozQMwlNNFD6ax1FYHRs7Z7nRa5/lGs1zSM 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)(376014)(36860700013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: W+u3CLSL7nq9KzoTxbHADCuSNnIkSudw8QFUMSCzZU+c0KBXLGsgk61OunEORSVf/n6a1GcfoNwYBo8oQTv5/V+ttvQm1BPxSAde/RaoDwVQ7462TFIxcQr8pLOpvaTcK304+MJ1O2Xahdisfr7cOQ3RAxFPZM21nrxpw/9apiBUOdfC7g4IZ94IEF6+9gK/q/uHU4QpqC83L03oB6InQEyc71v1FZbbPm4aBYSI6NDkgQx/Q40iOgOBMCrxDK2sjhh6/9KrntlP9lkpFIdtIAkKwnkDckC+JvBIi34Q1p25N9OWoG3DT9VJz05QchW0/J5/meoMs4DnU1eaBwpayAfLimSV+EWjf/aw6JFXT5VkM337EXrzcsXaAK6k3Te+k0rvFPCfJNs7bcvCJmEG5WLcn6AONfkaYxXdrDmxKRvt/6CYBJOpRhsRABjczzs3P61xyHqizqjuAoM6dGweqQVwwI/KbVsuVxsyOg6+HXesGiaIuZaeCGmgGgFflA+xUb+0kIjlPNBey/GDDuQO024AeVGEMrDGgHq6clpQGYJCXE20TVTeN8pN9UwA+o1kzsJzWRIFiDZ28Bcmq/ChqQ2OgeO3BSb0DzyJA8Jr8o2TDnmWmK1R7e+9Vl/kl1lrUcPxYtjmSpukXTSvXEn9WQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:23.1116 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8c37a99f-851b-4e86-9987-08dce48a4d48 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1P190MB0704 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057078-311388-12692-32534-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.11.233 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaWxsaGQGYGUNTQ2NQ00SzZPM 3E1CLRMs3A1Mww2SLJzDLNxCTJPCnJTKk2FgDkPf7JQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan11-98.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: Oleksandr Kolomeiets The Key Matcher module checks the values of individual fields of a packet. It supports both exact match which is implemented with a CAM, and wildcards which is implemented with a TCAM. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/include/hw_mod_backend.h | 85 ++++++ drivers/net/ntnic/meson.build | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 3 + .../nthw/flow_api/hw_mod/hw_mod_backend.c | 1 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_km.c | 278 ++++++++++++++++++ .../supported/nthw_fpga_9563_055_049_0000.c | 94 +++++- 6 files changed, 461 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_km.c diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index 20b10faf5e..f40b33a888 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -32,6 +32,7 @@ void *callocate_mod(struct common_func_s *mod, int sets, ...); void zero_module_cache(struct common_func_s *mod); #define ALL_ENTRIES -1000 +#define ALL_BANK_ENTRIES -1001 #define INDEX_TOO_LARGE (NT_LOG(INF, FILTER, "ERROR:%s: Index too large\n", __func__), -2) @@ -267,6 +268,89 @@ struct km_func_s { struct hw_mod_km_v7_s v7; }; }; +enum hw_km_e { + /* functions */ + HW_KM_RCP_PRESET_ALL = 0, + HW_KM_CAM_PRESET_ALL, + /* to sync and reset hw with cache - force write all entries in a bank */ + HW_KM_TCAM_BANK_RESET, + /* fields */ + HW_KM_RCP_QW0_DYN = FIELD_START_INDEX, + HW_KM_RCP_QW0_OFS, + HW_KM_RCP_QW0_SEL_A, + HW_KM_RCP_QW0_SEL_B, + HW_KM_RCP_QW4_DYN, + HW_KM_RCP_QW4_OFS, + HW_KM_RCP_QW4_SEL_A, + HW_KM_RCP_QW4_SEL_B, + HW_KM_RCP_DW8_DYN, + HW_KM_RCP_DW8_OFS, + HW_KM_RCP_DW8_SEL_A, + HW_KM_RCP_DW8_SEL_B, + HW_KM_RCP_DW10_DYN, + HW_KM_RCP_DW10_OFS, + HW_KM_RCP_DW10_SEL_A, + HW_KM_RCP_DW10_SEL_B, + HW_KM_RCP_SWX_CCH, + HW_KM_RCP_SWX_SEL_A, + HW_KM_RCP_SWX_SEL_B, + HW_KM_RCP_MASK_A, + HW_KM_RCP_MASK_B, + HW_KM_RCP_DUAL, + HW_KM_RCP_PAIRED, + HW_KM_RCP_EL_A, + HW_KM_RCP_EL_B, + HW_KM_RCP_INFO_A, + HW_KM_RCP_INFO_B, + HW_KM_RCP_FTM_A, + HW_KM_RCP_FTM_B, + HW_KM_RCP_BANK_A, + HW_KM_RCP_BANK_B, + HW_KM_RCP_KL_A, + HW_KM_RCP_KL_B, + HW_KM_RCP_KEYWAY_A, + HW_KM_RCP_KEYWAY_B, + HW_KM_RCP_SYNERGY_MODE, + HW_KM_RCP_DW0_B_DYN, + HW_KM_RCP_DW0_B_OFS, + HW_KM_RCP_DW2_B_DYN, + HW_KM_RCP_DW2_B_OFS, + HW_KM_RCP_SW4_B_DYN, + HW_KM_RCP_SW4_B_OFS, + HW_KM_RCP_SW5_B_DYN, + HW_KM_RCP_SW5_B_OFS, + HW_KM_CAM_W0, + HW_KM_CAM_W1, + HW_KM_CAM_W2, + HW_KM_CAM_W3, + HW_KM_CAM_W4, + HW_KM_CAM_W5, + HW_KM_CAM_FT0, + HW_KM_CAM_FT1, + HW_KM_CAM_FT2, + HW_KM_CAM_FT3, + HW_KM_CAM_FT4, + HW_KM_CAM_FT5, + HW_KM_TCAM_T, + HW_KM_TCI_COLOR, + HW_KM_TCI_FT, + HW_KM_TCQ_BANK_MASK, + HW_KM_TCQ_QUAL +}; +bool hw_mod_km_present(struct flow_api_backend_s *be); +int hw_mod_km_alloc(struct flow_api_backend_s *be); +void hw_mod_km_free(struct flow_api_backend_s *be); +int hw_mod_km_reset(struct flow_api_backend_s *be); +int hw_mod_km_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_km_cam_flush(struct flow_api_backend_s *be, int start_bank, int start_record, + int count); +int hw_mod_km_tcam_flush(struct flow_api_backend_s *be, int start_bank, int count); +int hw_mod_km_tcam_set(struct flow_api_backend_s *be, enum hw_km_e field, int bank, int byte, + int byte_val, uint32_t *value_set); +int hw_mod_km_tci_flush(struct flow_api_backend_s *be, int start_bank, int start_record, + int count); +int hw_mod_km_tcq_flush(struct flow_api_backend_s *be, int start_bank, int start_record, + int count); struct flm_func_s { COMMON_FUNC_INFO_S; @@ -483,6 +567,7 @@ struct flow_api_backend_s { /* flow filter FPGA modules */ struct cat_func_s cat; + struct km_func_s km; /* NIC attributes */ unsigned int num_phy_ports; diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 3d394f9bad..e37bb96331 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -50,6 +50,7 @@ sources = files( 'nthw/flow_api/flow_km.c', 'nthw/flow_api/hw_mod/hw_mod_backend.c', 'nthw/flow_api/hw_mod/hw_mod_cat.c', + 'nthw/flow_api/hw_mod/hw_mod_km.c', 'nthw/flow_filter/flow_nthw_cat.c', 'nthw/flow_filter/flow_nthw_csu.c', 'nthw/flow_filter/flow_nthw_flm.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index 3b1d7c5850..c85838519b 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -287,6 +287,9 @@ struct flow_nic_dev *flow_api_create(uint8_t adapter_no, const struct flow_api_b if (init_resource_elements(ndev, RES_KM_FLOW_TYPE, ndev->be.cat.nb_flow_types)) goto err_exit; + if (init_resource_elements(ndev, RES_KM_CATEGORY, ndev->be.km.nb_categories)) + goto err_exit; + if (init_resource_elements(ndev, RES_SLC_LR_RCP, ndev->be.max_categories)) goto err_exit; diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c index 33fb4df126..9d5572f4b2 100644 --- a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c @@ -18,6 +18,7 @@ static const struct { bool (*present)(struct flow_api_backend_s *be); } module[] = { { "CAT", hw_mod_cat_alloc, hw_mod_cat_free, hw_mod_cat_reset, hw_mod_cat_present }, + { "KM", hw_mod_km_alloc, hw_mod_km_free, hw_mod_km_reset, hw_mod_km_present }, }; #define MOD_COUNT (ARRAY_SIZE(module)) diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_km.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_km.c new file mode 100644 index 0000000000..680fcd0af9 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_km.c @@ -0,0 +1,278 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include +#include + +#include "hw_mod_backend.h" + +#define _MOD_ "KM" +#define _VER_ be->km.ver + +#define KM_TCQ_ENTRIES 2048 +#define KM_RCP_MASK_A_SIZE 11 +#define KM_RCP_MASK_D_A_SIZE 12 /* Mask for double size word extractors for DW8/DW10 */ +#define KM_RCP_MASK_B_SIZE 6 + +bool hw_mod_km_present(struct flow_api_backend_s *be) +{ + return be->iface->get_km_present(be->be_dev); +} + +int hw_mod_km_alloc(struct flow_api_backend_s *be) +{ + int nb; + _VER_ = be->iface->get_km_version(be->be_dev); + NT_LOG(DBG, FILTER, "KM MODULE VERSION %i.%i\n", VER_MAJOR(_VER_), VER_MINOR(_VER_)); + + nb = be->iface->get_nb_km_categories(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(km_categories); + + be->km.nb_categories = (uint32_t)nb; + + nb = be->iface->get_nb_km_cam_banks(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(cam_banks); + + be->km.nb_cam_banks = (uint32_t)nb; + + nb = be->iface->get_nb_km_cam_records(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(cam_records); + + be->km.nb_cam_records = (uint32_t)nb; + + nb = be->iface->get_nb_km_cam_record_words(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(cam_record_words); + + be->km.nb_cam_record_words = (uint32_t)nb; + + nb = be->iface->get_nb_km_tcam_banks(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(tcam_banks); + + be->km.nb_tcam_banks = (uint32_t)nb; + + nb = be->iface->get_nb_km_tcam_bank_width(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(tcam_bank_width); + + be->km.nb_tcam_bank_width = (uint32_t)nb; + + switch (_VER_) { + case 7: + be->km.nb_km_rcp_mask_a_word_size = 12; + be->km.nb_km_rcp_mask_b_word_size = 6; + + if (!callocate_mod((struct common_func_s *)&be->km, 5, &be->km.v7.rcp, + be->km.nb_categories, sizeof(struct km_v7_rcp_s), + &be->km.v7.cam, be->km.nb_cam_banks * be->km.nb_cam_records, + sizeof(struct km_v7_cam_s), &be->km.v7.tcam, + be->km.nb_tcam_banks * 4 * 256, sizeof(struct km_v7_tcam_s), + &be->km.v7.tci, + be->km.nb_tcam_banks * be->km.nb_tcam_bank_width, + sizeof(struct km_v7_tci_s), &be->km.v7.tcq, KM_TCQ_ENTRIES, + sizeof(struct km_v7_tcq_s))) + return -1; + + break; + + /* end case 7 */ + default: + return UNSUP_VER; + } + + return 0; +} + +void hw_mod_km_free(struct flow_api_backend_s *be) +{ + if (be->km.base) { + free(be->km.base); + be->km.base = NULL; + } +} + +int hw_mod_km_reset(struct flow_api_backend_s *be) +{ + uint32_t tcam_v_set[3] = { 0x00000000, 0x00000000, 0x00000000 }; + + /* Zero entire cache area */ + zero_module_cache((struct common_func_s *)(&be->km)); + + NT_LOG(DBG, FILTER, "INIT KM RCP\n"); + hw_mod_km_rcp_flush(be, 0, ALL_ENTRIES); + + /* init CAM - all zero */ + NT_LOG(DBG, FILTER, "INIT KM CAM\n"); + hw_mod_km_cam_flush(be, 0, 0, ALL_ENTRIES); + + /* init TCAM - all zero */ + NT_LOG(DBG, FILTER, "INIT KM TCAM\n"); + + for (unsigned int i = 0; i < be->km.nb_tcam_banks; i++) { + /* TCAM entries are cache controlled, + * thus need to hard reset initially to sync cache with HW + */ + hw_mod_km_tcam_set(be, HW_KM_TCAM_BANK_RESET, i, 0, 0, tcam_v_set); + } + + hw_mod_km_tcam_flush(be, 0, ALL_ENTRIES); + + /* init TCI - all zero */ + NT_LOG(DBG, FILTER, "INIT KM TCI\n"); + hw_mod_km_tci_flush(be, 0, 0, ALL_ENTRIES); + + NT_LOG(DBG, FILTER, "INIT KM TCQ\n"); + + for (unsigned int i = 0; i < be->km.nb_tcam_bank_width; i++) + hw_mod_km_tcq_flush(be, 0, i, be->km.nb_tcam_banks); + + return 0; +} + +int hw_mod_km_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->km.nb_categories; + + if ((unsigned int)(start_idx + count) > be->km.nb_categories) + return INDEX_TOO_LARGE; + + return be->iface->km_rcp_flush(be->be_dev, &be->km, start_idx, count); +} + +int hw_mod_km_cam_flush(struct flow_api_backend_s *be, int start_bank, int start_record, int count) +{ + if (count == ALL_ENTRIES) + count = be->km.nb_cam_records * be->km.nb_cam_banks; + + unsigned int end = start_bank * be->km.nb_cam_records + start_record + count; + + if (end > (be->km.nb_cam_banks * be->km.nb_cam_records)) + return INDEX_TOO_LARGE; + + return be->iface->km_cam_flush(be->be_dev, &be->km, start_bank, start_record, count); +} + +int hw_mod_km_tcam_flush(struct flow_api_backend_s *be, int start_bank, int count) +{ + if (count == ALL_ENTRIES) + count = be->km.nb_tcam_banks * 4 * 256; + + else if (count == ALL_BANK_ENTRIES) + count = 4 * 256; + + unsigned int end = start_bank * 4 * 256 + count; + + if (end > (be->km.nb_tcam_banks * 4 * 256)) + return INDEX_TOO_LARGE; + + return be->iface->km_tcam_flush(be->be_dev, &be->km, start_bank, 0, 0, count); +} + +static int hw_mod_km_tcam_mod(struct flow_api_backend_s *be, enum hw_km_e field, int bank, + int byte, int byte_val, uint32_t *value_set, int get) +{ + unsigned int start_index = bank * 4 * 256 + (int)byte * 256 + byte_val; + + if (start_index >= (be->km.nb_tcam_banks * 4 * 256)) + return INDEX_TOO_LARGE; + + switch (_VER_) { + case 7: + switch (field) { + case HW_KM_TCAM_BANK_RESET: + if (get) + return UNSUP_FIELD; + + { + int start_idx = bank * 4 * 256; + + for (int i = 0; i < 4 * 256; i++) { + be->km.v7.tcam[start_idx + i].t[0] = value_set[0]; + be->km.v7.tcam[start_idx + i].t[1] = value_set[1]; + be->km.v7.tcam[start_idx + i].t[2] = value_set[2]; + be->km.v7.tcam[start_idx + i].dirty = 1; + } + } + break; + + case HW_KM_TCAM_T: { + int index = bank * 4 * 256 + byte * 256 + byte_val; + + if (get) { + value_set[0] = be->km.v7.tcam[index].t[0]; + value_set[1] = be->km.v7.tcam[index].t[1]; + value_set[2] = be->km.v7.tcam[index].t[2]; + + } else { + /* only change if any bits has to be changed */ + if (be->km.v7.tcam[index].t[0] != value_set[0] || + be->km.v7.tcam[index].t[1] != value_set[1] || + be->km.v7.tcam[index].t[2] != value_set[2]) { + be->km.v7.tcam[index].t[0] = value_set[0]; + be->km.v7.tcam[index].t[1] = value_set[1]; + be->km.v7.tcam[index].t[2] = value_set[2]; + be->km.v7.tcam[index].dirty = 1; + } + } + } + break; + + default: + return UNSUP_FIELD; + } + + break; + + /* end case 7 */ + default: + return UNSUP_VER; + } + + return 0; +} + +int hw_mod_km_tcam_set(struct flow_api_backend_s *be, enum hw_km_e field, int bank, int byte, + int byte_val, uint32_t *value_set) +{ + return hw_mod_km_tcam_mod(be, field, bank, byte, byte_val, value_set, 0); +} + +int hw_mod_km_tci_flush(struct flow_api_backend_s *be, int start_bank, int start_record, int count) +{ + if (count == ALL_ENTRIES) + count = be->km.nb_tcam_banks * be->km.nb_tcam_bank_width; + + unsigned int end = (int)start_bank * be->km.nb_tcam_bank_width + start_record + count; + + if (end > (be->km.nb_tcam_banks * be->km.nb_tcam_bank_width)) + return INDEX_TOO_LARGE; + + return be->iface->km_tci_flush(be->be_dev, &be->km, start_bank, start_record, count); +} + +int hw_mod_km_tcq_flush(struct flow_api_backend_s *be, int start_bank, int start_record, int count) +{ + if (count == ALL_ENTRIES) + count = be->km.nb_tcam_banks * be->km.nb_tcam_bank_width; + + unsigned int end = (int)start_bank * be->km.nb_tcam_bank_width + start_record + count; + + if (end > (be->km.nb_tcam_banks * be->km.nb_tcam_bank_width)) + return INDEX_TOO_LARGE; + + return be->iface->km_tcq_flush(be->be_dev, &be->km, start_bank, start_record, count); +} diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c index 4efd5aa2f8..a003334a23 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c @@ -667,6 +667,97 @@ static nthw_fpga_register_init_s iic_registers[] = { { IIC_TX_FIFO_OCY, 69, 4, NTHW_FPGA_REG_TYPE_RO, 0, 1, iic_tx_fifo_ocy_fields }, }; +static nthw_fpga_field_init_s km_cam_ctrl_fields[] = { + { KM_CAM_CTRL_ADR, 13, 0, 0x0000 }, + { KM_CAM_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s km_cam_data_fields[] = { + { KM_CAM_DATA_FT0, 4, 192, 0x0000 }, { KM_CAM_DATA_FT1, 4, 196, 0x0000 }, + { KM_CAM_DATA_FT2, 4, 200, 0x0000 }, { KM_CAM_DATA_FT3, 4, 204, 0x0000 }, + { KM_CAM_DATA_FT4, 4, 208, 0x0000 }, { KM_CAM_DATA_FT5, 4, 212, 0x0000 }, + { KM_CAM_DATA_W0, 32, 0, 0x0000 }, { KM_CAM_DATA_W1, 32, 32, 0x0000 }, + { KM_CAM_DATA_W2, 32, 64, 0x0000 }, { KM_CAM_DATA_W3, 32, 96, 0x0000 }, + { KM_CAM_DATA_W4, 32, 128, 0x0000 }, { KM_CAM_DATA_W5, 32, 160, 0x0000 }, +}; + +static nthw_fpga_field_init_s km_rcp_ctrl_fields[] = { + { KM_RCP_CTRL_ADR, 5, 0, 0x0000 }, + { KM_RCP_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s km_rcp_data_fields[] = { + { KM_RCP_DATA_BANK_A, 12, 694, 0x0000 }, { KM_RCP_DATA_BANK_B, 12, 706, 0x0000 }, + { KM_RCP_DATA_DUAL, 1, 651, 0x0000 }, { KM_RCP_DATA_DW0_B_DYN, 5, 729, 0x0000 }, + { KM_RCP_DATA_DW0_B_OFS, 8, 734, 0x0000 }, { KM_RCP_DATA_DW10_DYN, 5, 55, 0x0000 }, + { KM_RCP_DATA_DW10_OFS, 8, 60, 0x0000 }, { KM_RCP_DATA_DW10_SEL_A, 2, 68, 0x0000 }, + { KM_RCP_DATA_DW10_SEL_B, 2, 70, 0x0000 }, { KM_RCP_DATA_DW2_B_DYN, 5, 742, 0x0000 }, + { KM_RCP_DATA_DW2_B_OFS, 8, 747, 0x0000 }, { KM_RCP_DATA_DW8_DYN, 5, 36, 0x0000 }, + { KM_RCP_DATA_DW8_OFS, 8, 41, 0x0000 }, { KM_RCP_DATA_DW8_SEL_A, 3, 49, 0x0000 }, + { KM_RCP_DATA_DW8_SEL_B, 3, 52, 0x0000 }, { KM_RCP_DATA_EL_A, 4, 653, 0x0000 }, + { KM_RCP_DATA_EL_B, 3, 657, 0x0000 }, { KM_RCP_DATA_FTM_A, 16, 662, 0x0000 }, + { KM_RCP_DATA_FTM_B, 16, 678, 0x0000 }, { KM_RCP_DATA_INFO_A, 1, 660, 0x0000 }, + { KM_RCP_DATA_INFO_B, 1, 661, 0x0000 }, { KM_RCP_DATA_KEYWAY_A, 1, 725, 0x0000 }, + { KM_RCP_DATA_KEYWAY_B, 1, 726, 0x0000 }, { KM_RCP_DATA_KL_A, 4, 718, 0x0000 }, + { KM_RCP_DATA_KL_B, 3, 722, 0x0000 }, { KM_RCP_DATA_MASK_A, 384, 75, 0x0000 }, + { KM_RCP_DATA_MASK_B, 192, 459, 0x0000 }, { KM_RCP_DATA_PAIRED, 1, 652, 0x0000 }, + { KM_RCP_DATA_QW0_DYN, 5, 0, 0x0000 }, { KM_RCP_DATA_QW0_OFS, 8, 5, 0x0000 }, + { KM_RCP_DATA_QW0_SEL_A, 3, 13, 0x0000 }, { KM_RCP_DATA_QW0_SEL_B, 3, 16, 0x0000 }, + { KM_RCP_DATA_QW4_DYN, 5, 19, 0x0000 }, { KM_RCP_DATA_QW4_OFS, 8, 24, 0x0000 }, + { KM_RCP_DATA_QW4_SEL_A, 2, 32, 0x0000 }, { KM_RCP_DATA_QW4_SEL_B, 2, 34, 0x0000 }, + { KM_RCP_DATA_SW4_B_DYN, 5, 755, 0x0000 }, { KM_RCP_DATA_SW4_B_OFS, 8, 760, 0x0000 }, + { KM_RCP_DATA_SW5_B_DYN, 5, 768, 0x0000 }, { KM_RCP_DATA_SW5_B_OFS, 8, 773, 0x0000 }, + { KM_RCP_DATA_SWX_CCH, 1, 72, 0x0000 }, { KM_RCP_DATA_SWX_SEL_A, 1, 73, 0x0000 }, + { KM_RCP_DATA_SWX_SEL_B, 1, 74, 0x0000 }, { KM_RCP_DATA_SYNERGY_MODE, 2, 727, 0x0000 }, +}; + +static nthw_fpga_field_init_s km_status_fields[] = { + { KM_STATUS_TCQ_RDY, 1, 0, 0x0000 }, +}; + +static nthw_fpga_field_init_s km_tcam_ctrl_fields[] = { + { KM_TCAM_CTRL_ADR, 14, 0, 0x0000 }, + { KM_TCAM_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s km_tcam_data_fields[] = { + { KM_TCAM_DATA_T, 72, 0, 0x0000 }, +}; + +static nthw_fpga_field_init_s km_tci_ctrl_fields[] = { + { KM_TCI_CTRL_ADR, 10, 0, 0x0000 }, + { KM_TCI_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s km_tci_data_fields[] = { + { KM_TCI_DATA_COLOR, 32, 0, 0x0000 }, + { KM_TCI_DATA_FT, 4, 32, 0x0000 }, +}; + +static nthw_fpga_field_init_s km_tcq_ctrl_fields[] = { + { KM_TCQ_CTRL_ADR, 7, 0, 0x0000 }, + { KM_TCQ_CTRL_CNT, 5, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s km_tcq_data_fields[] = { + { KM_TCQ_DATA_BANK_MASK, 12, 0, 0x0000 }, + { KM_TCQ_DATA_QUAL, 3, 12, 0x0000 }, +}; + +static nthw_fpga_register_init_s km_registers[] = { + { KM_CAM_CTRL, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, km_cam_ctrl_fields }, + { KM_CAM_DATA, 3, 216, NTHW_FPGA_REG_TYPE_WO, 0, 12, km_cam_data_fields }, + { KM_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, km_rcp_ctrl_fields }, + { KM_RCP_DATA, 1, 781, NTHW_FPGA_REG_TYPE_WO, 0, 44, km_rcp_data_fields }, + { KM_STATUS, 10, 1, NTHW_FPGA_REG_TYPE_RO, 0, 1, km_status_fields }, + { KM_TCAM_CTRL, 4, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, km_tcam_ctrl_fields }, + { KM_TCAM_DATA, 5, 72, NTHW_FPGA_REG_TYPE_WO, 0, 1, km_tcam_data_fields }, + { KM_TCI_CTRL, 6, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, km_tci_ctrl_fields }, + { KM_TCI_DATA, 7, 36, NTHW_FPGA_REG_TYPE_WO, 0, 2, km_tci_data_fields }, + { KM_TCQ_CTRL, 8, 21, NTHW_FPGA_REG_TYPE_WO, 0, 2, km_tcq_ctrl_fields }, + { KM_TCQ_DATA, 9, 15, NTHW_FPGA_REG_TYPE_WO, 0, 2, km_tcq_data_fields }, +}; + static nthw_fpga_field_init_s mac_pcs_bad_code_fields[] = { { MAC_PCS_BAD_CODE_CODE_ERR, 16, 0, 0x0000 }, }; @@ -1311,6 +1402,7 @@ static nthw_fpga_module_init_s fpga_modules[] = { { MOD_IIC, 1, MOD_IIC, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 896, 22, iic_registers }, { MOD_IIC, 2, MOD_IIC, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 24832, 22, iic_registers }, { MOD_IIC, 3, MOD_IIC, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 24960, 22, iic_registers }, + { MOD_KM, 0, MOD_KM, 0, 7, NTHW_FPGA_BUS_TYPE_RAB1, 1024, 11, km_registers }, { MOD_MAC_PCS, 0, MOD_MAC_PCS, 0, 2, NTHW_FPGA_BUS_TYPE_RAB2, 10240, 44, mac_pcs_registers @@ -1488,5 +1580,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { }; nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { - 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 16, fpga_modules, + 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 17, fpga_modules, }; From patchwork Fri Oct 4 15:34:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145115 X-Patchwork-Delegate: ferruh.yigit@amd.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 74D2345AAF; Fri, 4 Oct 2024 17:55:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B4A0742EE5; Fri, 4 Oct 2024 17:51:38 +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 192BC427C7 for ; Fri, 4 Oct 2024 17:51:36 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2169.outbound.protection.outlook.com [104.47.17.169]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:51:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=srvw78WIn9fcEBUVe7eFyFM8ktCs6EzjVkCyIENmx7+AyEYxQvB9QAD+QywFfe7tPuCoO99MJw+FmYXJZtQgcipJxniiaWPUzIRnyjMDyanze6PJX+wNIEs9YmHduSY8WJZFiDeotwhkRTqQekg5NMjyCJg1+ORZSmCnHDhnBESTC4HLDII+pckaCS1bJ3TE8urTiFVMnh3QbwZGqiqTQy6FNclt8SOreSi+duA/xe/EeJHThGnmMAKkamBl2SuEW9/8kt/SJCXSD9c0hNSjQYClxBZXxUvVpkYlW/WnjAOxSI3CAIDk7t2rm6SNb1F/qyIs9u4tbeNfjeL7BGeQMA== 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=TFjTG1pMXlBUr2yjqm0tjVeegwA5CRoqE+2euQsjK/k=; b=DJ+0Ow84DXOb3/50eIdu3H/RHpgESbQZwp4vKGoBRsJhO/pkcsFRxKv4brFCRJdiFk0sWCyrYHPdfJsOLtIr6p6p+7x3dVDKkkLozplaeqMKzMyHcXXUBKpIb/JM2+YzwH6tVQHSpDVCxb9HJwvyPjfqTXmVM29L6EeiZJTQIfKST5r1INc38aeRu+GkjaS/EIX3vhEGSPo2QxY2FtVobssJqugx1zNHtkzf+PzmZd2enyKAUhFXwhcKgn5rtGwQ6eUxrlVZHCQLGlquGjkeZrKYkCqCeGEhj3f/yYQwOgcMz4euLS+yFAPzDVfSSlpFKnohznA6iPnngN0Z96hFzA== 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=TFjTG1pMXlBUr2yjqm0tjVeegwA5CRoqE+2euQsjK/k=; b=JvfuPER/Z+XhJdSGLuxR/aXwhOUHOM5exgsowTg5Ie7TOiQP3Hr3PQNb1071R8eYpDI/Ht7ejeK18o5T+zOJC7kWRYr5yy98JRlVz7k/ADXgut0uklx3gIAPuBWjU/KzSTpdn9eRMQz1h0ADJEWWNodb/Ngm2SjhHt+76Sziy0c= Received: from AM0PR10CA0132.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::49) by DBAP190MB0901.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:1b3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.24; Fri, 4 Oct 2024 15:36:24 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::d1) by AM0PR10CA0132.outlook.office365.com (2603:10a6:208:e6::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:24 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:23 +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, Oleksandr Kolomeiets Subject: [PATCH v1 25/31] net/ntnic: add flow matcher (FLM) FPGA module Date: Fri, 4 Oct 2024 17:34:48 +0200 Message-ID: <20241004153551.267935-31-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|DBAP190MB0901:EE_ X-MS-Office365-Filtering-Correlation-Id: 98621ccd-425f-4593-bab2-08dce48a4dcb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: ZdVyJXMaCUpib7tEQ/CLCj1g1c7rYNNIB1VU4509vUThfnvAyaw9eRgwjyT5jcvPZWol51tjtu4ev9gpAdxozyHfEh+qvXtHYM72Admvn9H7U9K96HNzk+RYpJW0nVG3DQd3Dgfe+8D343DzfO51TJvEsewDNHPMLvttQskrOl0+EQlfsj7iQH4hlvoh+QlZj/7BU3aX92OtOQlQPY+hLHYmOroZyrkzuPaupq67B0kIQt4Fjl0TjoK90h9gx6xtCTC8phzruLyjwOf8ARr8w7COBgxI3XQuju9Hpoz/kOB0+BYxw9AwYqhaXIBr4rVwyNAf3DzfQNzm1iq3NpEMlr28mKF9M6nd+/FrDoNvzMa5UX0qF9WgViivgtFSDPaFBeTXFUeHla88l+HJcFCEp1k1s6Tr4Zq8HZ3aUbHkXmSXFT1qeAvo0Qn/wA+gNW5L6VbLZMtwYIg5V5kA16N9b1Cjuu1MvMS7lis0CMW9vXpTBvDMH+4AjRQTczLH/UFQM7E8pk28zui9KDPBJo0aLkPwcbtRhQYrOYE2rFLuCximf9iMDwkpikftGfxrzvihREXjfpriStBZTsyjBTwAIj11hVpePjsP+704kYurpjkjo3plYkYEEksPTxY0QSw+kufF+c9mmuXa4UgiH3/t8aT6VdowXkzX2RzGhdX7MDlZrW8bXjDEWMsbJH87eT2HBjemBqiaDNjW0/k/7a4f/v8I/4pH6MgHmlsdJc4ly6RDiq/47hjGrVB1e3bowzoGSoJmnmejZoR4tRQ7FOj97NaUzI1sC7+XSVdB5+F7pI5QU4ptK4+ch5YDeISKhFp5xf1/Zpv9gI5CKQNkrFiwEFgAUC/00RtZtp7mJ6zu2GC3sBmBo5KNkzpwfhedQnTsr2H7ECIPfAeU8ZrAhkYMNSnlnf0k9N+LeN0510aUcOsGMh4qrpXRTEWIpSe3FhzziAVoWb/iHYg2ZdZHKuEWzRS3axxuJWziKRUYPBTJM1jZOXqvcq5A9ZDXsM3hfmckYtmLuYoPS5PqGPKrHen6xWg9KG0XE4bHjkTRBAyhwmbry2OYv0r5VSRCSOXvdZvi90oTLdxXrdFmTrjOXSzAyKFN91jg73DWEhH3mREBsJmwOTuKI248ClW/jEH4hF5ihi81bVTQccqKnQsWAAWladKoZU2PXH58f0IHqmohjpiT0zLExm96cDGdPXw4pGwR0dkpuLOOoLdNGpPTDB+nHDuruVIZEJsmZmH84ZCtIZ/ASsgaLwam+HDIMQi0ddE+4UjeaV156z+euABRw83tMEGngKmhvBtoopBV0TWrz39nsKzOYLiR/UQlQnQmsj+hD5M8ZIrw/SqfKx8Ipc2jZ/U0IubsxVABKKQDoQnHVhdrfhaq6c5UzRZ3TtRvoU8x 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)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 23w/5HFQrhcPU+i/TVMFrVRWdnWpWju7JpIVTPctaW9V+RiyL4V1oJIEBiCWD9IdMHQYIARTREbrdaUNQ4Bq820oMC5aSI3JnoXVCKAtuHdxl4jBGLSunlNbWEvoGySFtQWmQLWQhOQyl3YY6aClQ+cVcrKfqBlfnk/Qj8LPrt0QPGvKxYPZVkdpz92FlYz58qJ8ZIylxW/OLOMh+f1Tv3ZktaiRfDHF1c5hkGxuOR07G9CwxMX3pJUbUkxiFmVm2jGfrNvhT+baSv3txNDq7kL0TlwKC+2eV3Ql+ss64J3KaocKrpUU+zhS6vmv8kpjBFrY9kF3vnOsKWN1DU1NJ+RxGCyIkAloT3IS+dilbyGK5I4my51G6EdYjfLgovtQYmVTk/xCGefSv2ntBYIEGrSPt616HHEIQrDLstz1Sod9pi6ZDfmGlld4cYoraSJKU822aH2Fm+O/a+51qbNUNT87KsJFvtgEAr89QkXcXOsItxwS5btumQsxl9oHWiko1QQDZ1HH62Yyv7pMk2BrSPk6sVP8Y4B0H0Y3dec9DVggAM3L3l/pxXXVYNR/LoYKXBVOUFc+bBrfNUG5xYcG3zZJ4/U6yH8Y1If2IS+Vri/XLrcofVdHdcMPZJ7zcLawj4XCBUBguW8gDOawyPPwXw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:23.9709 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 98621ccd-425f-4593-bab2-08dce48a4dcb 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAP190MB0901 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057094-311388-7260-10965-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.169 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoamhoYmQGYGUNQ8OcXQIMXAPD ElMdHEEChjappibGhmaWJsnGphamasVBsLALOpo7tCAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan11-98.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: Oleksandr Kolomeiets The Flow Matcher module is a high-performance stateful SDRAM lookup and programming engine which supported exact match lookup in line-rate of up to hundreds of millions of flows. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/include/hw_mod_backend.h | 117 +++++++ drivers/net/ntnic/meson.build | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 6 + .../nthw/flow_api/hw_mod/hw_mod_backend.c | 1 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c | 300 ++++++++++++++++++ 5 files changed, 425 insertions(+) create mode 100644 drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index f40b33a888..3933d4bf53 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -367,6 +367,122 @@ struct flm_func_s { struct hw_mod_flm_v25_s v25; }; }; +enum hw_flm_e { + /* functions */ + HW_FLM_CONTROL_PRESET_ALL = 0, + HW_FLM_RCP_PRESET_ALL, + HW_FLM_FLOW_LRN_DATA, + HW_FLM_FLOW_INF_STA_DATA, + /* Control fields */ + HW_FLM_CONTROL_ENABLE = FIELD_START_INDEX, + HW_FLM_CONTROL_INIT, + HW_FLM_CONTROL_LDS, + HW_FLM_CONTROL_LFS, + HW_FLM_CONTROL_LIS, + HW_FLM_CONTROL_UDS, + HW_FLM_CONTROL_UIS, + HW_FLM_CONTROL_RDS, + HW_FLM_CONTROL_RIS, + HW_FLM_CONTROL_PDS, + HW_FLM_CONTROL_PIS, + HW_FLM_CONTROL_CRCWR, + HW_FLM_CONTROL_CRCRD, + HW_FLM_CONTROL_RBL, + HW_FLM_CONTROL_EAB, + HW_FLM_CONTROL_SPLIT_SDRAM_USAGE, + HW_FLM_STATUS_CALIB_SUCCESS, + HW_FLM_STATUS_CALIB_FAIL, + HW_FLM_STATUS_INITDONE, + HW_FLM_STATUS_IDLE, + HW_FLM_STATUS_CRITICAL, + HW_FLM_STATUS_PANIC, + HW_FLM_STATUS_CRCERR, + HW_FLM_STATUS_EFT_BP, + HW_FLM_STATUS_CACHE_BUFFER_CRITICAL, + HW_FLM_LOAD_BIN, + HW_FLM_LOAD_LPS, + HW_FLM_LOAD_APS, + HW_FLM_PRIO_LIMIT0, + HW_FLM_PRIO_FT0, + HW_FLM_PRIO_LIMIT1, + HW_FLM_PRIO_FT1, + HW_FLM_PRIO_LIMIT2, + HW_FLM_PRIO_FT2, + HW_FLM_PRIO_LIMIT3, + HW_FLM_PRIO_FT3, + HW_FLM_PST_PRESET_ALL, + HW_FLM_PST_BP, + HW_FLM_PST_PP, + HW_FLM_PST_TP, + HW_FLM_RCP_LOOKUP, + HW_FLM_RCP_QW0_DYN, + HW_FLM_RCP_QW0_OFS, + HW_FLM_RCP_QW0_SEL, + HW_FLM_RCP_QW4_DYN, + HW_FLM_RCP_QW4_OFS, + HW_FLM_RCP_SW8_DYN, + HW_FLM_RCP_SW8_OFS, + HW_FLM_RCP_SW8_SEL, + HW_FLM_RCP_SW9_DYN, + HW_FLM_RCP_SW9_OFS, + HW_FLM_RCP_MASK, + HW_FLM_RCP_KID, + HW_FLM_RCP_OPN, + HW_FLM_RCP_IPN, + HW_FLM_RCP_BYT_DYN, + HW_FLM_RCP_BYT_OFS, + HW_FLM_RCP_TXPLM, + HW_FLM_RCP_AUTO_IPV4_MASK, + HW_FLM_BUF_CTRL_LRN_FREE, + HW_FLM_BUF_CTRL_INF_AVAIL, + HW_FLM_BUF_CTRL_STA_AVAIL, + HW_FLM_STAT_LRN_DONE, + HW_FLM_STAT_LRN_IGNORE, + HW_FLM_STAT_LRN_FAIL, + HW_FLM_STAT_UNL_DONE, + HW_FLM_STAT_UNL_IGNORE, + HW_FLM_STAT_REL_DONE, + HW_FLM_STAT_REL_IGNORE, + HW_FLM_STAT_PRB_DONE, + HW_FLM_STAT_PRB_IGNORE, + HW_FLM_STAT_AUL_DONE, + HW_FLM_STAT_AUL_IGNORE, + HW_FLM_STAT_AUL_FAIL, + HW_FLM_STAT_TUL_DONE, + HW_FLM_STAT_FLOWS, + HW_FLM_STAT_STA_DONE, /* module ver 0.20 */ + HW_FLM_STAT_INF_DONE, /* module ver 0.20 */ + HW_FLM_STAT_INF_SKIP, /* module ver 0.20 */ + HW_FLM_STAT_PCK_HIT, /* module ver 0.20 */ + HW_FLM_STAT_PCK_MISS, /* module ver 0.20 */ + HW_FLM_STAT_PCK_UNH, /* module ver 0.20 */ + HW_FLM_STAT_PCK_DIS, /* module ver 0.20 */ + HW_FLM_STAT_CSH_HIT, /* module ver 0.20 */ + HW_FLM_STAT_CSH_MISS, /* module ver 0.20 */ + HW_FLM_STAT_CSH_UNH, /* module ver 0.20 */ + HW_FLM_STAT_CUC_START, /* module ver 0.20 */ + HW_FLM_STAT_CUC_MOVE, /* module ver 0.20 */ + HW_FLM_SCAN_I, /* module ver 0.22 */ + HW_FLM_SCRUB_PRESET_ALL, + HW_FLM_SCRUB_T, /* module ver 0.22 */ + HW_FLM_SCRUB_R, /* module ver 0.24 */ + HW_FLM_SCRUB_DEL, /* module ver 0.24 */ + HW_FLM_SCRUB_INF, /* module ver 0.24 */ +}; + +bool hw_mod_flm_present(struct flow_api_backend_s *be); +int hw_mod_flm_alloc(struct flow_api_backend_s *be); +void hw_mod_flm_free(struct flow_api_backend_s *be); +int hw_mod_flm_reset(struct flow_api_backend_s *be); + +int hw_mod_flm_control_flush(struct flow_api_backend_s *be); +int hw_mod_flm_control_set(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t value); + +int hw_mod_flm_scan_flush(struct flow_api_backend_s *be); + +int hw_mod_flm_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); + +int hw_mod_flm_scrub_flush(struct flow_api_backend_s *be, int start_idx, int count); struct hsh_func_s { COMMON_FUNC_INFO_S; @@ -568,6 +684,7 @@ struct flow_api_backend_s { /* flow filter FPGA modules */ struct cat_func_s cat; struct km_func_s km; + struct flm_func_s flm; /* NIC attributes */ unsigned int num_phy_ports; diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index e37bb96331..9af7e3d813 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -50,6 +50,7 @@ sources = files( 'nthw/flow_api/flow_km.c', 'nthw/flow_api/hw_mod/hw_mod_backend.c', 'nthw/flow_api/hw_mod/hw_mod_cat.c', + 'nthw/flow_api/hw_mod/hw_mod_flm.c', 'nthw/flow_api/hw_mod/hw_mod_km.c', 'nthw/flow_filter/flow_nthw_cat.c', 'nthw/flow_filter/flow_nthw_csu.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index c85838519b..d39bdc9936 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -296,6 +296,12 @@ struct flow_nic_dev *flow_api_create(uint8_t adapter_no, const struct flow_api_b if (init_resource_elements(ndev, RES_FLM_FLOW_TYPE, ndev->be.cat.nb_flow_types)) goto err_exit; + if (init_resource_elements(ndev, RES_FLM_RCP, ndev->be.flm.nb_categories)) + goto err_exit; + + if (init_resource_elements(ndev, RES_SCRUB_RCP, ndev->be.flm.nb_scrub_profiles)) + goto err_exit; + /* may need IPF, COR */ /* check all defined has been initialized */ diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c index 9d5572f4b2..fe66493336 100644 --- a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c @@ -19,6 +19,7 @@ static const struct { } module[] = { { "CAT", hw_mod_cat_alloc, hw_mod_cat_free, hw_mod_cat_reset, hw_mod_cat_present }, { "KM", hw_mod_km_alloc, hw_mod_km_free, hw_mod_km_reset, hw_mod_km_present }, + { "FLM", hw_mod_flm_alloc, hw_mod_flm_free, hw_mod_flm_reset, hw_mod_flm_present }, }; #define MOD_COUNT (ARRAY_SIZE(module)) diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c new file mode 100644 index 0000000000..c52467b575 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c @@ -0,0 +1,300 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include +#include + +#include "hw_mod_backend.h" + +#define _MOD_ "FLM" +#define _VER_ be->flm.ver + +bool hw_mod_flm_present(struct flow_api_backend_s *be) +{ + return be->iface->get_flm_present(be->be_dev); +} + +int hw_mod_flm_alloc(struct flow_api_backend_s *be) +{ + int nb; + _VER_ = be->iface->get_flm_version(be->be_dev); + NT_LOG(DBG, FILTER, "FLM MODULE VERSION %i.%i\n", VER_MAJOR(_VER_), VER_MINOR(_VER_)); + + nb = be->iface->get_nb_flm_categories(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(flm_categories); + + be->flm.nb_categories = (uint32_t)nb; + + nb = be->iface->get_nb_flm_size_mb(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(flm_size_mb); + + be->flm.nb_size_mb = (uint32_t)nb; + + nb = be->iface->get_nb_flm_entry_size(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(flm_entry_size); + + be->flm.nb_entry_size = (uint32_t)nb; + + nb = be->iface->get_nb_flm_variant(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(flm_variant); + + be->flm.nb_variant = (uint32_t)nb; + + nb = be->iface->get_nb_flm_prios(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(flm_prios); + + be->flm.nb_prios = (uint32_t)nb; + + nb = be->iface->get_nb_flm_pst_profiles(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(flm_pst_profiles); + + be->flm.nb_pst_profiles = (uint32_t)nb; + + if (_VER_ >= 22) { + nb = be->iface->get_nb_flm_scrub_profiles(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(flm_scrub_profiles); + + be->flm.nb_scrub_profiles = (uint32_t)nb; + } + + nb = be->iface->get_nb_rpp_per_ps(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(flm_rpp_clock); + + be->flm.nb_rpp_clock_in_ps = (uint32_t)nb; + + nb = be->iface->get_nb_flm_load_aps_max(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(flm_load_aps_max); + + be->flm.nb_load_aps_max = (uint32_t)nb; + + switch (_VER_) { + case 25: + if (!callocate_mod((struct common_func_s *)&be->flm, 38, &be->flm.v25.control, 1, + sizeof(struct flm_v25_control_s), &be->flm.v25.status, 1, + sizeof(struct flm_v25_status_s), &be->flm.v25.load_bin, 1, + sizeof(struct flm_v25_load_bin_s), &be->flm.v25.load_pps, 1, + sizeof(struct flm_v25_load_pps_s), &be->flm.v25.load_lps, 1, + sizeof(struct flm_v25_load_lps_s), &be->flm.v25.load_aps, 1, + sizeof(struct flm_v25_load_aps_s), &be->flm.v25.prio, 1, + sizeof(struct flm_v25_prio_s), &be->flm.v25.pst, + be->flm.nb_pst_profiles, sizeof(struct flm_v25_pst_s), + &be->flm.v25.rcp, be->flm.nb_categories, + sizeof(struct flm_v25_rcp_s), + &be->flm.v25.buf_ctrl, 1, sizeof(struct flm_v25_buf_ctrl_s), + &be->flm.v25.lrn_done, 1, sizeof(struct flm_v25_stat_lrn_done_s), + &be->flm.v25.lrn_ignore, 1, + sizeof(struct flm_v25_stat_lrn_ignore_s), + &be->flm.v25.lrn_fail, 1, sizeof(struct flm_v25_stat_lrn_fail_s), + &be->flm.v25.unl_done, 1, sizeof(struct flm_v25_stat_unl_done_s), + &be->flm.v25.unl_ignore, 1, + sizeof(struct flm_v25_stat_unl_ignore_s), + &be->flm.v25.rel_done, 1, sizeof(struct flm_v25_stat_rel_done_s), + &be->flm.v25.rel_ignore, 1, + sizeof(struct flm_v25_stat_rel_ignore_s), + &be->flm.v25.aul_done, 1, sizeof(struct flm_v25_stat_aul_done_s), + &be->flm.v25.aul_ignore, 1, + sizeof(struct flm_v25_stat_aul_ignore_s), + &be->flm.v25.aul_fail, 1, sizeof(struct flm_v25_stat_aul_fail_s), + &be->flm.v25.tul_done, 1, sizeof(struct flm_v25_stat_tul_done_s), + &be->flm.v25.flows, 1, sizeof(struct flm_v25_stat_flows_s), + &be->flm.v25.prb_done, 1, sizeof(struct flm_v25_stat_prb_done_s), + &be->flm.v25.prb_ignore, 1, + sizeof(struct flm_v25_stat_prb_ignore_s), + &be->flm.v25.sta_done, 1, sizeof(struct flm_v25_stat_sta_done_s), + &be->flm.v25.inf_done, 1, sizeof(struct flm_v25_stat_inf_done_s), + &be->flm.v25.inf_skip, 1, sizeof(struct flm_v25_stat_inf_skip_s), + &be->flm.v25.pck_hit, 1, sizeof(struct flm_v25_stat_pck_hit_s), + &be->flm.v25.pck_miss, 1, sizeof(struct flm_v25_stat_pck_miss_s), + &be->flm.v25.pck_unh, 1, sizeof(struct flm_v25_stat_pck_unh_s), + &be->flm.v25.pck_dis, 1, sizeof(struct flm_v25_stat_pck_dis_s), + &be->flm.v25.csh_hit, 1, sizeof(struct flm_v25_stat_csh_hit_s), + &be->flm.v25.csh_miss, 1, sizeof(struct flm_v25_stat_csh_miss_s), + &be->flm.v25.csh_unh, 1, sizeof(struct flm_v25_stat_csh_unh_s), + &be->flm.v25.cuc_start, 1, sizeof(struct flm_v25_stat_cuc_start_s), + &be->flm.v25.cuc_move, 1, sizeof(struct flm_v25_stat_cuc_move_s), + &be->flm.v25.scan, 1, sizeof(struct flm_v25_scan_s), + &be->flm.v25.scrub, be->flm.nb_scrub_profiles, + sizeof(struct flm_v25_scrub_s))) + return -1; + + break; + + default: + return UNSUP_VER; + } + + return 0; +} + +void hw_mod_flm_free(struct flow_api_backend_s *be) +{ + if (be->flm.base) { + free(be->flm.base); + be->flm.base = NULL; + } +} + +int hw_mod_flm_reset(struct flow_api_backend_s *be) +{ + /* Zero entire cache area */ + zero_module_cache((struct common_func_s *)(&be->flm)); + + NT_LOG(DBG, FILTER, "INIT FLM\n"); + hw_mod_flm_control_set(be, HW_FLM_CONTROL_SPLIT_SDRAM_USAGE, 0x10); + + hw_mod_flm_control_flush(be); + hw_mod_flm_scrub_flush(be, 0, ALL_ENTRIES); + hw_mod_flm_scan_flush(be); + hw_mod_flm_rcp_flush(be, 0, ALL_ENTRIES); + + return 0; +} + +int hw_mod_flm_control_flush(struct flow_api_backend_s *be) +{ + return be->iface->flm_control_flush(be->be_dev, &be->flm); +} + +static int hw_mod_flm_control_mod(struct flow_api_backend_s *be, enum hw_flm_e field, + uint32_t *value, int get) +{ + switch (_VER_) { + case 25: + switch (field) { + case HW_FLM_CONTROL_PRESET_ALL: + if (get) + return UNSUP_FIELD; + + memset(be->flm.v25.control, (uint8_t)*value, + sizeof(struct flm_v25_control_s)); + break; + + case HW_FLM_CONTROL_ENABLE: + GET_SET(be->flm.v25.control->enable, value); + break; + + case HW_FLM_CONTROL_INIT: + GET_SET(be->flm.v25.control->init, value); + break; + + case HW_FLM_CONTROL_LDS: + GET_SET(be->flm.v25.control->lds, value); + break; + + case HW_FLM_CONTROL_LFS: + GET_SET(be->flm.v25.control->lfs, value); + break; + + case HW_FLM_CONTROL_LIS: + GET_SET(be->flm.v25.control->lis, value); + break; + + case HW_FLM_CONTROL_UDS: + GET_SET(be->flm.v25.control->uds, value); + break; + + case HW_FLM_CONTROL_UIS: + GET_SET(be->flm.v25.control->uis, value); + break; + + case HW_FLM_CONTROL_RDS: + GET_SET(be->flm.v25.control->rds, value); + break; + + case HW_FLM_CONTROL_RIS: + GET_SET(be->flm.v25.control->ris, value); + break; + + case HW_FLM_CONTROL_PDS: + GET_SET(be->flm.v25.control->pds, value); + break; + + case HW_FLM_CONTROL_PIS: + GET_SET(be->flm.v25.control->pis, value); + break; + + case HW_FLM_CONTROL_CRCWR: + GET_SET(be->flm.v25.control->crcwr, value); + break; + + case HW_FLM_CONTROL_CRCRD: + GET_SET(be->flm.v25.control->crcrd, value); + break; + + case HW_FLM_CONTROL_RBL: + GET_SET(be->flm.v25.control->rbl, value); + break; + + case HW_FLM_CONTROL_EAB: + GET_SET(be->flm.v25.control->eab, value); + break; + + case HW_FLM_CONTROL_SPLIT_SDRAM_USAGE: + GET_SET(be->flm.v25.control->split_sdram_usage, value); + break; + + default: + return UNSUP_FIELD; + } + + break; + + default: + return UNSUP_VER; + } + + return 0; +} + +int hw_mod_flm_control_set(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t value) +{ + return hw_mod_flm_control_mod(be, field, &value, 0); +} + +int hw_mod_flm_scan_flush(struct flow_api_backend_s *be) +{ + return be->iface->flm_scan_flush(be->be_dev, &be->flm); +} + +int hw_mod_flm_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->flm.nb_categories; + + if ((unsigned int)(start_idx + count) > be->flm.nb_categories) + return INDEX_TOO_LARGE; + + return be->iface->flm_rcp_flush(be->be_dev, &be->flm, start_idx, count); +} + +int hw_mod_flm_scrub_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->flm.nb_scrub_profiles; + + if ((unsigned int)(start_idx + count) > be->flm.nb_scrub_profiles) + return INDEX_TOO_LARGE; + + return be->iface->flm_scrub_flush(be->be_dev, &be->flm, start_idx, count); +} From patchwork Fri Oct 4 15:34:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145089 X-Patchwork-Delegate: ferruh.yigit@amd.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 03BF145AAF; Fri, 4 Oct 2024 17:50:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B0D93427B0; Fri, 4 Oct 2024 17:50:46 +0200 (CEST) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id 3BD76427D2 for ; Fri, 4 Oct 2024 17:50:44 +0200 (CEST) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03lp2170.outbound.protection.outlook.com [104.47.51.170]) by mx-outbound22-159.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:50:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FN65CiGXZIlPeVoN4cX34ozhulm7WK55JPjZp44b2vitgX4NaC1tTW4sWG8vlNe2S9F5tDfQTfiMpoByfqZ9gcWeZqsBb5SIbrT4tLPmqNu/t/PBhOWl0BY+Hrf0rny/A3tT3RrV1Mv8dU0Ej2LAEGy2o/OOMuwD8bI2r7OTWYFaQFVkoNV0a60y2Jq7soni2MULsZ5VwoPK4eTBc2HDI1RdMUa/az06z9mWCXVFL10DuHUwVHZ4pEkQVZar+yXv18pO74KxzAozmVqtdHtXdHtwUDcLfee2bIDic8089wBnBsg5DKrGoRRMYliAaV3Fd4iOeGYHZmIYBHJhjnfvow== 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=m7EsbddnTEzfze8bceOS5giOxKTQObkS2bk7iPi+jnc=; b=SAiK4ngWWnjZFa+UOEP0RoICIXb45TtrG+rQ9rDd/u1/xoZ9amdZyIanMHWA9jdI4FXqJLe/hVYIVCiXbG//PVymrtR4geSKCLRjuarsNj+elyRPoFJSWO4IxTAfe2yg3u03IhgjSjwzcNrsitszPLf537NR8vgo4vKeP+9UbwGX7lPYwpqGAr092dEPPOnFyRSatzxbP5SE2rF36nIxtY6yyn6/MQWXnvOWS8HguhoFwVsy+cqAJ8E1HBhAmcyVpV+oMHqmOFxlUQZgnPaYjbF9/FatUEteQixLG8hfPPkvmwkeoQeLyiTjGFH83JRlJYVtvk5eiTd+Rv8QoWVOAA== 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=m7EsbddnTEzfze8bceOS5giOxKTQObkS2bk7iPi+jnc=; b=CnRwrTjrCM4ZHeiZjQ8mvkfpQz3AbqPuyv0L2S+VOn3+txIYbJnuZSRCZGoKimGeCadtMqnzWVwFJQAgQaO0r5fgrWkjGoDHPTBlHhQ3R6Qr3w/FGvgxl1Pan9LaqkGtqQNDipmobPcXzhTZ6f/Gx6ISE5rasPwcyXg/CWIIA24= Received: from AM0PR10CA0108.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::25) by DBAP190MB0824.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:1a9::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 15:36:24 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::e4) by AM0PR10CA0108.outlook.office365.com (2603:10a6:208:e6::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.19 via Frontend Transport; Fri, 4 Oct 2024 15:36:24 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:24 +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, Oleksandr Kolomeiets Subject: [PATCH v1 26/31] net/ntnic: add hasher (HSH) FPGA module Date: Fri, 4 Oct 2024 17:34:49 +0200 Message-ID: <20241004153551.267935-32-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|DBAP190MB0824:EE_ X-MS-Office365-Filtering-Correlation-Id: 43b53cde-174a-41ef-18cd-08dce48a4e2b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: f0Uj4BK44/gTkyJCooi5ret+XqA0vcpvMxwPpAnxFOxpZcnSM/vqvAlh9qiFi441BeuPio+e1Ud8lxllNzx+ct3AIAoxvZ19vGoWyvVU8gvtcf1Tz8oDpJdqjD1Z7AN5MzkPLmzjPXX2g2BWTAUOfIwb210JPZ7X3JMrju7w7D8Yg1cHbSzlbjzKZibgS4LWeXHK7NUJLFZksJAs1V/x+bcaDiV3AF6hrya1PpOxwZML4qM59yyMIcGfikQXbH7I98qQ6ZTxJoW3t08Th3jmYptEpHinecFr59t3BhCELY6ERF4841mLdo6uVRHOWKzAqoBVbqDh7pjNJsRVogXEvvzF5GcWXRXxMd1uY9u7AUNB3QwNO6jvcQOjvW173lTli+IZnADWkOH8F687gTEsmDT+sbO7pEN/ytzm45mpIre4DSmIj1G6nnBVICVbP9D85dvoZlYJUY4SJ1gCfw5NMuDQYU+bY37s8FyzOZH7hn8HX0fNWEhApbdhV4OOxfCIpntDHMnwxq/o98KYfvwRQgXlQpdXHEthL+Yh8qa+hchayZ9pQSKUi8kXmYQkSxVmvX4QhLruxfv0wEzqv/8gpn2Ux9czb4oxc8FHiOixKHV7vQPSFSWaCvR/LHZu3hDWsrBzQqisRqHckGP6EHcOSiJ1mjAAgZjswcOzKDq5IgL2ZuBX0j7KhWIcwOTEm74SzBMpCw9VpT6AD/dkwPnrRkweUHBv2zRAkWYg4D1LY1/baTJdY1CHAdo0PptSjYGCXJAGZaKo7Qe/Qu/ikf9GpYDvaqSy1KPq+uHzjWKX5tvTmESQ8tmP8T6M1WZPhPv2QhJGjgGYCIAsKcWuUxcd+hOEPWDxuWgQ1Uhl6eFeVh11uauChCvTTGWNJZJk2la611vFK0OO+noX84H+N7w/0e5Ge9dfdzUUvez3oKHeLcopoFFrhpzzKQOsNrKhmBbkhM5+3W8aaOIAyoEqQEOg29qwTfM9iIlQiFM9nkSIwd8lFUO1dNQlUSuQUQmQ44/mByM/sIHxRX+grSbuS+jV3wr0gpShKWcVTedLXnSDa+0iXkeaAS8GKlgFnpwefDdA6WsmlcXW04DqSX4B2wS7Ol6czmkJE9yhc1C2yu9z+TO0D/ZMY8QMEoJEKOSKfJ0bWnTynJ79fYtiGN/9BQVAoQDvAc2BesBTXvoONzG7mphhyRFKupQfI9Dnrbyj6MWlLIkQ7P+XqaSPKsh0HgzsqItHcM33wPc0nQqdAY2r+V/1i9o1oyZPtomT1o2/2lLCxv45p/5IsoredCljYyqskdgcqmMU3122qUqKrVWeCOqyIyq06gaKyPNmvMKyVv//BOHNJXba2D/qI+81QOxDHc9wDuKwhm0HAHESBhRuqEXthIiVi4UY7/gh2+ewW4C2 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)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: lwTIN9QHeuc7SsJbOxpXDZW04yHOkh/UizP3ceKS0fNWyEqzub5KuyH0JjiW9Bec7wVJ0ZuWB5gGlb5TrFerFqIGQIGkzQKALcaVw5ds7UPTB9q7iCSJ14d/HPTCz/C8/x6F9NOaQP9Bo0Olj0k7BALbZEkneW7VS+wEmDR/yIH7RIk/8S62LYV6r0JkaFB4d1zXJJDLrMOzuIoXKEODXcvs3TsABRCOojEb+quPKhfDpGlTUcxyju6uiXerqC97jghJZXVkRW1oARCUnv3aEp4W4Yi3EAdlUSfTWpZRwAFBgL4VVe5ChUJ6yN+Uo+gtrL/z9lT0MuxSr0llStpHNZB1bszCimXIQzQFggwlWkBdrLplGXsRCh2LMj7AFRr5NXnJVW+F8gZEoADS03hKGcTJmZPmHm/Zpdo8qw7B86YJdJya4zfhjeUpDLIA6eznVK7MX4JS51hc4ldA6+6jf+Qy30BUiPi36k1coKWudGW134jgMJLYK+ISfSc0AqkJ2qaESved2w5IT0ZPBf4u4x3S6PDI/byTbaI+KhoOzVIA2JDgLBS4qwxGW9bpCr/ZQNU5Y+lR6Gm1hHtBjQphce1VEC6REF47giV1rDe2g+fZPct1KHx5rDY00DfiDaIG/9DgbUVDHZgXyjJLZaZ/YA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:24.5959 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43b53cde-174a-41ef-18cd-08dce48a4e2b 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAP190MB0824 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057043-305791-12642-36002-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.51.170 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVpYGloZAVgZQMNHIKNU4NcnCMD XRzNQ01Twl0dTCOMnAMNnMMik5OTFRqTYWADt/UBNBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan16-215.eu-central-1b.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: Oleksandr Kolomeiets The Hasher module calculates a configurable hash value to be used internally by the FPGA. The module support both Toeplitz and NT-hash. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/include/hw_mod_backend.h | 36 ++++++++ drivers/net/ntnic/meson.build | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 3 + .../nthw/flow_api/hw_mod/hw_mod_backend.c | 1 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_hsh.c | 84 +++++++++++++++++++ .../supported/nthw_fpga_9563_055_049_0000.c | 39 ++++++++- 6 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_hsh.c diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index 3933d4bf53..6bf651272f 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -493,6 +493,41 @@ struct hsh_func_s { struct hw_mod_hsh_v5_s v5; }; }; +enum hw_hsh_e { + /* functions */ + HW_HSH_RCP_PRESET_ALL = 0, + HW_HSH_RCP_COMPARE, + HW_HSH_RCP_FIND, + /* fields */ + HW_HSH_RCP_LOAD_DIST_TYPE = FIELD_START_INDEX, + HW_HSH_RCP_MAC_PORT_MASK, + HW_HSH_RCP_SORT, + HW_HSH_RCP_QW0_PE, + HW_HSH_RCP_QW0_OFS, + HW_HSH_RCP_QW4_PE, + HW_HSH_RCP_QW4_OFS, + HW_HSH_RCP_W8_PE, + HW_HSH_RCP_W8_OFS, + HW_HSH_RCP_W8_SORT, + HW_HSH_RCP_W9_PE, + HW_HSH_RCP_W9_OFS, + HW_HSH_RCP_W9_SORT, + HW_HSH_RCP_W9_P, + HW_HSH_RCP_P_MASK, + HW_HSH_RCP_WORD_MASK, + HW_HSH_RCP_SEED, + HW_HSH_RCP_TNL_P, + HW_HSH_RCP_HSH_VALID, + HW_HSH_RCP_HSH_TYPE, + HW_HSH_RCP_TOEPLITZ, + HW_HSH_RCP_K, + HW_HSH_RCP_AUTO_IPV4_MASK +}; +bool hw_mod_hsh_present(struct flow_api_backend_s *be); +int hw_mod_hsh_alloc(struct flow_api_backend_s *be); +void hw_mod_hsh_free(struct flow_api_backend_s *be); +int hw_mod_hsh_reset(struct flow_api_backend_s *be); +int hw_mod_hsh_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); struct qsl_func_s { COMMON_FUNC_INFO_S; @@ -685,6 +720,7 @@ struct flow_api_backend_s { struct cat_func_s cat; struct km_func_s km; struct flm_func_s flm; + struct hsh_func_s hsh; /* NIC attributes */ unsigned int num_phy_ports; diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 9af7e3d813..18aafc57f0 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -51,6 +51,7 @@ sources = files( 'nthw/flow_api/hw_mod/hw_mod_backend.c', 'nthw/flow_api/hw_mod/hw_mod_cat.c', 'nthw/flow_api/hw_mod/hw_mod_flm.c', + 'nthw/flow_api/hw_mod/hw_mod_hsh.c', 'nthw/flow_api/hw_mod/hw_mod_km.c', 'nthw/flow_filter/flow_nthw_cat.c', 'nthw/flow_filter/flow_nthw_csu.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index d39bdc9936..b43c8fef1a 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -290,6 +290,9 @@ struct flow_nic_dev *flow_api_create(uint8_t adapter_no, const struct flow_api_b if (init_resource_elements(ndev, RES_KM_CATEGORY, ndev->be.km.nb_categories)) goto err_exit; + if (init_resource_elements(ndev, RES_HSH_RCP, ndev->be.hsh.nb_rcp)) + goto err_exit; + if (init_resource_elements(ndev, RES_SLC_LR_RCP, ndev->be.max_categories)) goto err_exit; diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c index fe66493336..3ccc14c4ce 100644 --- a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c @@ -20,6 +20,7 @@ static const struct { { "CAT", hw_mod_cat_alloc, hw_mod_cat_free, hw_mod_cat_reset, hw_mod_cat_present }, { "KM", hw_mod_km_alloc, hw_mod_km_free, hw_mod_km_reset, hw_mod_km_present }, { "FLM", hw_mod_flm_alloc, hw_mod_flm_free, hw_mod_flm_reset, hw_mod_flm_present }, + { "HSH", hw_mod_hsh_alloc, hw_mod_hsh_free, hw_mod_hsh_reset, hw_mod_hsh_present }, }; #define MOD_COUNT (ARRAY_SIZE(module)) diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_hsh.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_hsh.c new file mode 100644 index 0000000000..77dfbb5374 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_hsh.c @@ -0,0 +1,84 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include +#include + +#include "hw_mod_backend.h" + +#define _MOD_ "HSH" +#define _VER_ be->hsh.ver + +bool hw_mod_hsh_present(struct flow_api_backend_s *be) +{ + return be->iface->get_hsh_present(be->be_dev); +} + +int hw_mod_hsh_alloc(struct flow_api_backend_s *be) +{ + int nb; + _VER_ = be->iface->get_hsh_version(be->be_dev); + NT_LOG(DBG, FILTER, "HSH MODULE VERSION %i.%i\n", VER_MAJOR(_VER_), VER_MINOR(_VER_)); + + /* detect number of HSH categories supported by FPGA */ + nb = be->iface->get_nb_hsh_categories(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(hsh_categories); + + be->hsh.nb_rcp = (uint32_t)nb; + + /* detect if Toeplitz hashing function is supported by FPGA */ + nb = be->iface->get_nb_hsh_toeplitz(be->be_dev); + + if (nb < 0) + return COUNT_ERROR(hsh_toeplitz); + + be->hsh.toeplitz = (uint32_t)nb; + + switch (_VER_) { + case 5: + if (!callocate_mod((struct common_func_s *)&be->hsh, 1, &be->hsh.v5.rcp, + be->hsh.nb_rcp, sizeof(struct hsh_v5_rcp_s))) + return -1; + + break; + + /* end case 5 */ + default: + return UNSUP_VER; + } + + return 0; +} + +void hw_mod_hsh_free(struct flow_api_backend_s *be) +{ + if (be->hsh.base) { + free(be->hsh.base); + be->hsh.base = NULL; + } +} + +int hw_mod_hsh_reset(struct flow_api_backend_s *be) +{ + /* Zero entire cache area */ + zero_module_cache((struct common_func_s *)(&be->hsh)); + + NT_LOG(DBG, FILTER, "INIT HSH RCP\n"); + return hw_mod_hsh_rcp_flush(be, 0, be->hsh.nb_rcp); +} + +int hw_mod_hsh_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->hsh.nb_rcp; + + if ((start_idx + count) > (int)be->hsh.nb_rcp) + return INDEX_TOO_LARGE; + + return be->iface->hsh_rcp_flush(be->be_dev, &be->hsh, start_idx, count); +} diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c index a003334a23..4317da8094 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c @@ -544,6 +544,42 @@ static nthw_fpga_register_init_s hif_registers[] = { { HIF_UUID3, 176, 32, NTHW_FPGA_REG_TYPE_RO, 462142918, 1, hif_uuid3_fields }, }; +static nthw_fpga_field_init_s hsh_rcp_ctrl_fields[] = { + { HSH_RCP_CTRL_ADR, 4, 0, 0x0000 }, + { HSH_RCP_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s hsh_rcp_data_fields[] = { + { HSH_RCP_DATA_AUTO_IPV4_MASK, 1, 742, 0x0000 }, + { HSH_RCP_DATA_HSH_TYPE, 5, 416, 0x0000 }, + { HSH_RCP_DATA_HSH_VALID, 1, 415, 0x0000 }, + { HSH_RCP_DATA_K, 320, 422, 0x0000 }, + { HSH_RCP_DATA_LOAD_DIST_TYPE, 2, 0, 0x0000 }, + { HSH_RCP_DATA_MAC_PORT_MASK, 2, 2, 0x0000 }, + { HSH_RCP_DATA_P_MASK, 1, 61, 0x0000 }, + { HSH_RCP_DATA_QW0_OFS, 8, 11, 0x0000 }, + { HSH_RCP_DATA_QW0_PE, 5, 6, 0x0000 }, + { HSH_RCP_DATA_QW4_OFS, 8, 24, 0x0000 }, + { HSH_RCP_DATA_QW4_PE, 5, 19, 0x0000 }, + { HSH_RCP_DATA_SEED, 32, 382, 0x0000 }, + { HSH_RCP_DATA_SORT, 2, 4, 0x0000 }, + { HSH_RCP_DATA_TNL_P, 1, 414, 0x0000 }, + { HSH_RCP_DATA_TOEPLITZ, 1, 421, 0x0000 }, + { HSH_RCP_DATA_W8_OFS, 8, 37, 0x0000 }, + { HSH_RCP_DATA_W8_PE, 5, 32, 0x0000 }, + { HSH_RCP_DATA_W8_SORT, 1, 45, 0x0000 }, + { HSH_RCP_DATA_W9_OFS, 8, 51, 0x0000 }, + { HSH_RCP_DATA_W9_P, 1, 60, 0x0000 }, + { HSH_RCP_DATA_W9_PE, 5, 46, 0x0000 }, + { HSH_RCP_DATA_W9_SORT, 1, 59, 0x0000 }, + { HSH_RCP_DATA_WORD_MASK, 320, 62, 0x0000 }, +}; + +static nthw_fpga_register_init_s hsh_registers[] = { + { HSH_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, hsh_rcp_ctrl_fields }, + { HSH_RCP_DATA, 1, 743, NTHW_FPGA_REG_TYPE_WO, 0, 23, hsh_rcp_data_fields }, +}; + static nthw_fpga_field_init_s iic_adr_fields[] = { { IIC_ADR_SLV_ADR, 7, 1, 0 }, }; @@ -1398,6 +1434,7 @@ static nthw_fpga_module_init_s fpga_modules[] = { gpio_phy_registers }, { MOD_HIF, 0, MOD_HIF, 0, 0, NTHW_FPGA_BUS_TYPE_PCI, 0, 18, hif_registers }, + { MOD_HSH, 0, MOD_HSH, 0, 5, NTHW_FPGA_BUS_TYPE_RAB1, 1536, 2, hsh_registers }, { MOD_IIC, 0, MOD_IIC, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 768, 22, iic_registers }, { MOD_IIC, 1, MOD_IIC, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 896, 22, iic_registers }, { MOD_IIC, 2, MOD_IIC, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 24832, 22, iic_registers }, @@ -1580,5 +1617,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { }; nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { - 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 17, fpga_modules, + 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 18, fpga_modules, }; From patchwork Fri Oct 4 15:34:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145116 X-Patchwork-Delegate: ferruh.yigit@amd.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 BD72D45AAF; Fri, 4 Oct 2024 17:55:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E17E042EE3; Fri, 4 Oct 2024 17:51:39 +0200 (CEST) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id 8211042E24 for ; Fri, 4 Oct 2024 17:51:37 +0200 (CEST) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02lp2113.outbound.protection.outlook.com [104.47.11.113]) by mx-outbound22-159.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:51:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=g8m+Mzm2HorRimqPhIKhfOMaHeu5fZsf1RyXNAQYyZkfKkhyzmeKsu9gFRSYA5iUgKyHwt/ZMNbxdagl4PEmO+YpCL0e1rjjUaSSZjtJv0HNmXVtcpT+lz6IT4LsigglP0cX7+ZuEOgC5kmhRG+MVPnjIgyD22EGqwoEuGPX0kBVoNKGNxa0gyQXywzHNRsJudGY9IHqXUBJBfLazp0TytbruAbhPb6qJ9SxvAop0mUhzO+YGCksuXgkhyfP5l8NZJPvvynJGngokNBnKuj/jbOkZTEwBHf/wnVEL+v5emv9qxhSw32WltFSSl5hcomnlCWRK1iz7c33CHzpU9XpMw== 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=B8u/DwR1WhibYc5POCYyGm2FQ55vYKNswWFMUXYm5Ew=; b=uH7J3PukXp5dRHamGAQqk3t/jIdHRugzAa3TIbm3H8DKUeE4g2E0F4/N88BH2p7hNcWYYgdN4tjt6UtSdEjtAeETvNt6ejd4jmM7Ql23Auux/gEDNf7y4jOG6U5ljUlcg/J5UrYQSkul7CA5Js4tv0XR0483h0TdZwQX6DD8M7nLy9watKXs4cHVVlHtAaNW4Gr8BM/1PlfnjEuKuf0BGrmj0W5mf3b5nWLH/kUhmgQpAHAom6Ry0TVfSIDr3ln0hSIgQtx+lCIc1CLRAfbYpVedC0+iVhd5iOnL2EmWGSC5wlIH2WnyhY4YEuCyH+NI0Xg17MRTftPh3mYOEEV4Gg== 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=B8u/DwR1WhibYc5POCYyGm2FQ55vYKNswWFMUXYm5Ew=; b=flV6RaQApD7McNqC7sxyyEbRDM+HKsx/xw3zhGhFV/da//ZgAQGaQOkfDPmzf+DgdqVLzVYMgWN5ulWl1oc64yhBdF/zZAmN4H+rBsN/av3MROhxUIH8YJchg9SRgBLSo3VjjCLsrdCaeovZnxH7fyA/pwvwPp7XJijAEOVRtLM= Received: from AM0PR10CA0132.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::49) by DB9P190MB1051.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:22d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 15:36:25 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::d1) by AM0PR10CA0132.outlook.office365.com (2603:10a6:208:e6::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:25 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:25 +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, Oleksandr Kolomeiets Subject: [PATCH v1 27/31] net/ntnic: add queue select (QSL) FPGA module Date: Fri, 4 Oct 2024 17:34:50 +0200 Message-ID: <20241004153551.267935-33-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|DB9P190MB1051:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f91e313-df43-4828-9e2c-08dce48a4e91 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: rzj7SvvFteEipHT6S7VJfQy5dreVAd72FoTOhSZ7tgoglZqzQ+oxT4LkwzN71DdFCgSj81P68Er6ujI0KepR+fxANKYoiEImNYskewBpjrofWXN05fZ1aAqx+hFrQwHm2V7dzBXaSoU0yu9KojOMku0T9WJcUXRrCc4mbNVVj/tI6wo3iZ89lSvREMXlyLEwUSOhik1AWJg4eJrsM/y6Fjfa4t0rFjhLzey8dQ2HJPW739dD3TWktPD606DnIw4YLAxJIZkWv93vMCNMdnYB4EFeKMTzqFp09wwJ59rUN+oxUk1PhPUfsIyim+tw2iSnWbRzDK0eiW7uJC1p8KH1TtaG93n5nv1sE5x7TC3AGaAC6CTjjJFRSEWmS+uibUtl4Ra/6ImHthif6p3i8QbsxwMWvUENs1Aj067YRHjTxvRBw30Ewnbv1tKyjijuCYmqFcV70cxEfe57r8Wdw29o2RvbbGmzl7IQIhxXqF0rP8H1eTljufvSJxJh+GypwJ1GPBh4yvb/84/t6fJmr/uROnuEopixPlhljhtP+D5ztqMKVevLMEP/XvAs8vJTylk+95c9OhHueBw/0wgBSUfoPqoc8+r7/+lhh59jIiEHM1PHZjTNv5fQvaFvkFZPY2oK55Cqptm/YZ9jdn+0OH13rGpAUIn1FUIvUWJRGGUQqmGhVOljRH2kfeVc4HMHIPa96zD53wcARsyQmmRL+uD352vq596IfwK0gC5It9p10bauVFz8COOXQvkuM8FDRIWj3tk4T0Pyrj3DpE9JmZFZdRTN1pTpMlz2V8f3+5kl24xzFb9Kmyah9cMjqZshNOiAN0tmLBCzlaKtkDKAZxi1hfTa+IdL4VbJ+9bO9hcG/S7G2KPT8TVYeZmiMfrpXWSnLvDZDgsNYqjYomdVNOiIQqCgfqk9SkOWFeZ3XtRtp3Qz0abUq2GM4624KsCQ22ikAULfWxDca1peH9j5so6PQlHOKnwpEzqR088YSzLk8h7+IzyOkuDKub0lbsPEnQKIVTYHVHafZmYm5Q2L7TjR5sDTQ6MU3Z+rkmbMixPdjG0b9Sn1EPyxeswiYZHy9O4W4dokayASr/LixZG4bN8u0kaNMP1INaZHlkqV8xsfa5DeYfYFMW7FT/GI3aojbTlgVB27E9LVykvIb320nDcHId4jNVOwHkSequNurlSdE7rqTvnQKPD5Sjpis6B+s6PEtYOrXfMsBeJnDj0xnQfZiH/ke4ySLE3Hk8kqmscyXxCH2hBNa9wRNscqPFahfnsv6Sn5j9orCh9aZkdfTenSUlSMtq7ZNGKn6+jHq+3yZLK2ZWIWNesmtpnOz0IWW9r/FzXOkqoqIT8YRDoQ/lH7yTTHAVwDQY4pcb2gvTivhedC7Uc2Q7kTzhz0ijfDJPOw 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)(82310400026)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 9bFKVKiJqw/AIcT9y25eUVqT7RiIgqBl9v5JQo4CsmFO7yr/iVSulJBEFBUrmEsAytRdolyOgCwvsHBxlRen7qLWpzW7JDU6tcORucbSc/9c2vLp+0yBF6sUUhHByNikO7JbhOqrBaTWUwErcklJVjYsCYgSdiq5Q6FuFvkyJyT0t83GJK6Nxa3aaJyIfe6rS37S8cMCw2sjI8d5ds5zgLCwztuDxUoY+ah/eZ8MZyhccvWSn4y/Aupwdk2Wc3oatWF3X/9iqSwUEwGQnqsaEexX2n1RXuZKW8Fof3utBOfHvInAF6p1Bhivw0hOwJeJXbr2o4f64cCv8QxcrV6pWXgyc0OeyMpulx2uqi8xYew54CSsBM61Kto5UtFB7hZSZrPlaRnN9/RLt5VWKyt7tDv4wVVFr1KB2p576VvOYoljhWNWWyAJotSj4U0UOlDxa2901/v7SeFoWCbDnKUNXY8uexUoS/uKeUrMG8l0ST2tC/Kd+ktW3UpUolE9iT/QHl0JK3uPdF33iO2ey+yqUcxubuWzVUE8Tl8Amam/vHeu629aAlVNCQyH+cAfSs8sKoOsc6DUbWVlVYgSFwcMi5s7A55YuQA8Y6Tt1uX86ugWouUFXYxTHPqnRxhZJaecqEv0E4o7vD/oDn9A7sa1Rg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:25.2834 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3f91e313-df43-4828-9e2c-08dce48a4e91 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9P190MB1051 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057096-305791-12647-36049-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.11.113 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZGlibmQGYGUDTR3MDEJNE8JS 051cAyLc3IwMjcyMLcAIQTLS0tLZRqYwHDpJ8aQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan14-233.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: Oleksandr Kolomeiets The Queue Selector module directs packets to a given destination which includes host queues, physical ports, exceptions paths, and discard. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/include/hw_mod_backend.h | 37 ++++ drivers/net/ntnic/meson.build | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 14 ++ .../nthw/flow_api/hw_mod/hw_mod_backend.c | 1 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_qsl.c | 170 ++++++++++++++++++ .../supported/nthw_fpga_9563_055_049_0000.c | 57 +++++- 6 files changed, 279 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_qsl.c diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index 6bf651272f..13e0d1731e 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -537,6 +537,42 @@ struct qsl_func_s { struct hw_mod_qsl_v7_s v7; }; }; +enum hw_qsl_e { + /* functions */ + HW_QSL_RCP_PRESET_ALL = 0, + HW_QSL_RCP_COMPARE, + HW_QSL_RCP_FIND, + HW_QSL_QST_PRESET_ALL, + /* fields */ + HW_QSL_RCP_DISCARD = FIELD_START_INDEX, + HW_QSL_RCP_DROP, + HW_QSL_RCP_TBL_LO, + HW_QSL_RCP_TBL_HI, + HW_QSL_RCP_TBL_IDX, + HW_QSL_RCP_TBL_MSK, + HW_QSL_RCP_LR, + HW_QSL_RCP_TSA, + HW_QSL_RCP_VLI, + HW_QSL_QST_QUEUE, + HW_QSL_QST_EN, /* Alias: HW_QSL_QST_QEN */ + HW_QSL_QST_TX_PORT, + HW_QSL_QST_LRE, + HW_QSL_QST_TCI, + HW_QSL_QST_VEN, + HW_QSL_QEN_EN, + HW_QSL_UNMQ_DEST_QUEUE, + HW_QSL_UNMQ_EN, +}; +bool hw_mod_qsl_present(struct flow_api_backend_s *be); +int hw_mod_qsl_alloc(struct flow_api_backend_s *be); +void hw_mod_qsl_free(struct flow_api_backend_s *be); +int hw_mod_qsl_reset(struct flow_api_backend_s *be); +int hw_mod_qsl_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_qsl_qst_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_qsl_qen_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_qsl_unmq_flush(struct flow_api_backend_s *be, int start_idx, int count); +int hw_mod_qsl_unmq_set(struct flow_api_backend_s *be, enum hw_qsl_e field, uint32_t index, + uint32_t value); struct slc_lr_func_s { COMMON_FUNC_INFO_S; @@ -721,6 +757,7 @@ struct flow_api_backend_s { struct km_func_s km; struct flm_func_s flm; struct hsh_func_s hsh; + struct qsl_func_s qsl; /* NIC attributes */ unsigned int num_phy_ports; diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 18aafc57f0..02981ef987 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -53,6 +53,7 @@ sources = files( 'nthw/flow_api/hw_mod/hw_mod_flm.c', 'nthw/flow_api/hw_mod/hw_mod_hsh.c', 'nthw/flow_api/hw_mod/hw_mod_km.c', + 'nthw/flow_api/hw_mod/hw_mod_qsl.c', 'nthw/flow_filter/flow_nthw_cat.c', 'nthw/flow_filter/flow_nthw_csu.c', 'nthw/flow_filter/flow_nthw_flm.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index b43c8fef1a..5d6571310c 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -144,6 +144,14 @@ int flow_delete_eth_dev(struct flow_eth_dev *eth_dev) /* delete all created flows from this device */ pthread_mutex_lock(&ndev->mtx); + /* + * remove unmatched queue if setup in QSL + * remove exception queue setting in QSL UNM + */ + hw_mod_qsl_unmq_set(&ndev->be, HW_QSL_UNMQ_DEST_QUEUE, eth_dev->port, 0); + hw_mod_qsl_unmq_set(&ndev->be, HW_QSL_UNMQ_EN, eth_dev->port, 0); + hw_mod_qsl_unmq_flush(&ndev->be, eth_dev->port, 1); + #ifdef FLOW_DEBUG ndev->be.iface->set_debug_mode(ndev->be.be_dev, FLOW_BACKEND_DEBUG_MODE_NONE); #endif @@ -293,6 +301,12 @@ struct flow_nic_dev *flow_api_create(uint8_t adapter_no, const struct flow_api_b if (init_resource_elements(ndev, RES_HSH_RCP, ndev->be.hsh.nb_rcp)) goto err_exit; + if (init_resource_elements(ndev, RES_QSL_RCP, ndev->be.qsl.nb_rcp_categories)) + goto err_exit; + + if (init_resource_elements(ndev, RES_QSL_QST, ndev->be.qsl.nb_qst_entries)) + goto err_exit; + if (init_resource_elements(ndev, RES_SLC_LR_RCP, ndev->be.max_categories)) goto err_exit; diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c index 3ccc14c4ce..4f16235a67 100644 --- a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c @@ -21,6 +21,7 @@ static const struct { { "KM", hw_mod_km_alloc, hw_mod_km_free, hw_mod_km_reset, hw_mod_km_present }, { "FLM", hw_mod_flm_alloc, hw_mod_flm_free, hw_mod_flm_reset, hw_mod_flm_present }, { "HSH", hw_mod_hsh_alloc, hw_mod_hsh_free, hw_mod_hsh_reset, hw_mod_hsh_present }, + { "QSL", hw_mod_qsl_alloc, hw_mod_qsl_free, hw_mod_qsl_reset, hw_mod_qsl_present }, }; #define MOD_COUNT (ARRAY_SIZE(module)) diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_qsl.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_qsl.c new file mode 100644 index 0000000000..f69717cf84 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_qsl.c @@ -0,0 +1,170 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include +#include + +#include "hw_mod_backend.h" + +#define _MOD_ "QSL" +#define _VER_ be->qsl.ver + +#define QSL_QEN_ENTRIES 32 +#define QSL_QNMQ_ENTRIES 256 + +bool hw_mod_qsl_present(struct flow_api_backend_s *be) +{ + return be->iface->get_qsl_present(be->be_dev); +} + +int hw_mod_qsl_alloc(struct flow_api_backend_s *be) +{ + int nb; + _VER_ = be->iface->get_qsl_version(be->be_dev); + NT_LOG(DBG, FILTER, "QSL MODULE VERSION %i.%i\n", VER_MAJOR(_VER_), VER_MINOR(_VER_)); + + nb = be->iface->get_nb_qsl_categories(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(qsl_categories); + + be->qsl.nb_rcp_categories = (uint32_t)nb; + + nb = be->iface->get_nb_qsl_qst_entries(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(qsl_qst_entries); + + be->qsl.nb_qst_entries = (uint32_t)nb; + + switch (_VER_) { + case 7: + if (!callocate_mod((struct common_func_s *)&be->qsl, 4, &be->qsl.v7.rcp, + be->qsl.nb_rcp_categories, sizeof(struct qsl_v7_rcp_s), + &be->qsl.v7.qst, be->qsl.nb_qst_entries, + sizeof(struct qsl_v7_qst_s), &be->qsl.v7.qen, QSL_QEN_ENTRIES, + sizeof(struct qsl_v7_qen_s), &be->qsl.v7.unmq, QSL_QNMQ_ENTRIES, + sizeof(struct qsl_v7_unmq_s))) + return -1; + + break; + + /* end case 7 */ + default: + return UNSUP_VER; + } + + return 0; +} + +void hw_mod_qsl_free(struct flow_api_backend_s *be) +{ + if (be->qsl.base) { + free(be->qsl.base); + be->qsl.base = NULL; + } +} + +int hw_mod_qsl_reset(struct flow_api_backend_s *be) +{ + /* Zero entire cache area */ + zero_module_cache((struct common_func_s *)(&be->qsl)); + + NT_LOG(DBG, FILTER, "INIT QSL RCP\n"); + hw_mod_qsl_rcp_flush(be, 0, ALL_ENTRIES); + + NT_LOG(DBG, FILTER, "INIT QSL QST\n"); + hw_mod_qsl_qst_flush(be, 0, ALL_ENTRIES); + + NT_LOG(DBG, FILTER, "INIT QSL QEN\n"); + hw_mod_qsl_qen_flush(be, 0, ALL_ENTRIES); + + NT_LOG(DBG, FILTER, "INIT QSL UNMQ\n"); + be->iface->qsl_unmq_flush(be->be_dev, &be->qsl, 0, 256); + + return 0; +} + +int hw_mod_qsl_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->qsl.nb_rcp_categories; + + if ((unsigned int)(start_idx + count) > be->qsl.nb_rcp_categories) + return INDEX_TOO_LARGE; + + return be->iface->qsl_rcp_flush(be->be_dev, &be->qsl, start_idx, count); +} + +int hw_mod_qsl_qst_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->qsl.nb_qst_entries; + + if ((unsigned int)(start_idx + count) > be->qsl.nb_qst_entries) + return INDEX_TOO_LARGE; + + return be->iface->qsl_qst_flush(be->be_dev, &be->qsl, start_idx, count); +} + +int hw_mod_qsl_qen_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = QSL_QEN_ENTRIES; + + if ((start_idx + count) > QSL_QEN_ENTRIES) + return INDEX_TOO_LARGE; + + return be->iface->qsl_qen_flush(be->be_dev, &be->qsl, start_idx, count); +} + +int hw_mod_qsl_unmq_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = QSL_QNMQ_ENTRIES; + + if ((start_idx + count) > QSL_QNMQ_ENTRIES) + return INDEX_TOO_LARGE; + + return be->iface->qsl_unmq_flush(be->be_dev, &be->qsl, start_idx, count); +} + +static int hw_mod_qsl_unmq_mod(struct flow_api_backend_s *be, enum hw_qsl_e field, uint32_t index, + uint32_t *value, int get) +{ + if (index >= QSL_QNMQ_ENTRIES) + return INDEX_TOO_LARGE; + + switch (_VER_) { + case 7: + switch (field) { + case HW_QSL_UNMQ_DEST_QUEUE: + GET_SET(be->qsl.v7.unmq[index].dest_queue, value); + break; + + case HW_QSL_UNMQ_EN: + GET_SET(be->qsl.v7.unmq[index].en, value); + break; + + default: + return UNSUP_FIELD; + } + + break; + + /* end case 7 */ + default: + return UNSUP_VER; + } + + return 0; +} + +int hw_mod_qsl_unmq_set(struct flow_api_backend_s *be, enum hw_qsl_e field, uint32_t index, + uint32_t value) +{ + return hw_mod_qsl_unmq_mod(be, field, index, &value, 0); +} diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c index 4317da8094..7eeb210b80 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c @@ -1297,6 +1297,60 @@ static nthw_fpga_register_init_s pci_wr_tg_registers[] = { { PCI_WR_TG_TG_WR_RUN, 4, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1, pci_wr_tg_tg_wr_run_fields }, }; +static nthw_fpga_field_init_s qsl_qen_ctrl_fields[] = { + { QSL_QEN_CTRL_ADR, 5, 0, 0x0000 }, + { QSL_QEN_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s qsl_qen_data_fields[] = { + { QSL_QEN_DATA_EN, 4, 0, 0x0000 }, +}; + +static nthw_fpga_field_init_s qsl_qst_ctrl_fields[] = { + { QSL_QST_CTRL_ADR, 12, 0, 0x0000 }, + { QSL_QST_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s qsl_qst_data_fields[] = { + { QSL_QST_DATA_LRE, 1, 9, 0x0000 }, { QSL_QST_DATA_QEN, 1, 7, 0x0000 }, + { QSL_QST_DATA_QUEUE, 7, 0, 0x0000 }, { QSL_QST_DATA_TCI, 16, 10, 0x0000 }, + { QSL_QST_DATA_TX_PORT, 1, 8, 0x0000 }, { QSL_QST_DATA_VEN, 1, 26, 0x0000 }, +}; + +static nthw_fpga_field_init_s qsl_rcp_ctrl_fields[] = { + { QSL_RCP_CTRL_ADR, 5, 0, 0x0000 }, + { QSL_RCP_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s qsl_rcp_data_fields[] = { + { QSL_RCP_DATA_DISCARD, 1, 0, 0x0000 }, { QSL_RCP_DATA_DROP, 2, 1, 0x0000 }, + { QSL_RCP_DATA_LR, 2, 51, 0x0000 }, { QSL_RCP_DATA_TBL_HI, 12, 15, 0x0000 }, + { QSL_RCP_DATA_TBL_IDX, 12, 27, 0x0000 }, { QSL_RCP_DATA_TBL_LO, 12, 3, 0x0000 }, + { QSL_RCP_DATA_TBL_MSK, 12, 39, 0x0000 }, { QSL_RCP_DATA_TSA, 1, 53, 0x0000 }, + { QSL_RCP_DATA_VLI, 2, 54, 0x0000 }, +}; + +static nthw_fpga_field_init_s qsl_unmq_ctrl_fields[] = { + { QSL_UNMQ_CTRL_ADR, 1, 0, 0x0000 }, + { QSL_UNMQ_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s qsl_unmq_data_fields[] = { + { QSL_UNMQ_DATA_DEST_QUEUE, 7, 0, 0x0000 }, + { QSL_UNMQ_DATA_EN, 1, 7, 0x0000 }, +}; + +static nthw_fpga_register_init_s qsl_registers[] = { + { QSL_QEN_CTRL, 4, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, qsl_qen_ctrl_fields }, + { QSL_QEN_DATA, 5, 4, NTHW_FPGA_REG_TYPE_WO, 0, 1, qsl_qen_data_fields }, + { QSL_QST_CTRL, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, qsl_qst_ctrl_fields }, + { QSL_QST_DATA, 3, 27, NTHW_FPGA_REG_TYPE_WO, 0, 6, qsl_qst_data_fields }, + { QSL_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, qsl_rcp_ctrl_fields }, + { QSL_RCP_DATA, 1, 56, NTHW_FPGA_REG_TYPE_WO, 0, 9, qsl_rcp_data_fields }, + { QSL_UNMQ_CTRL, 6, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, qsl_unmq_ctrl_fields }, + { QSL_UNMQ_DATA, 7, 8, NTHW_FPGA_REG_TYPE_WO, 0, 2, qsl_unmq_data_fields }, +}; + static nthw_fpga_field_init_s rac_dbg_ctrl_fields[] = { { RAC_DBG_CTRL_C, 32, 0, 0x0000 }, }; @@ -1456,6 +1510,7 @@ static nthw_fpga_module_init_s fpga_modules[] = { MOD_PCI_WR_TG, 0, MOD_PCI_WR_TG, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 2304, 7, pci_wr_tg_registers }, + { MOD_QSL, 0, MOD_QSL, 0, 7, NTHW_FPGA_BUS_TYPE_RAB1, 1792, 8, qsl_registers }, { MOD_RAC, 0, MOD_RAC, 3, 0, NTHW_FPGA_BUS_TYPE_PCI, 8192, 14, rac_registers }, { MOD_RST9563, 0, MOD_RST9563, 0, 5, NTHW_FPGA_BUS_TYPE_RAB0, 1024, 5, rst9563_registers }, }; @@ -1617,5 +1672,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { }; nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { - 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 18, fpga_modules, + 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 19, fpga_modules, }; From patchwork Fri Oct 4 15:34:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145119 X-Patchwork-Delegate: ferruh.yigit@amd.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 0FF6D45AAF; Fri, 4 Oct 2024 17:55:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 500AB42EF5; Fri, 4 Oct 2024 17:51:44 +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 78850427AF for ; Fri, 4 Oct 2024 17:51:39 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2172.outbound.protection.outlook.com [104.47.17.172]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:51:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xDga6g6AuN2WHBjlGvDcrwAasknN2bU/cwdjo7ssK5m9dhjtphCFXQXkTehQsVXeRfsNPkozB8Secia+2pgHdNoR0rqcVfyd8gzW4+dIq3owVC1s+X8yh7n3XCb5Qa3PnNGzcvl0b5uLttRH7pWsDeDjmedY8gWKlZfnwg8okUtRJQZlQhTgUWNRHgk1RydgHc1Gi18zbTwG8QubjMYeQvmvda4Sm5sVta+7ayvNcVDJ63LnhmO2bpxiHQa+XFbRTbTz28k3BsfO2zvxQRYwY8E6FieJfYWt+1NN9gq8eMYaKulYvSAxRIxu7/XM2cYl/f4b3LT9gSX/yjscxIU+EQ== 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=xnYnin0spfMO0W/uJkkIxC38N7+rFzKTHek0Q8ZEjQU=; b=HpJTMYEUnryCiOL7W4C/QsdHWhw2QI+sBEb6OCHDRgHK/9LluaWmiRhIX4IwI+zywmkdkZaF/2lboq03QsPm2wK1++QWOdqxhGFbXLryOla6HYdsfaVQSUhLw8t/ZhXYHvisa6BQpjU+rIJ1YXq4NeI/EvLOXhprnEFDIXZqgNpbRgB34u7m4T+RvAEB4x5NS2GamE+wE5LPELNURFbMIqCothkhWn9I2YNNIeD6q1pNbeb6+uAaz/1tiF4v8/rSoc/TJMcBAQf16sbt3O4OAHInz0pgPWDZPGKVJOJ75KoWBML/RpYCXbpNa3ZKUJeFKnqkwCIKYb55nBhzTMLqtw== 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=xnYnin0spfMO0W/uJkkIxC38N7+rFzKTHek0Q8ZEjQU=; b=RCG4n8+g8oImRawR3NT6ykmuXwChdxp/zJ15imefDB5qJ0F6XFMfFJNk2sLEKAEmacRlnk1VnBOlPffrE395WwZWybmjep3y6RVL5vX58yrloESj6ya129S5mGOrvp3qn8UMKIAaXbOe9hwdhEvRVRRbIKEOBnt6nTT68QO97ms= Received: from AM0PR10CA0131.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::48) by DBAP190MB0982.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:1b1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Fri, 4 Oct 2024 15:36:27 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::6c) by AM0PR10CA0131.outlook.office365.com (2603:10a6:208:e6::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:26 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:26 +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, Oleksandr Kolomeiets Subject: [PATCH v1 28/31] net/ntnic: add slicer (SLC LR) FPGA module Date: Fri, 4 Oct 2024 17:34:51 +0200 Message-ID: <20241004153551.267935-34-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|DBAP190MB0982:EE_ X-MS-Office365-Filtering-Correlation-Id: ac97932f-daa1-457c-aca7-08dce48a4f01 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: Y+IinysJKTm+TDQi+kobtpiYyXzoZUXmR1BW8nAnvBuxQHar8WC7l3ewFqTE50yeYHD5PzKttHrgJqSoONN5vHRSTPsURoHlEjyCmcsUdgiNZDxZg1GSQYhW/tLlIUrW535kvIS1FqyoZcL8boyHur02xkZAXatxdafEzPprFVW3+stN8gl7bSkUZHRc3l3RBjBshNAQD5Yf5no0KB5kXFuEFXTfI+Ett8d7QDWk+2DQoVJaQu5SzGy4pkkv3UY/ZIE2j/iQJDhJiiCtdERaVs6esdcFFc3cfbLx5ALRIWseUURRuGkhdBpCKN+LJmhJtgdtoAfBKwWLDFP1MGSvv/7KyU4d8BEvUW5zrNPXXt0xlgTDwPYxgoVsIm3bZItFROCawCaq1bK3Pjz7vkevG9JlsktqSXf4oXiAEF9JyLM0OrYv6Qh2Ph67+0qOkkNBtwVmqomTex8WNEbXdK/JjOfvC3pFEIZcFlsyaRGs7JVPhKAftB5XwvuRaD5NKbx0XjuGa06nNBbA6iSfiCn/RYU1hByNPfzmJnKFJwekWCsY48yzA7uimALEOwkIJlST5hWb0IX3FL57XEiL94AuiKgeCYWYJWQRxCHB2X0yUBMcYFKY+L+vXnskMA+AyTQQEdjlymF3PRNKYsrUDU0KOJSkwKN/adWfOQ6IvXZ/k9ahVotPYKfzfV0/dOOij9EuZ5J4n+e+I1ccqb9BZlywwNBs5iOtw81MHDAUQg3MaL4xw7r5cNE26yCZky0S2NTPz1wiMbgmoWms0ZGFbx19t68xRn3Mrj+bRspSTKD21HRzYEgEcdLDSxPvQo/dN9dF5SlKRUsD7/p5xuRDlP/5KyKSMXUrBoGgVoZZ61Ix9z7BiY16sXmWqICCUwrcZZSK6gwlkF1rzlRAwN8BA3R7xsHJ90TPQfp0t/yl8AJ0X+NSaQLoNe699p0MlYHbG2OXwMsJw3X/6gkj2htYcx7ESeMDRIoJ2F68O7FFKwssYfBTPozybzmoGeKrGqjHUQqcuHxN+7VoqIKNi21B8vZ3OAN79y1ITEsqr/mzjnc1XwAiEo8XbBLHJcq/0N1ZYNyHK2uN/V1XDyUKcInXO+4DmprG+v1BsZSUOdf5GY9EIh7X+eI/ygi2UbmkvAonUYlFBs+rxhplmlhxESIe2vku8ILN1M01n4KR4oWfzQGle9lZQv87sotoSkqtDTjtNiD5XUe1xz/MpJdcsB3s7wB/mUkBwrKLDyJR+WxlwMRJ90AU62sGDNOKZCr07JCwymXdPKxeqpHCUDkzDL8at1Q+4ZOg5PuNBPr2+cgnsFh6267ng++XkarTeD6J3V4K/GLYE2K3lc29uAL+B97I6IFjc7fsvrR6qZnytIRO2N5QlbTUogj7CpVWAlf5vD1FxyDs 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)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: XXB6hVN9u5zQsJqo5HawUJGW5p6CUt/iYLNdqjajJN0exVh4SCjwmObkubiwc7socLyDUTT7uvcs7lesS4MyQ0xmUmnOD+amZORZWyEjiemmA7IhXfxuxcawPgDuzxHTO0WbJY9YDQU1ncHrFsSGyhqjB0r3bvean/3ZpCyTvDyox9tYiKrCnhjbEbWzvi2FnwkFifm1JvQgHKsMPu9n2U1uXve16TdUWSPQ/bnYiQ96EJZV8qDkWNvIPtnFScZ+VHVdb0t8xFVSGyoVxyehCJYPBW3jDmkD2DvYklQfAdy86wPg/3GjhPE/gADapoFw9KcX0tPqmOz4Fye5jcMLhE17KmzUw7VvB1Re5SDA3e+xcTjsEvm7ghk8NA3YlBBjctHijK6XLGi1uW90SoBH11RW/enu7sAsTjWrNTvLuDHUCnP3zaHFTYqxVDHSaiRZKf1Eh5kDdzYvzEgz2Arcb3FefMAunwGjXiob+dR8jABDF2TpQI6OtpHPPqbCT+Rnb7iuyXWi3/O655Yjj27VXbFwoqNuXH+F7geBSKQxqxVgfX98pNIj8qFyyJiHhTnqXQmRQ5Uncv6Jkj4eqYyIFD0TxfWNA6AInkdAq5DKu3uMYfGp8aa5gCi9tIx9z49r/RBiZ4KhRwGWYv0d5acCEg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:26.0178 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac97932f-daa1-457c-aca7-08dce48a4f01 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAP190MB0982 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057098-311388-12679-32553-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.172 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqYGluZAVgZQ0DQ1Lc3Q1Mjc0D wRKGiclGhikJSclGZhYGppYGRknqxUGwsAMR6F40EAAAA= X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan23-144.eu-central-1b.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: Oleksandr Kolomeiets The Slicer for Local Retransmit module can cut of the head a packet before the packet leaves the FPGA RX pipeline. This is used when the TX pipeline is configured to add a new head in the packet. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/include/hw_mod_backend.h | 21 ++++++ drivers/net/ntnic/meson.build | 1 + .../nthw/flow_api/hw_mod/hw_mod_backend.c | 4 ++ .../nthw/flow_api/hw_mod/hw_mod_slc_lr.c | 65 +++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_slc_lr.c diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index 13e0d1731e..b28192e682 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -7,6 +7,7 @@ #define _HW_MOD_BACKEND_H_ #include +#include #include "ntlog.h" @@ -580,6 +581,25 @@ struct slc_lr_func_s { struct hw_mod_slc_lr_v2_s v2; }; }; +enum hw_slc_lr_e { + /* functions */ + HW_SLC_LR_RCP_PRESET_ALL = 0, + HW_SLC_LR_RCP_COMPARE, + HW_SLC_LR_RCP_FIND, + /* fields */ + HW_SLC_LR_RCP_HEAD_SLC_EN = FIELD_START_INDEX, + HW_SLC_LR_RCP_HEAD_DYN, + HW_SLC_LR_RCP_HEAD_OFS, + HW_SLC_LR_RCP_TAIL_SLC_EN, + HW_SLC_LR_RCP_TAIL_DYN, + HW_SLC_LR_RCP_TAIL_OFS, + HW_SLC_LR_RCP_PCAP +}; +bool hw_mod_slc_lr_present(struct flow_api_backend_s *be); +int hw_mod_slc_lr_alloc(struct flow_api_backend_s *be); +void hw_mod_slc_lr_free(struct flow_api_backend_s *be); +int hw_mod_slc_lr_reset(struct flow_api_backend_s *be); +int hw_mod_slc_lr_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); struct pdb_func_s { COMMON_FUNC_INFO_S; @@ -758,6 +778,7 @@ struct flow_api_backend_s { struct flm_func_s flm; struct hsh_func_s hsh; struct qsl_func_s qsl; + struct slc_lr_func_s slc_lr; /* NIC attributes */ unsigned int num_phy_ports; diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 02981ef987..4caee8ac41 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -54,6 +54,7 @@ sources = files( 'nthw/flow_api/hw_mod/hw_mod_hsh.c', 'nthw/flow_api/hw_mod/hw_mod_km.c', 'nthw/flow_api/hw_mod/hw_mod_qsl.c', + 'nthw/flow_api/hw_mod/hw_mod_slc_lr.c', 'nthw/flow_filter/flow_nthw_cat.c', 'nthw/flow_filter/flow_nthw_csu.c', 'nthw/flow_filter/flow_nthw_flm.c', diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c index 4f16235a67..6b0ea2a4a6 100644 --- a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c @@ -22,6 +22,10 @@ static const struct { { "FLM", hw_mod_flm_alloc, hw_mod_flm_free, hw_mod_flm_reset, hw_mod_flm_present }, { "HSH", hw_mod_hsh_alloc, hw_mod_hsh_free, hw_mod_hsh_reset, hw_mod_hsh_present }, { "QSL", hw_mod_qsl_alloc, hw_mod_qsl_free, hw_mod_qsl_reset, hw_mod_qsl_present }, + { + "SLC LR", hw_mod_slc_lr_alloc, hw_mod_slc_lr_free, hw_mod_slc_lr_reset, + hw_mod_slc_lr_present + }, }; #define MOD_COUNT (ARRAY_SIZE(module)) diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_slc_lr.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_slc_lr.c new file mode 100644 index 0000000000..d95352ec67 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_slc_lr.c @@ -0,0 +1,65 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include + +#include "hw_mod_backend.h" + +#define _MOD_ "SLC_LR" +#define _VER_ be->slc_lr.ver + +bool hw_mod_slc_lr_present(struct flow_api_backend_s *be) +{ + return be->iface->get_slc_lr_present(be->be_dev); +} + +int hw_mod_slc_lr_alloc(struct flow_api_backend_s *be) +{ + _VER_ = be->iface->get_slc_lr_version(be->be_dev); + NT_LOG(DBG, FILTER, "SLC LR MODULE VERSION %i.%i\n", VER_MAJOR(_VER_), VER_MINOR(_VER_)); + + switch (_VER_) { + case 2: + if (!callocate_mod((struct common_func_s *)&be->slc_lr, 1, &be->slc_lr.v2.rcp, + be->max_categories, sizeof(struct slc_lr_v2_rcp_s))) + return -1; + + break; + + default: + return UNSUP_VER; + } + + return 0; +} + +void hw_mod_slc_lr_free(struct flow_api_backend_s *be) +{ + if (be->slc_lr.base) { + free(be->slc_lr.base); + be->slc_lr.base = NULL; + } +} + +int hw_mod_slc_lr_reset(struct flow_api_backend_s *be) +{ + /* Zero entire cache area */ + zero_module_cache((struct common_func_s *)(&be->slc_lr)); + + NT_LOG(DBG, FILTER, "INIT SLC LR RCP\n"); + return hw_mod_slc_lr_rcp_flush(be, 0, be->max_categories); +} + +int hw_mod_slc_lr_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->max_categories; + + if ((unsigned int)(start_idx + count) > be->max_categories) + return INDEX_TOO_LARGE; + + return be->iface->slc_lr_rcp_flush(be->be_dev, &be->slc_lr, start_idx, count); +} From patchwork Fri Oct 4 15:34:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145131 X-Patchwork-Delegate: ferruh.yigit@amd.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 3758245AAF; Fri, 4 Oct 2024 17:57:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 81A5142F00; Fri, 4 Oct 2024 17:52:15 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id 7F6C442ECE for ; Fri, 4 Oct 2024 17:52:12 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2175.outbound.protection.outlook.com [104.47.17.175]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:52:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mNV6QbRcyTPZjPAushvqbpgBKbYCAfk2YDuLUGMLzGoOlw76tvzOluYS4G4HopkGNHQKws5jQuD0a6SNY9Gq+mdDu6hbT+TJwR7wE9HP8ie0KJ3uAmmSit80d3dt85K0SWKoUjC4aC2E852MXnVyT1u36u6hxtfp4dzyIWMkOf3BfDQC9Q2cryhfKVEBhJER/49MjPYEGAajOAdQ7kgh1WM5htO/DWQC9XkGEONeyNBLYCb4VAWhlOaMXUi/8I/S7Tn6x4m5LnosYZEwVsA8in2NoesL4jSCkTLNS1nm107XezTFcfnTy5sjtkHLj+UtzOU/lJU9qraeCY9rXK1mWg== 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=wBBV/Gu9lxIr+wr/M42sah3EV9egPZ3zeRl9cYtkNt0=; b=JrGORpkbQZB1zca7/KCMRF5nyINXfEd90mXTwNB95/+qRVCsSknd4zaDaCBL63Qj37UuZ35hbTSWIyOFRK+NYtomgJIbOyqNGYHxoMuXcdt8oKhzgNFK7W5UgVROBgNPoAOCQ+v7fkfxWYTbrW6Zw07dQqbd1LXGqJGAVJPoT5hMigCaVRhz3qn/ZMH2ii9ewimtxVpvihuE+JNf3JWwbvkIim/gXEyl8kZedJ9nNYR759rdLyd5n9B28YhzKbRyKyE7HbGbnsG6Yirx9S5jrrnT+DcOpsIZgNbM4dvBx977hOAXAFFaO+gw27FaafHb3HNUGVlwinSvZA72Ng3Lzw== 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=wBBV/Gu9lxIr+wr/M42sah3EV9egPZ3zeRl9cYtkNt0=; b=bqyEJ8NcJvjMAzbVzabbTN1JNNhfxvtPyY4Iief7RVR0USBCCB8/pb6nKhnqYmWaoTu3H/33p3FjLBi0NkFvPfagLr87Nt6EAuloxI7I6Khgp9Ldt7hvCN3dNtZHbLaau0xasnSAwbEuAQHDykeuJMvqExI3oeZcJId6XRZexBA= Received: from AM0PR10CA0104.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::21) by VE1P190MB0861.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:1ad::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 15:36:28 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::cf) by AM0PR10CA0104.outlook.office365.com (2603:10a6:208:e6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:28 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:28 +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, Oleksandr Kolomeiets Subject: [PATCH v1 29/31] net/ntnic: add packet descriptor builder (PDB) FPGA module Date: Fri, 4 Oct 2024 17:34:52 +0200 Message-ID: <20241004153551.267935-35-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|VE1P190MB0861:EE_ X-MS-Office365-Filtering-Correlation-Id: 493effb7-8aaa-4ba3-da0c-08dce48a5032 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: bpDSHNhybYC/3TdvcaZEN1GpgBYrGNU3E/B35BKpov+pSG3F0JgQTBF9ZV2ZHyr95VeZBciL/VfwIDTeO7hQloiGg/6xaxInGEANMK4xfMBWDytrMKpHrLxJe+ao9yO8maTWvQG5fc1ke9puj0/1C6gO8YnR3lDcpXA7qnIAGJWXiTeBBCDnH1Vhpl14zGQ+wXXLHujcP65aHWvtDX4rGDh/pIL+F6JArNEfaC2fXn8RkyyeGbSJqBdSQuM9OHT5ScWFfncA99KdjFheD/4Lt6OnZMNT/A7JePPNXPDijLzYOAre0dlPRvhfw0usv9quKfAxRkTWOO21BOhPQt+KDWPa9LlT3gwTpyQ1QDwXbRTS+XnF/Lo8gyrAdXAssUXby/ODJ94QQH1aKUFkD63H5j1cIcgl5Xktfu8KPHxtgPPKMLkbmKYDL9eIOWTBt8jkKK3N1YpSv6t1/n4SBrWksmJTZVb7eZzb6UK4OtGXry8BPjUOmsr2xJgiybnEKkzT7OBRZr7WKD+eSEBxh8A153EP8+MACa7o3BaTOa5sIr+2htbnRLmZEWD3FO/QVw3kuwk4vSNZBNhcXN2c2IocjNs/EeLG0nkeiv+HaxgS+DCDEwawOnoEAOFiFdEhrdQFXrfSE2FjHgQCdt+YH/nbUXPX8Kg7HipYMNchK1Di8H6A7BImsTeWgFj9Ah5AGbiUSEF43Z7ORAG8zdWi+tqXS5mPRVizIec0UEusnkj51zFuJEJv1A6rg936JcosL8oVXbwHUDuXE3l2N3+jhF7Xyof9VJZOH7flvYXlzMno8whZ+usHiW374g5za243nAR8484EJlVaYNbM1jjw763PNFlpL432AljMPlX6Y/9kiQNL4PTTeZt1FS1v2iqvQ9Zb6ONpFW2HMW9/cmRzISkG0BvjuwKPQ/TWRa+T5YT6mXM9jJeReZtwQHUtsL4Tb2Fc7WYUGPq16e/b8UdI7fDa5RtRMqwbFclo1MjdLjuwoNQCLSu/67TWgn6jAtUHlF9NyIkLiGE6FU+l8XaFQFlCEB7N4iPTpLg88QbbED5rdCaseLxhKyjE5hKcPpnvpELq1pKneUGeC3zxExqgWMS/onAg9dVAXD7vdXON9pTVljqdbLBL7aq7VAFsrCvO3PQnRPmKDcOsWz+/l3bo9SS3HPYeRIgyrGFHMd+Q5lTJK0hxBj6PxLhUuX38MYOLbfh/3NZyADQmAHWeJkwH88DMEJjq/tx1MAKtCtQG/AoeLEwRxcFYJflho86ugj0dX13vfpiRay6P53uOD2bXI6qnLXxLJ4+1V8RQ18/EYQLd9C+bICozqzeKCffG2IjEukXuYXVe9KlzTiWzsqKHgK4IDxOngDUN0OnxFxPGNjzrMWlwOBBafSrA4bkGVnKoKeZC 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)(376014)(82310400026)(36860700013)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: r7ea/hH7Le0GsbAYfQVRUIvJg2dkHL3fHnYoyJj3NopR+PDbSwrCxadh+1PuwIthOWgL498/gNEjplP1XVc8A1gJ/+0dyzvp4Q5KJvmNXAkPvUMH5KwWu4Yn7aUOvXU1zCfipW8DMDK4GbVLW8NnODzNeMy+y7HSO3/WAJsTsCehWibtnKgzFJ8ztclsYXfuTVsyx7vB/Yj4KQwfMg/m78euD/x0YmkcLcahpHWU6NAicVP5Xt1JyvG+dGFv2IRhA9iZ3km7pnLobAw5ZWkUHUD3PMM2eFyl1hOlqDGvUAj7KZ81i8thyCoUbW/gxib7JtIwqDMDF62LDvilUVZSmoNZQhaVywrcG67V8hw/5xrTcunlnw7fGw0Lv+a48KCkVTixSAQ5BKBc1sk2BQtejQaNqikEoKyqMeRNZZyw9d3FzSeV+MVBJcH/f6L57GmQxDCtyx8Da/jCG7okQ0PVvoN7vvEg2fRDIRl+vCXASV8En+sOO/Eg/HYVJ4WJ3qw8eXtCobsmtbzQlA106S14K7sbBCbraeloKJOPq+d40AG0AAErTiIar8mITh5OReRjWav0ug2BLi0ANzMnc8phvxvcjgKwKsSYPWtqbeA141/rTNYD9kcHdtQTTMYGvyPKeDETQdUVPKFaLCm3P6apTw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:28.0178 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 493effb7-8aaa-4ba3-da0c-08dce48a5032 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1P190MB0861 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057125-311388-12691-32582-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.175 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVpaGJqZAVgZQ0NgiySDVzNDAIs 3MxMgoMdnAINU4zSjRPC05xcg4Kc1AqTYWAAKLqOlBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259495 [from cloudscan11-98.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: Oleksandr Kolomeiets The Packet Description Builder module creates packet meta-data for example virtio-net headers. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/include/hw_mod_backend.h | 34 ++++++++ drivers/net/ntnic/meson.build | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 3 + .../nthw/flow_api/hw_mod/hw_mod_backend.c | 1 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_pdb.c | 86 +++++++++++++++++++ .../supported/nthw_fpga_9563_055_049_0000.c | 40 ++++++++- 6 files changed, 164 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_pdb.c diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index b28192e682..9644639131 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -609,6 +609,39 @@ struct pdb_func_s { struct hw_mod_pdb_v9_s v9; }; }; +enum hw_pdb_e { + /* functions */ + HW_PDB_RCP_PRESET_ALL = 0, + HW_PDB_RCP_COMPARE, + HW_PDB_RCP_FIND, + /* fields */ + HW_PDB_RCP_DESCRIPTOR = FIELD_START_INDEX, + HW_PDB_RCP_DESC_LEN, + HW_PDB_RCP_TX_PORT, + HW_PDB_RCP_TX_IGNORE, + HW_PDB_RCP_TX_NOW, + HW_PDB_RCP_CRC_OVERWRITE, + HW_PDB_RCP_ALIGN, + HW_PDB_RCP_OFS0_DYN, + HW_PDB_RCP_OFS0_REL, + HW_PDB_RCP_OFS1_DYN, + HW_PDB_RCP_OFS1_REL, + HW_PDB_RCP_OFS2_DYN, + HW_PDB_RCP_OFS2_REL, + HW_PDB_RCP_IP_PROT_TNL, + HW_PDB_RCP_PPC_HSH, + HW_PDB_RCP_DUPLICATE_EN, + HW_PDB_RCP_DUPLICATE_BIT, + HW_PDB_RCP_PCAP_KEEP_FCS, + HW_PDB_CONFIG_TS_FORMAT, + HW_PDB_CONFIG_PORT_OFS, +}; +bool hw_mod_pdb_present(struct flow_api_backend_s *be); +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_config_flush(struct flow_api_backend_s *be); struct tpe_func_s { COMMON_FUNC_INFO_S; @@ -779,6 +812,7 @@ struct flow_api_backend_s { struct hsh_func_s hsh; struct qsl_func_s qsl; struct slc_lr_func_s slc_lr; + struct pdb_func_s pdb; /* NIC attributes */ unsigned int num_phy_ports; diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 4caee8ac41..0415e5a5b2 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -53,6 +53,7 @@ sources = files( 'nthw/flow_api/hw_mod/hw_mod_flm.c', 'nthw/flow_api/hw_mod/hw_mod_hsh.c', 'nthw/flow_api/hw_mod/hw_mod_km.c', + 'nthw/flow_api/hw_mod/hw_mod_pdb.c', 'nthw/flow_api/hw_mod/hw_mod_qsl.c', 'nthw/flow_api/hw_mod/hw_mod_slc_lr.c', 'nthw/flow_filter/flow_nthw_cat.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index 5d6571310c..03946fb52f 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -301,6 +301,9 @@ struct flow_nic_dev *flow_api_create(uint8_t adapter_no, const struct flow_api_b if (init_resource_elements(ndev, RES_HSH_RCP, ndev->be.hsh.nb_rcp)) goto err_exit; + if (init_resource_elements(ndev, RES_PDB_RCP, ndev->be.pdb.nb_pdb_rcp_categories)) + goto err_exit; + if (init_resource_elements(ndev, RES_QSL_RCP, ndev->be.qsl.nb_rcp_categories)) goto err_exit; diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c index 6b0ea2a4a6..118e49f539 100644 --- a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c @@ -26,6 +26,7 @@ static const struct { "SLC LR", hw_mod_slc_lr_alloc, hw_mod_slc_lr_free, hw_mod_slc_lr_reset, hw_mod_slc_lr_present }, + { "PDB", hw_mod_pdb_alloc, hw_mod_pdb_free, hw_mod_pdb_reset, hw_mod_pdb_present }, }; #define MOD_COUNT (ARRAY_SIZE(module)) 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 new file mode 100644 index 0000000000..13f0972e07 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_pdb.c @@ -0,0 +1,86 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include +#include + +#include "hw_mod_backend.h" + +#define _MOD_ "PDB" +#define _VER_ be->pdb.ver + +bool hw_mod_pdb_present(struct flow_api_backend_s *be) +{ + return be->iface->get_pdb_present(be->be_dev); +} + +int hw_mod_pdb_alloc(struct flow_api_backend_s *be) +{ + int nb; + _VER_ = be->iface->get_pdb_version(be->be_dev); + NT_LOG(DBG, FILTER, "PDB MODULE VERSION %i.%i\n", VER_MAJOR(_VER_), VER_MINOR(_VER_)); + + nb = be->iface->get_nb_pdb_categories(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(pdb_categories); + + be->pdb.nb_pdb_rcp_categories = (uint32_t)nb; + + switch (_VER_) { + case 9: + if (!callocate_mod((struct common_func_s *)&be->pdb, 2, &be->pdb.v9.rcp, + be->pdb.nb_pdb_rcp_categories, sizeof(struct pdb_v9_rcp_s), + &be->pdb.v9.config, 1, sizeof(struct pdb_v9_config_s))) + return -1; + + break; + + /* end case 9 */ + default: + return UNSUP_VER; + } + + return 0; +} + +void hw_mod_pdb_free(struct flow_api_backend_s *be) +{ + if (be->pdb.base) { + free(be->pdb.base); + be->pdb.base = NULL; + } +} + +int hw_mod_pdb_reset(struct flow_api_backend_s *be) +{ + int err = 0; + /* Zero entire cache area */ + zero_module_cache((struct common_func_s *)(&be->hsh)); + + NT_LOG(DBG, FILTER, "INIT PDB RCP\n"); + err |= hw_mod_pdb_rcp_flush(be, 0, ALL_ENTRIES); + + NT_LOG(DBG, FILTER, "INIT PDB CONFIG\n"); + err |= hw_mod_pdb_config_flush(be); + return err; +} + +int hw_mod_pdb_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->pdb.nb_pdb_rcp_categories; + + if ((unsigned int)(start_idx + count) > be->pdb.nb_pdb_rcp_categories) + return INDEX_TOO_LARGE; + + return be->iface->pdb_rcp_flush(be->be_dev, &be->pdb, start_idx, count); +} + +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/supported/nthw_fpga_9563_055_049_0000.c b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c index 7eeb210b80..9f821abf55 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c @@ -1297,6 +1297,43 @@ static nthw_fpga_register_init_s pci_wr_tg_registers[] = { { PCI_WR_TG_TG_WR_RUN, 4, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1, pci_wr_tg_tg_wr_run_fields }, }; +static nthw_fpga_field_init_s pdb_config_fields[] = { + { PDB_CONFIG_PORT_OFS, 6, 3, 0 }, + { PDB_CONFIG_TS_FORMAT, 3, 0, 0 }, +}; + +static nthw_fpga_field_init_s pdb_rcp_ctrl_fields[] = { + { PDB_RCP_CTRL_ADR, 4, 0, 0x0000 }, + { PDB_RCP_CTRL_CNT, 16, 16, 0x0000 }, +}; + +static nthw_fpga_field_init_s pdb_rcp_data_fields[] = { + { PDB_RCP_DATA_ALIGN, 1, 17, 0x0000 }, + { PDB_RCP_DATA_CRC_OVERWRITE, 1, 16, 0x0000 }, + { PDB_RCP_DATA_DESCRIPTOR, 4, 0, 0x0000 }, + { PDB_RCP_DATA_DESC_LEN, 5, 4, 0 }, + { PDB_RCP_DATA_DUPLICATE_BIT, 5, 61, 0x0000 }, + { PDB_RCP_DATA_DUPLICATE_EN, 1, 60, 0x0000 }, + { PDB_RCP_DATA_IP_PROT_TNL, 1, 57, 0x0000 }, + { PDB_RCP_DATA_OFS0_DYN, 5, 18, 0x0000 }, + { PDB_RCP_DATA_OFS0_REL, 8, 23, 0x0000 }, + { PDB_RCP_DATA_OFS1_DYN, 5, 31, 0x0000 }, + { PDB_RCP_DATA_OFS1_REL, 8, 36, 0x0000 }, + { PDB_RCP_DATA_OFS2_DYN, 5, 44, 0x0000 }, + { PDB_RCP_DATA_OFS2_REL, 8, 49, 0x0000 }, + { PDB_RCP_DATA_PCAP_KEEP_FCS, 1, 66, 0x0000 }, + { PDB_RCP_DATA_PPC_HSH, 2, 58, 0x0000 }, + { PDB_RCP_DATA_TX_IGNORE, 1, 14, 0x0000 }, + { PDB_RCP_DATA_TX_NOW, 1, 15, 0x0000 }, + { PDB_RCP_DATA_TX_PORT, 5, 9, 0x0000 }, +}; + +static nthw_fpga_register_init_s pdb_registers[] = { + { PDB_CONFIG, 2, 10, NTHW_FPGA_REG_TYPE_WO, 0, 2, pdb_config_fields }, + { PDB_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, pdb_rcp_ctrl_fields }, + { PDB_RCP_DATA, 1, 67, NTHW_FPGA_REG_TYPE_WO, 0, 18, pdb_rcp_data_fields }, +}; + static nthw_fpga_field_init_s qsl_qen_ctrl_fields[] = { { QSL_QEN_CTRL_ADR, 5, 0, 0x0000 }, { QSL_QEN_CTRL_CNT, 16, 16, 0x0000 }, @@ -1510,6 +1547,7 @@ static nthw_fpga_module_init_s fpga_modules[] = { MOD_PCI_WR_TG, 0, MOD_PCI_WR_TG, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 2304, 7, pci_wr_tg_registers }, + { MOD_PDB, 0, MOD_PDB, 0, 9, NTHW_FPGA_BUS_TYPE_RAB1, 2560, 3, pdb_registers }, { MOD_QSL, 0, MOD_QSL, 0, 7, NTHW_FPGA_BUS_TYPE_RAB1, 1792, 8, qsl_registers }, { MOD_RAC, 0, MOD_RAC, 3, 0, NTHW_FPGA_BUS_TYPE_PCI, 8192, 14, rac_registers }, { MOD_RST9563, 0, MOD_RST9563, 0, 5, NTHW_FPGA_BUS_TYPE_RAB0, 1024, 5, rst9563_registers }, @@ -1672,5 +1710,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { }; nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { - 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 19, fpga_modules, + 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 20, fpga_modules, }; From patchwork Fri Oct 4 15:34:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145153 X-Patchwork-Delegate: ferruh.yigit@amd.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 6B91245AAF; Fri, 4 Oct 2024 18:51:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 54B1242E77; Fri, 4 Oct 2024 18:51:46 +0200 (CEST) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id 6BA60427CE for ; Fri, 4 Oct 2024 18:51:44 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2110.outbound.protection.outlook.com [104.47.18.110]) by mx-outbound22-159.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 16:51:43 +0000 Received: from AS1P190MB1824.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:4a2::21) by AM0P190MB0579.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:19e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 16:51:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PrGTVAOcwZZgsNoM2l7QJMNTdJTEvZkJqV73xnLLd+Op8gW59q7YuENUjUq0ITChKKj7pEb7olcH2jRyJhnvwK/L7gUB3YKaM+KyQWtvzvU8fLsaZ5HG3M6Zv6K7Q5zQZ4gWL0suLg2Xihppfset7Z79UXr7osK+sGNJK/YaYendPMYNnLJK9inDATodPIb05GcQwmcVRwbvK3CtHgU7hcKU3pcWmGQ9/z2bvorPktIYYkYDWJhArs2jjvFawL17fRRWYOv47dHNJuH1H7Dkj8LhNQTsOq5pbJIiV8mqNyPyvN3IGN3dX+Rmsnrj9TfEBCkFSxlMaFofgmbMhrcKPw== 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=9BfyTFh5vxHFO7lBWXD/Jh0Xl1ubneUH5YV7A7jcPpU=; b=O9Jzo76ECyb1fg9LVavnngsnOwf4pZa2X21aL9rak8zg6YLDvz0kmCJovwlWKO5gsSKgmyKbBEs9gb+lcFnBjf0SrS0zA2NgcBl0TTrfXDWYQKbWCroVUfw/lRS7eh/mSr+lGe6Uf63lYQwrAQgeURMKEGVV//jzB2VAV4vc7lF8iEG8SPiIjdN5bOApodUFHdeKpGlswQ4oPj2ncyLfnWdH6KNYQj20qH6cSn8m04Y+/xZdPCjKg0wRCFKClwYwSEnZwbIlopPLTqb+Qtg1UMMDi6QkUao7BKosDVW7QJuK4AlIfOkZqwfVmI80XNzX8X/3MbT1xEVsEkS5wMg/uQ== 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=9BfyTFh5vxHFO7lBWXD/Jh0Xl1ubneUH5YV7A7jcPpU=; b=RrEosd4VSw18bXQv0CLEzXvVj8I4rMq2qJ5r/uVrvvuJ3mSxmU27yMKJhE+c0PRLiI9JEuvMxidTzV5p+Kd5KWSJPhEQDH189lefKboXs+cggst6y/eCMaJbiSzY7ykEMK07KBj/LKZqap4RmlwdEkr28fiLLYmGcWz9v5PoDpM= Received: from AM0PR10CA0128.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::45) by AS1P190MB1824.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:4a2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.15; Fri, 4 Oct 2024 15:36:29 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::83) by AM0PR10CA0128.outlook.office365.com (2603:10a6:208:e6::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:29 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:29 +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, Oleksandr Kolomeiets Subject: [PATCH v1 30/31] net/ntnic: add Tx Packet Editor (TPE) FPGA module Date: Fri, 4 Oct 2024 17:34:53 +0200 Message-ID: <20241004153551.267935-36-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|AS1P190MB1824:EE_|AM0P190MB0579:EE_ X-MS-Office365-Filtering-Correlation-Id: 79068dd7-2f47-4e62-aaa9-08dce48a50e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: mcv6nJp4b1zbDhEfsZSRCKHgv7susOQd9wrXvUbExN72tnYsC8juDHWNk7hHwmTAe16z3jij9lkAncC7ek5SxiqhwhBSVbRL2M9rAAPcmC5UPnYX4VPFfp3JexZ+/d0S7Sh/xZvqN3SJqeR71Bq492+LahU7J+Curue2DF8R+9bAPj+tul/ks5Dh+/XuVUT7IYZWEg1gza5uNMQvsziXmnrWsvLhVcyn+DWIK9EmT2/m4AKGdIQVDxQ3ji7KBPIjew8oxF9E/kmqfLL/i//MItM2nFNQ5AsVqCIegmRVP3q9zqZ+Igq45HBMoXOFvHGz/TfinMZRTOaFhBX1OCL505RhWOICUrpuSparaOiALsXJCTt2120nh2SnzmbWinp9BXglExiTiqgYXPC2EkfAd9lx1hpcUtJfjMNbUDgiBoSV1TOwqOZkps2Dn7TCkgp5HDd3yopvLMOwMfSLLe+kohuWB+bwWdrblwtM8YjIsOQZ1XN+B7wq69CRJ53zEJmI5GpFGFD3kkQWtb2yMYpcJfP8JYHat3OR6cDqkCt+IBOAIk1TVsAO/FWqMORlOkm2mfMzK4rWXUaY3SX3iAxA39X1aGq2FJRGSZ2Edx159P0JE0U/9gr965QmFjxuRwYBYivN2sbyxixXAkDe8GyyJ2Iy8Sl53BFfA11QZzIp/Gbb0QISF8n3FkhslmuyEUBWMFXpxM4grO62uYv89tXNsLY3kCrsPxVIpFfstFjVVAByypSeF6KLTsdLzhPtRHAuNb9EctyYQa5q+HZOw9V9Mcjd0SVlxs7//+n25T2WX2/Mon9ycig76Cwk5HNL+MJIGDpJcFkSFX/7TRDtRVGq7COzDmVblBOjVDv2LXAUKSi109xeyWRW6m7jr6SjUzEUae35yu7GsKFRBMS0GwTedor2J8ADH4/2a09QARr2z5tJjlyhgdlv/0NoFY3ythDgkEwp6m42rKrFig+TGasgUCnjWrnadzHH3/Ci8rRhh2tVqhrpP4Slg6dWk+ifTd/8EPD8PJOmaiiKmfkeIcZ+0n9NAxSADBsgXm32tT8cDPLLnLFOiQM4vCaDCAEIY7OrXq7d3JuuALOcsMzjUAQVhhwegH6XaEutpasTt2p1Et2gR9x0Rtn91QINoRk555FTQItuyqirl8BkEFWUngS5hVuAvrRlK7QFJX8LkuKPGcpy9AZqMXgxzWWlFyiNMqUMXZU4pylgqFcjPU3QXpu2ILgKlt6GqP+sZkSxfJ7o2XSYVWqX8YlbdYWwbSTz+AoWuSd7mmv0Ol61dPvOxB5bqcQ5cN+AmcFxGMpRiH0lUW73ytpA5qwPVmPcAGV3HyKEmmeRQYYoYzSZ+rCKNiYvKoyfjCyEP04rRRTCXrEIyaWe11B1Tx34Qs8krdG0FZ/g 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)(376014)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: KNWdTTah3mLZaFg7cq76Ojf6wV+Z71aiZxGCKxLD97IqhghitpFR3xScad3iUbYm3o8ZaGezyygVpWpORzhU55VcPkhDf2ZPCoEq7npLLNPc+kwp1Q30EiCoYJFiERJMjnz+p3BxV0ccL95wDPJsIBPRm3Fwe7UlrvBG5aNH+3j/4XfBK2OlMQmd5o26DaeE9n1y69a+LtAHTL9N91OVUxiFgIU6fVq0fUeJTkvkSS54mqvTJapFLaVYtb9tDLu8n9LGQmpTxS08Ty7o1eBRp5wlrmLCIyjLQmwHVkI1lyNSU5UgaDBWrxParicU7e0X31pdj9PKT6LlcjWeUxtmGcLoD+ZrnDxLIu7rsVZrYGf1lEiiegvCCguIXgqILjKbg+GV+pFy6xZiW3R2gBOHDoC6rhB67M1lY+fjozzyktsENYQP8X05XBCy/nwEkn3cTqeh06Klxpj887z7lBZoSmK5IIJ7OhlRkHf5MQj+5eT64L6G+ChLMTL1YZmmo3JmV7rtTAPn4lVDT1DIZfHHRhq3Uo/OCCAr9YP+x9H7JFUowiViJSpxWSbzxqzom4bUUHLo3CC5ViXb7ps7bqEOIpn20ZBB9KixDuFiJWs6soNOrl4cgXYsKYtjgpVIg6d8Zukzopppwt68PSyhdugbPQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:29.1897 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 79068dd7-2f47-4e62-aaa9-08dce48a50e5 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1P190MB1824 X-OriginatorOrg: napatech.com X-BESS-ID: 1728060703-305791-12647-39124-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.18.110 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVobGhpamQGYGUNTEyNQ41dDczM QwMTnFxNDEPC3FxCzZIDXJIsksydjMUqk2FgBHgfz0QgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259495 [from cloudscan9-172.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: Oleksandr Kolomeiets The TX Packet Editor is a software abstraction module, that keeps track of the handful of FPGA modules that are used to edit packets in the TX pipeline. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/include/hw_mod_backend.h | 80 +++++ drivers/net/ntnic/meson.build | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 9 + .../nthw/flow_api/hw_mod/hw_mod_backend.c | 1 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c | 277 ++++++++++++++++++ 5 files changed, 368 insertions(+) create mode 100644 drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index 9644639131..cfd5150e59 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -654,6 +654,85 @@ struct tpe_func_s { struct hw_mod_tpe_v3_s v3; }; }; +enum hw_tpe_e { + /* functions */ + HW_TPE_PRESET_ALL = 0, + HW_TPE_FIND, + HW_TPE_COMPARE, + /* Control fields */ + HW_TPE_RPP_RCP_EXP = FIELD_START_INDEX, + HW_TPE_IFR_RCP_IPV4_EN, + HW_TPE_IFR_RCP_IPV4_DF_DROP, + HW_TPE_IFR_RCP_IPV6_EN, + HW_TPE_IFR_RCP_IPV6_DROP, + HW_TPE_IFR_RCP_MTU, + HW_TPE_INS_RCP_DYN, + HW_TPE_INS_RCP_OFS, + HW_TPE_INS_RCP_LEN, + HW_TPE_RPL_RCP_DYN, + HW_TPE_RPL_RCP_OFS, + HW_TPE_RPL_RCP_LEN, + HW_TPE_RPL_RCP_RPL_PTR, + HW_TPE_RPL_RCP_EXT_PRIO, + HW_TPE_RPL_RCP_ETH_TYPE_WR, + HW_TPE_RPL_EXT_RPL_PTR, + HW_TPE_RPL_EXT_META_RPL_LEN, /* SW only */ + HW_TPE_RPL_RPL_VALUE, + HW_TPE_CPY_RCP_READER_SELECT, + HW_TPE_CPY_RCP_DYN, + HW_TPE_CPY_RCP_OFS, + HW_TPE_CPY_RCP_LEN, + HW_TPE_HFU_RCP_LEN_A_WR, + HW_TPE_HFU_RCP_LEN_A_OUTER_L4_LEN, + HW_TPE_HFU_RCP_LEN_A_POS_DYN, + HW_TPE_HFU_RCP_LEN_A_POS_OFS, + HW_TPE_HFU_RCP_LEN_A_ADD_DYN, + HW_TPE_HFU_RCP_LEN_A_ADD_OFS, + HW_TPE_HFU_RCP_LEN_A_SUB_DYN, + HW_TPE_HFU_RCP_LEN_B_WR, + HW_TPE_HFU_RCP_LEN_B_POS_DYN, + HW_TPE_HFU_RCP_LEN_B_POS_OFS, + HW_TPE_HFU_RCP_LEN_B_ADD_DYN, + HW_TPE_HFU_RCP_LEN_B_ADD_OFS, + HW_TPE_HFU_RCP_LEN_B_SUB_DYN, + HW_TPE_HFU_RCP_LEN_C_WR, + HW_TPE_HFU_RCP_LEN_C_POS_DYN, + HW_TPE_HFU_RCP_LEN_C_POS_OFS, + HW_TPE_HFU_RCP_LEN_C_ADD_DYN, + HW_TPE_HFU_RCP_LEN_C_ADD_OFS, + HW_TPE_HFU_RCP_LEN_C_SUB_DYN, + HW_TPE_HFU_RCP_TTL_WR, + HW_TPE_HFU_RCP_TTL_POS_DYN, + HW_TPE_HFU_RCP_TTL_POS_OFS, + HW_TPE_CSU_RCP_OUTER_L3_CMD, + HW_TPE_CSU_RCP_OUTER_L4_CMD, + HW_TPE_CSU_RCP_INNER_L3_CMD, + HW_TPE_CSU_RCP_INNER_L4_CMD, +}; +bool hw_mod_tpe_present(struct flow_api_backend_s *be); +int hw_mod_tpe_alloc(struct flow_api_backend_s *be); +void hw_mod_tpe_free(struct flow_api_backend_s *be); +int hw_mod_tpe_reset(struct flow_api_backend_s *be); + +int hw_mod_tpe_rpp_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); + +int hw_mod_tpe_rpp_ifr_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); + +int hw_mod_tpe_ifr_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); + +int hw_mod_tpe_ins_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); + +int hw_mod_tpe_rpl_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); + +int hw_mod_tpe_rpl_ext_flush(struct flow_api_backend_s *be, int start_idx, int count); + +int hw_mod_tpe_rpl_rpl_flush(struct flow_api_backend_s *be, int start_idx, int count); + +int hw_mod_tpe_cpy_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); + +int hw_mod_tpe_hfu_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); + +int hw_mod_tpe_csu_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count); enum debug_mode_e { FLOW_BACKEND_DEBUG_MODE_NONE = 0x0000, @@ -813,6 +892,7 @@ struct flow_api_backend_s { struct qsl_func_s qsl; struct slc_lr_func_s slc_lr; struct pdb_func_s pdb; + struct tpe_func_s tpe; /* NIC attributes */ unsigned int num_phy_ports; diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 0415e5a5b2..e2eff3cf1e 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -56,6 +56,7 @@ sources = files( 'nthw/flow_api/hw_mod/hw_mod_pdb.c', 'nthw/flow_api/hw_mod/hw_mod_qsl.c', 'nthw/flow_api/hw_mod/hw_mod_slc_lr.c', + 'nthw/flow_api/hw_mod/hw_mod_tpe.c', 'nthw/flow_filter/flow_nthw_cat.c', 'nthw/flow_filter/flow_nthw_csu.c', 'nthw/flow_filter/flow_nthw_flm.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index 03946fb52f..9d47aed061 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -319,6 +319,15 @@ struct flow_nic_dev *flow_api_create(uint8_t adapter_no, const struct flow_api_b if (init_resource_elements(ndev, RES_FLM_RCP, ndev->be.flm.nb_categories)) goto err_exit; + if (init_resource_elements(ndev, RES_TPE_RCP, ndev->be.tpe.nb_rcp_categories)) + goto err_exit; + + if (init_resource_elements(ndev, RES_TPE_EXT, ndev->be.tpe.nb_rpl_ext_categories)) + goto err_exit; + + if (init_resource_elements(ndev, RES_TPE_RPL, ndev->be.tpe.nb_rpl_depth)) + goto err_exit; + if (init_resource_elements(ndev, RES_SCRUB_RCP, ndev->be.flm.nb_scrub_profiles)) goto err_exit; diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c index 118e49f539..13e98ea9ba 100644 --- a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_backend.c @@ -27,6 +27,7 @@ static const struct { hw_mod_slc_lr_present }, { "PDB", hw_mod_pdb_alloc, hw_mod_pdb_free, hw_mod_pdb_reset, hw_mod_pdb_present }, + { "TPE", hw_mod_tpe_alloc, hw_mod_tpe_free, hw_mod_tpe_reset, hw_mod_tpe_present }, }; #define MOD_COUNT (ARRAY_SIZE(module)) diff --git a/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c new file mode 100644 index 0000000000..180deefd72 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c @@ -0,0 +1,277 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include + +#include "hw_mod_backend.h" + +#define _MOD_ "TPE" +#define _VER_ be->tpe.ver + +bool hw_mod_tpe_present(struct flow_api_backend_s *be) +{ + return be->iface->get_tpe_present(be->be_dev); +} + +int hw_mod_tpe_alloc(struct flow_api_backend_s *be) +{ + int nb; + _VER_ = be->iface->get_tpe_version(be->be_dev); + NT_LOG(DBG, FILTER, _MOD_ " MODULE VERSION %i.%i\n", VER_MAJOR(_VER_), VER_MINOR(_VER_)); + + nb = be->iface->get_nb_tpe_categories(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(tpe_categories); + + be->tpe.nb_rcp_categories = (uint32_t)nb; + + nb = be->iface->get_nb_tpe_ifr_categories(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(tpe_ifr_categories); + + be->tpe.nb_ifr_categories = (uint32_t)nb; + + nb = be->iface->get_nb_tx_cpy_writers(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(tx_cpy_writers); + + be->tpe.nb_cpy_writers = (uint32_t)nb; + + nb = be->iface->get_nb_tx_rpl_depth(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(tx_rpl_depth); + + be->tpe.nb_rpl_depth = (uint32_t)nb; + + nb = be->iface->get_nb_tx_rpl_ext_categories(be->be_dev); + + if (nb <= 0) + return COUNT_ERROR(tx_rpl_ext_categories); + + be->tpe.nb_rpl_ext_categories = (uint32_t)nb; + + switch (_VER_) { + case 3: + if (!callocate_mod((struct common_func_s *)&be->tpe, 10, &be->tpe.v3.rpp_rcp, + be->tpe.nb_rcp_categories, sizeof(struct tpe_v1_rpp_v0_rcp_s), + &be->tpe.v3.rpp_ifr_rcp, be->tpe.nb_ifr_categories, + sizeof(struct tpe_v2_rpp_v1_ifr_rcp_s), &be->tpe.v3.ifr_rcp, + be->tpe.nb_ifr_categories, sizeof(struct tpe_v2_ifr_v1_rcp_s), + + &be->tpe.v3.ins_rcp, be->tpe.nb_rcp_categories, + sizeof(struct tpe_v1_ins_v1_rcp_s), + + &be->tpe.v3.rpl_rcp, be->tpe.nb_rcp_categories, + sizeof(struct tpe_v3_rpl_v4_rcp_s), &be->tpe.v3.rpl_ext, + be->tpe.nb_rpl_ext_categories, + sizeof(struct tpe_v1_rpl_v2_ext_s), &be->tpe.v3.rpl_rpl, + be->tpe.nb_rpl_depth, sizeof(struct tpe_v1_rpl_v2_rpl_s), + + &be->tpe.v3.cpy_rcp, + be->tpe.nb_cpy_writers * be->tpe.nb_rcp_categories, + sizeof(struct tpe_v1_cpy_v1_rcp_s), + + &be->tpe.v3.hfu_rcp, be->tpe.nb_rcp_categories, + sizeof(struct tpe_v1_hfu_v1_rcp_s), + + &be->tpe.v3.csu_rcp, be->tpe.nb_rcp_categories, + sizeof(struct tpe_v1_csu_v0_rcp_s))) + return -1; + + break; + + default: + return UNSUP_VER; + } + + return 0; +} + +void hw_mod_tpe_free(struct flow_api_backend_s *be) +{ + if (be->tpe.base) { + free(be->tpe.base); + be->tpe.base = NULL; + } +} + +int hw_mod_tpe_reset(struct flow_api_backend_s *be) +{ + int err = 0; + + /* Zero entire cache area */ + zero_module_cache((struct common_func_s *)(&be->tpe)); + + NT_LOG(DBG, FILTER, "INIT TPE\n"); + err |= hw_mod_tpe_rpp_rcp_flush(be, 0, ALL_ENTRIES); + err |= hw_mod_tpe_ins_rcp_flush(be, 0, ALL_ENTRIES); + err |= hw_mod_tpe_rpl_rcp_flush(be, 0, ALL_ENTRIES); + err |= hw_mod_tpe_rpl_ext_flush(be, 0, ALL_ENTRIES); + err |= hw_mod_tpe_rpl_rpl_flush(be, 0, ALL_ENTRIES); + err |= hw_mod_tpe_cpy_rcp_flush(be, 0, ALL_ENTRIES); + err |= hw_mod_tpe_hfu_rcp_flush(be, 0, ALL_ENTRIES); + err |= hw_mod_tpe_csu_rcp_flush(be, 0, ALL_ENTRIES); + err |= hw_mod_tpe_rpp_ifr_rcp_flush(be, 0, ALL_ENTRIES); + err |= hw_mod_tpe_ifr_rcp_flush(be, 0, ALL_ENTRIES); + + return err; +} + +/* + * RPP_IFR_RCP + */ + +int hw_mod_tpe_rpp_ifr_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->tpe.nb_ifr_categories; + + if ((unsigned int)(start_idx + count) > be->tpe.nb_ifr_categories) + return INDEX_TOO_LARGE; + + return be->iface->tpe_rpp_ifr_rcp_flush(be->be_dev, &be->tpe, start_idx, count); +} + +/* + * RPP_RCP + */ + +int hw_mod_tpe_rpp_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->tpe.nb_rcp_categories; + + if ((unsigned int)(start_idx + count) > be->tpe.nb_rcp_categories) + return INDEX_TOO_LARGE; + + return be->iface->tpe_rpp_rcp_flush(be->be_dev, &be->tpe, start_idx, count); +} + +/* + * IFR_RCP + */ + +int hw_mod_tpe_ifr_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->tpe.nb_ifr_categories; + + if ((unsigned int)(start_idx + count) > be->tpe.nb_ifr_categories) + return INDEX_TOO_LARGE; + + return be->iface->tpe_ifr_rcp_flush(be->be_dev, &be->tpe, start_idx, count); +} + +/* + * INS_RCP + */ + +int hw_mod_tpe_ins_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->tpe.nb_rcp_categories; + + if ((unsigned int)(start_idx + count) > be->tpe.nb_rcp_categories) + return INDEX_TOO_LARGE; + + return be->iface->tpe_ins_rcp_flush(be->be_dev, &be->tpe, start_idx, count); +} + +/* + * RPL_RCP + */ + +int hw_mod_tpe_rpl_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->tpe.nb_rcp_categories; + + if ((unsigned int)(start_idx + count) > be->tpe.nb_rcp_categories) + return INDEX_TOO_LARGE; + + return be->iface->tpe_rpl_rcp_flush(be->be_dev, &be->tpe, start_idx, count); +} + +/* + * RPL_EXT + */ + +int hw_mod_tpe_rpl_ext_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->tpe.nb_rpl_ext_categories; + + if ((unsigned int)(start_idx + count) > be->tpe.nb_rpl_ext_categories) + return INDEX_TOO_LARGE; + + return be->iface->tpe_rpl_ext_flush(be->be_dev, &be->tpe, start_idx, count); +} + +/* + * RPL_RPL + */ + +int hw_mod_tpe_rpl_rpl_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->tpe.nb_rpl_depth; + + if ((unsigned int)(start_idx + count) > be->tpe.nb_rpl_depth) + return INDEX_TOO_LARGE; + + return be->iface->tpe_rpl_rpl_flush(be->be_dev, &be->tpe, start_idx, count); +} + +/* + * CPY_RCP + */ + +int hw_mod_tpe_cpy_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + const uint32_t cpy_size = be->tpe.nb_cpy_writers * be->tpe.nb_rcp_categories; + + if (count == ALL_ENTRIES) + count = cpy_size; + + if ((unsigned int)(start_idx + count) > cpy_size) + return INDEX_TOO_LARGE; + + return be->iface->tpe_cpy_rcp_flush(be->be_dev, &be->tpe, start_idx, count); +} + +/* + * HFU_RCP + */ + +int hw_mod_tpe_hfu_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->tpe.nb_rcp_categories; + + if ((unsigned int)(start_idx + count) > be->tpe.nb_rcp_categories) + return INDEX_TOO_LARGE; + + return be->iface->tpe_hfu_rcp_flush(be->be_dev, &be->tpe, start_idx, count); +} + +/* + * CSU_RCP + */ + +int hw_mod_tpe_csu_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count) +{ + if (count == ALL_ENTRIES) + count = be->tpe.nb_rcp_categories; + + if ((unsigned int)(start_idx + count) > be->tpe.nb_rcp_categories) + return INDEX_TOO_LARGE; + + return be->iface->tpe_csu_rcp_flush(be->be_dev, &be->tpe, start_idx, count); +} From patchwork Fri Oct 4 15:34:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145095 X-Patchwork-Delegate: ferruh.yigit@amd.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 E2E1145AAF; Fri, 4 Oct 2024 17:51:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 90CF042D7F; Fri, 4 Oct 2024 17:50:58 +0200 (CEST) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id E96F74278D for ; Fri, 4 Oct 2024 17:50:55 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2169.outbound.protection.outlook.com [104.47.17.169]) by mx-outbound22-159.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:50:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=N+WVqY2tzBgGk6fW5uRE/Z6VlV+q6XuibqlGoLQ3N/Vb7urgj6yTuuv47idVdlzfXU/wmipmMuR+jHDK/O36XGgAmQMNR2f6wCHqSHClkPf/68ybR5loorObdhbMWOFK2gH/PK6eNGGE6puY/GMJTV1rj15wYKc+iCIok4JlcZhhNK/YD3UVzRqr9lmvlzIogxFy3wyuqQTXuBHweUAWIfGxjnwx3hgjXuTl8FdcP0BzM3aZB4I0y7RY7FdAmxLgxvoiFrrvR9Nst2MgJjCNz9FUzSDFN3EDOGkO29iIwHGSB+NL4L5oMat3AwchCYIQcol+JeX040aMHs2s7HHEyQ== 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=eH8h9XdKsBZvEwQVIAy54T8pA7J3FXHKxQLMCSQUFyo=; b=FNdQugDH/gMxt8KAkujotTf+W1XTjbomCQXIfGJDPHTd7ksCvMc0TNWqpJZgl7uyNrQ97POZRlbgYcgAKnpZrF+P80IdzrHjXTa46ZV3oda66JXtcIJPJtoWsYtfABGlEPAupw/xSZMdKmmJZgwtFJPHmHqE2yGtOu7GWfX+w1oGeEzz0FbifoIIAvoZ5BlwnB8gH5gLrD+4V2gPuIu0o9Y/QqTatEuO3UOXx7Qu5GLXWo3/YMVDXIGpEemiHes+FSGhL3NGZvVexdAzMnqtF0lJkRE6w/yRbo4bFknXD+vo5mxo2n0mD/eXlWHIU+Cb6M9dryzBCouGRprbRgI49w== 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=eH8h9XdKsBZvEwQVIAy54T8pA7J3FXHKxQLMCSQUFyo=; b=XgVWGxM9S6nN+IZ+G+KZDtzK4o6E33SAxA+yeEDVLsC96XelO5gS2eGIRc4GuAqCNSY9LvGSQtfs695LxI1UQYphEbLHLrx4jf4TqjWT+TsTTtX8U2s8by1HRRwysGC2qz54Xqf2dJ2k2ZorjgxQI9pjeVBPdeiTVIitSJHpf+k= Received: from AM0PR10CA0125.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::42) by GV1P190MB1993.EURP190.PROD.OUTLOOK.COM (2603:10a6:150:58::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 15:36:30 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::25) by AM0PR10CA0125.outlook.office365.com (2603:10a6:208:e6::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:30 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:29 +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, Oleksandr Kolomeiets Subject: [PATCH v1 31/31] net/ntnic: add receive MAC converter (RMC) core module Date: Fri, 4 Oct 2024 17:34:54 +0200 Message-ID: <20241004153551.267935-37-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|GV1P190MB1993:EE_ X-MS-Office365-Filtering-Correlation-Id: 53baba3a-39bc-436e-2fc6-08dce48a514c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: jMHOqT1sM/Fsh8ky5Q0QCvN53NxAGFnA7B+I+131i41l/8lhHnzsX7KWLTmz0JFODd5p+cXVo3mAF/wMTkoxW5x86eQBAYTQzM6jlqs80ViZIk++odHD15siRxO3BDBrSaq/rahAxV7hRA1rr1vpiMwEEzbr62qtCHPzb7iKvjFVocmSpk/TopmX4YwKb031WCj3kXzcnL9TgeJXmn8s66GguUhZ3nT2LalwXwyVgiFEpgEAER8uWanrmtLflZMi+5YhVK+zBg8wraUra2OOWtt1//ZD+oc1z+S+4HaBNjPUqi/R31QfV2tnn1vyOUDezAsI8akD2MJieLvGYo4F0I3WxjyY7ZOqhWz7BcKVRxn/T8V5zHY+8nAny1UvJY5sNsG6wC+2fR0Ds5QtIrsZP+ZSqCCkWGCZOgqxcfVecM4J+ToJ+OI5tEnTiO1++nRD3KwU+/WwoXGNs7O30IFyhbDLR2y0jAKFlgVQfWgg99W3aPl+7uKKwtLZ3BRUWqpTneLr8n/FOd/PKcSmzdE3qEMqYd+3BLNLxyvbT52y2Noea9GHcIum6nPd3Vrx8WHYiVc2pi2/wPILWYO9rVkwlXDu10zVfdwlMV2L9zlurqtl5u6rc20IayxgpMFXMc+R2DkqErTFh4lwhMzScm0ueS9X34klad+29Txkj95O2FuT7Sf5R6EwbN7UdkYdsjoSKN1YgUiuEQiu1qNt1CPlZgxC2RNxHlAWA7ECPMn8np0DhTHDPNLf4LEkQzOmJQHt3EklUJlLYxU7FsIHIg4Oq/VSTN4t9fGdP5GTN/fPFOTbo2z3L03+qcbNxUysZGTTDJaJpHk7l5zHz+J0qEhdwzwa94nTXm5h/g2rKTn9Kg7GSHDbdZtGovVJixglVlmstO4IJEuTqFJuZSAJiUIkXrk3nGitcfVfCWIYj+nVnNTfxu8mqME3tWoiSC+kwkKPZBRrcwivseoTZ26Yn2c/wxFRo5FHnnklF5lgdF5ylIWGYrfO5o0yqJpQ7YuaunM2fvTKsh4ZXBJvhBgyGmGEnYjHInO994dPu2o2+NmqB52NLnlVfQqsNmmbM9KBkA1yXHTDwFgDHj23PdMwtcSYV1+uT6JpaHHhw2yf6Lz7XJWFix/72EiiqWwYAugSFnakyEl2uK3OFa6P2TE1hSmRZxEAtvFCJ3+5OzWzO+Ppn7Ev6ruBn1VbM0KbJd+SmT5uNOKWnKeglmXJOcnnvmuSqwvWfixVH2UmHz+tzhb4GUqjOJQtk1/sP/2NWmT3yH26oPHoYPfkZQc8RFg9vIm07VF/XSwsSfDeraOkT9WkGc8dM6SuQ58DoN0273R2husSZASZgM/TZCxK78CDNl/19s4qug+xpQgssJicRRa/Y5KHjQVkbKmK/VSwYl5uMZw6 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)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: lWrdSnKL1D9j7x0e8rrvsOF/8oaPWl+gxECQ9iR0S5xlt+qFhOili3Eyg/fHcac6KeuZKi/vLD6bLRYgEo6/7pfYxHBz9GE+O50h74bPSyO1Gueudhfv3I8NDdWVdvBb/M5/d38gdO6rVDzzXWcHtYX1NbfKVDlNZfHPP87rJzNv1plv6srJYceIvUZC0MYbKXKtjYroqzXYK3q2ZosqTB1sHkg4E5U5qZ/z2dq3TkhAfAxeoV0ka39Umfw89ee1im2ItVMEsNxzN4vudscE3FkPyL60X37gnHN6Av3aBW3ICxtCO2egIxiQoYGfX5IUKl9nsyhDohZIjsg3Gl1ZP2O4pSwr1SusLkc2SgJte5GvtET2iaxjL7CCnjCwW2pPOl0Oh+90RyyKHXFEulza1nLBjyCyiCBoITF6OJwP02TLmBtQs/i7HjL8p/oY0QCuk/UPLVTPLeX26bXChOr3/97ksa4q7g3FSmkcJ2Vf0eRW77rkcjfAQYoENM22QaWKjKUzmBvA3/Wb5xpOBnfx5owZaVH5fp9YHmWw12sdzwjU35FVGaEXJZMTl8BESOYoC3t+/wGykIKUuD/vgMM/MuyXa7RexlmuwD3vX+xkrkJ1yOfUaTcjSz1StNKpc4AJdeaouXBjYxSfr9YYdCKFkA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:29.7678 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 53baba3a-39bc-436e-2fc6-08dce48a514c 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1P190MB1993 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057054-305791-12644-36011-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.169 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaGlhYWQGYGUNTY0twkOTnRxM jULDXVwDItOdHI1NgiydA82dzILNEoTak2FgBdJCESQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan9-172.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: Oleksandr Kolomeiets The RX MAC Converter module is part of the control mechanism of the physical ports. Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/adapter/nt4ga_adapter.c | 14 +++ drivers/net/ntnic/include/nt4ga_adapter.h | 1 + drivers/net/ntnic/include/ntnic_stat.h | 11 +++ drivers/net/ntnic/meson.build | 1 + .../net/ntnic/nthw/core/include/nthw_rmc.h | 49 ++++++++++ drivers/net/ntnic/nthw/core/nthw_rmc.c | 90 +++++++++++++++++++ .../supported/nthw_fpga_9563_055_049_0000.c | 29 +++++- .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 1 + .../nthw/supported/nthw_fpga_reg_defs_rmc.h | 36 ++++++++ 10 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/include/ntnic_stat.h create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_rmc.h create mode 100644 drivers/net/ntnic/nthw/core/nthw_rmc.c create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rmc.h diff --git a/drivers/net/ntnic/adapter/nt4ga_adapter.c b/drivers/net/ntnic/adapter/nt4ga_adapter.c index fd90f31abd..5d9db3450d 100644 --- a/drivers/net/ntnic/adapter/nt4ga_adapter.c +++ b/drivers/net/ntnic/adapter/nt4ga_adapter.c @@ -212,6 +212,20 @@ static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info) } } + nthw_rmc_t *p_nthw_rmc = nthw_rmc_new(); + if (p_nthw_rmc == NULL) { + NT_LOG(ERR, NTNIC, "Failed to allocate memory for RMC module\n"); + return -1; + } + + res = nthw_rmc_init(p_nthw_rmc, p_fpga, 0); + if (res) { + NT_LOG(ERR, NTNIC, "Failed to initialize RMC module\n"); + return -1; + } + + nthw_rmc_unblock(p_nthw_rmc, false); + return 0; } diff --git a/drivers/net/ntnic/include/nt4ga_adapter.h b/drivers/net/ntnic/include/nt4ga_adapter.h index 93218fd45b..809135f130 100644 --- a/drivers/net/ntnic/include/nt4ga_adapter.h +++ b/drivers/net/ntnic/include/nt4ga_adapter.h @@ -27,6 +27,7 @@ typedef struct hw_info_s { * Services provided by the adapter module */ #include "nt4ga_filter.h" +#include "ntnic_stat.h" typedef struct adapter_info_s { struct nt4ga_filter_s nt4ga_filter; diff --git a/drivers/net/ntnic/include/ntnic_stat.h b/drivers/net/ntnic/include/ntnic_stat.h new file mode 100644 index 0000000000..148088fe1d --- /dev/null +++ b/drivers/net/ntnic/include/ntnic_stat.h @@ -0,0 +1,11 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef NTNIC_STAT_H_ +#define NTNIC_STAT_H_ + +#include "nthw_rmc.h" + +#endif /* NTNIC_STAT_H_ */ diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index e2eff3cf1e..66d2770da7 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -41,6 +41,7 @@ sources = files( 'nthw/core/nthw_iic.c', 'nthw/core/nthw_mac_pcs.c', 'nthw/core/nthw_pcie3.c', + 'nthw/core/nthw_rmc.c', 'nthw/core/nthw_sdc.c', 'nthw/core/nthw_si5340.c', 'nthw/flow_api/flow_api.c', diff --git a/drivers/net/ntnic/nthw/core/include/nthw_rmc.h b/drivers/net/ntnic/nthw/core/include/nthw_rmc.h new file mode 100644 index 0000000000..65fbd8cda0 --- /dev/null +++ b/drivers/net/ntnic/nthw/core/include/nthw_rmc.h @@ -0,0 +1,49 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef NTHW_RMC_H_ +#define NTHW_RMC_H_ + +#include "nthw_fpga_model.h" + +struct nthw_rmc { + nthw_fpga_t *mp_fpga; + nthw_module_t *mp_mod_rmc; + int mn_instance; + + int mn_ports; + int mn_nims; + + bool mb_administrative_block; + + /* RMC CTRL register */ + nthw_register_t *mp_reg_ctrl; + nthw_field_t *mp_fld_ctrl_block_stat_drop; + nthw_field_t *mp_fld_ctrl_block_keep_alive; + nthw_field_t *mp_fld_ctrl_block_mac_port; + + /* RMC Status register */ + nthw_register_t *mp_reg_status; + nthw_field_t *mp_fld_sf_ram_of; + nthw_field_t *mp_fld_descr_fifo_of; + + /* RMC DBG register */ + nthw_register_t *mp_reg_dbg; + nthw_field_t *mp_fld_dbg_merge; + + /* RMC MAC_IF register */ + nthw_register_t *mp_reg_mac_if; + nthw_field_t *mp_fld_mac_if_err; +}; + +typedef struct nthw_rmc nthw_rmc_t; +typedef struct nthw_rmc nthw_rmc; + +nthw_rmc_t *nthw_rmc_new(void); +int nthw_rmc_init(nthw_rmc_t *p, nthw_fpga_t *p_fpga, int n_instance); + +void nthw_rmc_unblock(nthw_rmc_t *p, bool b_is_slave); + +#endif /* NTHW_RMC_H_ */ diff --git a/drivers/net/ntnic/nthw/core/nthw_rmc.c b/drivers/net/ntnic/nthw/core/nthw_rmc.c new file mode 100644 index 0000000000..9604825be0 --- /dev/null +++ b/drivers/net/ntnic/nthw/core/nthw_rmc.c @@ -0,0 +1,90 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include "ntlog.h" + +#include "nthw_drv.h" +#include "nthw_register.h" + +#include "nthw_rmc.h" + +nthw_rmc_t *nthw_rmc_new(void) +{ + nthw_rmc_t *p = malloc(sizeof(nthw_rmc_t)); + + if (p) + memset(p, 0, sizeof(nthw_rmc_t)); + + return p; +} + +int nthw_rmc_init(nthw_rmc_t *p, nthw_fpga_t *p_fpga, int n_instance) +{ + const char *const p_adapter_id_str = p_fpga->p_fpga_info->mp_adapter_id_str; + nthw_module_t *p_mod = nthw_fpga_query_module(p_fpga, MOD_RMC, n_instance); + + if (p == NULL) + return p_mod == NULL ? -1 : 0; + + if (p_mod == NULL) { + NT_LOG(ERR, NTHW, "%s: RMC %d: no such instance\n", p_adapter_id_str, n_instance); + return -1; + } + + p->mp_fpga = p_fpga; + p->mn_instance = n_instance; + p->mp_mod_rmc = p_mod; + + /* Params */ + p->mn_ports = + nthw_fpga_get_product_param(p_fpga, NT_RX_PORTS, + nthw_fpga_get_product_param(p_fpga, NT_PORTS, 0)); + p->mn_nims = nthw_fpga_get_product_param(p_fpga, NT_NIMS, 0); + p->mb_administrative_block = false; + + NT_LOG(DBG, NTHW, "%s: RMC %d\n", p_adapter_id_str, p->mn_instance); + + p->mp_reg_ctrl = nthw_module_get_register(p->mp_mod_rmc, RMC_CTRL); + + p->mp_fld_ctrl_block_stat_drop = + nthw_register_get_field(p->mp_reg_ctrl, RMC_CTRL_BLOCK_STATT); + p->mp_fld_ctrl_block_keep_alive = + nthw_register_get_field(p->mp_reg_ctrl, RMC_CTRL_BLOCK_KEEPA); + p->mp_fld_ctrl_block_mac_port = + nthw_register_get_field(p->mp_reg_ctrl, RMC_CTRL_BLOCK_MAC_PORT); + + p->mp_reg_status = nthw_module_query_register(p->mp_mod_rmc, RMC_STATUS); + + if (p->mp_reg_status) { + p->mp_fld_sf_ram_of = + nthw_register_get_field(p->mp_reg_status, RMC_STATUS_SF_RAM_OF); + p->mp_fld_descr_fifo_of = + nthw_register_get_field(p->mp_reg_status, RMC_STATUS_DESCR_FIFO_OF); + } + + p->mp_reg_dbg = nthw_module_query_register(p->mp_mod_rmc, RMC_DBG); + + if (p->mp_reg_dbg) + p->mp_fld_dbg_merge = nthw_register_get_field(p->mp_reg_dbg, RMC_DBG_MERGE); + + p->mp_reg_mac_if = nthw_module_query_register(p->mp_mod_rmc, RMC_MAC_IF); + + if (p->mp_reg_mac_if) + p->mp_fld_mac_if_err = nthw_register_get_field(p->mp_reg_mac_if, RMC_MAC_IF_ERR); + + return 0; +} + +void nthw_rmc_unblock(nthw_rmc_t *p, bool b_is_slave) +{ + uint32_t n_block_mask = ~0U << (b_is_slave ? p->mn_nims : p->mn_ports); + + /* BLOCK_STATT(0)=0 BLOCK_KEEPA(1)=0 BLOCK_MAC_PORT(8:11)=0 */ + if (!p->mb_administrative_block) { + nthw_field_clr_flush(p->mp_fld_ctrl_block_stat_drop); + nthw_field_clr_flush(p->mp_fld_ctrl_block_keep_alive); + nthw_field_set_val_flush32(p->mp_fld_ctrl_block_mac_port, n_block_mask); + } +} diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c index 9f821abf55..98b857158e 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c @@ -1468,6 +1468,32 @@ static nthw_fpga_register_init_s rac_registers[] = { { RAC_RAB_OB_DATA, 4168, 32, NTHW_FPGA_REG_TYPE_RC1, 0, 1, rac_rab_ob_data_fields }, }; +static nthw_fpga_field_init_s rmc_ctrl_fields[] = { + { RMC_CTRL_BLOCK_KEEPA, 1, 1, 1 }, { RMC_CTRL_BLOCK_MAC_PORT, 2, 8, 3 }, + { RMC_CTRL_BLOCK_RPP_SLICE, 8, 10, 0 }, { RMC_CTRL_BLOCK_STATT, 1, 0, 1 }, + { RMC_CTRL_LAG_PHY_ODD_EVEN, 1, 24, 0 }, +}; + +static nthw_fpga_field_init_s rmc_dbg_fields[] = { + { RMC_DBG_MERGE, 31, 0, 0 }, +}; + +static nthw_fpga_field_init_s rmc_mac_if_fields[] = { + { RMC_MAC_IF_ERR, 31, 0, 0 }, +}; + +static nthw_fpga_field_init_s rmc_status_fields[] = { + { RMC_STATUS_DESCR_FIFO_OF, 1, 16, 0 }, + { RMC_STATUS_SF_RAM_OF, 1, 0, 0 }, +}; + +static nthw_fpga_register_init_s rmc_registers[] = { + { RMC_CTRL, 0, 25, NTHW_FPGA_REG_TYPE_RW, 771, 5, rmc_ctrl_fields }, + { RMC_DBG, 2, 31, NTHW_FPGA_REG_TYPE_RO, 0, 1, rmc_dbg_fields }, + { RMC_MAC_IF, 3, 31, NTHW_FPGA_REG_TYPE_RO, 0, 1, rmc_mac_if_fields }, + { RMC_STATUS, 1, 17, NTHW_FPGA_REG_TYPE_RO, 0, 2, rmc_status_fields }, +}; + static nthw_fpga_field_init_s rst9563_ctrl_fields[] = { { RST9563_CTRL_PTP_MMCM_CLKSEL, 1, 2, 1 }, { RST9563_CTRL_TS_CLKSEL, 1, 1, 1 }, @@ -1550,6 +1576,7 @@ static nthw_fpga_module_init_s fpga_modules[] = { { MOD_PDB, 0, MOD_PDB, 0, 9, NTHW_FPGA_BUS_TYPE_RAB1, 2560, 3, pdb_registers }, { MOD_QSL, 0, MOD_QSL, 0, 7, NTHW_FPGA_BUS_TYPE_RAB1, 1792, 8, qsl_registers }, { MOD_RAC, 0, MOD_RAC, 3, 0, NTHW_FPGA_BUS_TYPE_PCI, 8192, 14, rac_registers }, + { MOD_RMC, 0, MOD_RMC, 1, 3, NTHW_FPGA_BUS_TYPE_RAB0, 12288, 4, rmc_registers }, { MOD_RST9563, 0, MOD_RST9563, 0, 5, NTHW_FPGA_BUS_TYPE_RAB0, 1024, 5, rst9563_registers }, }; @@ -1710,5 +1737,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { }; nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { - 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 20, fpga_modules, + 200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 21, fpga_modules, }; diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h index 51b2d99c01..5d6aac122c 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h @@ -34,6 +34,7 @@ #define MOD_PDB (0xa7771bffUL) #define MOD_QSL (0x448ed859UL) #define MOD_RAC (0xae830b42UL) +#define MOD_RMC (0x236444eUL) #define MOD_RPP_LR (0xba7f945cUL) #define MOD_RST9563 (0x385d6d1dUL) #define MOD_SDC (0xd2369530UL) diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h index 8fa41eb7ea..45f9794958 100644 --- a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h @@ -35,6 +35,7 @@ #include "nthw_fpga_reg_defs_pdb.h" #include "nthw_fpga_reg_defs_qsl.h" #include "nthw_fpga_reg_defs_rac.h" +#include "nthw_fpga_reg_defs_rmc.h" #include "nthw_fpga_reg_defs_rpl.h" #include "nthw_fpga_reg_defs_rpp_lr.h" #include "nthw_fpga_reg_defs_rst9563.h" diff --git a/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rmc.h b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rmc.h new file mode 100644 index 0000000000..07a1c8f890 --- /dev/null +++ b/drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rmc.h @@ -0,0 +1,36 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +/* + * nthw_fpga_reg_defs_rmc.h + * + * Auto-generated file - do *NOT* edit + * + */ + +#ifndef _NTHW_FPGA_REG_DEFS_RMC_ +#define _NTHW_FPGA_REG_DEFS_RMC_ + +/* RMC */ +#define NTHW_MOD_RMC (0x236444eUL) +#define RMC_CTRL (0x4c45f748UL) +#define RMC_CTRL_BLOCK_KEEPA (0x5e036c8UL) +#define RMC_CTRL_BLOCK_MAC_PORT (0x582a6486UL) +#define RMC_CTRL_BLOCK_RPP_SLICE (0x58c719cUL) +#define RMC_CTRL_BLOCK_STATT (0xb36d5342UL) +#define RMC_CTRL_LAG_PHY_ODD_EVEN (0xf4613c9UL) +#define RMC_DBG (0x578721f2UL) +#define RMC_DBG_MERGE (0xebfd6f00UL) +#define RMC_MAC_IF (0x806bb8b0UL) +#define RMC_MAC_IF_ERR (0xa79e974aUL) +#define RMC_STATUS (0x3c415d75UL) +#define RMC_STATUS_DESCR_FIFO_OF (0x7be968baUL) +#define RMC_STATUS_SF_RAM_OF (0x1832173dUL) + +#endif /* _NTHW_FPGA_REG_DEFS_RMC_ */ + +/* + * Auto-generated file - do *NOT* edit + */