Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp291970imu; Fri, 7 Dec 2018 00:52:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/Uw384nk1NAL/QXcMvINXFGoQII4ks0+WPnsGpgAP/vN1droErrhY1TxzvSes5/BFj/3Emd X-Received: by 2002:a63:680a:: with SMTP id d10mr1202894pgc.396.1544172734024; Fri, 07 Dec 2018 00:52:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544172734; cv=none; d=google.com; s=arc-20160816; b=z9GNr7ZUSReWidyC90H+GV0CSS+4OXFfDd1+00AK30EWsXspi3abOct1Vq8TpU7ctp KhpdOAhzHG2ggE0fLOd+cinGB/vncwJQ5Hw2/iZ3KpKZ0BwOEq6LBgZ2Fzqb6+Cw4c5M JlZIi5uvpe6oL3R5Bijg0k4+UeVyftsFS/ke1KZVHYOV7+lcv+/TgsoiN5uDisFWPGEw JI4YuFJSOcXZIddxWtIJaS9dk5CJZMyhkebkQArrKxKzsvZcoe2/tHonRiP7p6qZDRpF iFTZ5dhMqDqWmCf9WZaeneZc0vBKsXftNg98f+PG0a9nRL1LklS8SNpgDoxNGLCXsN4v +kqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=XHfdOktgGQbfsAAQcBMeVz3axsZkI1mthSwU/pxHE28=; b=S4GK7pqWG5KkP/OPDk38BR2vTX6YOLWGb+P0vsX5h+fcF4wsPo06ZcRY8oXrkqlc5N QkyiNK4N+5XoCU2XMvD5Ca4lFoAAvcF75GI8gsoaY4Fqi8ed8bC8BVELBsCfaZ1ZgBd4 waSTZdUMrkK/1+WZq920DjT7xbJ8Qqz9Wj8+xVjfCCD1NAR6+pa1QHUx/0D1YXhUhi6K ppRSoaTeVTI9nMR6bDd4Zri3X9CR7YQJgFzDULFITOtPInDNC+Cbd+mkLXU3juLDbrKO e5MCM7VFd+yeBOp6VwLE28ubwORfi5DY32E6Av3AqbsjIsDmbbX5iycEE+OtOxccW6UN I/RQ== 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 f5si2488535pgr.411.2018.12.07.00.51.59; Fri, 07 Dec 2018 00:52: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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726085AbeLGIvI (ORCPT + 99 others); Fri, 7 Dec 2018 03:51:08 -0500 Received: from mga18.intel.com ([134.134.136.126]:1705 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726057AbeLGIvE (ORCPT ); Fri, 7 Dec 2018 03:51:04 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Dec 2018 00:51:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,324,1539673200"; d="scan'208";a="96888346" Received: from btwcube1.sh.intel.com ([10.67.104.173]) by orsmga007.jf.intel.com with ESMTP; 07 Dec 2018 00:51:01 -0800 From: Tiwei Bie To: mst@redhat.com, jasowang@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, virtio-dev@lists.oasis-open.org Cc: wexu@redhat.com, jfreimann@redhat.com, maxime.coquelin@redhat.com, tiwei.bie@intel.com Subject: [RFC 2/3] virtio_ring: add VIRTIO_RING_NO_LEGACY Date: Fri, 7 Dec 2018 16:48:41 +0800 Message-Id: <20181207084842.13133-3-tiwei.bie@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181207084842.13133-1-tiwei.bie@intel.com> References: <20181207084842.13133-1-tiwei.bie@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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