From mboxrd@z Thu Jan 1 00:00:00 1970 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) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:content-transfer-encoding:mime-version; bh=Ral1sNq2Fyv/DaGQ+O7r9E+HQ9pVfwljKK+rG2ub4Gg=; b=mCBxvNFR+8+l4QVrmYiRoMNxZiVXrDI5u3KBYXqcg1lkwVXXUAtJUtK0E9n6JNRAkj 4j+l3UzwifLb7YEnrwGa83X7IM8MGPrEXbBA/jmMB2jdzT9m+Zpxu7nlvZ/T8djfwXW3 Nc7zui4UMwA4OPT69gGjL8QIs5StgwIc+rI569M1dpv/dqm3wDs6K7anSCuhkrfJOLcQ c2d/+ld5u4AccvetHKnCL8UHgcpuBTLIYzJwQdy3cQmgrQ49cclqc0duVPHzNo/pAKva Qe3yIRsGdHETqU2gxWpeONJVji8bmKaWbw2WwI17GChqpkuXTwK9EVQl+xMMVgoLJY8l JVqA== X-Gm-Message-State: ABuFfohogM5Zlb9JaU2si56ugJvAXR2Toaz80PHmzru0vsSwAhOh4kFz 4517JQqLSIsOAFaGhzI4jovf/2gD X-Google-Smtp-Source: ACcGV62hTEVMWWZu/TC0vL8K0rqKIFn6du5Pv9CQcbWtB769MrGjGLSgRijH94pS5gxZn8uZsP545Q== X-Received: by 2002:a1c:2984:: with SMTP id p126-v6mr2205444wmp.5.1539770341138; Wed, 17 Oct 2018 02:59:01 -0700 (PDT) Received: from localhost ([2001:1be0:110d:fcfe:ed7d:79a1:9a42:d85f]) by smtp.gmail.com with ESMTPSA id i15-v6sm15364019wro.58.2018.10.17.02.58.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Oct 2018 02:58:59 -0700 (PDT) Message-ID: <1539770338.25451.7.camel@debian.org> From: Luca Boccassi To: dev@dpdk.org Cc: bruce.richardson@intel.com Date: Wed, 17 Oct 2018 10:58:58 +0100 In-Reply-To: <20180828101240.12597-1-bluca@debian.org> References: <20180827165240.28322-1-bluca@debian.org> <20180828101240.12597-1-bluca@debian.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v6 1/2] bus/pci: harmonize and document rte_pci_read_config return value 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, 17 Oct 2018 09:59:02 -0000 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