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 AFD7B45B04; Thu, 10 Oct 2024 16:19:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0BFD442797; Thu, 10 Oct 2024 16:15:35 +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 844FD4066F for ; Thu, 10 Oct 2024 16:15:06 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2105.outbound.protection.outlook.com [104.47.18.105]) by mx-outbound20-48.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 10 Oct 2024 14:15:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BnscgTzLIZ2zLBPd9SoEVIZZ7ZP06dKkM47wYQCPZ0/MbcG4wtdLy1m903smUu6Yl+Zjg8myGfaWTNQ6E+D1PIN+HQkwgoSnQOJprzrCGFFJ7JFLiF8bTZMNzPJZz7pdJH7QN/RJ/xggWq8q5+8BFYgHysCGRh6y2cw5A2nkBd10pCsCGRSG3Y2KxdbSTLXqIzDTXYYdQoq8yDwxqj9MjHlA3fOyP2T1zUrLfsYzC6w7IFRu7NCJ9ohh6MlX/kVKpMdNwjYhPTJ1FpAJ7Up33AXoE+mg+EJzfXEQDZkW/voUI5cGWshitKCbB5NXOWC8a8ZCj2xe1vE6lCgjllalpg== 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=/ABu0JJkzpFLNEHKlsJFZ7DL1DUHObPEc5kccbJNmLw=; b=whOt97l3HVK9qf5JCXmsl7ffEe8AnFEXgMWB+NcMEOGwcQEETo3lb0NsovwWiBNsZO3JgocsfXB08EYh3Cll68wtHIvmbsomTpS7yqrBkwXLSMe+hcg/RuIrFkMLyl4fPMRzA6e5Tj+Cx9pexnlxac82G85IH0GqeW8Gmv50sSRbRwBDrnOYGRpGYshHXAIkYywtLQxZ573mUiahRoiLz0FyZxH9Idre3aURsWJco2WeFdAlm9Y2Xx3vJ53C2OKoMp/0Vr+kp0QggdOLJtaZbhnoSqmkDvugJb4HH2E6Au340tMlYxGgu5cJVfik3/RMLNvrmVyPOz3PWyfm51tQ5A== 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=/ABu0JJkzpFLNEHKlsJFZ7DL1DUHObPEc5kccbJNmLw=; b=o1osJclumfaYO8mp1t+KY6utGzVxbOmfPYSOw+45qhM7lre52PPF89GBeC1NS+WVKyOj6Rbbe7CQjmYTr+RwOq2v73e0+cVIkJc+OMvssH5iH3zISkKz97dmHPRq7RcigF1lY3ZeFdZX2RmjuhuwE3lrmUwUTQcJZ97fefyyYxk= Received: from DU2PR04CA0079.eurprd04.prod.outlook.com (2603:10a6:10:232::24) by DBAP190MB0918.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:1ab::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Thu, 10 Oct 2024 14:15:01 +0000 Received: from DU6PEPF0000B61B.eurprd02.prod.outlook.com (2603:10a6:10:232:cafe::e) by DU2PR04CA0079.outlook.office365.com (2603:10a6:10:232::24) 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:15:01 +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:15:01 +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, Danylo Vodopianov Subject: [PATCH v3 39/50] net/ntnic: add scatter-gather HW deallocation Date: Thu, 10 Oct 2024 16:13:54 +0200 Message-ID: <20241010141416.4063591-40-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_|DBAP190MB0918:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 1a62c16e-ed30-4305-db9c-08dce935edfd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?y1kstlACvELjmzkQb4JPJgpwj92rEdxbswN7EHIMj9etktAwn8IqjYBK18hm?= =?us-ascii?Q?klSGiDGpjtn5QNxrAUPcheSc28T2ZKCJjdYofeXwFhoj7Eco+eYbYm87MtC8?= =?us-ascii?Q?QiMGdwcfAgUrsw8qVRChLHJn76pHvkb2VLqTa63oc4OGFlDp5H8SJgKaf60n?= =?us-ascii?Q?Yzoq84INN1RjM9KqPMcsTftOZPsD6chpWcWjYh2mCfgAfzquZ5WWHvmWIjTa?= =?us-ascii?Q?FqUwclw9WJBHybUWyXhnYFMZKnwYKe+hp3hskNIpnYbtVrAsqgWKq1TP6RsG?= =?us-ascii?Q?/3ACnFWDmVL7L4viqAe9eexlvegvlzrQRjekYfZ0j0nUn+2eIcRtZLDhJzTF?= =?us-ascii?Q?SrMYeU06y5HBx3O6W3C6Y7Zghbh4VpSvn9VLEebybPomftB3etdSrWW5QOTK?= =?us-ascii?Q?abdnubnSraWFntWKNDBNDi2aHSdB59nvX/UG6Qy0gwPQhq1O/cUXlb4apQ/8?= =?us-ascii?Q?3FaiiuU32pnqm9Fbv+NaRMNZizKHYrCTbQJiwolbe6ibYLdMUOn8tZK7GCSL?= =?us-ascii?Q?MCpXIZpwjsbDnooRPI3c8F5wuNrvr2lFpEMEQo3c/BELxokG1G2gcg5F4sr+?= =?us-ascii?Q?pXexdNrFJWTPAI9Jlfcdnw2Wjuly7AZlAwGT5B5mcsMLtrT3QIORGFJuD14q?= =?us-ascii?Q?Lc0qPKZRDNhYXerReQdqe9NidPhKBwobKeFjdVBReIvH5PBGK6evhiygM5TZ?= =?us-ascii?Q?m0x7Qjh93RRZIu1iSI8CIQgl5sqp2Q4lyQLSHLgSeDgCRL82Ez8Ldn+3Ko8j?= =?us-ascii?Q?T5ZuYqqRrQXjG5+qz03jHx/Qp8fajgKwY7kuuBGX/833Lwezg+p/2dGXBbCx?= =?us-ascii?Q?RG5YFcM8PMGDpkh4DvSBdE7nyczIW/nIJi5e3TEbjVAg5qWiOR+Ob5rgxUj0?= =?us-ascii?Q?bTllajwknoVQs4Nf2UHfeRGEdcNIig9JMLmrWxmpUiM8epDH3rzhE8IYFY+B?= =?us-ascii?Q?NyLszjg+C2UqK6RQPuIqwKCNLiVPi6r+U7+FCLTximpiBvyeJwT/q5KR6VgI?= =?us-ascii?Q?h+eObB1b/SuZT+EFqr4NJWjDngNONPZSLsbiTCG0zebdfiVIvZ3iF/6dP+xf?= =?us-ascii?Q?2l1o04pvy5pP79F6u0Ba3XI8RjaacUMGzxaptLffyzJA9K9XNwV9RK2hSWR1?= =?us-ascii?Q?Zpp+8QH+9WkvLccmNq54qkazYxJhmmCa3ku5TGFOFQUpFct3m+IXh5TOiX+D?= =?us-ascii?Q?c8xr/MFL0suHTTj0qsGMwP9Cxs3axuGqI0LNojjXQIJJeUCTcv0wz2ifeMUH?= =?us-ascii?Q?gRd/gjBBYQW9m+YmX4nBgVTRtB9Gyj1JiLlbCoFA39f62fPrpnn0pxsAPm7j?= =?us-ascii?Q?oIMMhegeuWY8rZe6lT9Hn5XbnuAg23VdSljLNAcz9bBhJf/Bq3mGsWLwYxDd?= =?us-ascii?Q?D+uwPKuQ+1P4Trl41Aun0IiEXecq?= 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)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: wFrXlSIiYFFOGQV3a+OzuNqijJokxS4HVL9dXgazJFFK1jGTYkHOZhMMCOSdyoSvTSAyid+0ablE/OjZFIZmjVBLpOZkfndHq/OTCjJB7kGMBiYppktMg9bKqaApTLQE2oxfLjqAScLCY1TBD7Fc2L8Sa2DmPx/LpjXsW8PeqD+7UsHpWZ+L80bXhVqvB7ywNzd4+PLMPWW7MR+emM0/HITwrNmCzeIJPlg4KOIAcy2+aKv6J0Rt8/EDnOVQaGMxluW3c+V7yVBXvOcI8WmZR1AWACEjpcxbEKWotFoe0enFOCxeDvpi8jOdMuF5u0wZzElHzdlZaSn5CU6cqej2jMNfocfFndmmth6a1UbSs4mJBNVHgbwzzhD5MN81xkG2P/6udI70iQZI1qsXau7IxocqILvOAYd8ij2dtbjJZ756jQB4Fp4wjG1tn3WI1EkUXig+gN8PS1OeMgEAr4iNDlfEmKVIafZnGAlJc2sUUcyA+9HcLMPfLXZp++iJzvk6RJAPVOZvnSL31JHxxpjYiMXbQ3t5xwbYE9gm0ehdzw6HonOldCUBJyjB/qy+FRdJM4MMGha53hDQDGHaGydiJehtD8Wru7FkWxifMg3oBybutrTIYHi2yBvrftxIkYIECWiQrPBIn13HattSseVyZoIHLO2LSrpG7C97p0KleNI= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 14:15:01.2330 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1a62c16e-ed30-4305-db9c-08dce935edfd 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: DBAP190MB0918 X-BESS-ID: 1728569705-305168-12639-25908-1 X-BESS-VER: 2019.1_20241004.2057 X-BESS-Apparent-Source-IP: 104.47.18.105 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkamRhZAVgZQ0NDM3NIgyTzRPD XZyMTCwjTR3NIk2cIiLc3AyCA50SRNqTYWALpHsYxBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259630 [from cloudscan17-15.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=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: Danylo Vodopianov Deallocates memory for hardware Virtio queues and unmaps VFIO resources. Updated eth_tx_queue_release and eth_rx_queue_release. Released hardware Virtio queues for TX and RX. Signed-off-by: Danylo Vodopianov --- v3 * Remove newline characters from logs. --- drivers/net/ntnic/include/ntos_drv.h | 1 + drivers/net/ntnic/ntnic_ethdev.c | 32 ++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/drivers/net/ntnic/include/ntos_drv.h b/drivers/net/ntnic/include/ntos_drv.h index 191686a07a..233d585303 100644 --- a/drivers/net/ntnic/include/ntos_drv.h +++ b/drivers/net/ntnic/include/ntos_drv.h @@ -28,6 +28,7 @@ /* Structs: */ struct nthw_memory_descriptor { + void *phys_addr; void *virt_addr; uint32_t len; }; diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c index 24c38c015e..992ecd15e8 100644 --- a/drivers/net/ntnic/ntnic_ethdev.c +++ b/drivers/net/ntnic/ntnic_ethdev.c @@ -34,6 +34,8 @@ /* Max RSS queues */ #define MAX_QUEUES 125 +#define ONE_G_SIZE 0x40000000 + #define ETH_DEV_NTNIC_HELP_ARG "help" #define ETH_DEV_NTHW_RXQUEUES_ARG "rxqs" #define ETH_DEV_NTHW_TXQUEUES_ARG "txqs" @@ -193,16 +195,38 @@ static void release_hw_virtio_queues(struct hwq_s *hwq) hwq->vf_num = 0; } +static int deallocate_hw_virtio_queues(struct hwq_s *hwq) +{ + int vf_num = hwq->vf_num; + + void *virt = hwq->virt_queues_ctrl.virt_addr; + + int res = nt_vfio_dma_unmap(vf_num, hwq->virt_queues_ctrl.virt_addr, + (uint64_t)hwq->virt_queues_ctrl.phys_addr, ONE_G_SIZE); + + if (res != 0) { + NT_LOG(ERR, NTNIC, "VFIO UNMMAP FAILED! res %i, vf_num %i", res, vf_num); + return -1; + } + + release_hw_virtio_queues(hwq); + rte_free(hwq->pkt_buffers); + rte_free(virt); + return 0; +} + static void eth_tx_queue_release(struct rte_eth_dev *eth_dev, uint16_t queue_id) { - (void)eth_dev; - (void)queue_id; + struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; + struct ntnic_tx_queue *tx_q = &internals->txq_scg[queue_id]; + deallocate_hw_virtio_queues(&tx_q->hwq); } static void eth_rx_queue_release(struct rte_eth_dev *eth_dev, uint16_t queue_id) { - (void)eth_dev; - (void)queue_id; + struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; + struct ntnic_rx_queue *rx_q = &internals->rxq_scg[queue_id]; + deallocate_hw_virtio_queues(&rx_q->hwq); } static int num_queues_alloced; -- 2.45.0