Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5676598imm; Wed, 12 Sep 2018 09:24:39 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYXEtSpkqlhR9dR8tRlPQ1+qormt0H4HlgAKx8JMmq9boce0NACky6bsxSNCdoC4O6LbUOl X-Received: by 2002:a17:902:468:: with SMTP id 95-v6mr3095053ple.122.1536769479146; Wed, 12 Sep 2018 09:24:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536769479; cv=none; d=google.com; s=arc-20160816; b=Jb6WSOwKuUTGPRLYTD1NJxa5C947XEgx7Gz6zvDSMUYmiVjnAwAarzolP50hLtf4Mf B7aZ7uFBfZB6KWPMGs1FEEh574QwkvAcrySlWwlh4gsogRoH575U8pmA3qHOOuQ6WQ3V AZ0uhLwocJd7/HV+ux9aPOrh+EKpeBL+z6x9hFgTThA9MaRh7ZYEA2kxSdmo5jfBlMnW wnXwjr2x9GzsOhakmhDE1VSSzPN0ly2/dd51Q8Ypoqc9VFokrLgh0dhutrMgml+PnFs1 GA1GgyJw5wYbUPPS0ZspXHc3GgIHRffrMwUSo1Vdg/OFV8uPjBXKil6Cvq/0n3bU17s6 PAwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=3nmTrFd4awZ6BS6CSAyLyRIZwVx+XfGJPe121xPtb8g=; b=Jx8t9/+0M+WnaOi5npkuo9dmbfeQtA/4Pq4J808tsd6J1+yV1sLCDNW2ko9AJisvDM WGUhm6+c3XhcltnkJJnOT+GC5U65XLzw6nzazG+WgLRJFORZ3qhkjKH8g1wfNJV9FGyP 1CtHU/c4w5IVkv761E8O6IKXC/i+wvl52dlTrUr7F9A1RFJOps4h8JoCkOwIIqjcgXiZ WftwJeNfTp73J4/pk8wQmM6tzwt1WQ3lwnzIda/AO7nL4oUDg2TO/4UZJ6TgICdqx+os QVIs3ec4+/UOajsTpLEeSJ54BNruB11BCFFonhBGF3Rhafx8WCOch36pYWaVV6YF7p/N +HBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c22-v6si1395060pgk.237.2018.09.12.09.24.16; Wed, 12 Sep 2018 09:24:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728046AbeILV1m (ORCPT + 99 others); Wed, 12 Sep 2018 17:27:42 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37948 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726855AbeILV1m (ORCPT ); Wed, 12 Sep 2018 17:27:42 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B568940241C8; Wed, 12 Sep 2018 16:22:25 +0000 (UTC) Received: from redhat.com (ovpn-121-244.rdu2.redhat.com [10.10.121.244]) by smtp.corp.redhat.com (Postfix) with SMTP id 057E62166BA2; Wed, 12 Sep 2018 16:22:22 +0000 (UTC) Date: Wed, 12 Sep 2018 12:22:22 -0400 From: "Michael S. Tsirkin" To: Tiwei Bie Cc: jasowang@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, virtio-dev@lists.oasis-open.org, wexu@redhat.com, jfreimann@redhat.com Subject: Re: [PATCH net-next v2 3/5] virtio_ring: add packed ring support Message-ID: <20180912121650-mutt-send-email-mst@kernel.org> References: <20180711022711.7090-1-tiwei.bie@intel.com> <20180711022711.7090-4-tiwei.bie@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180711022711.7090-4-tiwei.bie@intel.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 12 Sep 2018 16:22:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 12 Sep 2018 16:22:25 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 11, 2018 at 10:27:09AM +0800, Tiwei Bie wrote: > This commit introduces the support (without EVENT_IDX) for > packed ring. > > Signed-off-by: Tiwei Bie > --- > drivers/virtio/virtio_ring.c | 495 ++++++++++++++++++++++++++++++++++- > 1 file changed, 487 insertions(+), 8 deletions(-) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index c4f8abc7445a..f317b485ba54 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -55,12 +55,21 @@ > #define END_USE(vq) > #endif > > +#define _VRING_DESC_F_AVAIL(b) ((__u16)(b) << 7) > +#define _VRING_DESC_F_USED(b) ((__u16)(b) << 15) > + > struct vring_desc_state { > void *data; /* Data for callback. */ > struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ > }; > > struct vring_desc_state_packed { > + void *data; /* Data for callback. */ > + struct vring_packed_desc *indir_desc; /* Indirect descriptor, if any. */ > + int num; /* Descriptor list length. */ > + dma_addr_t addr; /* Buffer DMA addr. */ > + u32 len; /* Buffer length. */ > + u16 flags; /* Descriptor flags. */ > int next; /* The next desc state. */ > }; > Idea: how about using data to chain these descriptors? You can validate it's pointing within an array to distinguish e.g. on detach. -- MST