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 7664DA0679 for ; Mon, 1 Apr 2019 16:58:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 398F03798; Mon, 1 Apr 2019 16:58:58 +0200 (CEST) Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by dpdk.org (Postfix) with ESMTP id CF5B03576 for ; Mon, 1 Apr 2019 16:58:56 +0200 (CEST) Received: by mail-pf1-f193.google.com with SMTP id i17so4705965pfo.6 for ; Mon, 01 Apr 2019 07:58:56 -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=VI+GRyp+U3xGKfN/rNlOMKwltxGkE3o1QJqNleRVgd4=; b=kqGEsnH8wJX39GvJTfdw0CjRioUcHPN5BWl17rKPaNKIrrUDkJxqALG3WtEcw4daJw 4VejrfkQZvE0oDZrs5CDlnVWchMJJ96d6zkn1DSlLyWQTFht2U+QVEXroi1e/IZIAK00 hgMZTbL/hgeMLz2FnTRLE74fM9Jb84jpwjJCoLn5zcJa1D+6Ol0D2phIrqubGDkgqE7U dM0tSd26AikxDscIQJ9UNJbvj/1y+SXFJ3XO38WFbYLLlNAVU05bL3rL345IVwL0J5bd sTwjhZ0V+FYrjvoG4cuGhrMglCa9IrVs2s3e7Iqm6JzkmMyAdl1OektDHyDDZzKoVIGG owVg== 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=VI+GRyp+U3xGKfN/rNlOMKwltxGkE3o1QJqNleRVgd4=; b=II86404+BY5/Ud9HgHEFLFodprQOUeg3G0H8lcBIPr2EXJnU8g1blJW7foZ/pNj9Bi nCADg0TSD3HIoU4litUZCdNvs3UwiqULDZo+WFfjcTTPzbQKOAHSLYKkEllVEU50dhIQ MXjxmuNGVoq15MBQHYYnDgLHkYZgFFdScaGb7NI+wWsU7pEjMAlkMQ1cXrrBO/dna0MO rFaZu7zai1l3/ulLf7h0pVV1EM6a+sYdVminxQTFH64CJxz5dojUPtGKCmMuWYk5Tofi 3wwmcQT2QWcxheq2F6/KBGJeqORMp3HW945pYTn+cdCICSzZwuNBIJftsUyfxcjdhvyZ KPNg== X-Gm-Message-State: APjAAAV7IEL4aS4glG6vPcYt3CA2mZdfDIGP3Cp9UMI1F8iEkf6SAZ7S TCmvNoH5KrfsrLn6BmSfoCIyZQ== X-Google-Smtp-Source: APXvYqxJtE+ek+qXKPUpTEOK0TmpWCVZgYhYfCVn+gV954DUjJZODNNc55re1KpQHtWjhVhTjoQKwQ== X-Received: by 2002:a62:1b03:: with SMTP id b3mr58858333pfb.150.1554130735517; Mon, 01 Apr 2019 07:58:55 -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 s19sm16207800pfe.74.2019.04.01.07.58.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Apr 2019 07:58:55 -0700 (PDT) Date: Mon, 1 Apr 2019 07:58:51 -0700 From: Stephen Hemminger To: Thomas Monjalon Cc: gaetan.rivet@6wind.com, Ferruh Yigit , Andrew Rybchenko , dev@dpdk.org Message-ID: <20190401075851.4908488a@shemminger-XPS-13-9360> In-Reply-To: <20190401022700.1570-2-thomas@monjalon.net> References: <20181130002716.27325-1-thomas@monjalon.net> <20190401022700.1570-1-thomas@monjalon.net> <20190401022700.1570-2-thomas@monjalon.net> 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: <20190401145851.E6NH1P6jMhXmsE7L3hK1y1k3yph-LaPHBTvddEF1Zm0@z> 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. What about keeping an unused port bit mask and using ffs (in the future)?