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 8414E45B04; Thu, 10 Oct 2024 16:15:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9EC0440A6E; Thu, 10 Oct 2024 16:14:45 +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 AE10340665 for ; Thu, 10 Oct 2024 16:14:35 +0200 (CEST) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02lp2042.outbound.protection.outlook.com [104.47.11.42]) by mx-outbound47-21.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 10 Oct 2024 14:14:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GZxvX0xZK1PuSpbdlNxKEbFDHSN6I/PZ/saCN8kC3cq9XyNp7aMjQMadeaThaWRsUAYnwwmeR6AxK2xdw07n1JqxHOcDk+lbKaEjtnSnnYjIRO5ETpD6tMmzGW4EYwwkRPMI5T/qs89ut0n5ee7UUgYYZzdjqLfyix4OHlwtJrTAxFjTjxJ3cZ/cVB+SjmJNY7VBstQfpk5zYUtRuA1gps79PSCdbuwtgurJuYnop+Izte1UfMESMhKKSKBGROnoAgNwUlT8FoqAfk9ENocF9MvfAeYHgO0NtHeOPP1tCKV+uhv6O3BpjjBE03VxeXS+RxqOtOe+upDtbGiVT7ePNg== 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=5R3VySS8/32ivoj/zx5UMhP4x4Os8n62rj5mDxnNegQ=; b=kw7x/mtHm9qgw9YIwjKBcbaVnj1o7IO70e8RzcRK/U/fKPV0aCf5ty9n4TDuU9L7g7K5iHwee7So8pqcOY2vdZHP8/+gZhYrtAbtFxDuYwn7268/6BZ8xoukt81cPDhNZA5/L85WkW0nE6VUbKl6ti2zJJlpU5ki+CCaiqf5kSkYoxusioQAzXJ/v+USYKEkNhW/v6Ww3/kc3QD6/wJTCh0xJMk0y6HRCX6YFDId+rlb/aJmT1npek/0c3Q6NMRg2LBbRcfWCzvYV9iEYY/f281MaF+z1EJ/LdbTFV9fRgcAehJjhcIdz+QGAmstOWCbuEF+RGzgj9ZJ9bN+ZSueXw== 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=5R3VySS8/32ivoj/zx5UMhP4x4Os8n62rj5mDxnNegQ=; b=DbOnG7wakZWIV5ue8ah5+q2xKw+R1yTfWdTrWNS859XzwrJcC6W1jpZDrHo/m/WvbFMpNWI+ZUSyFafZ1YB8zNH7Of2d9EilSceYtPSlxsXcmFLt3jyB1IQgTqlN/tbzfWDy/rUHCMgNs4msd3tUwSUk6elfcpDkm58m9OfP0To= Received: from DU2PR04CA0069.eurprd04.prod.outlook.com (2603:10a6:10:232::14) by AM9P190MB1299.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:267::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Thu, 10 Oct 2024 14:14:32 +0000 Received: from DU6PEPF0000B61B.eurprd02.prod.outlook.com (2603:10a6:10:232:cafe::a) by DU2PR04CA0069.outlook.office365.com (2603:10a6:10:232::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.17 via Frontend Transport; Thu, 10 Oct 2024 14:14:32 +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 DU6PEPF0000B61B.mail.protection.outlook.com (10.167.8.132) with Microsoft SMTP Server id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 14:14:32 +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, Oleksandr Kolomeiets Subject: [PATCH v3 09/50] net/ntnic: add flow backend deinitialization API Date: Thu, 10 Oct 2024 16:13:24 +0200 Message-ID: <20241010141416.4063591-10-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241010141416.4063591-1-sil-plv@napatech.com> References: <20241006203728.330792-2-sil-plv@napatech.com> <20241010141416.4063591-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU6PEPF0000B61B:EE_|AM9P190MB1299:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 8097738f-c2e4-4ff6-7531-08dce935dcc5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?dDfu54ULo3Ork605V5CED//JqOKW+hqkNNx8OidUh+dYa0rZhbiya20FXlx0?= =?us-ascii?Q?UgFZP/I14miHiurhYAxx9451NFdvvHLfyHafmokCz3Ut1caimLx2Z6Bh62CN?= =?us-ascii?Q?o4Gg3kZwzs1fN4YSyk+//hwGXDhQHhaGA9QB3KS6ek6/BgP8Hg+sPZsZjt1k?= =?us-ascii?Q?7C9VFbarMKo9wgIdrPRLxuEGpVgILIB8fZP6TUZW2SZ+7KRptfMNbU7w6POE?= =?us-ascii?Q?E4tFtz8pWB1l2Kf9XPzVlB7UQZF3v4HiLJc2+L76kGHxHDeP6Ekmh2HBVBNX?= =?us-ascii?Q?CQAgg7Vk7Hk3lPfuxPo/EkxEZdzlLGkBMEgW5YOibnREHir9eGGHgnduLOpz?= =?us-ascii?Q?OjZbKv+zROAitusjL3Vx8YUOR1q469XOiKwngic3GDjGSrBHULvQn/tK7FFo?= =?us-ascii?Q?y2n7xSzZZR85jhKYs/tAELQW0UAbPdiX71EaOt4V7oF7104x2KXgLjcxwyeD?= =?us-ascii?Q?MiyDneuPhPn8a/Hfwy/0UBAIV/AUF/9QkzzWBNy1d9y3ySjiY2PgYQpXiYpa?= =?us-ascii?Q?Sm1zs7IpRZ9vKB0yNzC8rYkEAFuK3KWRrFon4WswFK0Ey7/1NdIeGCWGhR9I?= =?us-ascii?Q?qnbteOOLM+iDA1DOOw3k9gWzqh3+c2LPDGJlOJmMah88h2E19LElecbnWiUO?= =?us-ascii?Q?4ODWYsnPRYJ7nlgRcm+pY/4oOD92CmkSVpnkDVcwDrASjtHJs5d6F1ggRuN/?= =?us-ascii?Q?fur/J15Lx64ZBqbSNxK0fMo0xfjGLa8YxnOhNw91JncNtaG0cDDirxwEuYzP?= =?us-ascii?Q?PBCLh4NWV/w5joHVQcprvRiq6W9NrXH2vZWHCMqaUt+Po4gY3mu2hgk3wnDs?= =?us-ascii?Q?rCdv6bnfwUZI0bOoem9xIpj2osBbGb8sTMPSFJNSwdN7ePy7iiaYvot4Ve3n?= =?us-ascii?Q?og6+/gjN2K5dlJ9LMBj4tYCBJJZUQkUWavmWvXBQQgP8/aK6JUzCBLGAY91j?= =?us-ascii?Q?oeHJIgTuJULRD8weLIxiyeRR/V1mlo07cgjOMHCh2iEeJ57Ws18SfPLldem1?= =?us-ascii?Q?/O3j/y3xhFG106cgDqSVPQwYQnRqNBslItbp1bh6t5glYeziAzoWRZkVNuJb?= =?us-ascii?Q?khhI2VIjVFOaXSkcFc0jakhMo6mheBgsf4htq4R5p6/rlM5Q+urVHHb6TuGp?= =?us-ascii?Q?hbq1IlrbtEY60n9R7MMEpSy5moamltSFzIaaDlWgbfe3EaNJMp3dDPH43PF8?= =?us-ascii?Q?2rao98Af+OMT+75B2Mkh2vPDtqxdm8rtDKzoquu8BLGJmLkum+YlDc+f+QKc?= =?us-ascii?Q?FX+JxR0xJ85zs+7xvFviEfHOwyJqWUEBq9pfEoFYYnKH43A1K+QEozFi11LE?= =?us-ascii?Q?Khjx105uu2K9b6l6KwRbzVrBNuhESv5bOsv1HQWNZIt02RHSjf2I2jzMDj4h?= =?us-ascii?Q?859ZrL0=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)(36860700013)(1800799024)(82310400026)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: kHp0MBhVOITvluVTCavB5xFic4Ew8VuAq6zyfEcfq6KhEmTFZGC3tc/HGSrjsy+RZ+Frk08UT0/YTRyV6ijUBXZjtHc7MNzleD3LiT+IDIJJ3A/1L+0fT0gjqyeLKCw3GPFyQn6Y9d4AMqC9yEoTc3btoTp6tsgxLHk4yGEAjB5VY6oGnHhp7Ay2YhPCgmtAoT6n0bsb6kgHLd9qRqrITBTjLL1+rOXnQjArvT/CkngR4djd0qY9O6fRxuowOprf7eCzbrGINZ95hxnU22/VI+59CIikqBxphOrclqfB36eaTKTFvigG77z0HMQuwuyR+v0YesHuaMCIZHylhScjwPmtwjPLAOqkG2GZV0Gd6bgfrbs4YEaZiIjxqVhiFRPcuFjiQMN+71hN7d4KXc4RCmr1bSPb3hIKv7ElPVtzlEWdvQjlje5s+Qx68PYo6YH4Cgugsmie4Mq0FCQPtJmWC1vAssqL0ezxpThIFbDSlv3gtQJr0eIn0T5Zksw4haEZrcXfx6iRLzOhS2dgvKsN3yJ7uvRrtcFRN9y3RRaQPygV7MpmU4JJPlMBHW3Rm6KOWYC34vgbIjoiTZia5SwjS7PDbFSdUrWkbuH8MdCvbGJmbt+OQPwQBSqfodilb4jdxdWBROB8AZ/cEtSOUamiBCYHLeoibUae+ieDYmA6Gnc= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 14:14:32.3578 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8097738f-c2e4-4ff6-7531-08dce935dcc5 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: DU6PEPF0000B61B.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9P190MB1299 X-BESS-ID: 1728569674-312053-24291-18438-1 X-BESS-VER: 2019.1_20241004.2057 X-BESS-Apparent-Source-IP: 104.47.11.42 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViaW5sZAVgZQ0CwpydQ8LSkp0S QpzSjZwtjUIiXZMi0x2cjQ3MjIJMlSqTYWAMDq8MdBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259630 [from cloudscan12-202.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 From: Oleksandr Kolomeiets Add high-level interfaces for the deinitialization of the backend. Signed-off-by: Oleksandr Kolomeiets --- v3 * Remove newline characters from logs. --- drivers/net/ntnic/include/flow_api.h | 7 ++++++- drivers/net/ntnic/include/flow_filter.h | 1 + drivers/net/ntnic/include/hw_mod_backend.h | 13 ++++++++++++ drivers/net/ntnic/nthw/flow_api/flow_api.c | 12 +++++++++++ .../ntnic/nthw/flow_api/flow_api_nic_setup.h | 14 +++++++++++++ drivers/net/ntnic/nthw/flow_api/flow_filter.c | 21 +++++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 1 + 7 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/include/hw_mod_backend.h create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_api_nic_setup.h diff --git a/drivers/net/ntnic/include/flow_api.h b/drivers/net/ntnic/include/flow_api.h index 112bcabdb5..6a2277c2ca 100644 --- a/drivers/net/ntnic/include/flow_api.h +++ b/drivers/net/ntnic/include/flow_api.h @@ -8,7 +8,12 @@ #include "ntlog.h" +#include "hw_mod_backend.h" + /* registered NIC backends */ -struct flow_nic_dev; +struct flow_nic_dev { + /* NIC backend API */ + struct flow_api_backend_s be; +}; #endif diff --git a/drivers/net/ntnic/include/flow_filter.h b/drivers/net/ntnic/include/flow_filter.h index 01cfce03d7..d204c0d882 100644 --- a/drivers/net/ntnic/include/flow_filter.h +++ b/drivers/net/ntnic/include/flow_filter.h @@ -10,5 +10,6 @@ #include "nthw_fpga_model.h" int flow_filter_init(nthw_fpga_t *p_fpga, struct flow_nic_dev **p_flow_device, int adapter_no); +int flow_filter_done(struct flow_nic_dev *dev); #endif /* __FLOW_FILTER_HPP__ */ diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h new file mode 100644 index 0000000000..46054a6a85 --- /dev/null +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -0,0 +1,13 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef _HW_MOD_BACKEND_H_ +#define _HW_MOD_BACKEND_H_ + +struct flow_api_backend_s { + void *be_dev; +}; + +#endif /* _HW_MOD_BACKEND_H_ */ diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index b4866d4bdf..78dede2f39 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -3,12 +3,24 @@ * Copyright(c) 2023 Napatech A/S */ +#include "flow_api_nic_setup.h" #include "ntnic_mod_reg.h" #include "flow_filter.h" +void *flow_api_get_be_dev(struct flow_nic_dev *ndev) +{ + if (!ndev) { + NT_LOG(DBG, FILTER, "ERR: %s", __func__); + return NULL; + } + + return ndev->be.be_dev; +} + static const struct flow_filter_ops ops = { .flow_filter_init = flow_filter_init, + .flow_filter_done = flow_filter_done, }; void init_flow_filter(void) diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api_nic_setup.h b/drivers/net/ntnic/nthw/flow_api/flow_api_nic_setup.h new file mode 100644 index 0000000000..da083f050a --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/flow_api_nic_setup.h @@ -0,0 +1,14 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef __FLOW_API_NIC_SETUP_H__ +#define __FLOW_API_NIC_SETUP_H__ + +#include "hw_mod_backend.h" +#include "flow_api.h" + +void *flow_api_get_be_dev(struct flow_nic_dev *dev); + +#endif /* __FLOW_API_NIC_SETUP_H__ */ diff --git a/drivers/net/ntnic/nthw/flow_api/flow_filter.c b/drivers/net/ntnic/nthw/flow_api/flow_filter.c index 63e217ba13..3bec51051b 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_filter.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_filter.c @@ -5,6 +5,7 @@ #include "flow_filter.h" #include "ntnic_mod_reg.h" +#include "flow_api_nic_setup.h" int flow_filter_init(nthw_fpga_t *p_fpga, struct flow_nic_dev **p_flow_device, int adapter_no) { @@ -25,3 +26,23 @@ int flow_filter_init(nthw_fpga_t *p_fpga, struct flow_nic_dev **p_flow_device, i return 0; } + +int flow_filter_done(struct flow_nic_dev *dev) +{ + void *be_dev = flow_api_get_be_dev(dev); + + int res = 0; + + if (be_dev) { + const struct flow_backend_ops *flow_backend_ops = get_flow_backend_ops(); + + if (flow_backend_ops == NULL) { + NT_LOG(WRN, FILTER, "%s: flow_backend module uninitialized", __func__); + return res; + } + + flow_backend_ops->bin_flow_backend_done(be_dev); + } + + return res; +} diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h index 3251f651be..90d9c73f9f 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.h +++ b/drivers/net/ntnic/ntnic_mod_reg.h @@ -121,6 +121,7 @@ void rst9563_ops_init(void); struct flow_backend_ops { const struct flow_api_backend_ops *(*bin_flow_backend_init)(nthw_fpga_t *p_fpga, void **be_dev); + void (*bin_flow_backend_done)(void *be_dev); }; const struct flow_backend_ops *get_flow_backend_ops(void); -- 2.45.0