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 5248D45AAF; Fri, 4 Oct 2024 17:53:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F3B1B42E69; Fri, 4 Oct 2024 17:51:16 +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 1C7F542E71 for ; Fri, 4 Oct 2024 17:51:13 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2105.outbound.protection.outlook.com [104.47.17.105]) 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:51:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OqyG6SKQ/bxOwFe6uWXj55Q+vFm9C1lTOz91dR4xw8IfizAcqeBT7r1d7BVBkQftNxyVCFGWwJB+MxGXkoLCqOQzOHMLq51igGj8gdrpBTw2qEGD9ApIr9PfukZwNbsOxv9/B06ejE5Qke0gJQcJpKlZ8xGFEqcoB0L6VJMh+7B+5rr32ZUmV1UvIJuvtpHYsZ0H5DmzyCKagWB3k0CTZTxvxEvgvfT/PZiSwMGbDRQqOtnMY1W0CpRtR3sAyVJ+zfl2euwYr+CefRdu1nDmQ8Xuoiuo/8KEpufqC9qpztTkSYiwFdmq8c94l7fAqUyZ73+Qi+yG2jTxZfrJBSgQFw== 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=BQpAKv5aIRSLyZSPmwr7Dc+qlxYIKc7XMC9xnHmg4MmfHrAwTN5klISFVEfMyrvJ1/XCOmyARgArpGvxPFT9mQJPoCa7YGpbAkAyABfAooApM8dSFkZhn18EyH0LqWZZnEgUW/BaN1OGCTbnaUC8VEsUbCRtypE8hpymiw9VJYtts6t/+nHhHI8JMvHJ/kVdNDBiCEx8FqyJHduTMNlsGxA8t7bSC8Wexs41hER1cRu+bXfzQbXieUHeych2FA1WJY+vakCJ4ETxBPwsfPeWWl5q8CpM+og/EU8LGZGW+BqeUpcSjJB2KP9AXDvpoCah1uXoKOMjrqo7k+913BQuqA== 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=Jf9v1QSf10JmuL5KxSqNU2bLwTmZ65peiieUBV0SxYDtNx9ECH694iFa8tWeH3zHZdbqcAMGnjx4pZ10RuYFvxzqaHaaHVq/YDGQcC9NEh6EFoMGg82hGNegIUAt/a8S7j4hmAsXaAGSHWDyXVQnBdM63ffwP1F55u1e8eJqif8= Received: from AM0PR10CA0117.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::34) by PA4P190MB1359.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:109::12) 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:36:32 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::9c) by AM0PR10CA0117.outlook.office365.com (2603:10a6:208:e6::34) 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:36:32 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:32 +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:34:57 +0200 Message-ID: <20241004153551.267935-40-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|PA4P190MB1359:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 57b44945-2ac8-4349-96d0-08dce48a5297 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-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So2wQNQpRxF9sc5LUoMKPrFSe2q?= =?us-ascii?Q?E507jrTx4AJEsqbuyohPcZxMi8faPfa8Rqb9/TQ1mAgz0jbw9mGTIzbyGa8M?= =?us-ascii?Q?zO0BYcjwPDt1io+oPTG0GnFhL4Ic8Z6joDwqvwP0WySzlLLrUCyIJ3wWmS1G?= =?us-ascii?Q?0TZRemtw97HGmoj5N0OrZCnuRLmmFGL7xJFLgMNKyQk693bFOlEDCfII7DEo?= =?us-ascii?Q?1TTkSfU1+MhMNgYgHA8IooFfBBYn7JgXXRsznVBw6VkVME8Afn+cIgVUt7qZ?= =?us-ascii?Q?037Jcz7QC6vJGJxRfJ+O669TMaYN8C+LJHvDsRRL9hpDv+nvgWIphT9RsZqs?= =?us-ascii?Q?jDTpWBVCAQDK+Xu8ojNZ9WySM02lMDbxroIWfn/WXKHGmojfd0DU6aT+TX/9?= =?us-ascii?Q?HjIJXourr+4v1uYSbWH+367dBL1rxJp8kuTEsswIvemAzqqOsM7otRGuksPS?= =?us-ascii?Q?Oy3PZCrsTMCLdY3k90kfVPRB9ZpoVRk+lBdT6CqZUtdaX73rMCqBNyPUZKeS?= =?us-ascii?Q?n7oOW1DPRKd3mtwc0vm3pAz6Fqvg?= 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: OVwqWUv24PdF5LZmSoi1UmdLvPOGvCOCk+wu4FDah+9Ny+8ANXqILPxirmKN5e+B3WoSZzXTOG93twiR0n5LfaVfgxbq13T3sea1spVhJDXjHTmQMfDiaWTZyH6IXHSFi8B0Nd1uxsMeh+E5NjtPX74GqkoXS9fUhh8YcIBuq7y+6v/VyNHbU3ZHILPJHK0G3yxdCx4TjiqP3UGFnyujaiGk/rHl49KjHYD2l5lky+en1CFcWplSs4za5c+9QyVVsepAfifEqXj1/dOT4ajNqlUE5hLgPOZbmXOs6Eg+vESke/ajVRKgfgHA3Y3kKhczOw6k6Y8BrZaG058E6zFAQrRjR1H0AWUuof/kzs4G8R8DYnojUsZvxlhHxgCvQyo7sRGuG8LS19kATL/Az1u0gQ+ylPUi+zGiuK9s69/G2/ImgapI2ArSEwsQnmWi7emiimIu0+l4oKChpblmSV3vcr0VICg9YQAsrfx8Veub8EiL7brkUIxNQE+itd4KO0RXPfS1oJYv3xZLExJYqKUYG9ZRM1Krxt1djlN52ijapBvSe32fTLct06P4zlwXPTYri6QARWjEyv6LHoz9TQeSDq+GYTNB/aokBDymNXa1cQb/fkKiOFHtHuBGMFGnPMug1/CifX0bfIE4PwUEAes8xw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:32.0335 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57b44945-2ac8-4349-96d0-08dce48a5297 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4P190MB1359 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057071-302249-12646-33876-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.105 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.259495 [from cloudscan14-206.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