From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f181.google.com (mail-wr0-f181.google.com [209.85.128.181]) by dpdk.org (Postfix) with ESMTP id 6EB363772 for ; Fri, 7 Jul 2017 02:10:03 +0200 (CEST) Received: by mail-wr0-f181.google.com with SMTP id 77so24324331wrb.1 for ; Thu, 06 Jul 2017 17:10:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=jCtQ+k89eRJSbnMT3r7eVdDp58am4SKTSu+48M7RFy8=; b=1BhQjxq8JynF5SzBfv7Qv9rTZssHGcsKJOeFEh7Nttf9yr0pgE9J4JLI4qYUc+nByo 4BMRQtex3qKUbzgPUe6zpV4YyaqCBmocfYu3PsRZQARPSlHbQ2Y0NeI5Ph0HToU6SACM BfWJEFzu8medWMgMFYm2OoP7XJ9PbMwOwk8kxDrUBmay1hB+m96EP1VQOZEb4GRRopEp fOH63hCboyjq6iiLea2lJnoa5IR+rxQ3v9PLvxk7DMhdFd+JPjCJ+pAN1izRnJ+137+e wxv60TSTT6IxMY0O14bah0QNvE5kcRGJuTmaqH+pq81Dlsvv+P7JBLrRHzQhr6f4wV9D /Qmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=jCtQ+k89eRJSbnMT3r7eVdDp58am4SKTSu+48M7RFy8=; b=luxppwNwiKssqAya5/w8AL1GOiDJ9FRIppIbYJi2Qg4WTKzI8D8BlzKlWheHiLd4hY zoV/OHEDBfWDCPIYJblx59AteA9xndaALJcR6zM7/lEr8F7RV74lc4FWmCQtEo2ZkRU9 nLPN1oiGL4gkUWoNRmYlwPqe8cPChMlv3kxENwVUA/sdM/W3GBKcaPim3TIP0yi5pK5V iqXfF/qHtbBJ8o5YF+rwNDZblg/DT1CMyz27pKFPhJT3L/ObtjfEanCQ//2mTSApHX78 QQcR8U4x7y7ZSBjXUwbuHrfC1lbfcYRurY0D7uFJ5VzMBW3WEs6AVuk4vBvamxkk6SG9 llRQ== X-Gm-Message-State: AIVw11147lW0pdxOupetOgjhur06p1cXMaC5nW/HkWv1C9aG7IDlt1E4 N+Bwz6KJXbSg+0kwoYM= X-Received: by 10.28.175.212 with SMTP id y203mr311814wme.2.1499386202774; Thu, 06 Jul 2017 17:10:02 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id f45sm2391166wrf.2.2017.07.06.17.10.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Jul 2017 17:10:02 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Fri, 7 Jul 2017 02:09:14 +0200 Message-Id: <3b129dc3f7a0e59a9754948bfb91329a5bcfc635.1499385282.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v6 07/22] pci: fix hotplug operations 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: , X-List-Received-Date: Fri, 07 Jul 2017 00:10:04 -0000 The device handle is already known and does not have to be infered from the PCI address. Additionally, rte_memcpy.h was erroneously included. Fixes: 00e62aae69c0 ("bus/pci: implement plug/unplug operations") Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_pci.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index fbdc356..a9a04db 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -47,7 +47,6 @@ #include #include #include -#include #include #include #include @@ -538,32 +537,20 @@ pci_find_device(const struct rte_device *start, rte_dev_cmp_t cmp, static int pci_plug(struct rte_device *dev, const char *devargs __rte_unused) { - struct rte_pci_device *pdev; - struct rte_pci_addr *addr; - - addr = &RTE_DEV_TO_PCI(dev)->addr; - - /* Find the current device holding this address in the bus. */ - FOREACH_DEVICE_ON_PCIBUS(pdev) { - if (rte_eal_compare_pci_addr(&pdev->addr, addr) == 0) - return rte_pci_probe_one(addr); - } - - rte_errno = ENODEV; - return -1; + return pci_probe_all_drivers(RTE_DEV_TO_PCI(dev)); } static int pci_unplug(struct rte_device *dev) { struct rte_pci_device *pdev; + int ret; pdev = RTE_DEV_TO_PCI(dev); - if (rte_pci_detach(&pdev->addr) != 0) { - rte_errno = ENODEV; - return -1; - } - return 0; + ret = rte_pci_detach_dev(pdev); + rte_pci_remove_device(pdev); + free(pdev); + return ret; } struct rte_pci_bus rte_pci_bus = { -- 2.1.4