From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by dpdk.org (Postfix) with ESMTP id 24FB2235 for ; Wed, 25 Jul 2018 11:16:31 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5A7FA401DEAB; Wed, 25 Jul 2018 09:16:30 +0000 (UTC) Received: from localhost (dhcp-192-225.str.redhat.com [10.33.192.225]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D530B2026D68; Wed, 25 Jul 2018 09:16:29 +0000 (UTC) Date: Wed, 25 Jul 2018 11:16:28 +0200 From: Jens Freimann To: Jiayu Hu Cc: dev@dpdk.org, tiwei.bie@intel.com, zhihong.wang@intel.com, maxime.coquelin@redhat.com, lei.a.yao@intel.com Message-ID: <20180725091628.2okgfghweto5aip2@jenstp.localdomain> References: <1532506902-98105-1-git-send-email-jiayu.hu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <1532506902-98105-1-git-send-email-jiayu.hu@intel.com> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 25 Jul 2018 09:16:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 25 Jul 2018 09:16:30 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jfreimann@redhat.com' RCPT:'' Subject: Re: [dpdk-dev] [PATCH] vhost: fix 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, 25 Jul 2018 09:16:31 -0000 On Wed, Jul 25, 2018 at 04:21:42PM +0800, Jiayu Hu wrote: >This patch fixes the incorrect return value for rte_vhost_dequeue_burst() >when virtqueue is not enabled or virtqueue address translation fails. > >Fixes: 62250c1d0978 ("vhost: extract split ring handling from Rx and Tx functions") An alternative would be to add a new variable and not reuse the count parameter as the return value, but your version is the minimal change and fixes the bug, so Reviewed-by: Jens Freimann regards, Jens > >Signed-off-by: Jiayu Hu >--- > lib/librte_vhost/virtio_net.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > >diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c >index 2b7ffcf..5d4b975 100644 >--- a/lib/librte_vhost/virtio_net.c >+++ b/lib/librte_vhost/virtio_net.c >@@ -1592,15 +1592,19 @@ rte_vhost_dequeue_burst(int vid, uint16_t queue_id, > if (unlikely(rte_spinlock_trylock(&vq->access_lock) == 0)) > return 0; > >- if (unlikely(vq->enabled == 0)) >+ if (unlikely(vq->enabled == 0)) { >+ count = 0; > goto out_access_unlock; >+ } > > if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM)) > vhost_user_iotlb_rd_lock(vq); > > if (unlikely(vq->access_ok == 0)) >- if (unlikely(vring_translate(dev, vq) < 0)) >+ if (unlikely(vring_translate(dev, vq) < 0)) { >+ count = 0; > goto out; >+ } > > /* > * Construct a RARP broadcast packet, and inject it to the "pkts" >-- >2.7.4 >