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 8FC9F455F3; Thu, 11 Jul 2024 14:09:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6057042E8E; Thu, 11 Jul 2024 14:08:06 +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 710E942E8D for ; Thu, 11 Jul 2024 14:08:01 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2168.outbound.protection.outlook.com [104.47.17.168]) by mx-outbound41-230.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 11 Jul 2024 12:08:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iSyvv7354nDbqfXEjbjyj9OOLmEu/y3/aJDfUFGb4pOTBRrds4qL3f22eg+joksmDEQqx1c5dcXUVtwYuQ5IUltCPlRs0e2N8qs1mcmGaIOu4qyt5zc2HX4U5b6WVJmW5Mmpmbvd3H49htGltTYTySwFLY71CcfbK7GJopStFPdsq2djPTrV1b4ZHMXle2X0d6cVT5510yWLA32yec8T3fY7jN6eiqxoyRh+1UAJ16zH/PflDFJTAwsd0bDtmSofSLCliAkV5dHksCibuzPTNuXGG0KBe1Q+PNkvzPzXn3pUblyD38LHBtmDFWGdcvoWI0w/ksCpaNQu6ltIChmRgA== 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=mYzKlkS6BnoFA6AA3wxQexU/hBcOVUWdvap4dW6H8bI+arpSxUcfzD6dyGN/kwz6+UiBehMdNsT4lpXZ29kDDx+1UNUbRen8YBRq1WNjeE1MXbbD81gXCyO589y7DLNTueP281RboJT7RxstEwV+ouXO/dClN4suosVP2aF8nPWqoKO1QUMHPNb+rfZp80HJ88gZsq9iu5D2z3iGa/urvd/OABSVKigNVaadv8nNCeLKYfNka3MIC3UvdwJ56z394xD50lcF5P7G5rJ1jxTKBRk65ZVVnTS7La7L/KwDmQ6NCjwQi/xP/Si3/+Ma12uNUGoS6SAAks+ZiUwsZsUETQ== 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=GmDcwazv9HFF2p5FoAQB60+7g/70sbe0UV8CF1OcVh8k0GXN29LPwc3LRb3aWbh2CIo6ca3cGuPZskf5cNK2aHwnGNS/RqN1UO3XQJnqaGhIeK2+g3ARMnhvBETNnoI6qY0EhnNLDO+Cfphr9sfQySfryZQ1v2Dd+ZdJwv3ytCM= Received: from AS9PR04CA0093.eurprd04.prod.outlook.com (2603:10a6:20b:50e::21) by DB9P190MB1051.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:22d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.22; Thu, 11 Jul 2024 12:07:58 +0000 Received: from AMS0EPF0000019F.eurprd05.prod.outlook.com (2603:10a6:20b:50e:cafe::13) by AS9PR04CA0093.outlook.office365.com (2603:10a6:20b:50e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.20 via Frontend Transport; Thu, 11 Jul 2024 12:07:58 +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 AMS0EPF0000019F.mail.protection.outlook.com (10.167.16.251) with Microsoft SMTP Server id 15.20.7762.17 via Frontend Transport; Thu, 11 Jul 2024 12:07:58 +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 v6 16/21] net/ntnic: add link 100G module ops Date: Thu, 11 Jul 2024 14:07:27 +0200 Message-ID: <20240711120737.698176-16-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240711120737.698176-1-sil-plv@napatech.com> References: <20240530144929.4127931-1-sil-plv@napatech.com> <20240711120737.698176-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF0000019F:EE_|DB9P190MB1051:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 0eaeecbd-4cc1-491b-a278-08dca1a21ad6 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-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11YCR9LjaY?= =?us-ascii?Q?kHxXUfAk9aBkFpwnOJ1Rjd+YP0DKR2LVOWQqSRS/Gu4Bp0Ubu1PD9Hh1JSJf?= =?us-ascii?Q?PfQzrAYbJoFu6NxlBsDhyHDcTVV7GnE1FiZfETOkufNVf1scf4IKs+GsNntH?= =?us-ascii?Q?H8aD8PVWh4zdfie5h8ZYL2wJoJo9/qt0jx8J0K81mcWDcYltb254UeHJDVZu?= =?us-ascii?Q?6l8bmVqQELJ2V8AA/7K7FC5N2BYfLmnqePduuJHf9Aul1Im3QforPO4a6L4c?= =?us-ascii?Q?xWHfUXEpoffuVsmjvnuNFShyZjrTuaiTicSK/48XvrDkyVRwgmtEYSurhPdl?= =?us-ascii?Q?jhvpU/aoNoyQO1ltJSjjzdbfII1DwiiVIrPml7hm2zWeNxFMk6I59x1490wl?= =?us-ascii?Q?mugHvnLZ5kYHe7rfMoxyFwPvA3NZrI+TubaPOe+wjosokp59gFidZNYpZ4Hu?= =?us-ascii?Q?y1cg9PcH92FypCGQzCyQY3swY9/awpKKNUwaUhrwTYruXT3ZBJs4BKknr8w5?= =?us-ascii?Q?mLisy3/akEo+SLe2b7tYZvhTdd/nwA3e94an78cLCc6BQuSn2I6TQkEq63Y1?= =?us-ascii?Q?UPRI/rpcyaKEH0KrgQ7b8qOWqvZoSwqe?= 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: gZPCBpbYG8l/lol4X70BtWu4z5Cz+bdy5hQP7eTYY2qkPUbd1Dn3AI/EbVizwtMoZ3aRPLzvniwf9VLLQpcRkFpgX+ktE9GusioKPIxvih4Z1gWpgVYUupLw2K3ERcRJZ3FioaCvM77BnLB/PrtoU5k7eQkA64xHJAwPy6NUAsgY01FqEAftsRagR7sObb1PkWMvzKkEYRayFhJXcta+wg3AeUfnXV/DWraVxylU3iHzIgHuiDsaTbpmzuRmPSNC4Y/a/IlGIV59Fx7HJ1OG3PL02BtMrjLno/VdWbwshcf2+pHd/zXuqj0x1FLiWZeEjYMdtnMbdcDuoXru4aC9+VA5jb7ngwAT9KycM49FCSEuJLpHR6VBbPJdyweKoW+i1grtUfas9vb5zm50Zq0A3tZxRShwIsVENAGZk3V+7NMiMqm9xQQAWtASjOPCwqJh0vmsasas0umoUTlJCx6RC5e1kfZwkYc05jycX7WC7flWtgYDZl4rNx4JystoCLa9xxYXaXu+bu9QHettLFuYm+h2Jfmp6ktOSROmNSjUT1qbUGr3VwNHV4ogECM4dm/YC70M2OCR+uNUeVXBzvaownI3BXvwMi7+b7mMe8EQ6OVl3TbOWwK45JYCFMN6s6x/p2JxkK/E+ZdGy+fvJddj/sU/voRDNmaWoLNPQgnwv1k= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2024 12:07:58.5409 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0eaeecbd-4cc1-491b-a278-08dca1a21ad6 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: AMS0EPF0000019F.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9P190MB1051 X-BESS-ID: 1720699680-310726-12653-23696-1 X-BESS-VER: 2019.1_20240702.1505 X-BESS-Apparent-Source-IP: 104.47.17.168 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.257551 [from cloudscan8-87.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