From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by dpdk.org (Postfix) with ESMTP id 3C2578E5D for ; Thu, 24 Sep 2015 18:36:07 +0200 (CEST) Received: by padhy16 with SMTP id hy16so77656448pad.1 for ; Thu, 24 Sep 2015 09:36:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=ICVIvj+mV6TRLxGxSQa4ePEq7SsgxV8aGl5k4rK18SI=; b=SBcP40MwDJa6vqSMw4vevC3W9LWvf/j8+g8Hu95L6LkA/6BzumMCgHHnrepaT1CuQT KZOrBn1RNYaLmt5mQNsET4nh46FHcuL0LOx74HJ8RWd3vfNM3ALlR4Rm0MBOguSoCrpW 0agGhxdb9CBQUZlrA7CXA3GlT1Xp6fCRyUg08HToIO3iCP51nI3wOo6L2w7QOKox0y1u R/Impk/R8tOvrhX7H8WHrUMrV1qBwpCfPAmn2gTqpaKGkCXGIQAlH7e5tJ5fhJpGOC5j wuzjQe3eQuwdVdO+LrC96sOabYeen0H0RaziFmPY+5+40jUVRY0TqN+rY4hkYknuOYgj 8rvA== X-Gm-Message-State: ALoCoQkddEE6YHx0sLTp3weBkDuBxa63rJ/nhTdSUxVDDj8QJfJAO8yTSS9NSKu0Kt3GZ9VwmJTr X-Received: by 10.68.196.99 with SMTP id il3mr725506pbc.166.1443112566362; Thu, 24 Sep 2015 09:36:06 -0700 (PDT) Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id u1sm14495682pbz.56.2015.09.24.09.36.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Sep 2015 09:36:06 -0700 (PDT) Date: Thu, 24 Sep 2015 09:36:17 -0700 From: Stephen Hemminger To: "Xie, Huawei" Message-ID: <20150924093617.6fd22053@urahara> In-Reply-To: References: <1442806742-32547-1-git-send-email-huawei.xie@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" Subject: Re: [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: Thu, 24 Sep 2015 16:36:07 -0000 On Thu, 24 Sep 2015 07:30:41 +0000 "Xie, Huawei" wrote: > On 9/21/2015 11:39 AM, Xie, Huawei wrote: > vring_size calculation should consider both used_event_idx at the tail > of avail ring and avail_event_idx at the tail of used ring. > Will merge those two fixes and send a new patch. > > 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); > > } > > > > /* > Why aren't we just using the standard Linux includes for this? See and the function vring_init() Keeping parallel copies of headers is prone to failures.