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 EBD6945AD8; Mon, 7 Oct 2024 21:37:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1691140A70; Mon, 7 Oct 2024 21:35:28 +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 A5BC040673 for ; Mon, 7 Oct 2024 21:35:20 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2170.outbound.protection.outlook.com [104.47.17.170]) by mx-outbound43-193.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 07 Oct 2024 19:35:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dyGFRdWxIxOpLG7J9cpWYYvWr9V88Ow/9HCs48m/PST57JFIEcItbTB3kTPtxfVPsWnSPswGXg0Tfuo1sDMPxonDnCEdlxu3sgK2niIVM+k60JcS3lhBT8lJm8dKYVpC/Nj5dAmKyT+4PTVOOGtKcjeS8fLt9nt/+YGmxVz2vkdZQxjj7Euqs57c44YGeZ2EdjqIJserz5kY64y9oPQQ58xK1EyCQeZtHqvnwMq1FQO7eaNRStAD8dFxQdhHdC4w8bW5YDzvx2CBuSmtY0xvmdseudUISjHxDoR+KR2w4X6mCLvcPmSblNpAcuKni0TtqhZ3Csq6ky+Tl1vDWzD8ig== 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=LJfb2FSzueN7U0WXQ+f0J5XmmM/g42ls2x2x/+XgMT0gQzZdmIKah7rL+zwOTnAbUXDlOJ+Z8UUmCW+NlnB7MFcwEm59xZRbN2h0KKkTmoEgJgO6vYVIiwEqZwwFf8E99nH0kKIetIFI7DwC9WLWs5O8mygg28+4etAIjGEEYgAv1MSiUZpEcVdOUbFoc8+SDpuhHwCV2iWzFvR8mrI2Wo9W9YH5rYpXQtzAo/VDMQeIC7rScaPpSZPcTmo+cEaxeGEdwpNel9E8dC39OmYxfCw7TEG0ll75IW4ODbxvui92724meYrQvRaXJzL5dSU0darCRAuKs3ztsQIUMNlBWg== 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=e2gzQI4QaslEGNX0Wi+R0Th3h5AogfkEgcp9rkvbgYipV5kVa14RhkNGmHjG07aO2ZHCknvIE0ZazP+AGz1ieeFqHnMgCX/iO7vjTWqoR2vUtuH8vkaSKpCnSfHr9nVgJE3rUnFxLNoSe5R3aHgF3QTT0afvHh1bEJrLa9ZNwoA= Received: from DB9PR05CA0023.eurprd05.prod.outlook.com (2603:10a6:10:1da::28) by PA4P190MB1117.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:105::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Mon, 7 Oct 2024 19:35:09 +0000 Received: from DB1PEPF000509EC.eurprd03.prod.outlook.com (2603:10a6:10:1da:cafe::64) by DB9PR05CA0023.outlook.office365.com (2603:10a6:10:1da::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.34 via Frontend Transport; Mon, 7 Oct 2024 19:35:09 +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 DB1PEPF000509EC.mail.protection.outlook.com (10.167.242.70) with Microsoft SMTP Server id 15.20.8048.13 via Frontend Transport; Mon, 7 Oct 2024 19:35:09 +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 v2 09/50] net/ntnic: add flow backend deinitialization API Date: Mon, 7 Oct 2024 21:33:45 +0200 Message-ID: <20241007193436.675785-10-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241007193436.675785-1-sil-plv@napatech.com> References: <20241006203728.330792-2-sil-plv@napatech.com> <20241007193436.675785-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509EC:EE_|PA4P190MB1117:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 787c462d-f95c-45c1-97d4-08dce70727d9 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: =?us-ascii?Q?Z/ExBi6JCw++8l4RMU2rQLsGZjWLbbcr8Gq5jlzyNHnQ0lS6FhHyyFFIdFry?= =?us-ascii?Q?ca7H/V/KGjWcbKuvui/SQ8Mf2fwu7u4K+yFBivYFOF4ZdIcuCyTsi923IAhj?= =?us-ascii?Q?NzE0yNuX7ns6qiE23LhZHLEiPEXvKDgvLM3zLeXdxE55RS/yTrrdeJwRjoua?= =?us-ascii?Q?btRVHohAOOUPE2wQmyku/uwHKaU1fgYNhzKYHi38y2r2wpKGM3Wuq9mY6E/J?= =?us-ascii?Q?6AgvHMeApmck3hMGP5U9mFeY9UMsMs0wXwP1D38UzdxRObm3PsatNiytBFJS?= =?us-ascii?Q?8wr62FFjRvu69iegPktyzHEfFstrjEk3gMGXsqUAevH03yHNUb3iVaM0q+lc?= =?us-ascii?Q?eQ1ISCS/PVYG+H9lla4ilt9x+9xkRE4N8ahI7ernS7O0jX3LojP+8MX4MVZw?= =?us-ascii?Q?pPyplmi1GoL5r4JB8xh/oG0/Wcf+VopDuZ4J0Jo6Jt8nYv6La0vcSTy4Z4Zt?= =?us-ascii?Q?dcrtOG89KQj9yrmd2rjdA+sH025orE549wf4nrMbALV6qObebvp11ZKrT8bS?= =?us-ascii?Q?XNEibBjghj4xe+otIGKXugxSoaM+HDio3rd8OV5Vms3Zue1sJ/QWJNaNOqfz?= =?us-ascii?Q?9kLI0vN2WyJGJ4UlOG2c7D4vzTYgMNv8aZ5J2c5Vb/wvxj8IPoZ+3xOXw8MH?= =?us-ascii?Q?F8g/uIAc0KID+bnELrMah55kcH82uqB6m8eAZdaXp1L/0/IyLOOT1uthwWeh?= =?us-ascii?Q?1JkMbhbwPKAsybcgqXb1/hVnutRb00aEdPBcMx/BOdWqzmf0j8MioxNA9xBT?= =?us-ascii?Q?3EFkqMxi8PGVtQYHsUMLMlMuCdehDCOALCrXSawInOjgt9pVc0n/rZInR2OG?= =?us-ascii?Q?6aZaqvRLUtFeHeasPdHBTGVlETbsFnF1iNGUozbJJhBYWb0zAagwOk4z9rU9?= =?us-ascii?Q?HyCZDQo/zcA/wOjiUOsAAyGN+p3P3I3AB3SFsg4otOVSNbZV4yELBuZArA8n?= =?us-ascii?Q?K/ixipuPKgkYHX7Qg+lQ3aGis6TSBJIv7GvGTjoaGEKUmdPPaHtBG3H8F2oi?= =?us-ascii?Q?4foTToDzNqXQu8ZFBtz679W3j9uXokD8JI11yvTgFvRbIciHBUJAPsE0ZYqw?= =?us-ascii?Q?a7AjFTRS3WaYMB/bJlCdVVexr7dvrK88CU4HnjuABJb8oMBw/1t/t4PBNGlj?= =?us-ascii?Q?OTad6G7hwh84bXtGn21KCI4PNiJcnNhg5hu5ifL2q8ioIphF/G5LMc1WppPR?= =?us-ascii?Q?92pgLj6nKxzsy5k/9MPxNgmJLAtWctL2XszSLABBImIgcfgHQaXoFlOu1Ktc?= =?us-ascii?Q?dEHbe7YaOKRKdHYmFBnRBWlOtgoCluBhwly9J5ygj16uKcNBYFTuNvsCsm0M?= =?us-ascii?Q?hEGn6H5lV1yLPyjIPXzVvCpNkyCgpF+sge1Xb6be3shodPOs2DcrnbuF6mDD?= =?us-ascii?Q?XXuoPos=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: LbpNWSydgrkn6IMtdwb7k3PxrlaAGB9Kcmg/AKd8H9lBe8uAPixX1NAUEHqhRjgq+MrZDF/1iU/oaGFMx7OVeT0Lf8m2S3DeE7pOXztPOoWHpR4jA5bT/GqG0IggVoQDL91ajZzjdBY/3HDJc4f7eRJKXdCZIeBBM2T/3C4IZRxr+/f6J803B30B2x1J6SrMhzRNbXo9gBZ1KzNW0DKO8GBKYXk6OVGawFgXIbu/IhiR6JZE2GPXmHsiBCeBqSBZ7NILc5mBerKhZlpm4kaAjht98n0QWn+T20cCGyUKP1SyddfUDlW/pV44ilSijEbHIXnPcr/hE0o2IeCcHyoRteI9y2FRF3FlVSsFZJCusE2mCq4kFfE6YxcGFUkFnxhRyFigGsptXmeGVECQ7b+skDOzimctIu64JuFijOnPlDVVjGcsMk5w8uZ0YSO90ZDuK8i7+PnKcaNLbAxks4cPAd3KsWgbRNNdQ1srUpZ52W8bJ5ZJvAuOQxWPDVF2KnOtSaUs//dcJeKQhOcAa2eIGT1Ldrl9OkhelUjt4tcrqkV29mT6bzyN8aAsriahQJZIXKCLMJ9Sits6tpGiKxX+pA/lUIQDoI1IqGtpxBMoJ89/SaDq1hrZ6vqOu9XPckY1zlzKYdIzzAyam1Q4+RHM9Q== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2024 19:35:09.6470 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 787c462d-f95c-45c1-97d4-08dce70727d9 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: DB1PEPF000509EC.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4P190MB1117 X-BESS-ID: 1728329710-311201-2748-3501-4 X-BESS-VER: 2019.1_20241004.2057 X-BESS-Apparent-Source-IP: 104.47.17.170 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.259566 [from cloudscan17-231.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