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 D32C445AAF; Fri, 4 Oct 2024 17:13:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 00DCE42E68; Fri, 4 Oct 2024 17:09:02 +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 6C4FE42D89 for ; Fri, 4 Oct 2024 17:08:34 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2177.outbound.protection.outlook.com [104.47.17.177]) 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:08:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Wjsog0tVat0z7kEG0ofEHau47LXxhvCbYhz96IqViOexFdqc8SJFUuYpXddMa57MOds3yZu4XAhpUKrVKL7l+zz+Po/q1f2SPLYLkaLGPlc+IxLyqkUGisOheP+seINt5EArmQEV4tXhx0l9xZmIhICSg0hlFqB7s2EMOgqnmVSQC/yChStogT3Bn/k5/+BbkQKsKY+tmnU2r4p18nJL62PcNGfaTwlxA+5sIssaaKoWCKpDzFt/VVl0c8aJLO4wFQSzYxuXcN7K8PjuPuvitenQwxG2r/Ig3Ogfo6Lb+9vJrFWgXhtKwF3nJICXXUwU6pQPiXXDTTLGQvKR3mMQCQ== 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=sJFU2L+djk9qhdHaBglixBeEXkTY2P4WFe9Suj5Yl4ppEOEfXtRQGsa1uVZgJz5ppGDedCKriaUuwk+uixMpdWYfINgg/Q/BS6HG7FRNAvCl7EbwotHU9trSdMX93SvaP8HfuYwgI99c1qac7I9TEaPDw0+d5s82kpG+96bGlf1hKz5BRTmQV7tV+7uNJsSyjE0aXQv8Wdd4one9kC0h67M7Romvrjj7n6vk6Z65iPF+kgBdPQqJFKtmuLEIiEWGxquufNHsS6jDY70wgC9GmQVHoMS6WpRRb8fTIYNCv3CJN2P5KditbV7/AFWeXl3gnw6bURPScCzipaDi/bnRjg== 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=BDSgKVd9nsmFpSWT4/Rl+r7JTdod0KBANjJfEzpO8lqb/XARENBAeW+VCBOWEhkukLgOUvKPMaakaQ9O1fGJhQKOCy3r1xlf0lct/hA0Hx2eo6OAZW3VKRD6SQ+zI/+PgbtDrHqtZ69oYRku7RTrMVtGr6TW1PSBiogLHt2uuZs= Received: from AM0PR02CA0032.eurprd02.prod.outlook.com (2603:10a6:208:3e::45) by DBAP190MB0949.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:1ad::11) 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:08:31 +0000 Received: from AMS0EPF000001AC.eurprd05.prod.outlook.com (2603:10a6:208:3e:cafe::b1) by AM0PR02CA0032.outlook.office365.com (2603:10a6:208:3e::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:08: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 AMS0EPF000001AC.mail.protection.outlook.com (10.167.16.152) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:08:30 +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:07:24 +0200 Message-ID: <20241004150749.261020-38-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004150749.261020-1-sil-plv@napatech.com> References: <20241004150749.261020-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001AC:EE_|DBAP190MB0949:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 1986e336-b3ed-45b4-5766-08dce4866897 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?rKsOnOe4C7H++jkWVSZG/GvFq+nX1yQYrF2IdwD939C+ZyPjOxuwroa43gYT?= =?us-ascii?Q?yoLFt2s7Xald/mPNrm+14otSZbJijFvTmjxBDjqszqT0cUuSIT2EkeZLCB5g?= =?us-ascii?Q?i1XhUui+i5Y1+kIf9WiCkeYnin8n72Fq5YwR0vGe7LEG9aHAwFJcWyrkcvjm?= =?us-ascii?Q?FPRm9xBPM+s40pEKaymCpZSNh2iz/k3/NnfuzhTgWHCfRHY7w4MaNdtSh+Uj?= =?us-ascii?Q?YmM+8J1PaMWzeGWPoOG9JPBboymnSyC03PHBCpQXk0auBMk9NAOx0u/rxcTk?= =?us-ascii?Q?AGiveF7uSpHyWAt55iL4rJTI4vu0tWhi1Doj8ZIbsn2j4WobWrmkZ22YFrV+?= =?us-ascii?Q?iY2RZD6NwkMsXDZhrn+Ntejunx0IMG8COpLMZmh8sQ0ZMuDPI7aJR9TrndnT?= =?us-ascii?Q?1HU0Dr9Wr/gVvdC9PkxjV2P3MZAACUg7bMLIi1P7yHHZOSmoBM+PDolF08a9?= =?us-ascii?Q?0O/CQTYv5dBM+tZysuCi+kydw+fq+1Vdvc5ILMCt6qsIx2EY9sRNmS3RZTuF?= =?us-ascii?Q?CYw/5k5bT8aqFqYXWJlHI+KZKva93nWR+OrhBoS8P6KHxdixuRNzvoDXudpL?= =?us-ascii?Q?uMNlGfpO/093L9AjHyXt2HYjT7JfahF6d/Njv+U+jBLo+nOjt4jKWjvYDzk5?= =?us-ascii?Q?ENn3FZHkGM1NaX2ejfhQ0gM1C4TFOyEDgPtMH8ocSstjFyGafuCjr31HkXmS?= =?us-ascii?Q?HWajaAg0M/OYmcuGt1zrAoA6oADsiUUsNDMsAktBVageo3bK+qZ9Z1oId4PU?= =?us-ascii?Q?XWB0hVQ7RRAfDSOyb0t2DigNMS5pAwBhEBQhVbOudkv0BQ+Pu0g4Hpt6f8JY?= =?us-ascii?Q?RzOanDVf0vbUvKkYBO+JpRxs8Vh1nlfxSgHDM/bKgohPgiBqvJ9+ALHDLdtC?= =?us-ascii?Q?3Hz+Y4hM//NxJZjJNdm4P8mogJBbEZxF+7dMQ4/m/vRep8oozk7unXcRyyzl?= =?us-ascii?Q?Sb9Km3oqjKXuYeo7OF2OORryars9iAsJtIaSH8o1HFhV89Nu5FdAP59YJ+uF?= =?us-ascii?Q?WmHH71RmWYy3mdsXsiIICHpopisXyiCN7+ogQh5Jd4WSbrEhvdmqeWT+0XaY?= =?us-ascii?Q?94ayDecHRXzCcwtB4tKj4Dn7u3ZP3/gzxW2SogYHJCrhVeQToHMUk6UDKDic?= =?us-ascii?Q?OVXg9K6L6AmxAJkuLjZaz1JK3JOVBCJoqug+7Zq6JgtV3uG2UAnGHQsA1sAd?= =?us-ascii?Q?KppaBIJPQF275wvDGSiPWJ9gwQ0r7i4f5q9durOARzjE9a4sRD9gybC+E+BV?= =?us-ascii?Q?3i/f/Kc0V2eAeUdK4Id6KZSOfT1a9VmEo0ALK4vTgSYzNMVsu6QfBVZzjUOg?= =?us-ascii?Q?7yLhWcHP2kAKJlDYyGmgf+4Esl8o6jAp5w7FNysRFkVCHuKDU8PJvXffr04v?= =?us-ascii?Q?QqX2EquAr/INfy+tuKSjYiSMljb0?= 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)(376014)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: VAED3Oq0+XA7PoeJjKXCJp7PJ7xKsSnC6FAM6RALiQOSbSqGM8xzL6DG72zJWOyFaM181jIi/Q8X3vabOvTspeHpl79NV2Aea3Sa+hQCkeZLGMaO1vMAJ4hYM0SVeJ+Ms7EQiqBqAvoxDvv+0UvIArEUrv1mpUpWqegi/2AKtimA22MRHwhrKv8v+kMivyPjwm4gJcK9FJ6+jkdGXZYApaIvJwA4/zKbV1qS8xARimlQYhtIMSAAsKDoG4dJUfO2FbnjpWXIBgVVMYDlk5ugwSVfQLuX6NjRSCmKlW0opKHsPGN8BcH7vW+oEI+2/kiyGqZ7S6dTvSBpZd+d4O4SHt0nHs86Wp2JRufAfcRCBIsP+zvtU3e1g9erS24LF9Zykx9OALal397RZLUaOT5T9FCQo6zp5ZH5R2xTV/x3TYUxi7LjwVzIqCUv+Xzds77W2YW2HeAvn6ZUQ6cf1ydz6K7e0Yz0aGs8DKVrj2JIlumuG+XLHL7oNZwj1jKhWoLZRPQSRcKkE5uK8t9Qj0MTM2ToRQSQbQrafRw+P9jwN2bQCYzdIJgj0esVJj2jryI5M3l3e0pAfIAOlo7YdPA7D56NNs8Hy3k/YfzCvaMJU8am49gUak+zUDd0GsflQS0GsOly8WIriPckRg2X6vLR6g== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:08:30.9548 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1986e336-b3ed-45b4-5766-08dce4866897 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: AMS0EPF000001AC.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAP190MB0949 X-BESS-ID: 1728054513-302249-12638-31684-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.177 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 cloudscan12-63.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 + */ -- 2.45.0