From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D5A1545B04; Thu, 10 Oct 2024 16:17:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EC0D340DDE; Thu, 10 Oct 2024 16:15:01 +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 3CD4D40A7F for ; Thu, 10 Oct 2024 16:14:47 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2110.outbound.protection.outlook.com [104.47.17.110]) by mx-outbound20-48.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 10 Oct 2024 14:14:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bkBdcZR99jYq/In72ol23D7rezEEG52yqyXEguasAiZrB24eiK2dZmOTLSU/Gg7Vh0f+BR2Or/kVsP65vORVllrNQl9VC2v2T7G/nih3BCkH0J2KpjGawtEGdajZEsmspmKZix/QnK5X78sVUdV2UsPespgGHn9x5Omv5se9DL8hQWSUoDoAztUl9cPlNlJa3qf30Lf6OSBWh2oOSzmnhlPuw+23FOVj1MSQUd3GUcmZCPR3hfZMPapgqUATNTljm6NpTbbzSsscaupaEaB6G7cmObh1mfeucHQA03AsijjrwwW5gjxMu24wGegcsMpL5x28Gcfx8sHThojfqBG9dw== 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=dMGMo4J+UWUnAFQ6TRC2WfnaUB7ugmez6Xc6yyQt5Jc=; b=lyS2V1tlNQnDi2pfp+xNQ4ZWeMXiFGkJzGfmB74aOFr3FPQsN1fOJ/Sf+649T0XBJshTHQpPaZ0dqQIvWnbRAW47G3zL5dv3M9tciux2M2X5UNzFpvlrWTSACBtnpqarmqv5H2nlexCuk48WelgZHAcj+yUNV6lBkfGuasJWrWTTumCkxl9N3vP9IWBSakPfarMaJEFAket3SaCwIAESOUzpeOQNZm0E1h0kBKzgrvglM4jUSD+d+40PwDj7YrG0owsCrr7UmWTIzoj7bSJ0R9TcQ2YqaGP8pHQhRI/VO2khJGB+35ywxgSsCrTOnjMjw41mgg5riM/LtDK4OoMPjQ== 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=dMGMo4J+UWUnAFQ6TRC2WfnaUB7ugmez6Xc6yyQt5Jc=; b=kZCn+kvocv5EjNo75bc3oA5AezuYaIadSoI8cfMzY3+V41TxiE7pHc6bbX89ArqeuxXOZPqMxwJe1Ggx82MN/a5bNwpVxf/8eb569iY9mqLvgmg1wmDkxgeb7eb44FLau3jR5RmPpow9GWE8nJLoBljaLmPTz8zjmaHiidsatps= Received: from DU2PR04CA0068.eurprd04.prod.outlook.com (2603:10a6:10:232::13) by PRAP190MB1810.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:291::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Thu, 10 Oct 2024 14:14:41 +0000 Received: from DU6PEPF0000B61B.eurprd02.prod.outlook.com (2603:10a6:10:232:cafe::2b) by DU2PR04CA0068.outlook.office365.com (2603:10a6:10:232::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.17 via Frontend Transport; Thu, 10 Oct 2024 14:14:41 +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 DU6PEPF0000B61B.mail.protection.outlook.com (10.167.8.132) with Microsoft SMTP Server id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 14:14:41 +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 v3 19/50] net/ntnic: add header field update (HFU) flow module Date: Thu, 10 Oct 2024 16:13:34 +0200 Message-ID: <20241010141416.4063591-20-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241010141416.4063591-1-sil-plv@napatech.com> References: <20241006203728.330792-2-sil-plv@napatech.com> <20241010141416.4063591-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU6PEPF0000B61B:EE_|PRAP190MB1810:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: a5091995-5b61-4928-3ae0-08dce935e1fa 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: =?us-ascii?Q?lrhNKZGnvWFAh74uo9pKNO4M0lDKQo2n4TKIi4NAkrsUL9vVvY1Up5yd7D2k?= =?us-ascii?Q?bM6IrDVyuZMInlXbHDpZXWDYEHnEdlxS/3o55ZudG5k53rctBPAgjZZbisYx?= =?us-ascii?Q?ne5B+f3bjB3f8kpeYnrqJ9hmgw8txMQ5YXNSTrnp6VdhQYdpoBT5czuIpdGn?= =?us-ascii?Q?j69t1bHA77Ivrm6Pjn6tJUJI4fsvCTgv70ut0XhneydnHRQlA4IXTBK1+XSZ?= =?us-ascii?Q?GSAwDGVDg4EKy4gB/oDehymCv/MFBl04RB1ZJlgQUgIJFWb/KsV7z7LQ/mDH?= =?us-ascii?Q?eFkKpyCPwxGNkrP1hrB4+yX/lFw5+JPczRAgCY0vLiR6wuXUr/9obnvRmMxE?= =?us-ascii?Q?5HUGKNF9MlsPi4YHEjrUAF9ceHkxbPCHJBw27Rrkqrgg3dswt/svb1XPSeb3?= =?us-ascii?Q?ysatfqeF1E+9CmlUxb6YCKbf5EzXyCxmqUXWjidMwdNKW/MyUYvZJbrC8rqG?= =?us-ascii?Q?S20Ny/Eiu6UCczQw86uLbLFKxWclUBBCOEJ0BOQJ+o9F+mKXMONZVO+wyhmj?= =?us-ascii?Q?o5tWFR1quNUKDfgxxXSWybu5xO5ATmzj3UpDsfa6OB+Csv8VOsL8olzfBqCN?= =?us-ascii?Q?Ayyo41foAFljHU+L2sSWXMSw0bx7w4W7ZRJc55Y359aqwE2U3IwLbhNSR6nl?= =?us-ascii?Q?9d/5JC9pdfP07MvTSNrGG1Tosx84zkjxio6zrXjNjDrdnUHkrjYVjvNwyywz?= =?us-ascii?Q?JPUizy//ifu0jig/4xCJXmfwfcv1AhQ872uSDuHYXqypja+f3hismNkR00NU?= =?us-ascii?Q?z4gkMHXTFC/YJEYZVZ+JqtrpZAONylqhZ47svEUyaKEKMTR8avCWOI09C9xq?= =?us-ascii?Q?Nn/QTVajTIvgubbdRFOgANkSxNwKLucF01BsbgEfq/MyMrR/6eqXWCY79d5+?= =?us-ascii?Q?XvZOVyNBWh8ksN/zInKn0V0XdLJrGYz8Z3PINT614EnnSoZPM+oOUK+xmeRf?= =?us-ascii?Q?oV/pRjzp0C9p2Vl/G6jj5pe4mpyNAtf0bUTV1anNPVJjlVER7TOqLsOKaNfK?= =?us-ascii?Q?iNtzjfG0i/4Dplzbj9OykygEqtvgnPAbQRuhDnSEIXsdKN2ekIEGLlWmnADB?= =?us-ascii?Q?9xiOmzvht33HCZkjcH2G1NsPMpwbbtGOJlLLufvSMRlHjw9l5xhj61Gy21Co?= =?us-ascii?Q?o/wyh4lfrToMNuL5nh3IiEnoDiH+4vIElJBYUp2zRp7hC2hoGO8TCIt8BXYd?= =?us-ascii?Q?HnBfrmighMlc7X6OOb2biIQR9FdbJmKfKm2PIRUlMqFNWXT9XOBzhW+Z+Bdo?= =?us-ascii?Q?SR8QFQjfy6xVKh6iIHV46Ir8wnGWQ5rqtxDe/Z9GnXs4Dkxu1S5ONa/h9wvT?= =?us-ascii?Q?NyICDGoQVGZ23KF7nkSIF4T+wVXny7BYY6zGG1fIXIfWdpQTrfGxcM5WHuop?= =?us-ascii?Q?8Z+PbJZQpbwCwz1bwOTLAUPDeAPe?= 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: I+3ItGpXrs7vUpqe9jXtMtmFtxTY/b96goDUey6NIaK9KfwDKa5pyoIvltdBQsbxSWUdqaTYivwgs8a1v5S+MAzZHg+XwEAmuYXM8dNiqEh6f5C2wU9ZPWAoY+vHqG8HggD8U0kRW2EvwqreRFILpGTqnjIqE506/+fkeljPp7h0jrzjqbgO6zzbIGn+Uel3ZxnFJdzzdXGEzGd9MbvrntOslm6NIr54QmsuD7WmcHbcSXTMNaRRrpi1BweLkXev/UCx8bAEm0cQUkh8DhTynvJDbnOrzlXHPrK6RFD/89GuXjbyLZIqr4SVLpVqyzR017dwQTtVMm5K60VmS3DPlHwthrVsaxv+O2sKf5hNOdqZINOmRtNuZXsKy897UuiZ/KlPBdONPoeRL2uFgjXItzkQZEAURzzw5wE6EJu2X9pkvIM3YDO8VGET9OrmK+1e1+7whB2V6Uy2mtOxoYhbooYDs2DIGuQhvcW0/VvcXJtwmoklFngc9Q/ajP3u0++Si4nAgEVTRb+EobAtC/mXkrVzyeRcFm8N1+2ezMdlT2d+/yF/CX2t1SaY5h81MhMBbvyJNL4SNgT6iFRoxGB37kgqaK62X9owMjKFsGcMfEYwL3v6RgOY87Q3AzV8ucjzJYD/EIkt9olo8YOzYgItdohJVLX87MMCQupANg/bWm0= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 14:14:41.0922 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5091995-5b61-4928-3ae0-08dce935e1fa 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: DU6PEPF0000B61B.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PRAP190MB1810 X-BESS-ID: 1728569684-305168-12641-25859-2 X-BESS-VER: 2019.1_20241004.2057 X-BESS-Apparent-Source-IP: 104.47.17.110 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaGlmbmQGYGUNQgJdXEwsDQ0C TVMjE5JTkl0cA4zcjE2DTF2MzYOMnETKk2FgD/bIR0QgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259630 [from cloudscan22-12.eu-central-1b.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 --- v3 * Remove newline characters from logs. --- 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 13bc9f479a..c99f4a81df 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..cefac6b371 --- /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", 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 + */ -- 2.45.0