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 1DF17454E8 for ; Tue, 25 Jun 2024 01:59:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 19340410DD; Tue, 25 Jun 2024 01:59:41 +0200 (CEST) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by mails.dpdk.org (Postfix) with ESMTP id 41BCE400EF for ; Tue, 25 Jun 2024 01:59:40 +0200 (CEST) Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-366df217347so2459499f8f.0 for ; Mon, 24 Jun 2024 16:59:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719273580; x=1719878380; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7O76801kai7PkmEB0yqkDf/Zs3Mu8udIU7HjdKo6k6I=; b=KOQdYIbaWqBfyGnaiCzRwWCim7NLE/175EBeMUtOVAXXuCCpsENYGOPydT3h7algLi 3BySji51mnBsWxBqO3/8daEkpP5K0oC5TY2fYagjIu/ign5ybDkQ2wn+iJStl1ujuhld V436z88xd/nlT4CC1EqN35bkMNj8Jgw6cn43rnRxWScL8rDky1uKLY8OUcOjqqCAj0DH +WXIyql0dAoD9Rqukvtroz92k2GRyrbtSTUeuIt9Rq5DxZrNn2W1SGi0b1Bqw8maDSnH 7q1Frjt3scw4Ae8SWCg6wnA7NYGynZKkhD9wC5UGfD+bEHrAX0e1XRJ5zjec9hc5qVB7 m7QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719273580; x=1719878380; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7O76801kai7PkmEB0yqkDf/Zs3Mu8udIU7HjdKo6k6I=; b=Kp2nKCBiDu2OtBs9cPFXOHg2IKgZNJedlQezzA4alcUz7DFq8IP2t6Zef+vUHVkdV5 lhIOpOcwTND76m/qulvkmdYL9ilst2+VXkMhFekffRoeNBTqGm7kJLWGwEXQDZ50if8L SnBBF9ZPjeSC87UjX/DJb+03yxZGiQJMLO9raWjPmCicLiftAsnnDQIMSwKUxYUU7ttu 7G7f2LRE6pJy0xnvnyMeleQ8YImCuPyzHl6tBv5Gz04zav3KQA+Q/RFZovXCykepp9Gy BhcS8qU9ZZC9+3B8RTDxh/Buhrbwg11+SNa/TGlee3pzUQSDEvusdqyBwi9RR2nGgJT3 rlXA== X-Forwarded-Encrypted: i=1; AJvYcCVsy+R/FPEnJ4/WzneRxIDntLTairqGQcSnVjXnU8A8POAXMauOxVu5FGqn/7yQ8HCh226Zzj+PkCNPhZenH14= X-Gm-Message-State: AOJu0YxL0sfwADvwWi00t/L5nNJYgEA3JhWk3a0lxplVJdU/V3/50raw DeZwDq6ihxGo2j9uUktRtfUwDhhO/DPIv0BKJtN5gRcvPMW+x4TzOJgv1w== X-Google-Smtp-Source: AGHT+IGIweZBJpdREfjWhXegTguDWJ21lBJIvM60Hp3k1Chz8TV+VerHJ9HR/1UXsKqjjY86VmtOvQ== X-Received: by 2002:a05:6000:8f:b0:362:d382:2569 with SMTP id ffacd0b85a97d-366e95d7df8mr3958738f8f.44.1719273579811; Mon, 24 Jun 2024 16:59:39 -0700 (PDT) Received: from localhost ([137.220.120.171]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a2f6ac2sm11489008f8f.76.2024.06.24.16.59.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 16:59:39 -0700 (PDT) From: luca.boccassi@gmail.com To: Long Wu Cc: Chaoyong He , Peng Zhang , dpdk stable Subject: patch 'net/nfp: fix representor port queue release' has been queued to stable release 22.11.6 Date: Tue, 25 Jun 2024 00:57:54 +0100 Message-Id: <20240624235907.885628-8-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240624235907.885628-1-luca.boccassi@gmail.com> References: <20240624235907.885628-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Hi, FYI, your patch has been queued to stable release 22.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/27/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/541c30f3d18029161a14c356ba88a5c8d2d16b82 Thanks. Luca Boccassi --- >From 541c30f3d18029161a14c356ba88a5c8d2d16b82 Mon Sep 17 00:00:00 2001 From: Long Wu Date: Tue, 19 Mar 2024 15:07:54 +0800 Subject: [PATCH] net/nfp: fix representor port queue release [ upstream commit 57f62be098be4c95964691183504c77e31797a42 ] 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: a256a1227dbe ("net/nfp: fix resource leak for exit of flower firmware") 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 4b8b02321c..090c828c18 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -524,6 +524,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) { @@ -581,8 +629,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; @@ -594,26 +640,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.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-06-25 00:22:13.882323625 +0100 +++ 0008-net-nfp-fix-representor-port-queue-release.patch 2024-06-25 00:22:13.069183284 +0100 @@ -1 +1 @@ -From 57f62be098be4c95964691183504c77e31797a42 Mon Sep 17 00:00:00 2001 +From 541c30f3d18029161a14c356ba88a5c8d2d16b82 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 57f62be098be4c95964691183504c77e31797a42 ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -21 +22 @@ -index b2c55879ca..d4c3c30682 100644 +index 4b8b02321c..090c828c18 100644 @@ -24 +25 @@ -@@ -305,6 +305,54 @@ nfp_flower_repr_tx_burst(void *tx_queue, +@@ -524,6 +524,54 @@ nfp_flower_repr_tx_burst(void *tx_queue, @@ -79 +80 @@ -@@ -362,8 +410,6 @@ nfp_flower_repr_dev_close(struct rte_eth_dev *dev) +@@ -581,8 +629,6 @@ nfp_flower_repr_dev_close(struct rte_eth_dev *dev) @@ -88 +89 @@ -@@ -375,26 +421,11 @@ nfp_flower_repr_dev_close(struct rte_eth_dev *dev) +@@ -594,26 +640,11 @@ nfp_flower_repr_dev_close(struct rte_eth_dev *dev)