From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44]) by dpdk.org (Postfix) with ESMTP id 8EC6D5691 for ; Wed, 20 Apr 2016 13:44:37 +0200 (CEST) Received: by mail-wm0-f44.google.com with SMTP id e201so47237813wme.0 for ; Wed, 20 Apr 2016 04:44:37 -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; bh=kFtfGdrN+aWCSqMPOopT4rOv/jha5zSLRsI8YzAaqms=; b=lnvSg4ZKUzexaxVru7eMnkWSX4Xu5JWwIJ/ulv7i3D53yISFn3TGTi749kVXc9gXeH 7SDwxxENyjH8pOTXyhGJegZsw/+Dj4qg3U+Jo8Cp+sJyIQLZVrc9QHUHkt8cIhnzj6Ub gD69m2sNSkfC8O+Ym61o2pUQ82ZWbIjhQgSGmfLanYrQrjgHUXub/VnXTm1qzGQPCsrA IoFag/xbtkSu1kQopT1VqiS7b1zEb22ledzCah+qXoxHpobYrG6iCi9LDBIS8WlHBeVh RAJ4Ulzg0V7nNaNt1iLUIAx5qUzH8mhsR+HiYut4H5sulBnSnUUgZtLhCinQKydaDn3g LnSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kFtfGdrN+aWCSqMPOopT4rOv/jha5zSLRsI8YzAaqms=; b=eLy7wadEE0L+EM2t1RRtxY6SsFUU98q1HFP55G4lvj/Ishn9AfYmX5QhLhDScja9tx YfOmDltnJqA2DiKbprqBjapTjxbxcFGsi/krlw0R6aT5PN31ENJeD8Rk3hUja8+pgjRu nOgSqJ5R8bKTqh5cswQHxxdjSl+1c+eMR9p9O9/zO5wIV7DRZ+X4tagiQJdOizWHyZxd eDTvogEs78zUhNc+XL476HAnAD7AqKnw6MzCtzbpSquL1kseB+hs3PTLHzl5LLcFtDhu gOS1tDbuTWFeDhp6mTTxSstENvvw+GtbIACmS8XLpzVHM4l8zoNuTX+MHcz3sICVGN6u toQA== X-Gm-Message-State: AOPr4FWcIBou3wtjxPcXUuOnD4lVFWT3lCwn2EpkyPeosvhoYU7b7sr7XcV6hDsFtaCC+ODR X-Received: by 10.194.107.36 with SMTP id gz4mr8269747wjb.33.1461152677394; Wed, 20 Apr 2016 04:44:37 -0700 (PDT) Received: from gloops.dev.6wind.com (144.77.126.78.rev.sfr.net. [78.126.77.144]) by smtp.gmail.com with ESMTPSA id m6sm5195708wje.21.2016.04.20.04.44.36 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Apr 2016 04:44:36 -0700 (PDT) From: David Marchand To: dev@dpdk.org Cc: thomas.monjalon@6wind.com, viktorin@rehivetech.com Date: Wed, 20 Apr 2016 13:44:14 +0200 Message-Id: <1461152657-19969-15-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461152657-19969-1-git-send-email-david.marchand@6wind.com> References: <1454076516-21591-1-git-send-email-david.marchand@6wind.com> <1461152657-19969-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [PATCH v2 14/17] ethdev: do not scan all pci devices on attach X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2016 11:44:37 -0000 No need to scan all devices, we only need to update the device being attached. Signed-off-by: David Marchand --- lib/librte_eal/common/eal_common_pci.c | 11 ++++++++--- lib/librte_ether/rte_ethdev.c | 3 --- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index 80d8ec6..d63b47b 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -325,6 +325,11 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr) if (addr == NULL) return -1; + /* update current pci device in global list, kernel bindings might have + * changed since last time we looked at it */ + if (pci_update_device(addr) < 0) + goto err_return; + TAILQ_FOREACH(dev, &pci_device_list, next) { if (rte_eal_compare_pci_addr(&dev->addr, addr)) continue; @@ -337,9 +342,9 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr) return -1; err_return: - RTE_LOG(WARNING, EAL, "Requested device " PCI_PRI_FMT - " cannot be used\n", dev->addr.domain, dev->addr.bus, - dev->addr.devid, dev->addr.function); + RTE_LOG(WARNING, EAL, + "Requested device " PCI_PRI_FMT " cannot be used\n", + addr->domain, addr->bus, addr->devid, addr->function); return -1; } diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 9d5827b..6cd6455 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -468,9 +468,6 @@ rte_eth_dev_is_detachable(uint8_t port_id) static int rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id) { - /* re-construct pci_device_list */ - if (rte_eal_pci_scan()) - goto err; /* Invoke probe func of the driver can handle the new device. */ if (rte_eal_pci_probe_one(addr)) goto err; -- 1.9.1