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 815B845509; Thu, 27 Jun 2024 09:41:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B1CE040ECF; Thu, 27 Jun 2024 09:39:55 +0200 (CEST) Received: from egress-ip42b.ess.de.barracuda.com (egress-ip42b.ess.de.barracuda.com [18.185.115.246]) by mails.dpdk.org (Postfix) with ESMTP id DD6D740E24 for ; Thu, 27 Jun 2024 09:39:46 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2168.outbound.protection.outlook.com [104.47.17.168]) by mx-outbound22-108.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 27 Jun 2024 07:39:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JqS5zmeAD6ifUpo6TlqjnNrcdPFRKZxxMfI/4ZyMPubaekWeXAIZDopqzkBIBqIlkJm8STi+GLaXP2hg+F0tXg3iVj62uVrHtKcDJPyxfKYRvn0H2u/uiChdVehBJrf7/hKP3cPfKelggUtJTQ7YvRHLvW3JNrfbWWJwTzpte3RF88vAQCUaQ6nWBSJU+Svi6j/ukUtQROuVstpHecSDDsD8izXTZ759jEwKvXyVGP3lzw5wC5rtkAURFkDLjZaCePzvqgQJO3/cRzRMuRPPMT8bPzFA/f28VgvyKLISYCCsOolW690W9e1+V28ioh6Es3RPTzqaaU1v6d33TyvJnA== 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=Pad98j15vqt6tdOaRyKXcvecqxeDpDkqnyL6+omRDbEdf8kfwC4t3jm/AuYpZQPu/GGcTH+98Mcw+30swG3hYU4c/UFaF2kCw0G8vA9NrXd3L4hwyS4iZQ+1r43HE7rjVKf4DPid527jaO4IHFpxnA0RXc9kkMRj63s6858Z6eikoo0jVTTunbE08oODDkl+oyVZV1YIw/6RcZJfrqa0p/cCRsVqnP6MSu7AI10TZBexfprSJOZlwgjqc59HnFx1FCpIQytUsM5IkjQikgbLQRMnfjvGL2vvP6UhuKeXxJ2xS7HHTmRRz1s4sS/UfksALzLDXH33Nl6dhxgme2diBA== 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=hR/eg9xvjTXOP18NNZkKYO/zXr42/xRYTMFEoldM382pTh/7Y430+Lnh0UOq3Ohdjwemrj6nMQtWPn5FSTtkX5WRoWvhC/ZfwZG12gbYDVesDgLc+Zf4v+AqWQ1UOMpAV0lS4wbIF9pruEIrSMpZsAYuhQXxuHIloY55joUYx4E= Received: from DUZPR01CA0342.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b8::26) by VE1P190MB0925.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:1ae::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.35; Thu, 27 Jun 2024 07:39:41 +0000 Received: from DB1PEPF000509E2.eurprd03.prod.outlook.com (2603:10a6:10:4b8:cafe::f9) by DUZPR01CA0342.outlook.office365.com (2603:10a6:10:4b8::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.25 via Frontend Transport; Thu, 27 Jun 2024 07:39:41 +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 DB1PEPF000509E2.mail.protection.outlook.com (10.167.242.52) with Microsoft SMTP Server id 15.20.7677.15 via Frontend Transport; Thu, 27 Jun 2024 07:39:40 +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 v5 17/23] net/ntnic: add link 100G module Date: Thu, 27 Jun 2024 09:38:58 +0200 Message-ID: <20240627073918.2039719-17-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240627073918.2039719-1-sil-plv@napatech.com> References: <20240530144929.4127931-1-sil-plv@napatech.com> <20240627073918.2039719-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509E2:EE_|VE1P190MB0925:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: a3953b00-e3b9-4e91-08e0-08dc967c4e32 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-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Be/4Zsq34rHJqURKmFtSpCBynxM8aM3idIkr/sw?= =?us-ascii?Q?8Kyl+o64g671OwvC73GckAlZ0FIw0CGCl5zU0P9uKolH6S4LVMIslVWnOPzg?= =?us-ascii?Q?qAKCzkHxpI18N/uoe5zwlFQphjWzMnnKUaf6ic4JbO+oudJZxZ316FTJe98z?= =?us-ascii?Q?/fIY8tLprwNjXDc4OWGN0dXLQCRsTOxBl6PVh1OwzpBCIblNalf/91nM6b5u?= =?us-ascii?Q?uzoCeOO71OtV9T0NJ6kPYnWubyT93hkVOl7gux1LR8L7IehOvCCQT0Rt1V9f?= =?us-ascii?Q?AqInAJ8saaXx8JBU4bHzHjAh0W0E/9Fw7EISvnXC3MXxcEx5cL9zqOwFd+hY?= =?us-ascii?Q?LjBFOvitsrXsmmX8tmOfhHzKiN4Jtz+u4EGYu7p+UkCYcvECIKfNfAzAXTFL?= =?us-ascii?Q?dhdw2NcChtndbPfd/Y7DOCjQDO+C/TzGdP6VdGNqT9QRtVuCEUvK5zUgWUQJ?= =?us-ascii?Q?SRV9Oncr8ejZ4woiASn1Tqs+g0+xxkc/RH2uMJePt3+c7xlolmGicELl0ykV?= =?us-ascii?Q?eirm7wF16V8mQlcRdyhSrQ3AqiJo+6aCkI2SdZk6hTKoLRwy1g=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:(13230040)(376014)(36860700013)(82310400026)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: lFfj3KktSbfUKLEksST4QN9iNAbcpr8hyN/CI0zyVAY/ywC80vfyz5sRmQZtk8mjcUfmte/34TPLh/M7qmKSIKoTu0q6J1vdKgEstyYTBgXWcVfuGVgkXED/JEujYp1UQCNAmxO3GkNfewYA3CsdS7Tsh5PMGPOAzq6CKq7Q8xTMBecrwepgX083l0F2fM432mkPb0ZHV7a506L7AhIu8vZIOE3PBZ/unmWKsMPzx1BQMe2p1JorwHRLzLlDuOwLkhguIs2F2fpUokqccLBgePxfMASEXI+xyBfajPwyTNI0C5RjuwgANrt6DSMabkFkCTZ+ir0rlQ9YJQMDCKBZuKXf97yeBPJ96/mGOwcB764mzeiwkjYAjuFSj0KUrzJZbVY/uFzKgKK4cJCVkZKcPjBk405kAFZPD+dXMtq+3OgDOTORhqZ4yEDANLtBxzheN4tGjZ2g0JVDQPIcI35nvbvu9cErROE4KUOwLmAYcbUGDEMa0xW2SqjJcfx694O7y2Rvu/c1tX98SS+w0NetYXVS86E4CVTRJ6bHztpNaOcM3L0SLG+uGQARy5PmFDBVUjs8fvw9kcycvDIqDAvIJA2m8CgtVEcRxA9uQ0xiB8Zc0eHG8l7fHRoRMyE30k/zcx6H4DQ/pEw/aejtha8ypA== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2024 07:39:40.8968 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3953b00-e3b9-4e91-08e0-08dc967c4e32 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: DB1PEPF000509E2.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1P190MB0925 X-BESS-ID: 1719473983-305740-12655-2626-2 X-BESS-VER: 2019.1_20240620.2317 X-BESS-Apparent-Source-IP: 104.47.17.168 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.257231 [from cloudscan13-64.eu-central-1a.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