From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by dpdk.org (Postfix) with ESMTP id 850468E6F for ; Fri, 25 Sep 2015 19:48:03 +0200 (CEST) Received: by pacfv12 with SMTP id fv12so113718725pac.2 for ; Fri, 25 Sep 2015 10:48:02 -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=+o7ZAlowl3zYFNWEujWVfapNkSqfh/ZYZJ5vXySyulU=; b=Vxx2kkUzQvSuKWTTiVFN1lNbpu65HrqscpGtwA0NVEvq/ifoFmoyQ4kOjTHa0amViT rIaiVK5Sop2WhS0EpNa/Mc3EYHEeAt2DlzD/7YxSB9ct6zkk5vI9tDTVkrKGPqK89/IV oMSM/ImlSyluwgpZDNJEJ3WthilimwwBfWK3zHmFd+tVLfzrlQ96ekx/pNKgVL0Wxlhb JLaM5qMcAmh77IQWkyJesKVStZX41mhQzDYOMTUWejVBi2WspJs4iJ+nl9MiU10cB2V3 +9Bjt8T16kg2EdCDvG7P38+FOA5uVzT6jGiVqsQ6k+6B46kaN2DVu1+5qL/rZx1USqs0 gDNQ== X-Gm-Message-State: ALoCoQl0PfSMWh+9130nudfVxueZfvyw1qf/wRVf0gwPWIyt9SVlf93O9O9YXtv0mmsz/SEzK1IM X-Received: by 10.68.227.227 with SMTP id sd3mr8960248pbc.116.1443203282818; Fri, 25 Sep 2015 10:48:02 -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 pk2sm5017382pbb.21.2015.09.25.10.48.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Sep 2015 10:48:02 -0700 (PDT) Date: Fri, 25 Sep 2015 10:48:10 -0700 From: Stephen Hemminger To: "Xie, Huawei" Message-ID: <20150925104810.2b0f0183@urahara> In-Reply-To: References: <1442806742-32547-1-git-send-email-huawei.xie@intel.com> <20150924093617.6fd22053@urahara> <20150924140150.5941e4a6@urahara> 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: Fri, 25 Sep 2015 17:48:03 -0000 On Fri, 25 Sep 2015 15:46:34 +0000 "Xie, Huawei" wrote: > On 9/25/2015 5:01 AM, Stephen Hemminger wrote: > > On Thu, 24 Sep 2015 18:35:37 +0000 > > "Xie, Huawei" wrote: > > > >> On 9/25/2015 12:36 AM, Stephen Hemminger wrote: > >>> 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. > >> Agree. > >> Using standard Linux includes then at least we don't need to redefine > >> the feature and other related MACRO. > >> This applies to vhost as well. > >> For vring, vring_init, we could also reuse the linux implementation > >> unless we have strong reason to define our own structure. > >> One reason was to support both FreeBSD and Linux. FreeBSD should have > >> its own header file. To avoid the case they have different vring > >> structure or VIRTIO_F_xx macro name, they are redefined here. > >> > > The Linux headers for virtio are explictly BSD licensed. > > You could at least just have a local copy of same code. > > > Exactly the same code (if no dependency and no other issue) or copy and > convert it to DPDK style? By DPDK style, i mean like using RTE_ALIGN macro. No. keep the Linux code as is. Just copy the headers. Don't introduce DPDK style.