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 2263445AD9; Mon, 7 Oct 2024 21:40:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DB72A40A84; Mon, 7 Oct 2024 21:36: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 E894B40676 for ; Mon, 7 Oct 2024 21:35:40 +0200 (CEST) Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03lp2232.outbound.protection.outlook.com [104.47.51.232]) by mx-outbound9-155.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 07 Oct 2024 19:35:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=M6l3QOAB9Le8+v3gZOFx9HAw4kSNFqnm7oGIB41nw6P9cTYVr6//Z6xJYL2uHp4vdDLrjtZ5iA29RNM/OthcL0k++xjEX8htJhrUCzV76SGOGRP5mwV0E0GS52fHYx8DU0kwDLhRLN3wHpvmzZmdpG1pDzA3DyjH5YRb0NS0PRRvSJhprWWmQpLZMRhvpMM3Yy5+nBoV7i8ODHxoAyQEP+D090IgqMTkNcwpzXf9sWDoqTz9TK5jU2g/gx5V9vVindPSnkbE/JufLNfrVDQ92MbwhEz3T7SMl+yG42/ZhDOJf286lN5NccnSi9HXuAxBjNv/eNUU/hU3qEvxTqMJ8w== 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=eUyg+tVQHuKi4mwp0cWYqNRAiADqBH4PsOFHdu3Je24+InTFRBSvRWBd8a4sCJsfTgzWUefDfhQ7CfSUVf7EKSEz6zyW+A/5XPbOHWn9ulkwcWU3LWanQiWh8S+O8P/hDZfBmzuXYNc93Y4sBEXYvxZyss/NLPW7Ftc6r/qzM5Zv5hnQJiteecRgRJVjWnIpPKuntaTNX57d1zddXktLvlFLspglEDeXK74opjeIrxfsuH0LTGeH7CRIpCXg8Bz1mJe+rF8jxnVQcKHfbldjBe3kPuKtE4/S8Tf1eArIqeg+awW1nUwnAq8fm3IJ6zE9oARDPFZim+ZGF1sO8WFMKg== 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=ArS2HHDuc+0d34o1fR4/sEOObN3RfCy56bSA+BZF4X/H0pNVV2RXo/XwPDcrT4v43rW4rw1Aj9rxy8vPr3v74KPZL67enaOV0Jsbls9Xhq+dZKBlqJZI4/AriRlJo+bSm/dMdABlEkqkJqdDAZGXPUe61Dyfdue6FXSXJjGMRRY= Received: from DB9PR05CA0023.eurprd05.prod.outlook.com (2603:10a6:10:1da::28) by PR3P190MB0908.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:88::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Mon, 7 Oct 2024 19:35:34 +0000 Received: from DB1PEPF000509EC.eurprd03.prod.outlook.com (2603:10a6:10:1da:cafe::95) 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:34 +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:34 +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 v2 39/50] net/ntnic: add scatter-gather HW deallocation Date: Mon, 7 Oct 2024 21:34:15 +0200 Message-ID: <20241007193436.675785-40-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_|PR3P190MB0908:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 8f8d56b9-ec98-4860-8263-08dce707369c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Micros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GVeJ6mAOH1NHL14nPS2cx/KhafvSVAnc+/mVIEwXZFqPOlC3U?= =?us-ascii?Q?82dhy2HijTeGQqWNTY2xSXwxA9XKh8L5FIEhrrxKTlBG1wzFbPdnjO/LpuQQ?= =?us-ascii?Q?oFMbIEn12tcNmhOD+rhF+UEZz8tly8fvwQFm8WZ+mNP7ZXDs/hyPraEr99hI?= =?us-ascii?Q?rtXjpNc/FCS9hJHKthQKLFqS1KtIU9v1cyOg52/F7EuNRmN8kNCmAJJN2e9A?= =?us-ascii?Q?t3HvyFqyyios4OeUHoPEwWulKswiEXeCWaotkDbHJHfBpLPr6tStXysc5U6k?= =?us-ascii?Q?kcRcZWsXcQXD+uELeqRxc13yumGgdEhcmYxEISOwoYhC/BKwfVJaUBnFq2w7?= =?us-ascii?Q?NDfBoKgpqIJXyx9DX+sIIUpm+gDms1FdnQ5rdyvkjH+lSjw9j7X1qxeeuBAW?= =?us-ascii?Q?QQHUbd/FibM9s+cTcv70OoGm19tW8BeWj5fZfmVJcmMpOpTxOjrSPSefBE6f?= =?us-ascii?Q?zs3OyCzwkNRzrqdL0KD6iG8jsae+xMd//iReZLHzQQT0MkDJiq8KIL6Udv52?= =?us-ascii?Q?lTDZYzF9WE+YqcqTlDP9OY5T5ttu?= 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)(1800799024)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: KMNXuTb1v5otOLunRrhb7eOXBIHOafqcq8dOvghZEjAjsQ2+iya0wiQS46NF6amYCRFswaKGXteBIG8Pqxi4yM9QM2Qa5iXmBsMmspFFrEDqUoV3wNuIXEvYRhYSDkn2txquqayaOXqq3PEYfDvh3aWnc+K7Y0R3iT3DpPc+X/7iKpehURTNc/4oBD2+ih0RSxoy+Z6GEVDzEf3zP+WFMlSh6lHOQu/QgOylChMOsnynkI+VusgcgA1S+B6Jt+lyOJ5gYMZt5k1BQUrvi1N8TbS5Xf+KBIS8VwCohYY4mqMbMqdFZsbHSu8TaOCo+5iFgJ7X8nO7e6pIDyNUmSllCwfTIctsjcUAceHwTffVUQXkUHtkz6vmhNdT4ux44GOPTrY7dIPbFnwI/laVR8LpdT7G+3zngK7sVZMbMGGVw6P9Im4BTE5bghb8elnhehBDnXq9ojXN7iizzPxtYz7e6Cs/0/vD9yaeZBAwA/qQ8oHtm+NnGeNFimgebZlYNGwxplYx9HCPVmBZf93sfQhi4/EZWiE7+oVHxKChA1eouQAVM1oECbG1KoaBzI3qOybQS5lEtv/ouo3WyrUN2wQTPBZmCfE22pDxyyU68HhPQH0HkUpEM+dofiMxC1Rxyj868KbJLXgrMch2MD8snqu2dQ== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2024 19:35:34.4125 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8f8d56b9-ec98-4860-8263-08dce707369c 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: PR3P190MB0908 X-BESS-ID: 1728329736-302459-3371-3622-2 X-BESS-VER: 2019.1_20241004.2057 X-BESS-Apparent-Source-IP: 104.47.51.232 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.259566 [from cloudscan16-140.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 --- 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