From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by dpdk.org (Postfix) with ESMTP id 8A3FD10A7 for ; Wed, 7 Jun 2017 18:55:22 +0200 (CEST) Received: by mail-wr0-f195.google.com with SMTP id g76so1700607wrd.2 for ; Wed, 07 Jun 2017 09:55:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=KRYJRLF0JLrOW3BOK80rDOmoY8/dlaqJNe4vk20H0M8=; b=DMQy9W4st3jGkGq9Udau4b7XoCy1+6mfJb/aADos9xeDFUCs67pyyOe0YaRel6IaoD c+HG2OjKs9gPaKf+PCXZxlA2rYfTHrMVXk7RVwMeWuOZQN7mEyNag74VQaPK1zp+Ws6v bFBBWt0yhZtrTz93gwYcg0f2npLOhgsKzSAWR93QuKvS/3an4GRcKSob8asKyhCHD9NC qsMtl12z4yhCpiG1huqz/zEXR2icWoBOuqJZAIundty3Q10C6UusYUgXOZhbRowvmulF 4IRtdoOSaK5bilVRDWrRb48DlEX0dUIGimuNjA4CY5iOXOUrJjrG4WxvWXrUr8rbTVwm AMoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=KRYJRLF0JLrOW3BOK80rDOmoY8/dlaqJNe4vk20H0M8=; b=Hpiq6sVnIRZ0Qw0NgFbmmliK36F4X8cEfGEDCDX30BmHOeRufYTlYImx3N7qkc2ZJz aKr8mBLv/Zv+gGUsCVmG90uMp14NFxKCwrBZGftmPnfBjnN5qi/if/IWzxZTWvOfac/9 7Hs2Ins7QeG96HYEA3uz+dM+oganEG0xP53zbfaUjoFa97oK9d1m3aDIfck9MSNwE76Q YwteJFiviFJfGBg2+K1i+vE73BHreS/Hvmvwf+fChdy1liKo8N0qgkOiSKfZ1cPKKMUu R5ex3q7tk6OpwJBQqIxUTaOlxSdyrRSgLGB5HIV9j7snnlbYDsJ2vpxhn1iVGRtTY3e2 tiew== X-Gm-Message-State: AODbwcCic7+5O1LmGmlVBKEXSC4syxa7eakO+3HYkPs4Co7CWWafAukk VL3dtgQsMdrcCmlKuPYZ/kmpY2W1ae95 X-Received: by 10.223.142.15 with SMTP id n15mr26920264wrb.131.1496854521979; Wed, 07 Jun 2017 09:55:21 -0700 (PDT) MIME-Version: 1.0 Sender: jblunck@gmail.com Received: by 10.28.25.65 with HTTP; Wed, 7 Jun 2017 09:55:21 -0700 (PDT) In-Reply-To: <20170607132742.GP18840@bidouze.vm.6wind.com> References: <33c95f6a-82b4-6557-7011-f210f34cbc88@nxp.com> <20170607132742.GP18840@bidouze.vm.6wind.com> From: Jan Blunck Date: Wed, 7 Jun 2017 18:55:21 +0200 X-Google-Sender-Auth: 7l8KLNTXSeXIuj35k5PmieSBy-4 Message-ID: To: =?UTF-8?Q?Ga=C3=ABtan_Rivet?= Cc: Shreyansh Jain , dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v2 01/11] bus: add bus iterator to find a particular bus 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: Wed, 07 Jun 2017 16:55:22 -0000 On Wed, Jun 7, 2017 at 3:27 PM, Ga=C3=ABtan Rivet = wrote: > On Wed, Jun 07, 2017 at 12:36:53PM +0530, Shreyansh Jain wrote: >> >diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/c= ommon/include/rte_bus.h >> >index 7c36969..006feca 100644 >> >--- a/lib/librte_eal/common/include/rte_bus.h >> >+++ b/lib/librte_eal/common/include/rte_bus.h >> >@@ -141,6 +141,38 @@ int rte_bus_probe(void); >> > void rte_bus_dump(FILE *f); >> > /** >> >+ * Bus match function. >> >+ * >> >+ * @param bus >> >+ * bus under test. >> >+ * >> >+ * @param data >> >+ * data matched >> >+ * >> >+ * @return >> >+ * 0 if the bus does not match. >> >+ * !0 if the bus matches. >> >> One of the common match function implementation could be simply to match >> a string. strcmp itself returns '0' for a successful match. >> On the same lines, should this function return value be reversed? >> - >> 0 if match >> !0 if not a match >> - >> That way, people would not have to change either the way strcmp works, >> for example, or the way various APIs expect '0' as success. >> >> same for rte_device_match_t as well. (in next patch) >> > > It was actually a point I hesitated a little before submitting this > version. > > The logic behind strcmp is that you can express three states: greater > than, equal, lower than, thus having total order within the string set. > > Here, buses are not ordered (logically). Having a bus lower or greater > than some arbitrary data does not mean much. > > Anyway, this was my reasoning for following Jan's proposal on this, but > I'm not against changing this API. Maybe having to possibility to > express total order could be useful eventually. I don't have a strong > opinion on this so unless someone shouts about it, I will follow your > remark. > It is better to have consistency on the match/comparator behavior. Also if it comes as a surprise to users lets change it.