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 397D443829 for ; Tue, 5 Mar 2024 16:36:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2565742E48; Tue, 5 Mar 2024 16:36:08 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id EF90142E47 for ; Tue, 5 Mar 2024 16:36:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709652966; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LjFaEklZV9XcUJM0ZRBy7chyKCjKqhMHFnKZZmsNvDs=; b=OGpCJiKohQDOYqxkn8M43jDoIl75vQzc1Q3BqvwC0QIeHYAdsM0zSio480TxDzn4w8pf3Z vV/SvzGGJqhSuBaD9ZbuE0HtjJopuyblsknavfL6zRsgTSTAjmVCqtqGonVIJc0+d/8mNn a26WrfST8NZLE5XJqm+Sy8cUQWAMyfs= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-18-uyRKSsupOU-NQCYoF8zpfQ-1; Tue, 05 Mar 2024 10:36:05 -0500 X-MC-Unique: uyRKSsupOU-NQCYoF8zpfQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E92093C025C3; Tue, 5 Mar 2024 15:36:04 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.194.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6CBB7200AE7F; Tue, 5 Mar 2024 15:36:04 +0000 (UTC) From: Kevin Traynor To: Andrew Boyer Cc: dpdk stable Subject: patch 'net/ionic: fix device close' has been queued to stable release 21.11.7 Date: Tue, 5 Mar 2024 15:34:26 +0000 Message-ID: <20240305153449.263666-53-ktraynor@redhat.com> In-Reply-To: <20240305153449.263666-1-ktraynor@redhat.com> References: <20240305153449.263666-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 21.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/11/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/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/3b7cc646a988ea82e94d4a00091ac74a1ad4c66f Thanks. Kevin --- >From 3b7cc646a988ea82e94d4a00091ac74a1ad4c66f Mon Sep 17 00:00:00 2001 From: Andrew Boyer Date: Tue, 6 Feb 2024 19:13:14 -0800 Subject: [PATCH] net/ionic: fix device close [ upstream commit 73028be3b4d4d52f5d73becfd22bff3f57a81252 ] The close routine should release all resources, but not call rte_eth_dev_destroy(). As written this code will call rte_eth_dev_release_port() twice and segfault. Instead, move rte_eth_dev_destroy() to the remove routine. eth_ionic_dev_uninit() will call close if necessary. Fixes: 175e4e7ed760 ("net/ionic: complete release on close") Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_ethdev.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 31fe23ef34..8a2b105238 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -953,14 +953,15 @@ ionic_dev_close(struct rte_eth_dev *eth_dev) ionic_lif_stop(lif); - ionic_lif_free_queues(lif); - IONIC_PRINT(NOTICE, "Removing device %s", eth_dev->device->name); ionic_unconfigure_intr(adapter); - rte_eth_dev_destroy(eth_dev, eth_ionic_dev_uninit); - ionic_port_reset(adapter); ionic_reset(adapter); + ionic_lif_free_queues(lif); + ionic_lif_deinit(lif); + ionic_lif_free(lif); /* Does not free LIF object */ + + lif->adapter = NULL; rte_free(adapter); @@ -1039,7 +1040,4 @@ static int eth_ionic_dev_uninit(struct rte_eth_dev *eth_dev) { - struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev); - struct ionic_adapter *adapter = lif->adapter; - IONIC_PRINT_CALL(); @@ -1047,11 +1045,11 @@ eth_ionic_dev_uninit(struct rte_eth_dev *eth_dev) return 0; - adapter->lif = NULL; + if (eth_dev->state != RTE_ETH_DEV_UNUSED) + ionic_dev_close(eth_dev); - ionic_lif_deinit(lif); - ionic_lif_free(lif); - - if (!(lif->state & IONIC_LIF_F_FW_RESET)) - ionic_lif_reset(lif); + eth_dev->dev_ops = NULL; + eth_dev->rx_pkt_burst = NULL; + eth_dev->tx_pkt_burst = NULL; + eth_dev->tx_pkt_prepare = NULL; return 0; @@ -1258,4 +1256,5 @@ eth_ionic_pci_remove(struct rte_pci_device *pci_dev) char name[RTE_ETH_NAME_MAX_LEN]; struct rte_eth_dev *eth_dev; + int ret = 0; /* Adapter lookup is using the eth_dev name */ @@ -1264,10 +1263,10 @@ eth_ionic_pci_remove(struct rte_pci_device *pci_dev) eth_dev = rte_eth_dev_allocated(name); if (eth_dev) - ionic_dev_close(eth_dev); + ret = rte_eth_dev_destroy(eth_dev, eth_ionic_dev_uninit); else IONIC_PRINT(DEBUG, "Cannot find device %s", pci_dev->device.name); - return 0; + return ret; } -- 2.43.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-05 14:08:55.911671690 +0000 +++ 0053-net-ionic-fix-device-close.patch 2024-03-05 14:08:54.692520876 +0000 @@ -1 +1 @@ -From 73028be3b4d4d52f5d73becfd22bff3f57a81252 Mon Sep 17 00:00:00 2001 +From 3b7cc646a988ea82e94d4a00091ac74a1ad4c66f Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 73028be3b4d4d52f5d73becfd22bff3f57a81252 ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -18,2 +19,2 @@ - drivers/net/ionic/ionic_ethdev.c | 30 +++++++++++++++--------------- - 1 file changed, 15 insertions(+), 15 deletions(-) + drivers/net/ionic/ionic_ethdev.c | 29 ++++++++++++++--------------- + 1 file changed, 14 insertions(+), 15 deletions(-) @@ -22 +23 @@ -index 7c55a26956..bedcf958e2 100644 +index 31fe23ef34..8a2b105238 100644 @@ -25 +26 @@ -@@ -1010,17 +1010,19 @@ ionic_dev_close(struct rte_eth_dev *eth_dev) +@@ -953,14 +953,15 @@ ionic_dev_close(struct rte_eth_dev *eth_dev) @@ -31,2 +32 @@ - if (adapter->intf->unconfigure_intr) - (*adapter->intf->unconfigure_intr)(adapter); + ionic_unconfigure_intr(adapter); @@ -38 +38 @@ -+ + @@ -43,3 +42,0 @@ - if (adapter->intf->unmap_bars) - (*adapter->intf->unmap_bars)(adapter); - @@ -49 +46 @@ -@@ -1099,7 +1101,4 @@ static int +@@ -1039,7 +1040,4 @@ static int @@ -57 +54 @@ -@@ -1107,11 +1106,11 @@ eth_ionic_dev_uninit(struct rte_eth_dev *eth_dev) +@@ -1047,11 +1045,11 @@ eth_ionic_dev_uninit(struct rte_eth_dev *eth_dev) @@ -75 +72 @@ -@@ -1268,4 +1267,5 @@ eth_ionic_dev_remove(struct rte_device *rte_dev) +@@ -1258,4 +1256,5 @@ eth_ionic_pci_remove(struct rte_pci_device *pci_dev) @@ -81 +78 @@ -@@ -1274,9 +1274,9 @@ eth_ionic_dev_remove(struct rte_device *rte_dev) +@@ -1264,10 +1263,10 @@ eth_ionic_pci_remove(struct rte_pci_device *pci_dev) @@ -87 +84,2 @@ - IONIC_PRINT(DEBUG, "Cannot find device %s", rte_dev->name); + IONIC_PRINT(DEBUG, "Cannot find device %s", + pci_dev->device.name);