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 9C1F545ACC; Sun, 6 Oct 2024 22:38:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4C34F40698; Sun, 6 Oct 2024 22:37:52 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id F327540663 for ; Sun, 6 Oct 2024 22:37:41 +0200 (CEST) Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02lp2236.outbound.protection.outlook.com [104.47.11.236]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 06 Oct 2024 20:37:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rWLLeNZjOm8kgDS8CUePM4piJ2CIdhoLDKOrfNpzEndDBQDSjiyPjeUILny1zgGlzsEzBiiGGKiTbUVk6T+PnX425PoYcSxNZCtrUwaU0+cPaz8wpBcMe7+iYOLvUc/nBgiSH+/lRM1UQ4X/RqXTKjCB39zXUSjZhD0MDy10t5aLhjnR+gKDIOTY7miXFpH7f5yWrarseaHoMu8wJ75wu6PC/WuYVLjNw88O9oHqUFmL0ebHBaNIA/ZinAnhJAhtI5rT04nbuQl//bRibpCPD5ML0/uvewRW1GPTdpdqHgG3HPd9CFyMRC9rXlVRW/OYJqUbaivokC6Ao6XiRjRHPA== 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=Fc85LoJKCnDzZnoAdp4KWs4lkZWou1lley+4JYmb8KsVi/HBUmIpCL2KOxnldGaSKcrhI32SkzHnrydiTaUsY/GuOtPaHL3afpXHnIcvQMdANLJL6b8NosK+g8dG9o/BOqRWu4zU7jvczZNEMqhP0WVii6gzqdhyGFWqi5Ant9Dq+wbRXyJSgTKpxgRXiM1XxfWsNz0URM1tv0PYu56/zuSPoOTQqLQ7iNS8EaeeSdkCqakLS+zlS5rwLsnFlNDQjV3PkU4BQfKXpF5zKR917ucXAfp5ZG7pdnBSlWdXkzjGBmwYpfdyug4z+k9NLhbO6mfzwvuJyS6t79Mx7EGisg== 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=dYz/nATgIatnrrLPgj4g8f1SYBGNW/34pZ/Q2J9zOF5+n8jKXWnUuJB2QfujJZhV7N7OB8O6kidOIJk7myM55EycGzov7DUVB0LsTGsFGnBTBlqPGJPtNhNYolsuCTF6vlU7wyz+TAv8PgXUlxo7ISAz/UHtNuxPsBhZju+IQkU= Received: from AM6PR04CA0005.eurprd04.prod.outlook.com (2603:10a6:20b:92::18) by DB9P190MB1937.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:394::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.20; Sun, 6 Oct 2024 20:37:38 +0000 Received: from AMS0EPF00000190.eurprd05.prod.outlook.com (2603:10a6:20b:92:cafe::fd) by AM6PR04CA0005.outlook.office365.com (2603:10a6:20b:92::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.20 via Frontend Transport; Sun, 6 Oct 2024 20:37:38 +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 AMS0EPF00000190.mail.protection.outlook.com (10.167.16.213) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Sun, 6 Oct 2024 20:37:38 +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 09/50] net/ntnic: add flow backend deinitialization API Date: Sun, 6 Oct 2024 22:36:36 +0200 Message-ID: <20241006203728.330792-10-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241006203728.330792-1-sil-plv@napatech.com> References: <20241006203728.330792-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF00000190:EE_|DB9P190MB1937:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 647e9013-7b4b-4b3a-51dc-08dce646b7ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-asc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kEnujqnGN+qOtqSFr8mCpK?= =?us-ascii?Q?+taRlbB3JWj8pzbkcHPsPvrnkWcePqlPDc6ALdtCxtoJaF8WYDY2Bdjvd2o8?= =?us-ascii?Q?rqcSFaR9JERlwZvGEjmGbo0PuP+lg4OSxVCMTgKtfDu3GL1MDtMXhIEyEQSI?= =?us-ascii?Q?kZnvl7W+BgjlODscLTiCw43lChRVC9ETtIjkXxkHHvDZlX99ocqXU9Eknjk1?= =?us-ascii?Q?TikdZiureOSCBzBSYP0ytX5ZEeKuam3T5WWdoPhyt0qw0/WW3bKa2aMJA0hR?= =?us-ascii?Q?CY2Mfpm9XEIvgoqK9LM4hdY4w0Okax5bvKjiVabtA4zSsMetlVdihSWw0oux?= =?us-ascii?Q?sbMOzpe6CFpbXr5dLWldldjle6gGcNthZJtfhkpKL+hVF7dgs6u1X2fK/tKe?= =?us-ascii?Q?fW8MudAVTrvzuQcm1U5gqHgSAlMKCIIkLidJbVywUtxiWwpZ47PSbLnfbsTO?= =?us-ascii?Q?xJycFE5O/8uLhyI9e5STSPZy6Qpfz7S5PbCKcwO3cRrOFqj8GgmXYtXeCopj?= =?us-ascii?Q?THV6azQ=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)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: E01QqnHijh6AbTczCvEw6Bmf4ZmpD8DqM/P/1KytDjKMqPA0RKNFUyMOiyjb9wLrwBDnXlT+V3RWu6RDXXulS8IFypwzTg+3+Xu3G1ism3puFQ5TXJtdhdX8T7VSS1+0cHIqAcYgYxPgbe2JqF5NIDlUdMay+gr8E+Sbbjke8lAW23UdI7q0Y6vfh58XZdEV3m/5x6FU9k/z1atXm1sXxdXfSSIgzmwuWa8QzhPWPA+iBBATFEvoH2NNcBZIxbe6lMyE2nZ6TVxpkNrPOGqs1SRPX0e1t+T10I8BDx4UYZMCYZLz02oKEJyV0w1AsSuKDW3EMgSAARf1+PyxsaM1O5K2Fum7abIGwrmB/dBa0ExGRe0fJ/zNwxbYbI57vCHcQJedPSRmfKxaYqgRMwB38zlNAJRAZuJs7ncrtgA0UW7CjJJ3ASfAP9ced53xfZXR4sIbNNkzzKmmkpn/Ft7l5pMFSL+f9PdVvL95fKpYhJ3I7YeVNZicOiKEN3Jrs0VrJ2OWQ7gabhauqVj9XkXq/3/Ym1BkZFW+dXGvVgw6tX6zKZGhmAjBHhKc9KDterlOJizSs+xXqwjzzxGEoB5LQ/AhfPzGywDuFEyTRqv89RvQvq8VfZMpiBBQ2Yb1b4cIRYigwmA3v2BAI46QoHPlrw== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2024 20:37:38.4212 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 647e9013-7b4b-4b3a-51dc-08dce646b7ce 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: AMS0EPF00000190.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9P190MB1937 X-BESS-ID: 1728247061-311388-12685-123464-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.11.236 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.259547 [from cloudscan18-201.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