From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 7414958EF for ; Mon, 21 Sep 2015 05:39:12 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 20 Sep 2015 20:39:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,565,1437462000"; d="scan'208";a="773222736" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga001.jf.intel.com with ESMTP; 20 Sep 2015 20:39:10 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t8L3d8TN025024; Mon, 21 Sep 2015 11:39:08 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t8L3d5SW032582; Mon, 21 Sep 2015 11:39:07 +0800 Received: (from hxie5@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t8L3d5UV032578; Mon, 21 Sep 2015 11:39:05 +0800 From: Huawei Xie To: dev@dpdk.org Date: Mon, 21 Sep 2015 11:39:02 +0800 Message-Id: <1442806742-32547-1-git-send-email-huawei.xie@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] virtio: fix used ring address calculation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Sep 2015 03:39:12 -0000 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 --- drivers/net/virtio/virtio_ring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } /* -- 1.9.3