Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp869904imu; Fri, 7 Dec 2018 10:09:13 -0800 (PST) X-Google-Smtp-Source: AFSGD/WtZj+E+QSdjkJuYzbEG+zP6HKiTio3Sq10ouCRgOiieIkXuzIn1M2YCiXPxuYMtW7x/vNy X-Received: by 2002:a62:46d0:: with SMTP id o77mr3259509pfi.172.1544206153803; Fri, 07 Dec 2018 10:09:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544206153; cv=none; d=google.com; s=arc-20160816; b=uTjPEagaux3AYUx2a2NHH8cc4EzENQEM3W5sjbL6dMM9QM6ISBlPROSS0+YbldSBun ntmA9R6S+cSu0blrPvkfdj6JrroppFtD3GpkPO2U68pXNVCIkBW7O6zh3B5kVeSFSpzy dLlveGrKpd1yMlN0+dVmgBIGizJkh/nO6i2m5KKhFQTkW0zfn0ycq8MG7gpdCg4pTDeK s7junokKBXlXkHe1oPb/DtlPgTMWULfjY+6p+bT2DquzIb2Z2pgFB46craj5l3npUz5e DsNWpyspp0KW9fniSjbpmcsSUPzyYEEVMgekL3TxBtQBXwGD4NRAMyTbQopp60PKJBpq MiPg== 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=jU+HV8P1E1ZSlubkP9+auDSaL5vlHdvDWsBRkiR2lJc=; b=bY5aPxAEnHk2+ns8czHsIZBKuCVbYn+cOETF1KaO5nYQBByq2M0LfCKPsvTm9M6ThK Ftismpj9jV6+NDNs31MD64JJRV44V8ume2Zd9h7DREZJUOZo+W1KKNK98jlihNzXMjGG sdcb6gYeLSf3FvAk+nIiVGsR1NZNYDu7xrSMvS+4vcxqKl1UU8LvF6vvp8hKPi5uuR5R dq1Wdj/Ucb80emzCBcizis+S7r2g/25+J8SUyBdGY1zHPqJ/QUeiwvxAbgatrXmqCZZS THP2DhXGfcjvzcwWv69EEU2TJu6nZ05/N0X7NqcZCWMR7vRCwjsqCB4Fm+dYRbnVtAxs 626Q== 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 u11si3144209pgo.474.2018.12.07.10.08.48; Fri, 07 Dec 2018 10:09:13 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726240AbeLGSFp (ORCPT + 99 others); Fri, 7 Dec 2018 13:05:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37282 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726111AbeLGSFp (ORCPT ); Fri, 7 Dec 2018 13:05:45 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E56E93164667; Fri, 7 Dec 2018 18:05:44 +0000 (UTC) Received: from redhat.com (ovpn-124-251.rdu2.redhat.com [10.10.124.251]) by smtp.corp.redhat.com (Postfix) with SMTP id 0916F5C228; Fri, 7 Dec 2018 18:05:35 +0000 (UTC) Date: Fri, 7 Dec 2018 13:05:35 -0500 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, maxime.coquelin@redhat.com Subject: Re: [RFC 2/3] virtio_ring: add VIRTIO_RING_NO_LEGACY Message-ID: <20181207130336-mutt-send-email-mst@kernel.org> References: <20181207084842.13133-1-tiwei.bie@intel.com> <20181207084842.13133-3-tiwei.bie@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181207084842.13133-3-tiwei.bie@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 07 Dec 2018 18:05:45 +0000 (UTC) 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 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. > > 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