Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1701511imu; Sat, 8 Dec 2018 05:36:26 -0800 (PST) X-Google-Smtp-Source: AFSGD/VPl0W20UBfHdYr3Icb9Ddxt6VXdbYPXBgk/4R7zbUnkjFPFel187uwG+Z+mSMRhdoU3aGf X-Received: by 2002:a17:902:4503:: with SMTP id m3mr5816699pld.23.1544276186758; Sat, 08 Dec 2018 05:36:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544276186; cv=none; d=google.com; s=arc-20160816; b=IIlCTQDIXUfYeTaAskyIgx1wtJGNiCgXC74ZIvyPmukXFaDS+GH6ewatv0D4dSgD33 I9O5C/ecFVzV2Aaa0Exg7lvKwPa/95WbyjR6K1EWGtY4ipYMAJgMfuVUrYgPpRa3UtSN z+IsR2N1t8C4C2/Ci5vRJ0if1rEMDdJmwdol5INISW+Faou3Hhje0JmYTJR8pNPBAGId ioVdYfZ9ihLgwm0Y8dteXCGqNeU8k2PnZCpYHa7/ZsoNqzg0evIR9QGgFFuuDif3DKZc drnaLAkiri91nGqSetU+9kaZ4mD8Ty7zhUGSOJyLcABEZWLuzk6bJMcVUVRJeQZMaXWA Se6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=xxv3WM2vMH/qEUzX6CoBpIrKYg0/ATDW2jCzzv/bYnA=; b=gCfCQdEy5XNILMmgi19iVzrNYR5QhJ/HVm9A2ycaAsmIfcmz7cJ/X62BZqdUZLRskd jC3sQMTyhCcOYKk98MrszQmVrbH7QmdY/X4azkmfprv4zPALcku9Fm3OmYzngNS7cK6z 7qC+5EXUzEWunjTORGkDK7kbe18scNsvipyPqgGxPMqHVIUtoOWyAFUj63sgtON6whIL xbfPKwhnYt5rIhskU1+MUHduru9M2QBrRKGWEwA4LoCb8JodG6dxuOvA8A+ZNkQKn5VH 3yOjZZJ539flyUbtLO/uFyJFkG3NcA5chm+rYlR+P5x/AwmlKRJPAUnjprSmrd6F0FQK 8Jnw== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d92si5783164pld.45.2018.12.08.05.36.09; Sat, 08 Dec 2018 05:36:26 -0800 (PST) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726161AbeLHNfc (ORCPT + 99 others); Sat, 8 Dec 2018 08:35:32 -0500 Received: from mga14.intel.com ([192.55.52.115]:41436 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726121AbeLHNfc (ORCPT ); Sat, 8 Dec 2018 08:35:32 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Dec 2018 05:35:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,330,1539673200"; d="scan'208";a="128248266" Received: from btwcube1.sh.intel.com (HELO dpdk-tbie) ([10.67.104.173]) by fmsmga001.fm.intel.com with ESMTP; 08 Dec 2018 05:35:30 -0800 Date: Sat, 8 Dec 2018 21:33:37 +0800 From: Tiwei Bie To: "Michael S. Tsirkin" 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, maxime.coquelin@redhat.com Subject: Re: [RFC 2/3] virtio_ring: add VIRTIO_RING_NO_LEGACY Message-ID: <20181208133337.GB29772@dpdk-tbie> References: <20181207084842.13133-1-tiwei.bie@intel.com> <20181207084842.13133-3-tiwei.bie@intel.com> <20181207130336-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181207130336-mutt-send-email-mst@kernel.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 07, 2018 at 01:05:35PM -0500, Michael S. Tsirkin wrote: > On Fri, Dec 07, 2018 at 04:48:41PM +0800, Tiwei Bie wrote: > > Introduce VIRTIO_RING_NO_LEGACY to support disabling legacy > > macros and layout definitions. > > > > Suggested-by: Michael S. Tsirkin > > Signed-off-by: Tiwei Bie > > --- > > VRING_AVAIL_ALIGN_SIZE, VRING_USED_ALIGN_SIZE and VRING_DESC_ALIGN_SIZE > > are not pre-virtio 1.0, but can also be disabled by VIRTIO_RING_NO_LEGACY > > in this patch, because their names are not consistent with other names. > > Not sure whether this is a good idea. If we want this, we may also want > > to define _SPLIT_ version for them. > > I don't think it's a good idea to have alignment in there - the point of > NO_LEGACY is to help catch bugs not to sanitize coding style IMHO. > > And spec calls "legacy" the 0.X interfaces, let's not muddy the waters. Make sense. Thanks! > > > > > include/uapi/linux/virtio_ring.h | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h > > index 9b0c0d92ab62..192573827850 100644 > > --- a/include/uapi/linux/virtio_ring.h > > +++ b/include/uapi/linux/virtio_ring.h > > @@ -37,6 +37,7 @@ > > #include > > #include > > > > +#ifndef VIRTIO_RING_NO_LEGACY > > /* > > * Notice: unlike other _F_ flags, below flags are defined as shifted > > * values instead of shifts for compatibility. > > @@ -51,6 +52,7 @@ > > #define VRING_USED_F_NO_NOTIFY 1 > > /* Same as VRING_SPLIT_AVAIL_F_NO_INTERRUPT. */ > > #define VRING_AVAIL_F_NO_INTERRUPT 1 > > +#endif /* VIRTIO_RING_NO_LEGACY */ > > > > /* Mark a buffer as continuing via the next field in split ring. */ > > #define VRING_SPLIT_DESC_F_NEXT 0 > > @@ -151,6 +153,7 @@ struct vring { > > struct vring_used *used; > > }; > > > > +#ifndef VIRTIO_RING_NO_LEGACY > > /* Alignment requirements for vring elements. > > * When using pre-virtio 1.0 layout, these fall out naturally. > > */ > > @@ -203,6 +206,7 @@ static inline unsigned vring_size(unsigned int num, unsigned long align) > > + align - 1) & ~(align - 1)) > > + sizeof(__virtio16) * 3 + sizeof(struct vring_used_elem) * num; > > } > > +#endif /* VIRTIO_RING_NO_LEGACY */ > > > > /* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */ > > /* Assuming a given event_idx value from the other side, if > > -- > > 2.17.1