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 2F76245ACC; Sun, 6 Oct 2024 22:42:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A70C640E22; Sun, 6 Oct 2024 22:38:42 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id 01A1D40B9B for ; Sun, 6 Oct 2024 22:38:06 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2110.outbound.protection.outlook.com [104.47.18.110]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 06 Oct 2024 20:38:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zUuFK93Ep2WHClAmi5wUDgQANS64IVx+o5pI6PCJ8kS8d2Rs+UqqRnlX3UAM5BJwBceZvSq+Y63TDpp532GdOF4rE4iAANJ/+A7jdjxaWnU13oM5pBexT3z1JpgIyO9HNkhZeOL64hocR2bbqjdwkepVj3iMt+M69ozRxS+G0pfPwmds68ZAM2N2rwWq90GPcf7a2y+DYNW1if7QTHbqyYFOuIFWvdxJY/T88zA4nWKNoVViDoKgPSwwi00Z6S14lhHinUmdnPNYp3J1vx+k6Y12X+7WTqjgU+jE3W99ArtXkWXVgqI3akMMChAwJHOAW8+gublr4gQp0W3+UD8Cbw== 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=Bm14AZEBsc4wE+aOwiQrK3pib0YuOd5eQdUb0klQcVKKVaxExalaenAeE1JKu23XweXSptGTwi7QYZhvWxW6L+Xvhs5AxEbUufqlZuuW+fCNO26+QwNOfrW1K7EqhdI2AZ6TrEbUqKYwV/h4I2fMLTqEao2hvrk6uIkeSUnw7KxUJgkqxipPuNE7sjfrDAAFxQfrKSKKFtFlsF7RDIH/zZsdvVFYz7SzQVUahXWcmz9KyaNWoVuXLYVBb+O2FkBLTYJcXUHmomzM45yC83XdcZlF0FIa6szuhBMI7IuTncgLCx0Oyo84P3yrV4+DzBLsdjX5d4RcHXj/hGCtCq2lUA== 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=CAmUKYcQuY7WMLhWo4vPSdaXBWXUfuZXT/xeQ3i1ySaaxOKX881bDU33XUcWVkgKbihVaCAA2WDbGEG2GzHPHuWiBZXewObqjgwfx4BBeRsln3un8v/3qN5XaymihfqbIcc31sPgZCOHu+zeO0TnPjFqTbNSJUDJx6wnkfjm+jM= Received: from AM6PR04CA0034.eurprd04.prod.outlook.com (2603:10a6:20b:92::47) by GV1P190MB2196.EURP190.PROD.OUTLOOK.COM (2603:10a6:150:1f1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.20; Sun, 6 Oct 2024 20:38:02 +0000 Received: from AMS0EPF00000190.eurprd05.prod.outlook.com (2603:10a6:20b:92:cafe::60) by AM6PR04CA0034.outlook.office365.com (2603:10a6:20b:92::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.20 via Frontend Transport; Sun, 6 Oct 2024 20:38:02 +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 AMS0EPF00000190.mail.protection.outlook.com (10.167.16.213) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Sun, 6 Oct 2024 20:38:02 +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 39/50] net/ntnic: add scatter-gather HW deallocation Date: Sun, 6 Oct 2024 22:37:06 +0200 Message-ID: <20241006203728.330792-40-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241006203728.330792-1-sil-plv@napatech.com> References: <20241006203728.330792-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF00000190:EE_|GV1P190MB2196:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: d33e727b-a703-43be-af66-08dce646c617 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?YrMN+rledt1ajc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= =?us-ascii?Q?O1obJ+Z0NyAS/kfITT1cTi0aZFuotKgwJwoQRC7zGTgShZsTOVcnyTtupLkn?= =?us-ascii?Q?OFbAJUohkqrSeBQyeFe0vpei4SAv0QCuaULAM57gqQ6/FDAEI7FhZw5rGL5t?= =?us-ascii?Q?/d1hQ6Lp9yNalP3AYA293ap8TM4/ubZJXRpcot4aop7aEWTlZZkOx/FQ+3xG?= =?us-ascii?Q?lQEOOa9Aau2GkbtXC7Qz6y3TamHH6pvHGmyLkCHuD7NR9w+XGvveeDggCif0?= =?us-ascii?Q?hhdp0QkyzWZXNMWLNI+3xaWeoRSzjJgn8Jzsep2znUaXnNR9mUqltzBYPlHw?= =?us-ascii?Q?xF3ckFbMg69DZKQUN/S8b0zRi+Bum8A/R7ea1hdXhZDXpo/aA9kTEeS7qf/d?= =?us-ascii?Q?mvAojlpf5le8xxKW4tfTQ7j4nptDucUatjTga2RAtpcDlANa/FqobHJqf+Yh?= =?us-ascii?Q?+dHK1zYp86yNuchF0U7ypz4nyyi8wpxkSg63dmL1TZdazpFCAYg/sJgOSAxJ?= =?us-ascii?Q?noyRjWlaGnagAkClhWKPVhdX7zAE?= 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: UA70R/1YVKxdvDFwRbt6eEtbNKtmsS8gwKHRvTt5WdifNN7AGrEV/d4Bg2iFx/zPrz9hmfJSPOFOMy7aZHHj4H+aV32VPA+fixGUkKFW2u8YRmO8Ry/3bYte5dp1qiLTv4QAhYVQO9KmkGCePrQy2BhOcuSvQ3dORSoLE/M1rewVyWgCfrCYCwTj8H0gUmV0+3cz/wxBQqMGoY6yfUmSHcOnPsitP+8p4/QohI1398b+a/k+UPS/E8MVobIjsA8Zua1ENPAT46sDaGOGpOtv3ayiLfke/zWNQIJ01+ST2/PMc0vjM25Sdv7h1W1k4o0o1LjP5RWrBndnHokMYqvTXRRWz0WtOcTyCHvpPa5oSpdCL0ieqnDYk2wm70ivekoUyFiGsiCxiqNggKoitnP8wPwjBiNP49UfUUHWzEbQWJb0QU7Ldi1eOJjYsHODZpcpz+1R0HVAes6C7BOuccY/71MAVniueuV4jg61l2hahz6SCfHAZ0cMEOmcLcuRcLTy0HBZpN6todZg5lkWT4ftPeHNfLHTCAP3PfKboEMvtn0fqDoPGfDsLralgKmnJkpb42Ajm96qWmMqZeq6LnysTo6WvpFoHYl08cNkkHlQujDATrvmwO6U3d4/Ag/7OiRPIRZqMdQkfRWiPqKHCzubxw== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2024 20:38:02.3901 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d33e727b-a703-43be-af66-08dce646c617 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: AMS0EPF00000190.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1P190MB2196 X-BESS-ID: 1728247086-311388-7260-101891-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.18.110 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.259547 [from cloudscan23-175.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