From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id C981223D for ; Wed, 25 Jul 2018 10:13:12 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2018 01:13:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,400,1526367600"; d="scan'208";a="248173031" Received: from dpdk15.sh.intel.com ([10.67.111.146]) by fmsmga005.fm.intel.com with ESMTP; 25 Jul 2018 01:13:08 -0700 From: Jiayu Hu To: dev@dpdk.org Cc: tiwei.bie@intel.com, zhihong.wang@intel.com, maxime.coquelin@redhat.com, lei.a.yao@intel.com, Jiayu Hu Date: Wed, 25 Jul 2018 16:21:42 +0800 Message-Id: <1532506902-98105-1-git-send-email-jiayu.hu@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [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 08:13:13 -0000 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") 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