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 D5AE045AAF; Fri, 4 Oct 2024 17:09:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A5F0D427C4; Fri, 4 Oct 2024 17:08: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 8E0134279E for ; Fri, 4 Oct 2024 17:08:11 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2168.outbound.protection.outlook.com [104.47.17.168]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:08:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=T4thEsgbHVrc9dkmy67WoRml0ftBZym9/nBLKE3YMH/ZtjEIJs3z5C8TqOqVeh1I6YVdF1gq7CuV6z5GBQyZKBix3dqBUvGxQiHYP54gy95VAe7i2C0ereKtTG1yTUa6vLBYWmaGI7DaTXRzWoSHc4zw72tpmzhEIriFIawoKmoQLwQlUSD32fCLsDSi+n0nJtFtDi1VnNU2S2jGcqbAQlCJcXSn0IcM7lrwXMLvKwMIDzGfTkGFsJYFwbeR6exOjeY8NRSDNJUqpmxe+arFg2S/UxyZqMMzhhA8Qv1vnpwlECPBM7S80OddGRV6ovqfkIg5DJ43b9mnYcfCYOsZuQ== 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=R+PJDQV7TvGaRxY5Apq745APsMZ9MBEd6RoKDEvkVLWHLnnJXmIIU+6Za8HZkTpjBC+lgWJTU4epV8gYSatZJQyTBpnuf9BEIR7OgMMGJwnsHAQ2/LJJVwL+dc1cTBijZREqNmFx38vgf181kIxxITIloFqY0Hrpq54SPtZ6ogSdAoabD9o9HcCzN2UeBUlb44fe2mTJrCAI8zmBXh6IlRrR1O5xJIflNpi+FhkvhX4dzzuqyoZrHyjwXn2CvzVGVOWzIYsdM2VbOWvGUD8wujvkczfzyZlvr7pZ3scsz/OTApOEDUQxJx25Wy7yoiAeOoLMh4ByD3+EOS9cl+azDg== 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=aNVXL6pd+cuzxgfODs0hQtafg4hOhEDUzu5avh0VG2Y+UN7VZ0zV0o1muEvixel+jwyQyhz+RnB8fEFtz1F0X12sXb/nLItbRCP0T4rLIbxP9uI/7C8NjY6uWXKzR6IDRuZA3np458nm68xfyLZjoUyX1mVJsFlZ+pyBXLHzcDY= Received: from AM0PR02CA0006.eurprd02.prod.outlook.com (2603:10a6:208:3e::19) by PA1P190MB2099.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:459::5) 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:08:08 +0000 Received: from AMS0EPF000001AC.eurprd05.prod.outlook.com (2603:10a6:208:3e:cafe::64) by AM0PR02CA0006.outlook.office365.com (2603:10a6:208:3e::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:08:08 +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.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:08:08 +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:06:57 +0200 Message-ID: <20241004150749.261020-11-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004150749.261020-1-sil-plv@napatech.com> References: <20241004150749.261020-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_|PA1P190MB2099:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 23ac9547-63f8-4ebb-2bda-08dce4865b03 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: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Vfb1FsQKyKugC6Yjn/vhSXz?= =?us-ascii?Q?keOyBCJfjl5i9w5jVZ5c6bObDJPyCDhYuIOlU7DCMQ8zhuyQ+7zDlmSRxV5W?= =?us-ascii?Q?XLubX90P1sLu0CLTkMXrA8P60+gr7CBYNxv+gh1w/k75DocwVjfiOmZm/eNu?= =?us-ascii?Q?03ZLfe98exE9hP4dKXq4eomvmSmwNxZfDH0eCz60fUmlQZ7FI77F0T/yEmzD?= =?us-ascii?Q?v8BExnCIh0TZXI9ISrfCkzoujw+NikkWiCB/RSMqPKNhgFHdnZEzROaDYeOJ?= =?us-ascii?Q?UENZVFz6bGEhAsuHBIbGyQTLJBsTGNhipmGnWpfYDGg3C8tbRvX7gy2Q5f9f?= =?us-ascii?Q?yEfWsu8iszTDZteuhKKctm4kE84N0yqmjR1HX43Iqg72XKIZK6WcJjQz57me?= =?us-ascii?Q?wJUrIXAsWsGPgYTlVeHWMyQlEa+pWUF7MOGyj6f+9ePDWau79k3pdL7ztLi6?= =?us-ascii?Q?Kd4ceFp8I5JOijDB71aY7FNrm32mz1lyz8KvdneICQm7MpO7JSS7kkROSls6?= =?us-ascii?Q?C5YgcPA=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)(1800799024)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: wCqntBbVWLgmWYZZe+s/Z9PHHLWnQbX6Z3AeNn0uJk/tdYV013ak8bW80+pcDebJzuEfrO9kPn4B1Nw8PIjqA6lWR8M9EYKq2Fke9dBc+sa428Rpq5ox1Vt4ZC2cWCxWMb6vnjMoI9PLfsQ2vedIwBIs6o+nibogo/okBABZbErm7xhnx8XUqgy2MBXKZOsJe9NcLp7gTflvLISkxsBwkPfMo+Fcrnq1noZogcKklu2H8pBhnM64E7QgoZ5IxfMF9M7NqdLIbM+KMUPe69yj2lfD8Q20H/9TE11h5IejO30wmdGkJWCmQXH3YwgmqfeL/FbckXiLEDfT6C82uNfa5MB9CPdQJpJSE9ZISrBSNeZb4KJ6+q90DZlf2S3g81ulxlTM9YwG6NCo5OSlqAlg9Uv3DuAMpJn3FghjF2DtFjFqGjkWvp3dtN9Zktv5Ae5NpBmy3bZ/qrgLvK7puypy4Oi358ApiMOwyGtCE1nh8l5ggXE3dVeKIBejbqx/1EbJ8HhZxD270u9Cib7HZTNxz5VsuKmF/qJQJ9FB7BV/Ft9Z2U2JdR5iwDrO8MWE50nl3JAC8IzEO1kR2IxZoiBD3Ad4g3rFGgBaSfqbDOpUT4afN69TAmuMoRw+OMHF1lYxBArIlKJw2SxuB3C/UNmjaw== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:08:08.1734 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23ac9547-63f8-4ebb-2bda-08dce4865b03 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: PA1P190MB2099 X-BESS-ID: 1728054490-311388-12691-30388-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.168 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 cloudscan22-131.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); -- 2.45.0