From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) by dpdk.org (Postfix) with ESMTP id AAB3A37A6 for ; Thu, 3 Dec 2015 02:38:32 +0100 (CET) Received: by pabfh17 with SMTP id fh17so58079880pab.0 for ; Wed, 02 Dec 2015 17:38:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=MubUrEn3rbdgZpH6R3CzaXL0XF9S8VLfKBM9lGptxjw=; b=ISD+NhR894WgeYDqwuU92MU4uZrTT5K0OgytTVzqEDnJx3kI6GtabeFpvApaO/NcL4 hmXbWLeHuh9so0v/QI2TEiBg0pF9HVYAtNDkTbp537bKXUJb5jF3sGnWGL0wMn8wnI0w 8GUPwJFTbZjEBHqkoKoBRxRgS8JPz8YB1AoEx0wUWB78llGby6vt6dC93QAjt9dl9J8U tYX3l312U424JrbUiKsdJCQa7+BuTwgq8yG/3ZLbWCsCZVWCWDCVxNVtKZZfH1bKXRqN DEqX31k4ArHh06682VZdBijKclQ4nXL7KHxJ5OshNyAtmrI+ZQ2NdN7oxLmi4+vMSN9B opRA== 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; bh=MubUrEn3rbdgZpH6R3CzaXL0XF9S8VLfKBM9lGptxjw=; b=VwnR54nJeGrPQFXr8piHkjp6YJv1tqg3DZ1EkXka0yhXmahzcGXLibH3xT1oYVVFrD pjlo9rFM2rZBTGD9HNPqqvX7t4j0IG3GeoP0fstiBnA0aJBdfpHQGSlBUCGPdkDN/Pxe ZYWFxsTaZBNY1nUzlaLtpL5ZNOf2gqjn1ECeDZgMdpW+D3QRX4wSayr129TsjNo/Q+R5 jQDcb8QqI95YEhSog9bex2Kbzl6dPZni2Hvl5TYBSaXO1elVGMEo0H/gxUGy/cCZx2PP +HsGuRHqt2DbirIhqS9Pdx9Ls98pvg7LxwSLuG0HsmMNwL39nm6VSO6R4yQlkNrRLUHB +UVw== X-Gm-Message-State: ALoCoQkGMky/1ojd8CBME79247U3Rnog9d/kaSdhoxLH4K3373iIKUHjRtdIXjDl8bF/4rVIaxiO X-Received: by 10.66.218.170 with SMTP id ph10mr9535036pac.58.1449106711882; Wed, 02 Dec 2015 17:38:31 -0800 (PST) Received: from xeon-e3.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id w20sm6752924pfi.55.2015.12.02.17.38.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Dec 2015 17:38:31 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Date: Wed, 2 Dec 2015 17:38:40 -0800 Message-Id: <1449106720-30430-1-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 Subject: [dpdk-dev] [PATCH] eal: don't crash if one pci device fails 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: Thu, 03 Dec 2015 01:38:33 -0000 If there is a failure to setup one pci device, there maybe other devices that can be initialized. Don't call rte_exit which is a forced crash, pass the error back to the application to decide what it wants to do. Might be good idea to return a positive value for the number of devices found, but that would break ABI. Signed-off-by: Stephen Hemminger --- lib/librte_eal/common/eal_common_pci.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index dcfe947..594ef9c 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -391,12 +391,13 @@ rte_eal_pci_probe(void) struct rte_pci_device *dev = NULL; struct rte_devargs *devargs; int probe_all = 0; - int ret = 0; + int failed = 0; if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) == 0) probe_all = 1; TAILQ_FOREACH(dev, &pci_device_list, next) { + int ret = 0; /* set devargs in PCI structure */ devargs = pci_devargs_lookup(dev); @@ -409,13 +410,17 @@ rte_eal_pci_probe(void) else if (devargs != NULL && devargs->type == RTE_DEVTYPE_WHITELISTED_PCI) ret = pci_probe_all_drivers(dev); - if (ret < 0) - rte_exit(EXIT_FAILURE, "Requested device " PCI_PRI_FMT - " cannot be used\n", dev->addr.domain, dev->addr.bus, - dev->addr.devid, dev->addr.function); + + if (ret < 0) { + 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); + failed = ret; + } } - return 0; + return failed; } /* dump one device */ -- 2.1.4