From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gaetan.rivet@6wind.com>
Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46])
 by dpdk.org (Postfix) with ESMTP id 8D6042935
 for <dev@dpdk.org>; Thu, 13 Jul 2017 10:14:49 +0200 (CEST)
Received: by mail-wm0-f46.google.com with SMTP id i127so17262723wma.0
 for <dev@dpdk.org>; Thu, 13 Jul 2017 01:14:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=6wind-com.20150623.gappssmtp.com; s=20150623;
 h=date:from:to:cc:subject:message-id:references:mime-version
 :content-disposition:content-transfer-encoding:in-reply-to
 :user-agent; bh=Duyop6VSQMBwdq3awL3c6bEWh1yFRFwDvIjFINJmUqk=;
 b=U8Y/fE0IAhdPpwXcppQNmVsk3jyF0mx3qa6dlFSKO1WfSKIx7oKwaiosiKfHc3NaV4
 9lmOMqTFEeeXEgqELxjMSokoCEjPNveVZPFABaYM3EAm8Vea+5lF40z8jcTd6yw8cyNV
 pYwklURvMPa3RM33jGXsEb/VHmCTNXsAVpsl+K3mgr+gudbPdTYH1uYTpB6/fHrUxXTb
 p42qfh3AXsXXS3w3yWhVVlyJy+EXddtrR7iDJt4ZYFFdWqA2u+beZAYWfWS5XTJjQBK/
 aHKvEJUUyhS1Ce66dffRsBVdM5k39ZEVjCzslFIsUZugmI0JjXVX6HQladhdwqn3aUS8
 TYTw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:references
 :mime-version:content-disposition:content-transfer-encoding
 :in-reply-to:user-agent;
 bh=Duyop6VSQMBwdq3awL3c6bEWh1yFRFwDvIjFINJmUqk=;
 b=U3bgBX2Zh2sENeW3FOUDYxPxszN/LTUnpbnh5YfBbxqAy7AFWBRBkbfIJpurpmJj+d
 GiHzSjTR0gBqPgV+qp8v0YD/ksdU2vSq3WvucMw2ho3kunuQ770LAzGkTPYJHr9Ob99a
 obi569zamSAOgpSMCikfQYhg64pQZDpec5EK/MAmXyIJPEtdeBmUy4iFtRxzkBJT0UmE
 wfIfEnilbcOLYF4+CdQ2NPop1Nm1rN3Gsg2zdk9vVxudTCUAGTUDuZo9+H4RubTGem+n
 CYlCMaudgSZIQsvfBf1B9KOV+m0qOTFynF/SHXgNewX/KJ/9z3IESLgJ1WmzjAPAvMTk
 FAsQ==
X-Gm-Message-State: AIVw113G23RccpfbcW9Tzgg7L6XEDEm0ZZu/6Ab2ja4jJ/P5bDUZdXUU
 nTwZFMwPM2snhF9K8Bc=
X-Received: by 10.28.198.1 with SMTP id w1mr943151wmf.78.1499933689140;
 Thu, 13 Jul 2017 01:14:49 -0700 (PDT)
Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com.
 [62.23.145.78])
 by smtp.gmail.com with ESMTPSA id k45sm4179580wrk.45.2017.07.13.01.14.47
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 13 Jul 2017 01:14:48 -0700 (PDT)
Date: Thu, 13 Jul 2017 10:14:39 +0200
From: =?iso-8859-1?Q?Ga=EBtan?= Rivet <gaetan.rivet@6wind.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org
Message-ID: <20170713081439.GH11154@bidouze.vm.6wind.com>
References: <20170712182812.18404-1-thomas@monjalon.net>
 <20170712203957.GG11154@bidouze.vm.6wind.com>
 <1868638.SUpGZpUFpc@xps>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <1868638.SUpGZpUFpc@xps>
User-Agent: Mutt/1.5.23 (2014-03-12)
Subject: Re: [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 <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 13 Jul 2017 08:14:49 -0000

On Thu, Jul 13, 2017 at 08:52:33AM +0200, Thomas Monjalon wrote:
> 12/07/2017 22:39, Gaëtan Rivet:
> > Hi Thomas,
> > 
> > Nice idea. A few remarks below:
> > 
> > On Wed, Jul 12, 2017 at 08:28:12PM +0200, Thomas Monjalon wrote:
> > >  	FOREACH_SUBDEV(sdev, i, dev) {
> > >  		if (sdev->state != DEV_PARSED)
> > >  			continue;
> > >  		da = &sdev->devargs;
> > > +
> > 
> > Superfluous line.
> 
> I don't think so :) It is isolating the "skip" block with its comment.
> 
> > > +		/* skip plugged out devices */
> > > +		if (! first_init
> > > +				&& sdev->cmdline == NULL
> > > +				&& strcmp(da->bus->name, "vdev") != 0) {
> > 
> > Use first_init == false instead of negation.
> > && should be at the end of the line instead of the start of the next
> > one.
> 
> Yes
> 
> > Indentation is wrong.
> 
> No, the coding style is to put 2 tabs for continuation lines.
> 
> > > +			da->bus->scan();
> > > +			if (bus->find_device(NULL, cmp_dev_name, da->name) == NULL)
> > > +				continue; /* device not found */
> > 
> > da->bus->find_device instead of bus->find_device.
> > This function cannot find the device back currently on the PCI bus,
> > blocking the plugging of VF.
> > 
> > The PCI bus will scan the VF while no rte_devargs exists to
> > describe it within the global list. If the device exists, it will
> > detect it, allocate it and then set its name.
> > Without any rte_devargs, the name of a PCI device falls back to its
> > canonical name (DomBDF instead of BDF). The name comparison with
> > da->name can only succeed if the slave was declared using the DomBDF
> > format.
> > 
> > The fix is to do a deep copy of the rte_devargs (the API has been
> > sent previously with the rte_devargs rework but I have since removed
> > it) and insert it using rte_eal_devargs_insert(). This is essentially
> > the solution I used for the rte_eal_hotplug_add() fix[1].
> > 
> > The alternative fix is to propose an API for buses to transform device
> > names into their canonical form on demand... And it would certainly only
> > be useful for the PCI bus.
> > 
> > The issue is discussed there:
> > [1]: http://dpdk.org/ml/archives/dev/2017-July/071155.html
> 
> OK, I was not aware of this exact issue.
> So I will wait above fix.

The fix above will not solve this issue.
If you are waiting for a proper, general fix, I don't think it will
arrive anytime soon.

I have the rte_eal_devargs_clone and a working version that I can send
in-reply-to if you want. But that's an API extension while in RC2 so...

-- 
Gaëtan Rivet
6WIND