From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by dpdk.org (Postfix) with ESMTP id A19703798 for ; Mon, 1 Apr 2019 18:07:50 +0200 (CEST) Received: by mail-pl1-f196.google.com with SMTP id m10so4710135plt.10 for ; Mon, 01 Apr 2019 09:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2aW/BSotuPz4ZLOigz0u7pYeVmXvpTnqAfhumieNBXA=; b=RiCETcZuyhLVxd42vReprUAijQAbOsM2urBpXy8x1KxI+8n3U8JQZkXdFBQDykhVUh eDgPQpr2/D7GGZoO0+eUGmhckcsIATN4XQM9WmiXowPhtZGFet9CMuRlXR43EfVGuFW0 Q4xoGZUUtlUySN2YDBFfGd0n2Ys0hgOe4h3LiL4k9UnvzyJgP3ik6SgUK5yk6KzE0Mvh DEIQQ3I+yPdgr0ERGG0PoKdXO7f3JWalu8+O4QzWbhQ7lDK5QRPCnUlRRbvoPrm5/Cxl m7OSltte9y2Ac3aVuaw66RsHKPWQwKQ1vXo5xKbPs5DdPhB78lfowADWojU4q/rC3b81 PuZQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=2aW/BSotuPz4ZLOigz0u7pYeVmXvpTnqAfhumieNBXA=; b=RqVZGBAAYRw9HXAp7jZs7ZUiUn2DzUxw/sdnN+3A8/a3TJVb1XMUSxAkAgblIeOz8q SPq3vcql+4Ym6Ga0NXHyh3wn5JD15VSZtc32mJVJ6hq6u+42Hu5sfGEFNgIwwD2Qvufv QG/w5AwJWkCixEY4tGmdHzlYZzxqzhNOJllbavKZANoiE0Fsmljr3ASuEuPop1NKL8A1 nHph+thc696rBoQtLLy6j/YL4gquv5LGdCgJcSq3Me04wGO2rzq3qLpLV+e1oZB61/Qg /ZpBHVPJ/kxBivAMQHPSD0EttpE1WGkBdLuWkE1gAoENVFK5hribeah1hNTBgGTy0tCR 1VZg== X-Gm-Message-State: APjAAAXFxSW1jEM57BqXAZQJR9qPJdOMSxO99jgIWZ5SGDvQ0ApG6hHA Ml1Igx4DzINBAJNK+Sxfs3dTZQ== X-Google-Smtp-Source: APXvYqwLWs8BDgNdv4FO4xYqxDccGfHGry4j/gvzbK6VeCmEnHC46D4fT17xAsad3iAj3QH23YOf6g== X-Received: by 2002:a17:902:9a98:: with SMTP id w24mr64132527plp.247.1554134869234; Mon, 01 Apr 2019 09:07:49 -0700 (PDT) Received: from shemminger-XPS-13-9360 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id 75sm18029878pfr.55.2019.04.01.09.07.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Apr 2019 09:07:49 -0700 (PDT) Date: Mon, 1 Apr 2019 09:07:45 -0700 From: Stephen Hemminger To: Thomas Monjalon Cc: gaetan.rivet@6wind.com, Ferruh Yigit , Andrew Rybchenko , dev@dpdk.org Message-ID: <20190401090745.48f23209@shemminger-XPS-13-9360> In-Reply-To: <21018304.OXf2jst79b@xps> References: <20181130002716.27325-1-thomas@monjalon.net> <20190401022700.1570-2-thomas@monjalon.net> <20190401075851.4908488a@shemminger-XPS-13-9360> <21018304.OXf2jst79b@xps> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Apr 2019 16:07:51 -0000 On Mon, 01 Apr 2019 17:17:35 +0200 Thomas Monjalon wrote: > 01/04/2019 16:58, Stephen Hemminger: > > On Mon, 1 Apr 2019 04:26:57 +0200 > > Thomas Monjalon 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? I have seen some applications spend lots of time doing: RTE_ETH_FOREACH_DEV(portid) { If ethdev kept a bitmask for unused ports then it could use the find first set instruction. Maybe the better way is to just fix the application to use its own bitmask of ports instead. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id F2A5DA0679 for ; Mon, 1 Apr 2019 18:07:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C7F204D3A; Mon, 1 Apr 2019 18:07:51 +0200 (CEST) Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by dpdk.org (Postfix) with ESMTP id A19703798 for ; Mon, 1 Apr 2019 18:07:50 +0200 (CEST) Received: by mail-pl1-f196.google.com with SMTP id m10so4710135plt.10 for ; Mon, 01 Apr 2019 09:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2aW/BSotuPz4ZLOigz0u7pYeVmXvpTnqAfhumieNBXA=; b=RiCETcZuyhLVxd42vReprUAijQAbOsM2urBpXy8x1KxI+8n3U8JQZkXdFBQDykhVUh eDgPQpr2/D7GGZoO0+eUGmhckcsIATN4XQM9WmiXowPhtZGFet9CMuRlXR43EfVGuFW0 Q4xoGZUUtlUySN2YDBFfGd0n2Ys0hgOe4h3LiL4k9UnvzyJgP3ik6SgUK5yk6KzE0Mvh DEIQQ3I+yPdgr0ERGG0PoKdXO7f3JWalu8+O4QzWbhQ7lDK5QRPCnUlRRbvoPrm5/Cxl m7OSltte9y2Ac3aVuaw66RsHKPWQwKQ1vXo5xKbPs5DdPhB78lfowADWojU4q/rC3b81 PuZQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=2aW/BSotuPz4ZLOigz0u7pYeVmXvpTnqAfhumieNBXA=; b=RqVZGBAAYRw9HXAp7jZs7ZUiUn2DzUxw/sdnN+3A8/a3TJVb1XMUSxAkAgblIeOz8q SPq3vcql+4Ym6Ga0NXHyh3wn5JD15VSZtc32mJVJ6hq6u+42Hu5sfGEFNgIwwD2Qvufv QG/w5AwJWkCixEY4tGmdHzlYZzxqzhNOJllbavKZANoiE0Fsmljr3ASuEuPop1NKL8A1 nHph+thc696rBoQtLLy6j/YL4gquv5LGdCgJcSq3Me04wGO2rzq3qLpLV+e1oZB61/Qg /ZpBHVPJ/kxBivAMQHPSD0EttpE1WGkBdLuWkE1gAoENVFK5hribeah1hNTBgGTy0tCR 1VZg== X-Gm-Message-State: APjAAAXFxSW1jEM57BqXAZQJR9qPJdOMSxO99jgIWZ5SGDvQ0ApG6hHA Ml1Igx4DzINBAJNK+Sxfs3dTZQ== X-Google-Smtp-Source: APXvYqwLWs8BDgNdv4FO4xYqxDccGfHGry4j/gvzbK6VeCmEnHC46D4fT17xAsad3iAj3QH23YOf6g== X-Received: by 2002:a17:902:9a98:: with SMTP id w24mr64132527plp.247.1554134869234; Mon, 01 Apr 2019 09:07:49 -0700 (PDT) Received: from shemminger-XPS-13-9360 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id 75sm18029878pfr.55.2019.04.01.09.07.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Apr 2019 09:07:49 -0700 (PDT) Date: Mon, 1 Apr 2019 09:07:45 -0700 From: Stephen Hemminger To: Thomas Monjalon Cc: gaetan.rivet@6wind.com, Ferruh Yigit , Andrew Rybchenko , dev@dpdk.org Message-ID: <20190401090745.48f23209@shemminger-XPS-13-9360> In-Reply-To: <21018304.OXf2jst79b@xps> References: <20181130002716.27325-1-thomas@monjalon.net> <20190401022700.1570-2-thomas@monjalon.net> <20190401075851.4908488a@shemminger-XPS-13-9360> <21018304.OXf2jst79b@xps> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190401160745.dWsJXg1vYsGk3M_nEnSmOocvWg0nLVhWhYGNYgGmBJs@z> On Mon, 01 Apr 2019 17:17:35 +0200 Thomas Monjalon wrote: > 01/04/2019 16:58, Stephen Hemminger: > > On Mon, 1 Apr 2019 04:26:57 +0200 > > Thomas Monjalon 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? I have seen some applications spend lots of time doing: RTE_ETH_FOREACH_DEV(portid) { If ethdev kept a bitmask for unused ports then it could use the find first set instruction. Maybe the better way is to just fix the application to use its own bitmask of ports instead.