From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1BBAEA0613 for ; Mon, 23 Sep 2019 13:56:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 031CF1BECA; Mon, 23 Sep 2019 13:56:51 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id CB84F1BEC9 for ; Mon, 23 Sep 2019 13:56:48 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8NBom1M019613; Mon, 23 Sep 2019 04:56:46 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=Me99YDBAIqQUJmMtViySgxrDnHomQHgHCvzsYF93p4M=; b=UAiULnje+LDnuMzANE4SZ3IjmFVCA3iDtMz3N3cjO156tq8Hc+a+Rj007ebqM0C/mVA/ d0gVKVLtAFdLgnZ8EEFZv3izXp+LlAyiSJHjqYCt8HbKKuAc/qkUE3GW7pG5tP46/bjM RYvpDzUK0R5Jxf46HQUpK4xju/CHDANMKvQGxZGnJ4O2OQpaK3yuzFwkdQaJz79zeLmI L9QFOngoJpQxe0OZCCy8iq5q+8JJOgD23MHFZMoZy8G4KmMpWwHoLAm89OZSofHNnEA+ tEDHCTqiwQS2PRuvjOdrmCMTTRMabA36nt3J/ocbz3n8IZkLvSkxp9QHtoNO4Gi9ElLE HQ== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2v5h7qe7bq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 23 Sep 2019 04:56:46 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 23 Sep 2019 04:56:45 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 23 Sep 2019 04:56:45 -0700 Received: from hyd1vattunuru-dt.caveonetworks.com (unknown [10.29.52.72]) by maili.marvell.com (Postfix) with ESMTP id DCEE03F703F; Mon, 23 Sep 2019 04:56:42 -0700 (PDT) From: To: CC: , , , , , Vamsi Attunuru Date: Mon, 23 Sep 2019 17:26:30 +0530 Message-ID: <20190923115630.7929-1-vattunuru@marvell.com> X-Mailer: git-send-email 2.8.4 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-23_04:2019-09-23,2019-09-23 signatures=0 Subject: [dpdk-dev] [PATCH v1 1/1] bus/pci: probe PCI devices in whitelisted order 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" From: Vamsi Attunuru Current pci bus driver scans pci devices in the order that it read from sysfs. Accordingly all or whitelisted devices are getting probed. Patch modifies the probing order of whitelisted pci devices in a sequence the devices are whitelisted(using EAL flags). It ensures the eth devices that application uses are probed in device whitelisted sequence, in turn it facilitates the packet forwarding applications to work without any packet loss or performance drop when the underneath network ports have different bandwidths. By altering the whitelist order applications like testpmd, l2fwd can forward the ingress traffic to egress port that has of equivalent bandwidth. Signed-off-by: Vamsi Attunuru --- drivers/bus/pci/pci_common.c | 67 ++++++++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 21 deletions(-) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index 6b46b4f..c27a0e9 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -293,32 +293,57 @@ rte_pci_probe(void) struct rte_pci_device *dev = NULL; size_t probed = 0, failed = 0; struct rte_devargs *devargs; - int probe_all = 0; + struct rte_pci_addr addr; int ret = 0; - if (rte_pci_bus.bus.conf.scan_mode != RTE_BUS_SCAN_WHITELIST) - probe_all = 1; - - FOREACH_DEVICE_ON_PCIBUS(dev) { - probed++; + if (rte_pci_bus.bus.conf.scan_mode != RTE_BUS_SCAN_WHITELIST) { + /* Probe all devices */ + FOREACH_DEVICE_ON_PCIBUS(dev) { + probed++; - devargs = dev->device.devargs; - /* probe all or only whitelisted devices */ - if (probe_all) ret = pci_probe_all_drivers(dev); - else if (devargs != NULL && - devargs->policy == RTE_DEV_WHITELISTED) - ret = pci_probe_all_drivers(dev); - if (ret < 0) { - if (ret != -EEXIST) { - RTE_LOG(ERR, EAL, "Requested device " - PCI_PRI_FMT " cannot be used\n", - dev->addr.domain, dev->addr.bus, - dev->addr.devid, dev->addr.function); - rte_errno = errno; - failed++; + if (ret < 0) { + if (ret != -EEXIST) { + RTE_LOG(ERR, EAL, "Requested device " + PCI_PRI_FMT " cannot be used\n", + dev->addr.domain, dev->addr.bus, + dev->addr.devid, + dev->addr.function); + rte_errno = errno; + failed++; + } + ret = 0; + } + } + } else { + /* Probe only whitelisted devices */ + RTE_EAL_DEVARGS_FOREACH("pci", devargs) { + if (devargs->policy != RTE_DEV_WHITELISTED) + continue; + + devargs->bus->parse(devargs->name, &addr); + + FOREACH_DEVICE_ON_PCIBUS(dev) { + if (rte_pci_addr_cmp(&dev->addr, &addr)) + continue; + probed++; + ret = pci_probe_all_drivers(dev); + if (ret < 0) { + if (ret != -EEXIST) { + RTE_LOG(ERR, EAL, + "Requested device " + PCI_PRI_FMT + "cannot be used\n", + dev->addr.domain, + dev->addr.bus, + dev->addr.devid, + dev->addr.function); + rte_errno = errno; + failed++; + } + ret = 0; + } } - ret = 0; } } -- 2.8.4