From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 588102B83 for ; Wed, 15 Aug 2018 05:12:37 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Aug 2018 20:12:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,241,1531810800"; d="scan'208";a="63246548" Received: from debian.sh.intel.com (HELO debian) ([10.67.104.194]) by fmsmga008.fm.intel.com with ESMTP; 14 Aug 2018 20:12:25 -0700 Date: Wed, 15 Aug 2018 11:11:44 +0800 From: Tiwei Bie To: Luca Boccassi Cc: dev@dpdk.org, maxime.coquelin@redhat.com, zhihong.wang@intel.com, bruce.richardson@intel.com, Brian Russell Message-ID: <20180815031144.GA7324@debian> References: <20180814143035.19640-1-bluca@debian.org> <20180814143035.19640-2-bluca@debian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180814143035.19640-2-bluca@debian.org> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH 2/2] virtio: fix PCI config err handling 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, 15 Aug 2018 03:12:38 -0000 On Tue, Aug 14, 2018 at 03:30:35PM +0100, Luca Boccassi wrote: > From: Brian Russell > > In virtio_read_caps, rte_pci_read_config returns the number of bytes > read from PCI config or < 0 on error. > If less than the expected number of bytes are read then log the > failure and return rather than carrying on with garbage. Is this a fix or an improvement? Or did you see anything broken without this patch? If so, we may need a fixes line and Cc stable. > > Signed-off-by: Brian Russell > --- > > Follow-up from: > http://mails.dpdk.org/archives/dev/2017-June/067278.html > https://patches.dpdk.org/patch/25056/ > > drivers/net/virtio/virtio_pci.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c > index 6bd22e54a6..a10698aed8 100644 > --- a/drivers/net/virtio/virtio_pci.c > +++ b/drivers/net/virtio/virtio_pci.c > @@ -567,16 +567,18 @@ virtio_read_caps(struct rte_pci_device *dev, struct virtio_hw *hw) > } > > ret = rte_pci_read_config(dev, &pos, 1, PCI_CAPABILITY_LIST); > - if (ret < 0) { > - PMD_INIT_LOG(DEBUG, "failed to read pci capability list"); > + if (ret != 1) { > + PMD_INIT_LOG(DEBUG, > + "failed to read pci capability list, ret %d", ret); > return -1; > } > > while (pos) { > ret = rte_pci_read_config(dev, &cap, sizeof(cap), pos); > - if (ret < 0) { > - PMD_INIT_LOG(ERR, > - "failed to read pci cap at pos: %x", pos); > + if (ret != sizeof(cap)) { > + PMD_INIT_LOG(DEBUG, Why change the log level to DEBUG? Thanks > + "failed to read pci cap at pos: %x ret %d", > + pos, ret); > break; > } > > -- > 2.18.0 >