From patchwork Fri Oct 4 15:34:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145123 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4DF3645AAF; Fri, 4 Oct 2024 17:56:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0706342EEB; Fri, 4 Oct 2024 17:51:56 +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 367CD42EFA for ; Fri, 4 Oct 2024 17:51:53 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2105.outbound.protection.outlook.com [104.47.18.105]) by mx-outbound8-201.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:51:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UU3lCDf/R7gCMMVr5zhKkqWyDM9O2ylQOzmpzpweaMtrqVxb/51LJCPbqk65+eI3d9SIJ6fUEuzAi9NFMDXUVjl5C0scnopb2kyo7pVxMtSz7Hd7o31TEPq7/l/6K515oBs8PWAuco9cGxL/zWBeGMGwJptG+l7i/eexKzRaD0L1ChOc8ZesWCG0tY8aBpeAGIcDcFQsaSGraWEB3KUGxOjb7DXpOJYiIZMuQT1weE7f00D7nu0qoxLNJODmDwmIQzPoI/3YPOw0GGLpbRBqgytaiqS0jDto5rdbGwzoRp+NG2/NydftyaplFj65XHf5rOmb+PaJ0p8V5I8zuv7LLw== 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=CnKxnDUSXnzR5oF0EKLEWFVfBeu3w2ijmQBkwWEoeJM=; b=Rv6rwrW7DI6a05kg2UxsQCglg+hHud/gU2y31fRH/+z1V76gGhZxsyj/sfw/qJyTSI8EdbRmgti3FjI8Y0M2OmbJFXUHU8YNQSm08RNL/+emwYlhlQMRJLoti4NZePmLDY6ZgTA4B+c6d3A8nYFxVBmTOecAkSh38EJi+rvNTMl6ver5oePRfzh3KAvo3F8MXlsNfnSvzVWeBfWSoQOrbzK01j2quXv7j90aMXm+cLzSlqmH8MBWTbs2lY/6yTgFsFAvmfV/lekHyqMvdOZCLC/V9PGswYFB8A/e1yWqosH1REARtR/7CKpoPoKGxByXgf47D9bIE3VH7OxPx/vi2w== 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=CnKxnDUSXnzR5oF0EKLEWFVfBeu3w2ijmQBkwWEoeJM=; b=pJYPCYhxPqAhKYJ7RfR9i0FvAtmue9VmGesqUp4iAHpGrHizWCJhP0HeK7Iz3uj+wv1FX5zQjDQryIeDreosZiuI2+AOvyQ4o6WnUNNj67MrkB3v/AHuohbZ9iV4Gbo94aWbSyWAxPdJAZETZyAlcYqwTI5yqu6Gz6DpmTZOcjQ= Received: from AM0PR10CA0102.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::19) by DU0P190MB1907.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:3bd::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 15:36:07 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::ca) by AM0PR10CA0102.outlook.office365.com (2603:10a6:208:e6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:07 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:07 +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 v1 04/31] net/ntnic: add flow backend deinitialization API Date: Fri, 4 Oct 2024 17:34:27 +0200 Message-ID: <20241004153551.267935-10-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|DU0P190MB1907:EE_ X-MS-Office365-Filtering-Correlation-Id: ba0a1abe-6305-49cb-b91e-08dce48a43c8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: 2I+l5f6s38B5vCIbRmOiORJDogfAFmRVRvho9kVAVeNna7HgDneAqlh9T506eHUFUWeqe86LfNKU4kCLQi7siOAC8gEhdGaMVJMV5JJycgIdYab36gPogz/G5enkqX8QfeJwSLoUSia8L15ZhGge9m/5XegskAVe6qQgQA/8MKng6sKlHxD4c2XnrcJWZ5n3Cc5pWgtTNd9Qm0ADiwPRxIKbcRPUtp+W8Ydi9wj1s3mJSdeXvq2EXiBzovPas3c24TE6YBbULzwDqOlCJi4deuBJpI6TuylU+0B2keT8zQr7rO6K/7kUTqAp/DGXsCPxPrl1KaMQTTlqxAOIHKYfVQQ/ivxu9bRPTK0pWwjYF8klFjGtvDzZ0LTTU/k3ZatHFW7pgmCEsafKvIxMPchUUG8gyYx91LOL3g5Zpf/RSPmNstWJklHXW2VKdnqYE1AQjKK2BzDCno9363L90fz2UX3miO9Msj6FxklZXhwxQYU7EcWaIWXnLm3LvBYbyGEk/6ZYgv5BzqXyCOGo8WHs+Vf9gqhgDd8SFskClBSGe7/TxtrqYyIz2pIBdQs6ELGhu49oEyX0hdTr6iVBpLPQ3qbwDX0HVEHYWV+UMuk3EI+nXfjd8Q++ianBUezEWjfn2PdMjrm2n2xN4qdcW6VVdDOPSMd6NaojIa91tPWEovhqm0Wm6v1Xf14gfG6tdUQ8RvG3KAQTi44Oi3X31/YmTqsyQG5fFkU4ycrDfEY+Whzpik6Bkle+8jCmjjSXxMRF1TUwj/lg/7uzuY4Naqy+/IcNenr1UpkUxxof5kDLWiGFi8XliUQlzs7cFHaLUbNUX+kzkjx+aJ7E0jnEGuxZXmiFGLVoSrA8JHE3mdqXYlQaY3/snbnpcUrtigkRxYtowTA/hI4za93FIkfrMzlbD8xMzuF6pC6BlNdiXUBb+zAzh2KcSBgzNlKUWQk42+v02XMpkiE2h4bc+EX9w9TQ+f4OEE5MhKhZib9QxW/BVF7nql6j6R0vUV7iHJnW1ujijnWmYbe3MFXDPlyYjcHpmXw6Te1Kg6cp1HmWBbWecbuLoxKSpiR4ovPXNyVjwQfrMUXUJlpOQrYK0m/d/dlo/owThiRnvh7bk/fl7qbF1VW3gtXflxZE/UQDUSIANs9UuJ9rljq+d4/8PhkwP9viPx65Oj2gRgSYXo+gj21s4g+hcU8qDGr5jO47PK/PE9+Izh2fmmfv9V2nlP6q+3g756tbuZ1kuUw1MJysNu0wWcvLTybYKz6xsuy7vxNiY3VVtCIL3/N4QXJvpDXjU+/g3JU73jgmbmVOX6GPN4eo/hGHEcAePS7s7wytigfbDaMyXKdwFMB6UdIm+eAS2FnKX+85nJYDMQ/tHnaK1ekLsLM= 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)(1800799024)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: UypgeKfiPr2MyCpDyEyO/HWF1EVHyeUmtTnOJVIICrwBWAmmVK/mTtoZEXpN765GZIgwMmIf9yaNexjd/LQfdHahFeDtzrgWPFnJThu/rIBMXkvZZlGn0XyS5zkItukAUJ9VcuCJWym4CfUtXzb/1kajWEgvD6+z+wRjN/85cZJ7ZSCm209/nUJ7dwYttNBQHO0ZNCOW8UjZGR5wNCTOJ0xRjuiqTwrC+YRPNroXrM2zKp9WDYEc0fytpy5VIu369spOItWPM34vtam1rvpxhnl++FuYKuQCfWmdpR/BdLoeZKVDkE9IJWKEZCpx1taxVG7X/pK54KaeuOrIxfrYShhGD/iZVZXSO8yJGxb/EM/AuwiiTrDcIYp9Jcdtxm/fiFWuR8Io8GqQXtJEf+qzBOKxqs1/gV1RBeAOEkc70MxmySKviJ0ATnmSkm3lx4PHn5qk2CDXthTlb2WbsUa2yOBrDNHKHytpMVr6JjRabZ6I2fxOnQX27G/lFeRNAUPu3reW4G1eLeD6wK3zEpqL3zNxnZg8QSFc057nP/u/PSGLWOlXbIZBJh0brTgCh4ayQtp7UZ9DPH4tP7H8RdTRoYOZLJKrZspkZ3tCAYc17ENbko4UhoLXXVmIV/NQDf7LFW/gXT1C7m05XNQQQc2Ppg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:07.1896 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba0a1abe-6305-49cb-b91e-08dce48a43c8 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0P190MB1907 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057112-302249-12643-33914-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.18.105 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViaWxoZAVgZQMNHQNNncwCDZ2D A51czEJC0p2dLENM3E2CLJMM08ycRYqTYWAKTitwlBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan16-215.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 From: Oleksandr Kolomeiets Add high-level interfaces for the deinitialization of the backend. Signed-off-by: Oleksandr Kolomeiets --- 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..9671a20e0b 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\n", __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 7b6e122190..e822ba7df9 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\n", __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);