DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] virtio: use volatile to get used->idx in the loop
@ 2016-05-24 16:16 Huawei Xie
  2016-05-25  8:25 ` Xie, Huawei
  2016-05-30  8:22 ` Yuanhan Liu
  0 siblings, 2 replies; 14+ messages in thread
From: Huawei Xie @ 2016-05-24 16:16 UTC (permalink / raw)
  To: dev; +Cc: stephen, konstantin.ananyev, thomas.monjalon, Huawei Xie

There is no external function call or any barrier in the loop,
the used->idx would only be retrieved once.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
---
 drivers/net/virtio/virtio_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index c3fb628..f6d6305 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -204,7 +204,8 @@ virtio_send_command(struct virtqueue *vq, struct virtio_pmd_ctrl *ctrl,
 		usleep(100);
 	}
 
-	while (vq->vq_used_cons_idx != vq->vq_ring.used->idx) {
+	while (vq->vq_used_cons_idx !=
+	       *((volatile uint16_t *)(&vq->vq_ring.used->idx))) {
 		uint32_t idx, desc_idx, used_idx;
 		struct vring_used_elem *uep;
 
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-06-14 13:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-24 16:16 [dpdk-dev] [PATCH] virtio: use volatile to get used->idx in the loop Huawei Xie
2016-05-25  8:25 ` Xie, Huawei
2016-05-25  8:34   ` Michael S. Tsirkin
2016-05-25  9:47     ` Bruce Richardson
2016-05-25  9:50       ` Michael S. Tsirkin
2016-05-25 10:00         ` Bruce Richardson
2016-05-25 15:24           ` Xie, Huawei
2016-05-30  8:22 ` Yuanhan Liu
2016-06-01  5:40   ` Xie, Huawei
2016-06-01  6:05     ` Yuanhan Liu
2016-06-02  8:39       ` Xie, Huawei
2016-06-02  8:52         ` Yuanhan Liu
2016-06-02  8:54           ` Xie, Huawei
2016-06-14 13:23             ` Yuanhan Liu

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).