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 05B4C45614; Fri, 12 Jul 2024 17:49:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 23ABF42FDD; Fri, 12 Jul 2024 17:48:09 +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 D3E5243001 for ; Fri, 12 Jul 2024 17:48:04 +0200 (CEST) Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02lp2240.outbound.protection.outlook.com [104.47.11.240]) by mx-outbound23-2.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 12 Jul 2024 15:48:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nIaGqJgSRRUIusSp/TF+Aql4ft9k+J+2txwuJhfN1TytMWjWkH/AxgdzsKkGusqDBcpR3aKsBupgQtnn3l4hw7dKVQC7v6Jt/bza3jsSzmEqZFE8ZdHgD5+SFZuZlE7gia8jEVIBqeiLy7RUsULd0MHUFuhFKLmL+5XPcDxCC+jEDJMG/Fv34c9qhWozH34R/CX3QQhwO8MyZONa6BsX38eHA5Ub6Snoz1fQqVQGn3BBb/EXuwNX3XBD1P0IBEzFNSelbsnyh4RRg/ixCEwRa6NOvFJ3EDozymy3/GBztcXyD0sHDYR9fwxBJYZ0LXsrj3H9iHWgUuBkQUfqerW0dQ== 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=JAmQ4hmu4q/ke3R0t/daSIox0AoyR1ZG1ZuAMNxFEF4w9jdKLgK5nCjEnXozkhb2MMUIGvkE6dGEonChHglKm2U/3ChmLdsDrXSdrT2r75sv5G9UcV71THEpSxTn4oJYgqcaFR4AhkhN9aH2bR7F+AEwflbUtXtqVDhARUV3uc+UJyPkx5Jp5S96IH7qwzJNvUDwhe254MNI5zkXnW/m4PWjtHrBI1/IgZkm0eJOePPh4PxsFltAa2boKS7hVvgKjmhZLkfRkKfVYEUufQ+gubIko8HTEzfs3XsLbBi4tpECVTHLAkHeVpofgdVR1Gr5Qqy7WXT9K4G7HbHWPkMgFQ== 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=KYGnYPmF3ZcH/RL0hgm8C85k0zo6L6irWAYhI369UaD8ATdA9m/BpwCFuW299ihafc9KIZSuGY6ToBZZ6315rXozY7RtAx7MHMysnuEjdRWbFQG4LRKvKp9M1lCcNgcvmnoW00HaJsfYdlNdVl/Mg5LQVR9TEMNYKabLIqlaSDs= Received: from DU7PR01CA0010.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::23) by PR3P190MB0842.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:8c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.22; Fri, 12 Jul 2024 15:47:59 +0000 Received: from DU2PEPF00028D0C.eurprd03.prod.outlook.com (2603:10a6:10:50f:cafe::5b) by DU7PR01CA0010.outlook.office365.com (2603:10a6:10:50f::23) 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 15:47:59 +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 DU2PEPF00028D0C.mail.protection.outlook.com (10.167.242.20) with Microsoft SMTP Server id 15.20.7762.17 via Frontend Transport; Fri, 12 Jul 2024 15:47:59 +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 v8 16/21] net/ntnic: add link 100G module ops Date: Fri, 12 Jul 2024 17:47:26 +0200 Message-ID: <20240712154737.1339646-16-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240712154737.1339646-1-sil-plv@napatech.com> References: <20240530144929.4127931-1-sil-plv@napatech.com> <20240712154737.1339646-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D0C:EE_|PR3P190MB0842:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 4e506e30-bebf-4403-809a-08dca28a01ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|376014|36860700013; X-Micro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OejoEUMQRCnlwPt1VxYdPFdLWWJ7bl8Rl5q0UPhhe6bIyhZKqLdA1icoh4?= =?us-ascii?Q?Ht+Dxs/zAVQKFa6o5OSnRcqkZ9i3DVJCjlQgcOYntYYAjjfBejpOvk0Tq40k?= =?us-ascii?Q?h/z96ADcpFHx5RVaDu/vsZ8YsrXXk0Nlxzecl8Mud34ySFCc92CGl4NxP6kC?= =?us-ascii?Q?wTxkWi1+EvqxLhcxUYPJ6kjlJh8FZbJ6cKNQ2rDvsqGVy9hQlm/o8zjviIio?= =?us-ascii?Q?JlzGvbUYUbc2KMR0O0wGR/Chu2rKGyxRsITvC8gdm7lpKPIEIkGYl9Gb1Yiq?= =?us-ascii?Q?qyPCGh4xyMqvWXpcc6pplTGQGpqHNQaAWTMbxUSBFjt6PZSSdgKSi8RG0F68?= =?us-ascii?Q?QsXutq1WA1PrGbYsKs0zn7diQuBEOiBtwHIpH+i/NrmcBCC48LvXv+ylSgP0?= =?us-ascii?Q?vbj30/M4BxjzTJ70DS0tEiYpMzhGGUBwcZUKhtx0NhNRZ0jE88r09TNS+PRO?= =?us-ascii?Q?LyQ4p5cICPp1r5IZszZa5S7VZw7xnLTn0qAgmCv+ExkNTuqR1s+DD4sLStMe?= =?us-ascii?Q?P0c1Ty0ZhMnKIMEZOuQ7cQrtmR6KZ5pSAIc5clIgPLR5XpuMrGQxyhNKEGFO?= =?us-ascii?Q?sZyCD1TrFkBnRh4m/L17YMDtdB/nsfn+?= 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: TX4m5eZR4In8FQj1pS0pZ4eLqRYN2PPnBJUL7G1nTFDTZ2kturXgrqTuRy0ioKNwgI2SbwFSLwNp23EyF67WI5tQalSA/pxlqGeVjagq1s5BwyOzVrwj+iUjaAtR38Os1gqre+UyPwCEEpjqnZMl0r2dHOQ5kXPszSYOJN/JW/og8zuAvuVlOntI3n/uKwJC6qD6WUDiXeI7jdIqO46EH/0irI+Wm51futG8riarENG9crS0LePVzRqrEGCvbxAkEZhpv/w1Dw2qvhIfzL9A4C8RE/gVJ1rd6nDXNINYZ/3pUKD/M0ycwx6oqApufQaNfpH/HAFb/DnGpdyfCN7gg2OvDT7uRXm2FZiKF0UmrC/7ZdVx8Tbo5toE31z825MO9LKfkyg2KQwJs2IerN8/ekRruevWa7g19cLCnEQNXmRh3Zx9JM89nUQb/CoFeWouIMCjuu/qhw4TX0IWvXzCAmFPTwPZ4vxTh15y5/iZwfFSj0qRcgpDai9rNV43IL1KvtEAyf4xtIYnueOeAlqOqEqQPDWNKg/iYQoDk1++Gk7CNUlYzWCOLX5KNHZ/qyP2yWxHlR0qv+lSOCMHNQg9C7Cwhh+ZTm+83gMTvNV+jfrmt4DeP/idm+z6wYgNl+sT5Y0+MRgNkjVphS8JjJpqHg== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2024 15:47:59.6452 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e506e30-bebf-4403-809a-08dca28a01ce 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: DU2PEPF00028D0C.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3P190MB0842 X-BESS-ID: 1720799282-305890-12640-32732-2 X-BESS-VER: 2019.1_20240702.1505 X-BESS-Apparent-Source-IP: 104.47.11.240 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.257575 [from cloudscan13-118.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 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