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 5AD0A4560F; Fri, 12 Jul 2024 11:49:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B9FCF42EFC; Fri, 12 Jul 2024 11:48:57 +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 E377842EDF for ; Fri, 12 Jul 2024 11:48:49 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2108.outbound.protection.outlook.com [104.47.18.108]) by mx-outbound45-239.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 12 Jul 2024 09:48:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dDGnhTU4UuUCU5SSw4Pk+ktsYUZ1mUkMD0iOZO8oEqvLnVbLdLxRlX04YyHiHNPnKOs66DIvU5LzWxGenfRukrgtUJQmUD8o+VH15FJrxXtkAAmTiUlLwR8f37EwOxMIhJ1t/Ym6KPL9dSdSKfBynVE+cILpNSDZcjCrXJ7pWbot4VHqzXYv67kIAoI4wGbC+hnDukIaEemGuyitIvMX7JbRFSlCceq5FchIzMchZbsu3EEE/u5MAiegXrP3AWWJCpLMzNm7HyQ42sNYhSN11Map6z+b0vAJPNilyDTKC0H+tAu8IWSOPM1A/l9Ku9rtzSBeZ0y6QHG2fCchH2KspA== 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=lgdb1wvnDhLyB35EjZbiIwHJ9NnaLQppI5jfyCuF14E=; b=vKM7apD01kpqyg1jVC24lLED2uZfgEYXQU0wZYu6W4KqdhRx94O+MCejl5gn6V/SlAGoBfFX8lTTVHok9e0JyqqrjgB/PEWUhvAAzT5OhagyG5K2MDP8w8Tmq+ixc/4zuHDgh0dQpevyz5st05ygnZHUeHxWtcAT/rXsS/iLLHxX3FoTC3qTS2mCRNtKIIz6McVvn6HZPcqAzeevtQmJCIw0nGxuJ8CkRXIhuh8v1kCOQJ23VJczYAwr3tWQzztTypF317TZWx37oEED/W/8oNzzX6F/KkNcj4/faDad/dXCI9z5PW/DEfksf2hAZfxozwcXpuwk2FjOy4cC23KXGw== 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=lgdb1wvnDhLyB35EjZbiIwHJ9NnaLQppI5jfyCuF14E=; b=QwYHGcEhlK0ROIvcNWztSmsDb0+aZk5029JJEjBsuDoe9Bu9i+021k14vWShmmgsGjwgmxqxNHM8xpQYUv+SE675j7LplXefGbTz5iWxiBNkFHcegsc4yZJADiqu5d5+opRV5tV7QgWO4igJ8e/hBUmhYT8I6aCDUSD+s9gwJKY= Received: from AS9PR06CA0533.eurprd06.prod.outlook.com (2603:10a6:20b:49d::22) by DU5P190MB2066.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:524::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Fri, 12 Jul 2024 09:48:47 +0000 Received: from AM1PEPF000252DD.eurprd07.prod.outlook.com (2603:10a6:20b:49d:cafe::79) by AS9PR06CA0533.outlook.office365.com (2603:10a6:20b:49d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23 via Frontend Transport; Fri, 12 Jul 2024 09:48:47 +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 AM1PEPF000252DD.mail.protection.outlook.com (10.167.16.55) with Microsoft SMTP Server id 15.20.7762.17 via Frontend Transport; Fri, 12 Jul 2024 09:48:47 +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 v7 16/21] net/ntnic: add link 100G module ops Date: Fri, 12 Jul 2024 11:48:21 +0200 Message-ID: <20240712094831.861260-16-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240712094831.861260-1-sil-plv@napatech.com> References: <20240530144929.4127931-1-sil-plv@napatech.com> <20240712094831.861260-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM1PEPF000252DD:EE_|DU5P190MB2066:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: cde687b8-1933-4b92-fbf1-08dca257d3a2 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: =?us-ascii?Q?uDyX0Tzho9ZKZobfW5FL0A90jNe9cNE5SObt3PAz/I9cbHnV7HycjJSW20/B?= =?us-ascii?Q?N6yusr7E97RjF4J2nVlvzzdERKNxiTPT5tIRiskEUMyq9hcYOyuNl9vwJXQn?= =?us-ascii?Q?40NpFL67hhgZPTF9K0vlM0XGCcKQ73tbWQWJ9240ixxWjsh6BMeghTUrE4zj?= =?us-ascii?Q?x5LVrv8zJlgX9C23HSHK2QxK66upY7PpGOOGg8RmkHOWG7uuuP6uT/DVDuWA?= =?us-ascii?Q?2KI65LyQ/pzvuUkii8bU+jfPlIo28oiAhPwsIk6pI4pkBJatZSuNT4CQ086P?= =?us-ascii?Q?tO7WyByxe1Hy4+w3N+P/GNIw4nh8595LTBRghY2BqzrPqQxYOLylpLsdNmRf?= =?us-ascii?Q?KAKN/md8O51BveNC+wlLAhCZMolAtu4kFXdt7gaKfW12H9tk8sHMMcOzuQq1?= =?us-ascii?Q?FiojVLO0nO3JdJPhMRJF/bDPyCPK+yqav4LcFwty8o9Wc6fWy+o+2fdgbZ+T?= =?us-ascii?Q?o9thfI3fTcrUriXicPnDvh2E+FFKo21iCyguCYV4tvjEIPsr4coH8J6N5GP5?= =?us-ascii?Q?KO6SWtn+uN2Gdsb0MspacbrVxvY6dCeWJtaat5M2mripUWEd7CFN4OJEfaHN?= =?us-ascii?Q?gzU53ZuWlV8PQltEq+7vCsn8oRWkEb2DcU3cQvC4319V+JyH3d33rB5tVmxB?= =?us-ascii?Q?dR3zzvGpYe3MXsFE0A1Xxy4FGFbHq9wMGFi5Si9TOngkAea89U1aZMG5IeVS?= =?us-ascii?Q?yNl/7t951cVs9oiqikosXLwizjckw5kSA9E2xkWGYW+xf/cQ97wtKENZsne5?= =?us-ascii?Q?GiZ190qAmUlyrgWze6oha0qeqCcJDG3W0LUGZ6YNdawApafnc6omr8HUiIit?= =?us-ascii?Q?w6wwXsctDn/QP701TXfU3DyFFx0eiAb+vjOWJt9npi/elIfnLQXgqqcZmtfg?= =?us-ascii?Q?G+4752TuGqgxtN8KVROB/hiMDRHVCrvc4DplUZKYnlEDMwy2d0+PcNNAjpf0?= =?us-ascii?Q?uizl+SUW35EPFkxjR1lqOq2vDLuwJI6jjcJaoQNu+/Y2tlwPnQrRUTtYUACU?= =?us-ascii?Q?q9W3N2XCzn7pWGujHwmK1H8JggIModawNGFlc4qMNXzQ8NciajEqrd0OFk2J?= =?us-ascii?Q?i2Xitu1R1PoWYwHP3XtUuWWjhTl1y/pODGFBsBaX4ZuFKfT3u2+LljEumoME?= =?us-ascii?Q?Y86lssSrmlEKa0hx+O903JKDaqOVzg5ufI95eEr2+o0VnnK4s2MFlbYMqIsb?= =?us-ascii?Q?aJwdn0bT89a3cfku0SPtekxHYNwn8qukOWT1ykNSAImmDvG05XiBdIBxgxTM?= =?us-ascii?Q?+KjSkpdCR+1m2wnfBsHJXr1vcM/gY5h8/kMPEzoxI6awW4F0fVdnSgolYAgG?= =?us-ascii?Q?bkUBHhT5sByM7CqG/1U7k2NtfyDziR62yD9LAHmJYLhXStv3+8rZNTuqBdVw?= =?us-ascii?Q?Gyho8aLof3v6JTE/UabW03fWEE8M+d9giZgWIfG8SNEwMCetrKgUaxieOxCs?= =?us-ascii?Q?cyYPlkQLjCC4RtHA1Vch7p7mx+6PQqdz?= 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: DxDMeaiWdVgo9kviQwM9CR4Vu4c6CP/rF5ybPdMZCLuRC+NKl/IBHHhJRum8yVwcTgvCqUFbPmVamFFJB4ykpQlKVjYGu6DMK0hn5T2Bfykgf7cHc8c4SrNwhZZU8klzj3EylUKEAxwp0N4c7iAY2WIpjq6SO0fyc22AHaThD4QQPLbuiQr510kYpORbcUxDQ7cViVKfRCIA6ayuC6OHlJMTNabsOqR6WJJpQpyEN0AXrm4rY6c2sH3ieog0OL2qLAZ9Lan4hFzdVv14/jYVy1cOz8jAJUkiUbsf1Dhe8L1BdIcUUX3KyLt31Q96qeDjmNTJdk/YL5CMz+O4+LuvjLyQIdYUGbfr5ru4jYt4D702T2gvWSz3s2C3LjXVK9yKTdrUORBGwPoOWbkoaBI+r/KdUktoFvi/vlOeAE7h8Mn0I/qcTgLfj9cFIujxFj8CDfcUtvqKGGCc8zC4IkWiknd82P8xcObw3xgVd033Kt/R5yFw379J6EzN5C0kI9jHTCo7tGhIdj+wMwNwY6rX/Oe3tJZhIY/xbqclAWFKfV1l4jdx5t5rEp0NVKgNLbAZQM5W/2gp/Dnwr54e4nCcjte4lhEI9OapnFgyRXjjtAafmo8fS/WHMcRJB9VUcYrXz2GxlF/zI1gz/efH/GBt7w== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2024 09:48:47.4733 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cde687b8-1933-4b92-fbf1-08dca257d3a2 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: AM1PEPF000252DD.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU5P190MB2066 X-BESS-ID: 1720777729-311759-12666-7838-1 X-BESS-VER: 2019.1_20240702.1505 X-BESS-Apparent-Source-IP: 104.47.18.108 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViZmJqZAVgZQMDklySgpNcXIMt XSyCwpKdkk0dTIyCglzcTcNM0yxTBFqTYWAE2SXy5BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.257571 [from cloudscan23-222.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 As the ntnic can support different speeds, an abstraction layer for 100G speed is needed. Signed-off-by: Serhii Iliushyk --- drivers/net/ntnic/adapter/nt4ga_adapter.c | 12 ++++- .../link_mgmt/link_100g/nt4ga_link_100g.c | 49 +++++++++++++++++++ drivers/net/ntnic/meson.build | 1 + drivers/net/ntnic/ntnic_mod_reg.c | 14 ++++++ drivers/net/ntnic/ntnic_mod_reg.h | 8 +++ 5 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c diff --git a/drivers/net/ntnic/adapter/nt4ga_adapter.c b/drivers/net/ntnic/adapter/nt4ga_adapter.c index e29fda7fbb..17fd8016dd 100644 --- a/drivers/net/ntnic/adapter/nt4ga_adapter.c +++ b/drivers/net/ntnic/adapter/nt4ga_adapter.c @@ -125,6 +125,7 @@ static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info) { int i; + const struct link_ops_s *link_ops = NULL; assert(fpga_info->n_fpga_prod_id > 0); for (i = 0; i < NUM_ADAPTER_PORTS_MAX; i++) { @@ -135,8 +136,15 @@ static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info) switch (fpga_info->n_fpga_prod_id) { /* NT200A01: 2x100G (Xilinx) */ case 9563: /* NT200A02 (Cap) */ - NT_LOG(ERR, NTNIC, "NT200A02 100G link module uninitialized\n"); - res = -1; + link_ops = get_100g_link_ops(); + + if (link_ops == NULL) { + NT_LOG(ERR, NTNIC, "NT200A02 100G link module uninitialized\n"); + res = -1; + break; + } + + res = link_ops->link_init(p_adapter_info, p_fpga); break; default: diff --git a/drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c b/drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c new file mode 100644 index 0000000000..36c4bf031f --- /dev/null +++ b/drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c @@ -0,0 +1,49 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include /* memcmp, memset */ + +#include "nt_util.h" +#include "ntlog.h" +#include "ntnic_mod_reg.h" + +/* + * Initialize all ports + * The driver calls this function during initialization (of the driver). + */ +static int nt4ga_link_100g_ports_init(struct adapter_info_s *p_adapter_info, nthw_fpga_t *fpga) +{ + (void)fpga; + const int adapter_no = p_adapter_info->adapter_no; + int res = 0; + + NT_LOG(DBG, NTNIC, "%s: Initializing ports\n", p_adapter_info->mp_adapter_id_str); + + /* + * Initialize global variables + */ + assert(adapter_no >= 0 && adapter_no < NUM_ADAPTER_MAX); + + if (res == 0 && !p_adapter_info->nt4ga_link.variables_initialized) { + if (res == 0) { + p_adapter_info->nt4ga_link.speed_capa = NT_LINK_SPEED_100G; + p_adapter_info->nt4ga_link.variables_initialized = true; + } + } + + return res; +} + +/* + * Init 100G link ops variables + */ +static struct link_ops_s link_100g_ops = { + .link_init = nt4ga_link_100g_ports_init, +}; + +void link_100g_init(void) +{ + register_100g_link_ops(&link_100g_ops); +} diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 001c75963e..32f955969f 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -22,6 +22,7 @@ includes = [ # all sources sources = files( 'adapter/nt4ga_adapter.c', + 'link_mgmt/link_100g/nt4ga_link_100g.c', 'link_mgmt/nt4ga_link.c', 'nthw/supported/nthw_fpga_9563_055_039_0000.c', 'nthw/supported/nthw_fpga_instances.c', diff --git a/drivers/net/ntnic/ntnic_mod_reg.c b/drivers/net/ntnic/ntnic_mod_reg.c index b79929c696..40e22c60fa 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.c +++ b/drivers/net/ntnic/ntnic_mod_reg.c @@ -5,6 +5,20 @@ #include "ntnic_mod_reg.h" +static struct link_ops_s *link_100g_ops; + +void register_100g_link_ops(struct link_ops_s *ops) +{ + link_100g_ops = ops; +} + +const struct link_ops_s *get_100g_link_ops(void) +{ + if (link_100g_ops == NULL) + link_100g_init(); + return link_100g_ops; +} + static const struct port_ops *port_ops; void register_port_ops(const struct port_ops *ops) diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h index 8d1971a9c4..68629412b7 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.h +++ b/drivers/net/ntnic/ntnic_mod_reg.h @@ -13,6 +13,14 @@ #include "nt4ga_adapter.h" #include "ntnic_nthw_fpga_rst_nt200a0x.h" +struct link_ops_s { + int (*link_init)(struct adapter_info_s *p_adapter_info, nthw_fpga_t *p_fpga); +}; + +void register_100g_link_ops(struct link_ops_s *ops); +const struct link_ops_s *get_100g_link_ops(void); +void link_100g_init(void); + struct port_ops { /* * port:s link mode -- 2.45.0