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 ABFB045ACC; Sun, 6 Oct 2024 22:42:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8AD5040E3E; Sun, 6 Oct 2024 22:38:32 +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 EE7B8406BC for ; Sun, 6 Oct 2024 22:38:03 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2177.outbound.protection.outlook.com [104.47.17.177]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 06 Oct 2024 20:38:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xQhOpB8bHo+CJp/+Kj+5gstcg5BoEPF/DziBwW+BJ9fg7iqDPFCU/7xXZ2XKtAUKABfW6NPDXTBS1MMFq9tijy+AgQkdsM6mOrcZbRhZgctY+30QAaENx+r3bT4RmsbfVkgeBZdCcx7Lk8ytlilO2O+75oUH/WmJG7GiOAyPpnVednAzijjY/jro4ihENDuZFxy02dci4TYC0jmbq54jdjEJnOdYrTH2hOBmiuIT42b6no20lUMK40cFOiXlmTOMMzUqlkdBOKBEbuypn4TbZS9PRo50+UJT7wbm9CsHABU+V5X6uOWAYmwV0x3divcoVE9lJzxkrxDpi+Hj9tRiCg== 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=WaUOTh7mlesA0zZepuZW6OeFtLJHtQ1NtnwIeEpNmmUqxzB6hjOsihJq+NyGURgJgm8hnFzKL9/zhrt61Osd5Ljn01PZcP6MyKgTUvcXCmqP0BK9F5AqQz778UWztNGUX/YDSXvD9Ku4ve6H9czzsLHMpm3GWFT7hcz4CnWrqjYE6UQrIZP+T2k3n8BICvFOHOHLMTSiHIXZ2qQcOzPdTQ3DZ6u1MZ3E5yivIasMaasFaBGKleDOqiEluRovTxUemh56Q658tir50nJJ42+O4VWJ0m0vzEWZ5yEyZuyzmvYPC2CXGw9YpztpT9fZ3rRHurjP6Et9O9BIrb/4zujzDA== 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=cYjxh0QK5z8A0Lk+SHaJSUZax4HJhpfIAGt/Wa2T45N8yzZdfLU8dOZuRdfgsn5SOS01sOQDWNZMu7JICrt15evMpOqKVDFmlXMTrIh7y5kuBF2Ql2Ds4DkGCmiJt0XfgjdZWTSKqesf7vgDN6fddoAFFRM19pl1S93KB6L97W0= Received: from AM6PR04CA0012.eurprd04.prod.outlook.com (2603:10a6:20b:92::25) by DB8P190MB0617.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:125::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Sun, 6 Oct 2024 20:38:00 +0000 Received: from AMS0EPF00000190.eurprd05.prod.outlook.com (2603:10a6:20b:92:cafe::e2) by AM6PR04CA0012.outlook.office365.com (2603:10a6:20b:92::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.20 via Frontend Transport; Sun, 6 Oct 2024 20:38:00 +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 AMS0EPF00000190.mail.protection.outlook.com (10.167.16.213) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Sun, 6 Oct 2024 20:38:00 +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 36/50] net/ntnic: add receive MAC converter (RMC) core module Date: Sun, 6 Oct 2024 22:37:03 +0200 Message-ID: <20241006203728.330792-37-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241006203728.330792-1-sil-plv@napatech.com> References: <20241006203728.330792-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF00000190:EE_|DB8P190MB0617:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: a3eda23e-9d9f-44ce-be98-08dce646c4c2 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: =?us-ascii?Q?BnxdwcgH9wlNvJMJvpH0WLwxWT8eoiEx+3n08WSy8b/ahjcHHgGK0dQCXmUu?= =?us-ascii?Q?EDZ4qMPPXYmtlbuo57FgayhZYv9lYzxzNFKLsF2nfiszuzVcuxwE8qA1DJEs?= =?us-ascii?Q?ZpUdi5u8zIAa3Y4WLZCwmEYipiNcsq/C7ghUFWw4UO2mMx1G5z979FfD3qdG?= =?us-ascii?Q?NXS+6vjZ4VORArBotkpsrEMioU92cBrApPSy2/LNf+AsIfi2Um6v7y024/N1?= =?us-ascii?Q?lO8V59dQWndCaqwJGDDGciecNsQZZOUbqLQ5ls+564IZ+dfoL09NizR4kzlx?= =?us-ascii?Q?OkyuFAWsqcSN+UtUuQVWbCbWEnYWyOcCzIMVO/ZMn+MAG7Xhxd3AYLLwXYo7?= =?us-ascii?Q?IlFKGy7GTSSzDTmFxFOEICp8y65xlx7g74rRh7/y1GN9N3fdSi81TX/H6IMV?= =?us-ascii?Q?Z9MgrwqNqrC3Tv3b1BPLkgV+vsoYc/DNHO91WFX+E7GsRLHS2NmymrOESE6Q?= =?us-ascii?Q?wiVhKxdah4bH6gEWYBQ7awk3B/zRz1JMCdKuVKyxdnAsMnf7OZSw+kKWUrtc?= =?us-ascii?Q?QrhDPeOnaP9YEpPI6iXh68+81ktGQ0rW29X18PVeLcX9Z+H4YcfZBgrz3zgB?= =?us-ascii?Q?RLDSjIgW+3bUHXGbK855++m2w5NCXzsb3687+3TbtgTBwAswn91tlpMhh3hW?= =?us-ascii?Q?BbzW3zixZQhf4W7fiHnxLGjojNsRW3joUOQAvUKkUtYJ4IOWgF7MV/IdVDgC?= =?us-ascii?Q?S6+MeONJXTJbU1NZytjZtwVCy6u9XJXSEQeZVVbtmMd6ZLfXB1gMGKhFsQGQ?= =?us-ascii?Q?CcM3o7Rc2jo+cIudk0S8XQeR23CftX7qtDnj8VeTclx1MPwfTPZYXn+bN0pX?= =?us-ascii?Q?1L/LJna+dMATsO5/J+ubHOhY7a+1338hbQViQXy6CqCT0Nemb/bT2n72uuGn?= =?us-ascii?Q?YjeVFnDtUKDXWQNj8lF8v8/pSsSNhLD0Ygj9oH9wRvhm6ociJMDMdyIf6/uv?= =?us-ascii?Q?BXZvkfEItT4X/+hhpd37VEngtcYtRyy2NBmcZRtXgTTxjB9EqAkG9zXt0ClA?= =?us-ascii?Q?2LzJmYNt2jimBa38jyMJ4rIf8GM+WaI0LwlYfa14lP0SiqiWaZ+2pWDo4Nsr?= =?us-ascii?Q?ooRQ5NBN6KzuToQ/Zfb4UCWOhFwSNYEb3vBKmMnGf/AX/ly/Fe2ruIhTdA1F?= =?us-ascii?Q?3JObsvw9W2IxRVzQnE8g0SskQM8Nb4vo0qraz3C55isUDuA9ulecR3RJ/XoR?= =?us-ascii?Q?/ugE5iWgiNsB7KHrXcrWvNZi7vXfqeTOSZA0pP4kP9xt0BDdrH9oA7vo5fMn?= =?us-ascii?Q?C8+5p8VvhX5agU8QMEhTo/C8gb1QKFiSfPZcR1NEldaYESp0JSVA2V7nbEKc?= =?us-ascii?Q?g/3Wk971N5oScrpkafyXjtPwgo3kAScWWHDivXCUyRSCAo8ewf7IkLuKx2ii?= =?us-ascii?Q?FWXN0l6DgKkPQ1oRyvOqZGxJ6dLv?= 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: yAGgkJIS5p/4WBU4zJZBj6U+223i/qUB/e8WlEpi7RwUxlS5yTKEEW2hMZaTfsWKXndlzmcY5NOOUYgMZUksQCE8Es1j1w3HT9N5i08BnwhkQCBbhMPfoGQGhyiUu4jFL9MI7USXaObb10wGzXBze0+CVgbfkuG58UtL8/Oqht7wwXuwUcg3vrgl8zbH2y7Pb22Y6OyDz5N79qTcwBJOwndPbGSJJ/zD+vNWRGoAtp7qPLak5Y/Yw6JwnYf9BRxgHA6OrgUvRehBVB5Svw9M1MXaPvuOaiBUFwTbCeKAnQKsILkBleFdM2EJS2yJqRu/P3SaAyblUW4CBuIGtN8oIrUNM29K/+uSobqHLNL9mI59DooUSkVkaTCdi83jV8hzbAcE34C/VOVBwLr1qFb4nzuwMj++k4gjQbRTUSyQa5FQgAQ9EB9rQLHeRt35vAC1aiDZIlnzRhqcwm3sdy5WvshIdhMP3DG2g0RXeSgAYOFUh95qHgNhyI5w3gpobqMDeW+ohE8d2RCm6r7Ojvdg3QNuiuGusLet2sS89OTeL4ApgtE+wEqFzAIBFZFP6DAmiL4BxgUuUL9ipnMYc/yH8my8zAyGVG5ixTyAKo1V+HRD0c8lR40SysfrXRS7MVA1gJ49Ifqjl8sfSz4UIDAU+w== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2024 20:38:00.1557 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3eda23e-9d9f-44ce-be98-08dce646c4c2 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: AMS0EPF00000190.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8P190MB0617 X-BESS-ID: 1728247082-311388-12692-123473-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.259547 [from cloudscan18-201.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 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