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 7D07445AAF; Fri, 4 Oct 2024 17:14:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8812742E97; Fri, 4 Oct 2024 17:09:07 +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 1628A42D35 for ; Fri, 4 Oct 2024 17:08:39 +0200 (CEST) Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03lp2233.outbound.protection.outlook.com [104.47.51.233]) 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:08:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fY0PcSTfoLpjNcdakaSAiY7h4L/0U02YGsvqXj+YAWlcG9Ei7e4bXsRikUWxEsomOjXibawSnRhV/KCT3zqLR37BPInFebHoJyvwPeKStujv1oP4IkQfPDrpyw1O0x+u+CO7pMUa5K67EXMHbkFD8q/2L4tcwXms3fwIG1BEN+e2skOGCnz3VikghKz/zouQEZQex9w8wYYT/aDMyfKFeIl3snlSRHmF/qfkQwGFPMt2SNBLOadHlNk8zAc5qr3S1Tltd47fkHImmwRiKkm4o2rEPDnBvAhn0ijacaQqQbinKQeTLsOk+3zT/tqsZI/h7DNJskgz+s21DhVYXOubBw== 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=AQ81zf7vRNFQAVitxybQBKoWJYPkZjKcLDzbsks/x7o=; b=hD3JPSvTfYRl9mUXyr9HbL+gD3JlU6hJFKh3riSDz6pJ4ZX84+ewuKQ+WXvYvdNsSEQaeTOyHgv6hn/EA5bKR4dXGlaX0BqupZxzhNeSlmqTigqpaYPtQmsB0R/+k8miTH+xWfHCeIdQy7q/uSsEVuKPjHft9vgi0M7PHy7DAtrvJIY1CqQmR6/vDQxQJfrMQ9WykFqzX/dWhSb4jLraspWtR9mlRHD01iPVZYUksHnx2rpnj5sE5xVVBbNbvvfL1lJPB/GM2F3qQAbkDvcHzuazYudTrJPOZSiVK4fA4XWbNnthzUbPjbghSQqOQgKDYfAX3TB2ZLJEWn4ntsBvAQ== 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=AQ81zf7vRNFQAVitxybQBKoWJYPkZjKcLDzbsks/x7o=; b=IxZb/FtbF1rKC460s7QgJpoF12g/RR1OYmRfthBWR5ZqhUUZmNvS3Ptbm5A6W6wVKd/k54QwJZVtbXyFv9uNv922+il1tyoPGBn63mHeV+CyUxh9sVsRNt7WVoIil99Mw/NH88fRQNPpuU73/rxMWgPrzgE5LBi7jHxeMrYzP2E= Received: from AM0PR02CA0013.eurprd02.prod.outlook.com (2603:10a6:208:3e::26) by AS8P190MB1983.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:52f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 15:08:34 +0000 Received: from AMS0EPF000001AC.eurprd05.prod.outlook.com (2603:10a6:208:3e:cafe::ff) by AM0PR02CA0013.outlook.office365.com (2603:10a6:208:3e::26) 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:33 +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:33 +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 v1 03/14] net/ntnic: add scatter-gather HW deallocation Date: Fri, 4 Oct 2024 17:07:28 +0200 Message-ID: <20241004150749.261020-42-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_|AS8P190MB1983:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 8eea0c09-2f6e-4dfb-48c8-08dce4866a49 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q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TTjcWUUkXpjcl2HniJatZuDS2oW?= =?us-ascii?Q?P69QfNsfXcViDadHXAgIm7zrXWZfQ2OscEJ7PZBgAX04u+nKCqMLeX547eJy?= =?us-ascii?Q?mFSlXa/Z6FgRb2xaowIVikPFqk9nSkczs/SD9trezW2rXLrhVRshxxTMPfsa?= =?us-ascii?Q?dRgHyIhjnYPMTnrmnbFwCLfiCn851vmOsGdqIotu6+KA9F/PDzPGlJNWknTN?= =?us-ascii?Q?7+hQyCjZg4DbPRdV/w+g9qaHbDCHN/vcERp/40sJuKY+vLJQfIzeBlj8BAcA?= =?us-ascii?Q?hJDomjrefLxRNsMpMigqW5PTHWl6VracTrxm2ItsIwbRKIlMo9nYYdb9fDdH?= =?us-ascii?Q?zb+AL7oIbdElktkATHhloxrKecwWWdYJQMSWW105EtTBTwBCGe9hGXBQnzD0?= =?us-ascii?Q?Zm/zbsLWyzvfYmilnJeZ812WY/F2AXUAmaPZgEV8qyY7SSycFnWV0rqMQkGP?= =?us-ascii?Q?nWt8hQ4fV4//eKx7XdlSkvlsQBMtnHrtDdJSVPBWC3v0OFVGWbC6duxG+1gK?= =?us-ascii?Q?wOgZSQCuP3HYI2eRvQfzRoxDGP5K?= 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)(82310400026)(36860700013)(376014)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Ik4BQ8HpE2ueJk33zSVFM1uGRuI80bkyc7fm35NNv2zBBTv+f9ndBEf/bD6zhbvW7x1WtIe6u2So8RtiZO+u43otHtdjDTIbzTxOtB4/blldeHaSVi5+RcmNuBjJZEPE8F5iDLBYw/eMlkyMVFV8ns5qGXIcg5mBZlzyaDwBozkWm3t+7AQIcTUH2tfvCxlAiSaaMQtX+P39DaHMcYPRhosmXaHdvJAkL+VnFnWtvHwhe95iWBw4IagaanaItdZM4nKIZ4U6bA5W/QlH1BRBU/BYBweYk4NPyqcUYbVhkezedncJyUzW2Pn6NXpLAwXXAoJ6P26JHxVy6uu1JApXyUH975EAjUHQvqTmNSBXjOsdN6PRZEEhbuNyR7NTSr3V5K8P0U4VGsNPtV5Yt29ViYnjveyADzxt/A8pyfnP8WOk1eSMbKC2y65GbU1EWIzqAAa+lg4qqqWOPC3gYte5VpGBiHGvgMMgzGS8rt/YuofH4ojFwAjNx8pQkouryCRxpEURaRYfjQ8OVSDvEa+Bi+0aACDRUuQ/x5Xz8Eof1Chs/7PxcJWJ2c8ASF/ysTkIgLMu/hNXAqV6z6+jUPs44lO5/iBNtpRp10KzWAtXGNuxAagKNQhgA4yvITrEykl3GIqEjdDuqn26qnbKGWkIHQ== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:08:33.7829 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8eea0c09-2f6e-4dfb-48c8-08dce4866a49 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: AS8P190MB1983 X-BESS-ID: 1728054515-302249-12644-31565-2 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.51.233 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkYmFiZAVgZQ0MjSwMjC0jQpxS DFzDwxydLCIsnQLCXJ0DTJ0jIpLclcqTYWABFz/T5BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan14-233.eu-central-1a.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 --- 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 79b5ae4d60..78a689d444 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\n", 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