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 BCC5445635; Wed, 17 Jul 2024 15:34:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8B2B4427CA; Wed, 17 Jul 2024 15:33:35 +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 A0E4D40E5E for ; Wed, 17 Jul 2024 15:33:29 +0200 (CEST) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02lp2040.outbound.protection.outlook.com [104.47.11.40]) by mx-outbound23-33.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 17 Jul 2024 13:33:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mV0J2g+W6SsUTksN8cHjKEplBApZ+EHt27QqAfhV7/GL57IenFYhHn2etpy/uwlKuX/8eScX+koaVKQC7cBw6Oc6sw4/UneKlTPcvf8nKPNjIUAFM3lkaRznEQqrNsCRi/rxjy2DYHpwqyCfiukrpPkVDzDR9TGKj/ZXUmS8VS5dOn/RQuNz4YW63JzeR6nuZCe5iD2BdEdmEM0JpT56Z11UHX/hJcGaXN3Gwro/RsrMYfzNzjg3rn3lOENObM+MZ6dTRBJHSX4E/wWVAhlJyzs+PiF0VmrjSvIr0+JaUAXeBGXEOBSnCZDdMt0zz+z8wz5DYfKyWM//cJM4fm1yUA== 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=cASPUnbxmWMzzEZiS7LDULsLGdmyx3t0vWFgleNCub8=; b=eO4FdfIzHPhtIVflbpxZgruDkMojfQb1OkXkMO3BlwxOV2xjv0Qk0uCVHXcnr/ldAPvy2jY8xm+XI97EOp5h5yaCtyWvicsjhg+lrq/OwrZHlZeuDpASmOrYeKTdHKIF9iekOLPEQvi3oclbXoZn4oxf9ou/0ntC/P89bHjtzdba4/bsz6WsCTx4R5kfoThuOq0paesxMeIJCJmas7v24Us8KQ7wquMkb+ckAI6CyVJsh8G9YMZfsQZWErdhghQ8t/uP3lt55UfmYTq3fWcU2Ojbs//AAHN9nXw76hZ2a55dDfCOgoaO4w2MhWJiuaMmVjDrnjp7rQppfyv4dwitQA== 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=cASPUnbxmWMzzEZiS7LDULsLGdmyx3t0vWFgleNCub8=; b=XtxBIHEwMBkydrirDlW+RoHvaUMqRpwfGXR8RD8Ed+H2tpPzWZyD/8Zf+D7SgbRdQvtyHgJlpcr92W/UHkdDzhb8aJz+Egsjw+onc2+oyN2Q8Lx0n3cy+sioZb2koc+uI39uPzpcjcyMRapcJTffbW1qm/R1g1iDFzMQjR0+IYg= Received: from AM0PR04CA0076.eurprd04.prod.outlook.com (2603:10a6:208:be::17) by PA4P190MB1213.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:bc::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.16; Wed, 17 Jul 2024 13:33:27 +0000 Received: from AM3PEPF0000A799.eurprd04.prod.outlook.com (2603:10a6:208:be:cafe::7e) by AM0PR04CA0076.outlook.office365.com (2603:10a6:208:be::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.16 via Frontend Transport; Wed, 17 Jul 2024 13:33:27 +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 AM3PEPF0000A799.mail.protection.outlook.com (10.167.16.104) with Microsoft SMTP Server id 15.20.7784.11 via Frontend Transport; Wed, 17 Jul 2024 13:33:26 +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 v10 16/21] net/ntnic: add link 100G module ops Date: Wed, 17 Jul 2024 15:33:03 +0200 Message-ID: <20240717133313.3104239-16-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240717133313.3104239-1-sil-plv@napatech.com> References: <20240530144929.4127931-1-sil-plv@napatech.com> <20240717133313.3104239-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM3PEPF0000A799:EE_|PA4P190MB1213:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: bf353375-08ce-45c0-e23b-08dca6650a07 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-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3Hcn8k0jfjWJ5W/MpIAd/pP?= =?us-ascii?Q?FE3VDqkIu9mLSow8hjgKRlR6G9eef73GVvCmCDBfAcbSXzoHu47aMJvr+M4o?= =?us-ascii?Q?TH9KVmxndPhnrxpI2ENoENM+fqWAhKrcDaAWG8GlcZb2oJksTD9lNSLadjej?= =?us-ascii?Q?BfZu2cjh7ECrM51gTPodE8Yn9NrEiMa0GJnQCWofePHgUYcEFoqr9J2HlGis?= =?us-ascii?Q?pMgHUM8kJ6RkyPwgPsmWLpw+XVAbdgyR7C5t9FDryu4Elkpgkxbn3CYEUDV7?= =?us-ascii?Q?tqm5d7vs65JfatXw70Dul3sLHPQ9+7qJQ+gE7EGl2Ev+4wqOjknRzAKvqvz9?= =?us-ascii?Q?y7cbvKStPkcnZ+iu/xvem3ZiaScn2t9IW97e70yL091W7YrOWaGbkhm2nVXT?= =?us-ascii?Q?UYVw+Bb+2OEdGZiqvXJ3XQ+hIu/tuAP5Asv31HUPsYmbqcrSAarX/40K5LML?= =?us-ascii?Q?Er+L8YtFNDyooInU9qVTk8Ga7gT8raeWDv1/etQpYdQlg9YSK7QbCFeYR2IN?= =?us-ascii?Q?TRo/VnOL29iuUAczy19W/++MNt8mc9LqLy7o4msyPhMQlYAKtosmE2I4PGLS?= =?us-ascii?Q?axIyCd9Ng360IZHlnfvfo+LouZM8qA3U?= 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: jc7p4l0hM6JSZKTSbgflmh3adlYzAgojt2st8BYObcheJS1MvpxX3xN0CF0nAE3oXE+p6IBXgNcIzolV+qErTCaeYoupNa2lrwMuapa61sBdHv9vYAmj8dzmIFOxzlDGSrXqOhdK9y+zjaIZQb1GxHSzrWqEzVXS41dTiEdwxHIUvLALQ/DDx4N6tYRZ4cs+2ruiWyokfuho22sb4BmFd8LCa5qsaftPaGDJZL5jo66kLV5R0E6M87HBEFE/+NLbf9o0iuop5Df8f07DzSfmbfVcCE/MDdy8mWAptJXedqKP5vuSBsdsOWEjTwIzUzDN6B5bkXTaa4TFb3yX0NnwL6WnWQitO1wCWgErOT2+CqqlIP+muc1WvhCld/I2+wX8jIgifXpXA+4s9oPO+LPhqoxYfHqg78S69PJfZr9LcEbM0a10SdQATjWjGhx/okRukLYnYs3qOp1fASzVC+1aS/6+HN1ZWqTVbAE5x2i5MNJJGn6sckOs+V7IRgurdaJ6y/jDQOyuoHp5TxTf2Qm7OxmCE4BIiv8tQ3jovK6z7llXQAidnCQQ3fC50q/0dLoAh5TEENhJpMewentJuBCjsgRRrP+5dO43LkSPZyFkyAlZ+wz8DQfeZzlchbp77vxIMYb6hzYGK3nDwZTrWeKVAQ== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2024 13:33:26.7933 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bf353375-08ce-45c0-e23b-08dca6650a07 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: AM3PEPF0000A799.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4P190MB1213 X-BESS-ID: 1721223208-305921-12777-14959-1 X-BESS-VER: 2019.1_20240716.1757 X-BESS-Apparent-Source-IP: 104.47.11.40 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVibmhkZAVgZQ0Mgw2cDA1DTVMM 0ixTg52cLA0sLSKCXZKMnYzDTVODFNqTYWAHLUZjBBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.257687 [from cloudscan16-115.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 --- v10 * Use 8 spaces as indentation in meson --- 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 be98938cc3..43bb566e33 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 5619bbe0bd..18eab54a5b 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.43.0