From mboxrd@z Thu Jan 1 00:00:00 1970 From: Luca Boccassi Subject: Re: [PATCH v6 1/2] bus/pci: harmonize and document rte_pci_read_config return value Date: Wed, 17 Oct 2018 10:58:58 +0100 Message-ID: <1539770338.25451.7.camel@debian.org> References: <20180827165240.28322-1-bluca@debian.org> <20180828101240.12597-1-bluca@debian.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Cc: bruce.richardson@intel.com To: dev@dpdk.org Return-path: Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id F2A701B10E for ; Wed, 17 Oct 2018 11:59:01 +0200 (CEST) Received: by mail-wm1-f66.google.com with SMTP id 143-v6so1354904wmf.1 for ; Wed, 17 Oct 2018 02:59:01 -0700 (PDT) In-Reply-To: <20180828101240.12597-1-bluca@debian.org> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, 2018-08-28 at 11:12 +0100, Luca Boccassi wrote: > On Linux, rte_pci_read_config on success returns the number of read > bytes, but on BSD it returns 0. > Document the return values, and have BSD behave as Linux does. >=20 > At least one case (bnx2x PMD) treats 0 as an error, so the change > makes sense also for that. >=20 > Signed-off-by: Luca Boccassi > --- > =C2=A0drivers/bus/pci/bsd/pci.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0| 4 +++- > =C2=A0drivers/bus/pci/rte_bus_pci.h | 2 ++ > =C2=A02 files changed, 5 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c > index 655b34b7e4..175d83cf1b 100644 > --- a/drivers/bus/pci/bsd/pci.c > +++ b/drivers/bus/pci/bsd/pci.c > @@ -439,6 +439,8 @@ int rte_pci_read_config(const struct > rte_pci_device *dev, > =C2=A0{ > =C2=A0 int fd =3D -1; > =C2=A0 int size; > + /* Copy Linux implementation's behaviour */ > + const int return_len =3D len; > =C2=A0 struct pci_io pi =3D { > =C2=A0 .pi_sel =3D { > =C2=A0 .pc_domain =3D dev->addr.domain, > @@ -469,7 +471,7 @@ int rte_pci_read_config(const struct > rte_pci_device *dev, > =C2=A0 } > =C2=A0 close(fd); > =C2=A0 > - return 0; > + return return_len; > =C2=A0 > =C2=A0 error: > =C2=A0 if (fd >=3D 0) > diff --git a/drivers/bus/pci/rte_bus_pci.h > b/drivers/bus/pci/rte_bus_pci.h > index 0d1955ffe0..df8f64798d 100644 > --- a/drivers/bus/pci/rte_bus_pci.h > +++ b/drivers/bus/pci/rte_bus_pci.h > @@ -219,6 +219,8 @@ void rte_pci_unregister(struct rte_pci_driver > *driver); > =C2=A0 *=C2=A0=C2=A0=C2=A0The length of the data buffer. > =C2=A0 * @param offset > =C2=A0 *=C2=A0=C2=A0=C2=A0The offset into PCI config space > + * @return > + *=C2=A0=C2=A0Number of bytes read on success, negative on error. > =C2=A0 */ > =C2=A0int rte_pci_read_config(const struct rte_pci_device *device, > =C2=A0 void *buf, size_t len, off_t offset); Hi Bruce, Any chance you could please review the small BSD patch above when you have a sec? Thanks! --=20 Kind regards, Luca Boccassi