From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas@monjalon.net>
Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com
 [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 674B61B69F;
 Wed,  9 May 2018 21:08:24 +0200 (CEST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id CD676211CD;
 Wed,  9 May 2018 15:08:23 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Wed, 09 May 2018 15:08:23 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 cc:content-transfer-encoding:content-type:date:from:in-reply-to
 :message-id:mime-version:references:subject:to:x-me-sender
 :x-me-sender:x-sasl-enc; s=mesmtp; bh=pnP8kE0L4uUI49dRKi1cfymHDo
 8TBlKDK6dyVb1+xB0=; b=AFuaBpJdOFgPx7EJ2tXkXqgb44hYRAY+/gkEAz28Lu
 +y1DnCQV03EZ45N3jhLjy/8lRJep0SzCzLHpVjflTOPsFSzQXZCGl6G64tFC8D+A
 0GoDgrLl0PWo5aSN7dV4Qte04iYsxD2Mwf3JAM18Y8IzFmSABSSPRtXU0XJYNiHp
 c=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=pnP8kE
 0L4uUI49dRKi1cfymHDo8TBlKDK6dyVb1+xB0=; b=R0K14aTjsJqr2T+5Dczn1j
 L8ukuMXdnYo9WQaKgD3iXXvM/INTOOVRriHpyyZE9m+QUTWin48MjP1IzDC5xWKR
 yt5lRaVP/ZxjM5yJXSejeQOFcUwCDPJGQyIa2ISybiECHP1ivD1rywwe8peR0wf4
 TBKLE67MALG4SlCBrNVKb4UAb8sBy0MQ10TZSc7tE6v6fnkyWb2FGVeiADxRO9fJ
 gQO52zlflxtk78hQG6wJeTT5Xs2DD9NhyJvjum3AFjqdt5C4CnIx4I6QM4HuFUHj
 EfniGn272jkbRSU6pfbQzEpWmBIEgX0aef1xyt/+lR4osVR/+s/edEkJdijw/h4w
 ==
X-ME-Sender: <xms:J0fzWiZfmR6W5CO-LJEnT7Wclt3Hls8ztYPJE9NyMu8Fo5oRUNQzdA>
Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id 054B0E4B94;
 Wed,  9 May 2018 15:08:22 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org, stable@dpdk.org, Matan Azrad <matan@mellanox.com>
Date: Wed, 09 May 2018 21:08:21 +0200
Message-ID: <1864854.i0eoOuio3f@xps>
In-Reply-To: <d7cc0e37-29d9-7793-1386-c556e1358793@intel.com>
References: <20180509094337.26112-1-thomas@monjalon.net>
 <20180509094337.26112-9-thomas@monjalon.net>
 <d7cc0e37-29d9-7793-1386-c556e1358793@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH 08/11] ethdev: fix port
	visibility before initialization
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://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: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 09 May 2018 19:08:25 -0000

09/05/2018 20:03, Ferruh Yigit:
> On 5/9/2018 10:43 AM, Thomas Monjalon wrote:
> > The port was set to the state ATTACHED during allocation.
> > The consequence was to iterate over ports which are not initialized.
> > 
> > The state ATTACHED is now set as the last step of probing.
> > 
> > The uniqueness of port name is now checked before the availability
> > of a port id for allocation (order reversed).
> > 
> > As the state is not set on allocation anymore, it is also not checked
> > in the function telling whether a port is allocated or not.
> > The name of the port is set on allocation, so it is enough as a check.
> > 
> > Fixes: 5588909af21b ("ethdev: add device iterator")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > Signed-off-by: Matan Azrad <matan@mellanox.com>
> > ---
> > @@ -3387,6 +3385,8 @@ rte_eth_dev_probing_finish(struct rte_eth_dev *dev)
> >  {
> >  	if (dev == NULL)
> >  		return;
> > +
> > +	dev->state = RTE_ETH_DEV_ATTACHED;
> 
> Aren't ethdev allocation and probe in different levels? Why not make ethdev
> allocation self sufficient but tie it to the device probe() ?

Ethdev allocation is self sufficient.
Probing is done by the PMD with these steps:
	1/ allocate ethdev port
	2/ initialize device
	3/ notify NEW event and set ethdev status