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 B184845501; Wed, 26 Jun 2024 21:57:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EBDB640A73; Wed, 26 Jun 2024 21:56:18 +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 701A2406FF for ; Wed, 26 Jun 2024 21:56:13 +0200 (CEST) Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03lp2113.outbound.protection.outlook.com [104.47.30.113]) by mx-outbound42-4.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 26 Jun 2024 19:56:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XmEi8YAr7KtiGEK+8yKdBp7jdeopHvZJkxhyPEir5SNwE6iXHj6x8A6qypxzt2RqBgF0vP/GFDQJ/q351HmnvAn7FcStRZyWHhuUr6d3QzdvSn/5y8CNJlBcUPeV1wk7bqKP+hWpSMmYKAv3NX4oXU5Yp9zbSJg5HEvUAZPaTFc4vLuFPuPx2fc8hSHeQ303DdqS5eouxGBiduJZm4I8XCufeqKOh78hjZlAxmys7OmGktTBPufszLmuDwMnRMfgWRj0rb8cQl4eefGvSv2hM1hB7s/dobHpDq2Q+A6xpB1+V3TOWDgBRb77Hc0ki7QEiz82/2YTM9YtKWJQzgCbWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=LufmEVtL/tkzCz+1rfYbUtJyalM+l9qtMkxkAOSkey8=; b=Ns2L76WLJxMIoQqot3dbGdZvCCeIEbz3X6qCGqsUAKKzuUfnwkujyIlo9mQrmknekR2I17UNuKI3bGgVjb8Q/jAbCceS4KFzDVEt/39ZGgAE7LzcPMxUl+cUAM+LUm6II9kPtVLHdnUYweJxWU3xrJAgXwWcPilmu4cGY+ExgnLB/AWELEjLR5nlPzhOtg+hS1vhWrinUo7l5rUyesBlNNnams9Qtlvk5PQQMdeaC7XoRe4pSthVjvRKWDpQzJRXhLv+0dvSXo2BpTCJ5F9mln/wxIa15Z8Xzu9JH0EaqdssQuvZKDpoRi4+3p/1XFpqnN5kzEjHC67izY26yDWSag== 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=LufmEVtL/tkzCz+1rfYbUtJyalM+l9qtMkxkAOSkey8=; b=k4913ht22lGOuc2ux8G5UHCRhHxkGBtVybNHnzeavrQXXOoj1D4mAla4II/TcEcSFOzqGdT0NgUIEwKm83fIJp4knbRTzeODuLUhFx0MYRCVnCVzPvwxiKYH+wacg8uM5aZSyyweFuIciMauVlOxHmhCcov7VgjjfO7Pzlcp9KM= Received: from AS4P250CA0019.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:5e3::10) by AM9P190MB1027.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:26e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.32; Wed, 26 Jun 2024 19:56:11 +0000 Received: from AMS0EPF000001AC.eurprd05.prod.outlook.com (2603:10a6:20b:5e3:cafe::5) by AS4P250CA0019.outlook.office365.com (2603:10a6:20b:5e3::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.22 via Frontend Transport; Wed, 26 Jun 2024 19:56:11 +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.7677.15 via Frontend Transport; Wed, 26 Jun 2024 19:56:10 +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 v4 17/23] net/ntnic: add link 100G module Date: Wed, 26 Jun 2024 21:55:27 +0200 Message-ID: <20240626195545.1793419-17-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240626195545.1793419-1-sil-plv@napatech.com> References: <20240530144929.4127931-1-sil-plv@napatech.com> <20240626195545.1793419-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_|AM9P190MB1027:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: ed32161d-190d-433c-350a-08dc961a070e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230038|36860700011|82310400024|1800799022|376012; X-Microsoft-Antispam-Message-Info: =?us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k0fyvnVtk7nJkgCrXQ7Ewk5clOvWVQ3GQ3X?= =?us-ascii?Q?RYYtmkHx3R483Uppo28Qp6XyxmJwBtkJnFc6uBB1U10dAFiJhUulSQKBal6r?= =?us-ascii?Q?ZGRMoAiEi/3mK5TelHk39qkbVZsgyFnd12eViQs94fG7Hc1vNwrbvPJbu4pd?= =?us-ascii?Q?8uZ/xnfBpic8rfBBl7XIoWE3XWradoSunSSrqccWKBcXw/r8HotPk7M93WMB?= =?us-ascii?Q?G/XChcgoXSG9WSClRG9462jVH8+O0kv0PZ1o7i70I2eWAGFuYlDC5UR8AaBa?= =?us-ascii?Q?j9zhHROaVzIABGElIIVUHgatnSeoPzubG74adOohs8aQN3VP7YG98TV1Fi2x?= =?us-ascii?Q?ACDJa43oRle49XXF7wtGajJrWIuU0/Spqd8W3fhP96DUBhG69VRc5/BPXety?= =?us-ascii?Q?YSIgTuxST5O/vj8m1x6HcyTUt7ywObsY6qNIQWwXfjdGLwUqziWiy+T1N/yJ?= =?us-ascii?Q?042jKzH8XW6NgPFpIyc6R0nnltWVJDr/WnGV9/BOxWvcFFiD1Yqo0y1u2Zqx?= =?us-ascii?Q?r77j9nVLARtgYYN8WKAifG9kC012DB5jbRaOBL9x8ZlUsvHkyw=3D=3D?= 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:(13230038)(36860700011)(82310400024)(1800799022)(376012); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: NXKfVcEUW/4v7hs2vOjkYuynGn/OTCsKjkaCL1kYGhXUuzE0YrbnLxzChiVmVAWtKa6J4kvSLaxIPszjwgZtysozIACIGanOLqzgwonCdp9+BsM98RnPuOuUKXVWOBORQENHlzagnDm74Z/ixFpSiF+5uMLNiqbYwH4oN1Ffp+gfpoZbRuSUUjFqwdOOnidhDOJ6NK/fsRSwC224T97aa1iz2jfWXnDArIFpzOLg2zI8mfPCcc9vHQ9sjc/tuUuniVgvWSxuPL7wbEfbMjo7CM6U0Lz+oEyo2cfOJNiBnMp3VySl5sZmyvmcUMa+VmEIy4gS5kBwusAUMrswr+KFvQJ7Y3IbWbLCp5t21FUzlxNT2FqHg6v9zBWa3zO/wAkULMdjNnlDktxfICVbku5EGRXpRXybjdYqWLK57Y5PQDDDqj8P8ocr6wtP874yhUZt3RqaeadOCCxa/D1hY6BeG+HdHZiWGVR24SqwqV9sShOEusvOfto5lAjM5t4S/wXjtGfYBzgMVhztvX5o/heYdFja8up21ls+KyHm652XuYZkjFs7zvKlLW9Kb5mYPovZZWNUWI1EmFbE+769laKR1hYVf/Xu/uU0FEwFc4v2Q76B0+VmyT0RaRu+smJD7a4hq79M8YjbWBi8Kw2MMVf/uQ== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2024 19:56:10.9892 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed32161d-190d-433c-350a-08dc961a070e 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: AM9P190MB1027 X-BESS-ID: 1719431772-310756-3629-2909-1 X-BESS-VER: 2019.1_20240620.2317 X-BESS-Apparent-Source-IP: 104.47.30.113 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViamFiZAVgZQ0DIxKcksycLcyM zcxMwy2cTUMinJ1CjNIDXZ3DA1JdlSqTYWADH9/4VBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.257218 [from cloudscan19-163.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, 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 Add ntnic 100G link support. 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 18089833d6..807c1dcde3 100644 --- a/drivers/net/ntnic/adapter/nt4ga_adapter.c +++ b/drivers/net/ntnic/adapter/nt4ga_adapter.c @@ -127,6 +127,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++) { @@ -137,8 +138,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 4d2559c46b..ace080c0b8 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -27,6 +27,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