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 58E9743CF7 for ; Tue, 19 Mar 2024 08:08:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4BEF140DCD; Tue, 19 Mar 2024 08:08:27 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2130.outbound.protection.outlook.com [40.107.96.130]) by mails.dpdk.org (Postfix) with ESMTP id 5E1394021E; Tue, 19 Mar 2024 08:08:24 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MD38pzLHdMB82C8nUc9f/vHBrr+kgpGsw7BOtsohv5DZN/xJKiBYJb64zxDArjmDCmG3UFxg2B+RJXVPKkdAKSH71NFIA6ZULQs2LrbZw+R5TYDsiuE/n6dYMPOoFZU22Mm4p4d6kgkM31cG40ZF5ux/MmWO1ffyJbJFnzBTK8kb3sE2CX9lYnQIKEAlKvMLlePLidyEr+pDeJhzoqDPvgLQSQLR6IWgHZkBHPg6v0eTLgdAO+OPt9jNh3tX3SzzgyfvyFJ22iFeZHTlHOs3wEsmiTjZl//7RdzaxzoXr4EpTnFM7oWFczMhszrdHvzZQ39psXNm63QEgdV3Yrwytg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=7HgwREMKhyQ2LaXrqj4JGhae6B9m56fpUHYPOyry/oc=; b=Bw+CQx3gQXB6+7YLASraHWGVnUvErMap9E+vBTCL8I+ibqML0YCZqVeUB1UzTmVYhuj2f5qq6FbcrxR168TNt+PbSaQ7astwnvaQxhXgF/ejGNH/zdrmQ7EnyXCBy7ThwqkYYnWZokxj5UvdFg/VTAu5ZAzQnf9TJdfr1+ot/b9eRyiOHpcPx+/pql24VLS12gSW+7TBZjDZU/0wRK5OMpyRKgYmhMtuiZEvSLsJ/w9l7FgeHnmp9s5FavHhpEv/Qt31q/+d/ub8cl/E7nyCQqzITFk6CuWYagWqWfReyWzPMhN8DcdZyhuhPbsHUjsBwLzVdtgiH5m+iGUrdw39+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7HgwREMKhyQ2LaXrqj4JGhae6B9m56fpUHYPOyry/oc=; b=Bc9QA7rXQnSnDqb4DtnuT6aZb0R/ziazCZSmZKEG5RJx7KD/Qs52j+xaM+yMH9WBXWYFryQSlnaXl4Qq5cNli7aBquu/KKsyzqVNVw9gMgCJOV7m3PTUdUBFnj1mxZvtYRVrokx/EnlUiXOA6kgbt1O43zZH2Xx2MxQF0Y+meDs= Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by DS7PR13MB4640.namprd13.prod.outlook.com (2603:10b6:5:38f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.28; Tue, 19 Mar 2024 07:08:20 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e%5]) with mapi id 15.20.7386.025; Tue, 19 Mar 2024 07:08:20 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , chaoyong.he@corigine.com, stable@dpdk.org, Peng Zhang Subject: [PATCH] net/nfp: fix representor port release queue problem Date: Tue, 19 Mar 2024 15:07:54 +0800 Message-Id: <20240319070754.398799-1-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ2PR07CA0023.namprd07.prod.outlook.com (2603:10b6:a03:505::9) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|DS7PR13MB4640:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2AO9frcSMlTKyoj02BImJAN7UOklDqgk2RX2AYy7nVAfhFolIJR0CykHHcRh35RZ7dZd0EAN/ZLBRLnuVpzrew5NrKH7AJp5lAYywk2pVeMRG05mtyd8qtAkH41beV4uupDiXLWP8TbmeEFN5Huk+NSvwVo7haLdgoXReAHLwMe1e3Qvkiji/4Uz2Z7xaM1EOS0uN6ftEcpy+PVf9pL9bTdA+u/xwfnnD+a6q6t0r3Osc2GqwnYAfdftCctbYbxnjlIq3Q4WWekBqgmpw2dvFc7VxHh8Dn5HIYVzlZKLaN8Au6SvpeQbQoOjkDLmnvwaJKnMhK9p6jtexVzBPgHQ5lLiNAQY2nTyndKhlkISCXEYxucTo+K4izzNcXLpWCwv9+Kh9chVFAmeayGj12p8MnzLKI+EfaT6uTVxLv6FD5smAMlO/o0+qHLROmCxV8gnUMXN6GTimngLTRPFC6MbVc/ZgXiU9hTeD2Jp7UCGnb8fnZ5MciSGF4wUi1UOv3gib3TcwPD3k7XYkbcKw1U61KQsndC9voPIOsvY+PSmXEqDw8g6Y9YKOcAN6zU0Q/dOkeiA0PutpcxacBL8Yz8XgskKph6YCScEsClXmz5UgsvxHxPGosOvE/UEsazzdRGVUI/SmSHOhoQvJMMI7j1Y2BN6bTGwRlbc5fDex5zawi/n3XyNJSukzQoKrEzqDRCa43JrnvyN7VGIUsMgbyVTPK9jNQpW2uDuUk8ivlrRoMs= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(52116005)(366007)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?wIRx9XwzheuaoLkmiJgUHZiu46B2lSYlL5wWPYx4aFVlsiUb7CclPBDUfO+a?= =?us-ascii?Q?QASv3jjmG0fH+40FGS/eTs09RFVGEeN6tYhqdWK5KplcKeC/tR1pddyFCDhI?= =?us-ascii?Q?Izcny4w/5PwhIvucNZ2v3UeIg7BAghjU465/CbvmQlUtUiO1G+K3O/0tOX+n?= =?us-ascii?Q?EIFjUkFLMrgTUdOHRgoXssyNEBaF5hSsr9uZqC7vBDF7zfXqLzwGOLKeNFVZ?= =?us-ascii?Q?Xy69WqFpziuBetLuE3VewchP7F8bpMOHKks60eBcJp9jbfeXKqcHLtyE6VNn?= =?us-ascii?Q?8TsbyPe5ZkI3Z/B9h4ZZrpH51K1Pu5IBihOTGHnnZJFDptVQmMjGukqHpIgz?= =?us-ascii?Q?41QHEKbpnlKH9VAA1S87WndbpYxEebK7WdgBmT/KG/mmGEov4XslWXwNe4yE?= =?us-ascii?Q?z6gCezNmKo82uvyGOG6cgqXrMmmFVdG4uLzdrzehgm9CMKbp3PKw9RjFz2Gu?= =?us-ascii?Q?GV8DuQeF/Q5LW7pYVDGz5IruIhj1jj3xRLfNX8CXOWEsZ8V3kXG0HaIW8BU6?= =?us-ascii?Q?O+GkP0i00EMoi54KxQ7foGJbXD0d1jeBAx8Zmn9+N7BrAsRPI0XSVmjbxz6s?= =?us-ascii?Q?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1gdAWrWphjtdLC?= =?us-ascii?Q?s7vU+Px1w7AGjPu6PPKhnh+iUENpTiPsZbXjZoMvaxORdmADXt5FAHd3EDoE?= =?us-ascii?Q?AhqBnXgkeflV8EhorVwoR0YhqThXEj7ofUrOmKHWW97gR79GeS17dYMmi9+Y?= =?us-ascii?Q?0g=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d60d21c-0705-4656-41ff-08dc47e35898 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2024 07:08:20.4187 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: c+HMp+i++S8dw0/W5s3i8X13N3bPNxJnxkOtV9pdwwtNgoWoJiyybZFpezGfSHPOvWm9uZbtatSCtQuXAk6BS84YSaArMyDKvzB+OkFf1P8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR13MB4640 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: Long Wu The PF representor port's queue is different from the VF/physical representor port. So the release process in close port should be different too. Fixes: 39b3951 ("net/nfp: fix resource leak for exit of flower firmware") Cc: chaoyong.he@corigine.com Cc: stable@dpdk.org Signed-off-by: Long Wu Reviewed-by: Chaoyong He Reviewed-by: Peng Zhang --- .../net/nfp/flower/nfp_flower_representor.c | 69 ++++++++++++++----- 1 file changed, 50 insertions(+), 19 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index f26bf83edb..c4f33cbb2e 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -304,6 +304,54 @@ nfp_flower_repr_tx_burst(void *tx_queue, return sent; } +static void +nfp_flower_repr_free_queue(struct nfp_flower_representor *repr) +{ + uint16_t i; + struct rte_eth_dev *eth_dev = repr->eth_dev; + + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) + rte_free(eth_dev->data->tx_queues[i]); + + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) + rte_free(eth_dev->data->rx_queues[i]); +} + +static void +nfp_flower_pf_repr_close_queue(struct nfp_flower_representor *repr) +{ + struct rte_eth_dev *eth_dev = repr->eth_dev; + + /* + * We assume that the DPDK application is stopping all the + * threads/queues before calling the device close function. + */ + nfp_net_disable_queues(eth_dev); + + /* Clear queues */ + nfp_net_close_tx_queue(eth_dev); + nfp_net_close_rx_queue(eth_dev); +} + +static void +nfp_flower_repr_close_queue(struct nfp_flower_representor *repr) +{ + switch (repr->repr_type) { + case NFP_REPR_TYPE_PHYS_PORT: + nfp_flower_repr_free_queue(repr); + break; + case NFP_REPR_TYPE_PF: + nfp_flower_pf_repr_close_queue(repr); + break; + case NFP_REPR_TYPE_VF: + nfp_flower_repr_free_queue(repr); + break; + default: + PMD_DRV_LOG(ERR, "Unsupported repr port type."); + break; + } +} + static int nfp_flower_repr_uninit(struct rte_eth_dev *eth_dev) { @@ -348,8 +396,6 @@ nfp_flower_repr_dev_close(struct rte_eth_dev *dev) uint16_t i; struct nfp_net_hw *hw; struct nfp_pf_dev *pf_dev; - struct nfp_net_txq *this_tx_q; - struct nfp_net_rxq *this_rx_q; struct nfp_flower_representor *repr; struct nfp_app_fw_flower *app_fw_flower; @@ -361,26 +407,11 @@ nfp_flower_repr_dev_close(struct rte_eth_dev *dev) hw = app_fw_flower->pf_hw; pf_dev = hw->pf_dev; - /* - * We assume that the DPDK application is stopping all the - * threads/queues before calling the device close function. - */ - nfp_net_disable_queues(dev); - - /* Clear queues */ - for (i = 0; i < dev->data->nb_tx_queues; i++) { - this_tx_q = dev->data->tx_queues[i]; - nfp_net_reset_tx_queue(this_tx_q); - } - - for (i = 0; i < dev->data->nb_rx_queues; i++) { - this_rx_q = dev->data->rx_queues[i]; - nfp_net_reset_rx_queue(this_rx_q); - } - if (pf_dev->app_fw_id != NFP_APP_FW_FLOWER_NIC) return -EINVAL; + nfp_flower_repr_close_queue(repr); + nfp_flower_repr_free(repr, repr->repr_type); for (i = 0; i < MAX_FLOWER_VFS; i++) { -- 2.39.1