From patchwork Tue Nov 12 08:47:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matan Azrad X-Patchwork-Id: 62876 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 560F1A04AB; Tue, 12 Nov 2019 09:48:01 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E533D2BB1; Tue, 12 Nov 2019 09:47:54 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 1E016374 for ; Tue, 12 Nov 2019 09:47:50 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@mellanox.com) with ESMTPS (AES256-SHA encrypted); 12 Nov 2019 10:47:47 +0200 Received: from pegasus07.mtr.labs.mlnx (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id xAC8ll0g025250; Tue, 12 Nov 2019 10:47:47 +0200 From: Matan Azrad To: dev@dpdk.org Cc: Gaetan Rivet , Bernard Iremonger , mukawa@igel.co.jp, stable@dpdk.org Date: Tue, 12 Nov 2019 08:47:38 +0000 Message-Id: <1573548459-6931-1-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH 1/2] bus/pci: fix driver detach clear X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When a rte_device is unplugged, the driver should be detached from the device. The PCI detach driver operation wrongly didn't clear the driver from the device structure what remain the device in probe state from the EAL point of view. Clear the driver in driver detach successful operation. Fixes: dbe6b4b61b0e ("pci: probe or close device") Cc: mukawa@igel.co.jp Cc: stable@dpdk.org Signed-off-by: Matan Azrad Acked-by: Thomas Monjalon --- drivers/bus/pci/pci_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index 6b46b4f..3f55420 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -247,6 +247,7 @@ static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev) /* clear driver structure */ dev->driver = NULL; + dev->device.driver = NULL; if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) /* unmap resources for devices that use igb_uio */ From patchwork Tue Nov 12 08:47:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matan Azrad X-Patchwork-Id: 62875 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E856AA04AF; Tue, 12 Nov 2019 09:47:54 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 27A0E2B8E; Tue, 12 Nov 2019 09:47:53 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 20FC1B62 for ; Tue, 12 Nov 2019 09:47:50 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@mellanox.com) with ESMTPS (AES256-SHA encrypted); 12 Nov 2019 10:47:47 +0200 Received: from pegasus07.mtr.labs.mlnx (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id xAC8ll0h025250; Tue, 12 Nov 2019 10:47:47 +0200 From: Matan Azrad To: dev@dpdk.org Cc: Gaetan Rivet , Bernard Iremonger , thomas@monjalon.net, stable@dpdk.org Date: Tue, 12 Nov 2019 08:47:39 +0000 Message-Id: <1573548459-6931-2-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1573548459-6931-1-git-send-email-matan@mellanox.com> References: <1573548459-6931-1-git-send-email-matan@mellanox.com> Subject: [dpdk-dev] [PATCH 2/2] app/testpmd: fix invalid port detaching X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The port was not validated before detaching. Ignore port detach operation when the port is not valid. Fixes: f8e5baa2662d ("app/testpmd: check not detaching device twice") Cc: thomas@monjalon.net Cc: stable@dpdk.org Signed-off-by: Matan Azrad Acked-by: Bernard Iremonger --- app/test-pmd/testpmd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 4444346..370eefe 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2545,6 +2545,9 @@ struct extmem_param { printf("Removing a device...\n"); + if (port_id_is_invalid(port_id, ENABLED_WARN)) + return; + dev = rte_eth_devices[port_id].device; if (dev == NULL) { printf("Device already removed\n");