* [dpdk-dev] [PATCH] vhost: fix return value
@ 2018-07-25 8:21 Jiayu Hu
2018-07-25 9:16 ` Jens Freimann
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jiayu Hu @ 2018-07-25 8:21 UTC (permalink / raw)
To: dev; +Cc: tiwei.bie, zhihong.wang, maxime.coquelin, lei.a.yao, Jiayu Hu
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 <jiayu.hu@intel.com>
---
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] vhost: fix return value
2018-07-25 8:21 [dpdk-dev] [PATCH] vhost: fix return value Jiayu Hu
@ 2018-07-25 9:16 ` Jens Freimann
2018-07-26 1:55 ` Tiwei Bie
2018-07-26 8:55 ` Tiwei Bie
2 siblings, 0 replies; 4+ messages in thread
From: Jens Freimann @ 2018-07-25 9:16 UTC (permalink / raw)
To: Jiayu Hu; +Cc: dev, tiwei.bie, zhihong.wang, maxime.coquelin, lei.a.yao
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 <jfreiman@redhat.com>
regards,
Jens
>
>Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
>---
> 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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] vhost: fix return value
2018-07-25 8:21 [dpdk-dev] [PATCH] vhost: fix return value Jiayu Hu
2018-07-25 9:16 ` Jens Freimann
@ 2018-07-26 1:55 ` Tiwei Bie
2018-07-26 8:55 ` Tiwei Bie
2 siblings, 0 replies; 4+ messages in thread
From: Tiwei Bie @ 2018-07-26 1:55 UTC (permalink / raw)
To: Jiayu Hu; +Cc: dev, zhihong.wang, maxime.coquelin, lei.a.yao
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")
>
> Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Acked-by: Tiwei Bie <tiwei.bie@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] vhost: fix return value
2018-07-25 8:21 [dpdk-dev] [PATCH] vhost: fix return value Jiayu Hu
2018-07-25 9:16 ` Jens Freimann
2018-07-26 1:55 ` Tiwei Bie
@ 2018-07-26 8:55 ` Tiwei Bie
2 siblings, 0 replies; 4+ messages in thread
From: Tiwei Bie @ 2018-07-26 8:55 UTC (permalink / raw)
To: Jiayu Hu; +Cc: dev, zhihong.wang, maxime.coquelin, lei.a.yao
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")
>
> Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Applied to dpdk-next-virtio/master, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-07-26 8:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-25 8:21 [dpdk-dev] [PATCH] vhost: fix return value Jiayu Hu
2018-07-25 9:16 ` Jens Freimann
2018-07-26 1:55 ` Tiwei Bie
2018-07-26 8:55 ` Tiwei Bie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).