From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas@monjalon.net>
Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com
 [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 06F9C3572
 for <dev@dpdk.org>; Mon,  1 Apr 2019 17:17:39 +0200 (CEST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 9486020CE1;
 Mon,  1 Apr 2019 11:17:38 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute1.internal (MEProxy); Mon, 01 Apr 2019 11:17:38 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding:content-type; s=mesmtp;
 bh=PGFvnQ1SeXUmk3pN74BVF6iqbdhd8SLzEEwf2YesYbA=; b=qG3yTL/dINhZ
 dgV5RvcXi0tvCZgLqxSCXNaYmcpmgt0WRTccy0shCic+28qDQ87Re5wryUAgWeYd
 VK3cqz7CI1S5nbeCCnKQrQVpE2XDmg3+DCy0Av8vP0w7m/URWqTH9FPmks8gkSsv
 a+c35UOkiTPO6ex5HmqgwvBM6xW3XXA=
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-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm2; bh=PGFvnQ1SeXUmk3pN74BVF6iqbdhd8SLzEEwf2YesY
 bA=; b=ekAYdOKjctZ3clJdgNdewSC4W0PSk5TqFbTcQ47LztMn6tIyGGFJQROhk
 Rzh8fdnc2DakHhQvFvW8qpip1T5ZQRLaivsKpqocwxDnD0WqBmhVoRzew7UwN1J8
 QwIFovhjkd63WVNmQx3vr5Onu02iU3CuhXxKu9rkBvV5vh2x0Yv2+6KKQcpDO+CJ
 WnrBiqe50jhrOU4Gw3RzB5A4Umbtud/o22WtE+PdBm8rBM0yyM2A0f/8pIvYXUE7
 8vqJG8dZwaqwnMQ0XjfJr/vxdjKHVSJ8ySZ+8FVwj7hZGbOdvhOsaRL7vwdO8GH4
 NK2sKHvf4AniZBykjhJBlun9ht7sA==
X-ME-Sender: <xms:kSuiXBf5vj0dt2TUNYBZCGpBfYm_9wsJ2AX9KfnY7QJ72wpij-ErWA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrleeggdekhecutefuodetggdotefrodftvf
 curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
 uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc
 fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs
 ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph
 epjeejrddufeegrddvtdefrddukeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhho
 mhgrshesmhhonhhjrghlohhnrdhnvghtnecuvehluhhsthgvrhfuihiivgeptd
X-ME-Proxy: <xmx:kSuiXAtVMDTdV_7uHi6n2lfhnGXsfuNl0q_deIMIaxd4SfVxoFQNHA>
 <xmx:kSuiXILwxbdcRn-FRMniOkt2ivC5S2QbAir0Bdwot8j8ChQYae3HQw>
 <xmx:kSuiXCbm85UesAsiTLhSDirw8QwkXPg5DNRCXogPK-e1oZfZE9Eqlg>
 <xmx:kiuiXJ3TpstEND3Vu0K3Qes7gHV2laFP54iwfhNOtH_TCfyiM9Mwzg>
Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id DDD0210391;
 Mon,  1 Apr 2019 11:17:36 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: gaetan.rivet@6wind.com, Ferruh Yigit <ferruh.yigit@intel.com>,
 Andrew Rybchenko <arybchenko@solarflare.com>, dev@dpdk.org
Date: Mon, 01 Apr 2019 17:17:35 +0200
Message-ID: <21018304.OXf2jst79b@xps>
In-Reply-To: <20190401075851.4908488a@shemminger-XPS-13-9360>
References: <20181130002716.27325-1-thomas@monjalon.net>
 <20190401022700.1570-2-thomas@monjalon.net>
 <20190401075851.4908488a@shemminger-XPS-13-9360>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: Re: [dpdk-dev] [PATCH v3 1/4] ethdev: simplify port state
	comparisons
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://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 01 Apr 2019 15:17:39 -0000

01/04/2019 16:58, Stephen Hemminger:
> On Mon,  1 Apr 2019 04:26:57 +0200
> Thomas Monjalon <thomas@monjalon.net> wrote:
> 
> > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> > index 10bdfb37e..33cffc498 100644
> > --- a/lib/librte_ethdev/rte_ethdev.c
> > +++ b/lib/librte_ethdev/rte_ethdev.c
> > @@ -330,8 +330,7 @@ uint16_t
> >  rte_eth_find_next(uint16_t port_id)
> >  {
> >  	while (port_id < RTE_MAX_ETHPORTS &&
> > -	       rte_eth_devices[port_id].state != RTE_ETH_DEV_ATTACHED &&
> > -	       rte_eth_devices[port_id].state != RTE_ETH_DEV_REMOVED)
> > +			rte_eth_devices[port_id].state == RTE_ETH_DEV_UNUSED)
> 
> For some applications that iterate over ports this is a hot path.

Really?

> What about keeping an unused port bit mask and using ffs (in the future)?

I don't understand your proposal. Please could you elaborate?

Do you agree on this patch anyway?

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id 607D5A0679
	for <public@inbox.dpdk.org>; Mon,  1 Apr 2019 17:17:41 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 5D6494C8D;
	Mon,  1 Apr 2019 17:17:40 +0200 (CEST)
Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com
 [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 06F9C3572
 for <dev@dpdk.org>; Mon,  1 Apr 2019 17:17:39 +0200 (CEST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 9486020CE1;
 Mon,  1 Apr 2019 11:17:38 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute1.internal (MEProxy); Mon, 01 Apr 2019 11:17:38 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding:content-type; s=mesmtp;
 bh=PGFvnQ1SeXUmk3pN74BVF6iqbdhd8SLzEEwf2YesYbA=; b=qG3yTL/dINhZ
 dgV5RvcXi0tvCZgLqxSCXNaYmcpmgt0WRTccy0shCic+28qDQ87Re5wryUAgWeYd
 VK3cqz7CI1S5nbeCCnKQrQVpE2XDmg3+DCy0Av8vP0w7m/URWqTH9FPmks8gkSsv
 a+c35UOkiTPO6ex5HmqgwvBM6xW3XXA=
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-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm2; bh=PGFvnQ1SeXUmk3pN74BVF6iqbdhd8SLzEEwf2YesY
 bA=; b=ekAYdOKjctZ3clJdgNdewSC4W0PSk5TqFbTcQ47LztMn6tIyGGFJQROhk
 Rzh8fdnc2DakHhQvFvW8qpip1T5ZQRLaivsKpqocwxDnD0WqBmhVoRzew7UwN1J8
 QwIFovhjkd63WVNmQx3vr5Onu02iU3CuhXxKu9rkBvV5vh2x0Yv2+6KKQcpDO+CJ
 WnrBiqe50jhrOU4Gw3RzB5A4Umbtud/o22WtE+PdBm8rBM0yyM2A0f/8pIvYXUE7
 8vqJG8dZwaqwnMQ0XjfJr/vxdjKHVSJ8ySZ+8FVwj7hZGbOdvhOsaRL7vwdO8GH4
 NK2sKHvf4AniZBykjhJBlun9ht7sA==
X-ME-Sender: <xms:kSuiXBf5vj0dt2TUNYBZCGpBfYm_9wsJ2AX9KfnY7QJ72wpij-ErWA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrleeggdekhecutefuodetggdotefrodftvf
 curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
 uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc
 fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs
 ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph
 epjeejrddufeegrddvtdefrddukeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhho
 mhgrshesmhhonhhjrghlohhnrdhnvghtnecuvehluhhsthgvrhfuihiivgeptd
X-ME-Proxy: <xmx:kSuiXAtVMDTdV_7uHi6n2lfhnGXsfuNl0q_deIMIaxd4SfVxoFQNHA>
 <xmx:kSuiXILwxbdcRn-FRMniOkt2ivC5S2QbAir0Bdwot8j8ChQYae3HQw>
 <xmx:kSuiXCbm85UesAsiTLhSDirw8QwkXPg5DNRCXogPK-e1oZfZE9Eqlg>
 <xmx:kiuiXJ3TpstEND3Vu0K3Qes7gHV2laFP54iwfhNOtH_TCfyiM9Mwzg>
Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id DDD0210391;
 Mon,  1 Apr 2019 11:17:36 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: gaetan.rivet@6wind.com, Ferruh Yigit <ferruh.yigit@intel.com>,
 Andrew Rybchenko <arybchenko@solarflare.com>, dev@dpdk.org
Date: Mon, 01 Apr 2019 17:17:35 +0200
Message-ID: <21018304.OXf2jst79b@xps>
In-Reply-To: <20190401075851.4908488a@shemminger-XPS-13-9360>
References: <20181130002716.27325-1-thomas@monjalon.net>
 <20190401022700.1570-2-thomas@monjalon.net>
 <20190401075851.4908488a@shemminger-XPS-13-9360>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="UTF-8"
Subject: Re: [dpdk-dev] [PATCH v3 1/4] ethdev: simplify port state
	comparisons
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://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Message-ID: <20190401151735.jVs0c5-XoBAH2gSFaq61sZmX3_bELGWR1zL1EfQvTYA@z>

01/04/2019 16:58, Stephen Hemminger:
> On Mon,  1 Apr 2019 04:26:57 +0200
> Thomas Monjalon <thomas@monjalon.net> wrote:
> 
> > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> > index 10bdfb37e..33cffc498 100644
> > --- a/lib/librte_ethdev/rte_ethdev.c
> > +++ b/lib/librte_ethdev/rte_ethdev.c
> > @@ -330,8 +330,7 @@ uint16_t
> >  rte_eth_find_next(uint16_t port_id)
> >  {
> >  	while (port_id < RTE_MAX_ETHPORTS &&
> > -	       rte_eth_devices[port_id].state != RTE_ETH_DEV_ATTACHED &&
> > -	       rte_eth_devices[port_id].state != RTE_ETH_DEV_REMOVED)
> > +			rte_eth_devices[port_id].state == RTE_ETH_DEV_UNUSED)
> 
> For some applications that iterate over ports this is a hot path.

Really?

> What about keeping an unused port bit mask and using ffs (in the future)?

I don't understand your proposal. Please could you elaborate?

Do you agree on this patch anyway?