From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DE862A034F; Wed, 13 May 2020 14:20:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E6E841D157; Wed, 13 May 2020 14:20:58 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 123242BA2 for ; Wed, 13 May 2020 14:20:56 +0200 (CEST) IronPort-SDR: bYvwluQ4fyw9ZBvKacnTKc/qib8adEyA3JxkdcLh13uyXOhtdC2Je+bbXiZjkSWocZ3KJS1Bfi ds2dn/I9+PAQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2020 05:20:56 -0700 IronPort-SDR: XgMU5+Mo/cQQsDwjYIvmOotFLPUu9JQIC071ET3iTmocgnm8wpWSzAiY/hpRin6mLbHEQ/PI4I rxiqDHDe4CZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,387,1583222400"; d="scan'208";a="251234779" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga007.jf.intel.com with ESMTP; 13 May 2020 05:20:55 -0700 Received: from hasmsx602.ger.corp.intel.com (10.184.107.142) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 13 May 2020 05:20:55 -0700 Received: from hasmsx603.ger.corp.intel.com (10.184.107.143) by HASMSX602.ger.corp.intel.com (10.184.107.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 13 May 2020 15:20:53 +0300 Received: from hasmsx603.ger.corp.intel.com ([10.184.107.143]) by HASMSX603.ger.corp.intel.com ([10.184.107.143]) with mapi id 15.01.1713.004; Wed, 13 May 2020 15:20:53 +0300 From: "Stojaczyk, Dariusz" To: =?Windows-1252?Q?Ga=EBtan_Rivet?= , Stephen Hemminger CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] pci: properly parse 32-bit domain numbers Thread-Index: AQHWKGGinvWB+zv+DUaJnQG/bNsPHqikj9oAgAD4HICAAGf1YA== Date: Wed, 13 May 2020 12:20:52 +0000 Message-ID: <722de9c5da1f464982458b7acc3839ba@intel.com> References: <20200512133057.106374-1-dariusz.stojaczyk@intel.com> <1589307388.25513.0@networkplumber.org> <20200513090429.szotkif776j7ehqf@u256.net> In-Reply-To: <20200513090429.szotkif776j7ehqf@u256.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.2.0.6 dlp-product: dlpe-windows dlp-reaction: no-action x-originating-ip: [163.33.253.164] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] pci: properly parse 32-bit domain numbers 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" > -----Original Message----- > From: Ga=EBtan Rivet > Sent: Wednesday, May 13, 2020 11:04 AM > To: Stephen Hemminger > Cc: Stojaczyk, Dariusz ; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] pci: properly parse 32-bit domain numbers >=20 > [SNIP] >=20 > The original code predates the change from macro in commit c742e8d3110b. >=20 > Fixes: af75078fece3 ("first public release") > Cc: stable@dpdk.org >=20 > Thanks for the fix, > Acked-by: Gaetan Rivet >=20 Yes, I wasn't sure if this is a fix or more of a feature. Well, it *could* = be backported, I guess. D. > > > --- > > > lib/librte_pci/rte_pci.c | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c > > > index d1ab6b414d..ad2cdfebb2 100644 > > > --- a/lib/librte_pci/rte_pci.c > > > +++ b/lib/librte_pci/rte_pci.c > > > @@ -72,9 +72,9 @@ pci_dbdf_parse(const char *input, struct rte_pci_ad= dr > > > *dev_addr) > > > > > > errno =3D 0; > > > val =3D strtoul(in, &end, 16); > > > - if (errno !=3D 0 || end[0] !=3D ':' || val > UINT16_MAX) > > > + if (errno !=3D 0 || end[0] !=3D ':' || val > UINT32_MAX) > > > return -EINVAL; > > > - dev_addr->domain =3D (uint16_t)val; > > > + dev_addr->domain =3D (uint32_t)val; > > > in =3D end + 1; > > > in =3D get_u8_pciaddr_field(in, &dev_addr->bus, ':'); > > > if (in =3D=3D NULL) > > > -- > > > 2.17.1 > > > > > > Agree this came up before on Hyper-V as well. It meant fixing libpci. > > > > Not sure the cast of val is necessary, other than an attempt to silence= some > > static checker > > about implicit type conversion causing loss of precision. > > > > > > > > > >=20 > The cast is useless indeed. Remnants from the original macro. > For now best to leave it as-is, make another patch to remove those > casts. >=20 > There are other potential bugs in parsing, -FFFFFFFFFFFF0001 is > considered valid (-FFFFFFFF00000001 with this patch) as well as an empty > domain. > I will send a fix for those. >=20 > -- > Ga=EBtan