From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 760B32E83 for ; Wed, 12 Jul 2017 20:28:22 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 2B13A20B90; Wed, 12 Jul 2017 14:28:22 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 12 Jul 2017 14:28:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:date:from:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc:x-sasl-enc; s=mesmtp; bh=N23JYRs7UwnQJ7PdvpMcJRBv6Hz JNiVv7UmRGHG7nW0=; b=V6cK9v0AmdApkDe0TMvwyVHyQEEut4Akd3zd+bRAIa+ Vo6AgIkT21NMemVtem4InPNUdwu8cWTPUG4QsGnntWADNVG+mWLDVdPzaD/3zQYF mMx7c7yI4HIUcvgUl45NImtSQDAbuQQ9zisBiFVYFEhfe31N3YJ2Hml7BTtZCIuY = DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=N23JYR s7UwnQJ7PdvpMcJRBv6HzJNiVv7UmRGHG7nW0=; b=PeunzQdwb18ArDaKQ4F/jF Syh5FTpasZNRSLi6AvIJ/+uZYPhBYTWoWmVJ7YprD7g/c/6BPrDZ0sCrrDoxRgpl msQcO+nKP/PJO4TmKDZFVzZM/+sI0OTMbw5z044vdo8isfcNyQxz4XAIsH0phe1K V9Xbm25jaC8aiqpGdO5BWfJaWy99H1ZgNcYlhfzxNnOKvZfn3pp2dWeImvyjRGB+ EQ82ckGVAXVzE6YJwOExG94+Gs9A4RtjLgwPhp4h1Oh7yl1UIYVoWB3mcnAoU5Mn l1/IoZDVGGpLM0GQBkMpNKvgAyUMXOoHJUy4kF5kQaTH5+iugtm9hVKDAxGDKXnQ == X-ME-Sender: X-Sasl-enc: DXtNLt9iEQqSLi56AdXhTzBj4j8bu4hvHAtvYAPFkND5 1499884101 Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 8A1907E21B; Wed, 12 Jul 2017 14:28:21 -0400 (EDT) From: Thomas Monjalon To: gaetan.rivet@6wind.com Cc: dev@dpdk.org Date: Wed, 12 Jul 2017 20:28:12 +0200 Message-Id: <20170712182812.18404-1-thomas@monjalon.net> X-Mailer: git-send-email 2.13.2 Subject: [dpdk-dev] [PATCH] net/failsafe: do not probe device if plugged out 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: Wed, 12 Jul 2017 18:28:22 -0000 When probing a sub-devices which does not exist in the system, some errors are logged: EAL: Cannot find unplugged device (0002:00:02.0) PMD: net_failsafe: ERROR: sub_device 0 probe failed It is normal to have these errors when initializing the failsafe device and its sub-devices. But we do not need to log them at each probe. And it is even less relevant if the sub-device has been plugged out. The unavailable devices are skipped after the first probe, considering two exceptions: - The vdevs are always probed because they do not really exist on the virtual bus before probing them. - The sub-device list given by an executed command line may change from one call to the next one, therefore it is considered to be always the first one. Anyway, such external command should check the device availability before passing it to the failsafe PMD. Signed-off-by: Thomas Monjalon --- This patch is on top of the failsafe series which is pending for integration in 17.08-rc2. --- drivers/net/failsafe/failsafe_eal.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c index 3321dda71..5181066ed 100644 --- a/drivers/net/failsafe/failsafe_eal.c +++ b/drivers/net/failsafe/failsafe_eal.c @@ -49,6 +49,11 @@ fs_find_ethdev(const struct rte_device *dev) return NULL; } +static int cmp_dev_name(const struct rte_device *dev, const void *name) +{ + return strcmp(dev->name, name); +} + static int fs_bus_init(struct rte_eth_dev *dev) { @@ -56,12 +61,24 @@ fs_bus_init(struct rte_eth_dev *dev) struct rte_device *rdev; struct rte_devargs *da; uint8_t i; + static int first_init = 1; int ret; FOREACH_SUBDEV(sdev, i, dev) { if (sdev->state != DEV_PARSED) continue; da = &sdev->devargs; + + /* skip plugged out devices */ + if (! first_init + && sdev->cmdline == NULL + && strcmp(da->bus->name, "vdev") != 0) { + da->bus->scan(); + if (bus->find_device(NULL, cmp_dev_name, da->name) == NULL) + continue; /* device not found */ + } + + /* probe device */ rdev = rte_eal_hotplug_add(da->bus->name, da->name, da->args); @@ -84,6 +101,10 @@ fs_bus_init(struct rte_eth_dev *dev) ETH(sdev)->state = RTE_ETH_DEV_DEFERRED; sdev->state = DEV_PROBED; } + + if (first_init) + first_init = 0; + return 0; } -- 2.13.2