[dpdk-dev] virtio: fix used ring address calculation

Message ID ED26CBA2FAD1BF48A8719AEF02201E365C801B@SHSMSX103.ccr.corp.intel.com
State Not Applicable, archived
Headers show

Commit Message

Jianfeng Tan Sept. 21, 2015, 9:19 a.m.
-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Huawei Xie
Sent: Monday, September 21, 2015 11:39 AM
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] virtio: fix used ring address calculation

used event idx is put at the end of available ring. It isn't taken into account when we calculate the address of used ring. Fortunately, it doesn't introduce the bug with fixed queue number 256 and 4KB alignment.

Signed-off-by: hxie5 <huawei.xie@intel.com>
---
 drivers/net/virtio/virtio_ring.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--

Acked-by: Jianfeng Tan <Jianfeng.tan@intel.com>

1.9.3

Patch

diff --git a/drivers/net/virtio/virtio_ring.h b/drivers/net/virtio/virtio_ring.h
index a16c499..92e430d 100644
--- a/drivers/net/virtio/virtio_ring.h
+++ b/drivers/net/virtio/virtio_ring.h
@@ -145,7 +145,7 @@  vring_init(struct vring *vr, unsigned int num, uint8_t *p,
 	vr->avail = (struct vring_avail *) (p +
 		num * sizeof(struct vring_desc));
 	vr->used = (void *)
-		RTE_ALIGN_CEIL((uintptr_t)(&vr->avail->ring[num]), align);
+		RTE_ALIGN_CEIL((uintptr_t)(&vr->avail->ring[num + 1]), align);
 }
 
 /*