Received: by 10.223.185.116 with SMTP id b49csp158782wrg; Tue, 13 Feb 2018 18:49:38 -0800 (PST) X-Google-Smtp-Source: AH8x226yaoANPaC9hyzYFOeElzTfDXE5yOSPHhCotXy5zco3eEo/B6f/twJP2SOeeSinoQefzp7V X-Received: by 10.98.53.7 with SMTP id c7mr328481pfa.180.1518576577899; Tue, 13 Feb 2018 18:49:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518576577; cv=none; d=google.com; s=arc-20160816; b=ryzxjWz1uYppOX0ldrueBVRLipKqYCOJGXszpy/to+GPLENTpjTM5aJ6akDBM7auiM xDRTqr09rvs25qjfyFReui+AkchgXF9eVeaNiBlgUuyuieroWpd6XS+icGGHiTqbVwv5 sMN3sY5JflHbaeIbSp83+G8xfE1yFDPdlF90AEEtkD4TR3q4Pb2/ma3w9cFfqf5ss99+ Tf+T8DS0HraNDfL8St+iAFPnHWsHdPcYvlxPwr1HSGSYh9HCVzbMoFV9zUl5bpWj6sLG mq7Qwra313Mm9/nWc1oq5YYR+YiLSR099SlRDgaHU/MKbmdkpeqClTslunKKmIr8GRSh naXg== 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:arc-authentication-results; bh=srMhqBz134LZ/U/4tlv2Rx/tJwh/iE/VlJzNFumiI6Y=; b=NQHv6lSdx16agOTy3g8ju1fh5LJaSNPSRSpsf/94Z5K9Yt5niOxO1vOIhoW3ljC7Bu W/KwRsKomhw/ZMbRYOKiYQ2cwzVlPQlBrSGCBeCaOzuaay2fyydh04RPg32vKxgXDdqx +l6BYsQB8oZEn560FKlyjfIiAAmtHUIpvw58SgZgnSGfeLf/yK6coxMen2dKSgGXsJWf txr4GiWgGm96lmHL80thIC/eQYjg8dpR5vtiX1oqK46rXw7oltVYzXi7vIJjmyRrQIpY WxtqNl7JMbNTzZx58Ki46ICrUU1uBUIRkFxSoPN2hkTdN/DS8ID23iDud+TDp1ILk/nK slEQ== 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 y3si890164pgo.193.2018.02.13.18.49.22; Tue, 13 Feb 2018 18:49:37 -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 S966580AbeBNCr2 (ORCPT + 99 others); Tue, 13 Feb 2018 21:47:28 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:56338 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966382AbeBNCr1 (ORCPT ); Tue, 13 Feb 2018 21:47:27 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B78C2EAE91; Wed, 14 Feb 2018 02:37:22 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-122.pek2.redhat.com [10.72.12.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id CEA68F41AA; Wed, 14 Feb 2018 02:37:19 +0000 (UTC) From: Jason Wang To: mst@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: wexu@redhat.com, jfreimann@redhat.com, tiwei.bie@intel.com, Jason Wang Subject: [PATCH RFC 1/2] virtio: introduce packed ring defines Date: Wed, 14 Feb 2018 10:37:08 +0800 Message-Id: <1518575829-1431-2-git-send-email-jasowang@redhat.com> In-Reply-To: <1518575829-1431-1-git-send-email-jasowang@redhat.com> References: <1518575829-1431-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 14 Feb 2018 02:37:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 14 Feb 2018 02:37:22 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jasowang@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Jason Wang --- include/uapi/linux/virtio_config.h | 9 +++++++++ include/uapi/linux/virtio_ring.h | 17 +++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h index 308e209..5903d51 100644 --- a/include/uapi/linux/virtio_config.h +++ b/include/uapi/linux/virtio_config.h @@ -71,4 +71,13 @@ * this is for compatibility with legacy systems. */ #define VIRTIO_F_IOMMU_PLATFORM 33 + +#define VIRTIO_F_RING_PACKED 34 + +/* + * This feature indicates that all buffers are used by the device in + * the same order in which they have been made available. + */ +#define VIRTIO_F_IN_ORDER 35 + #endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */ diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h index 6d5d5fa..a169b53 100644 --- a/include/uapi/linux/virtio_ring.h +++ b/include/uapi/linux/virtio_ring.h @@ -43,6 +43,8 @@ #define VRING_DESC_F_WRITE 2 /* This means the buffer contains a list of buffer descriptors. */ #define VRING_DESC_F_INDIRECT 4 +#define VRING_DESC_F_AVAIL 7 +#define VRING_DESC_F_USED 15 /* The Host uses this in used->flags to advise the Guest: don't kick me when * you add a buffer. It's unreliable, so it's simply an optimization. Guest @@ -62,6 +64,17 @@ * at the end of the used ring. Guest should ignore the used->flags field. */ #define VIRTIO_RING_F_EVENT_IDX 29 +struct vring_desc_packed { + /* Buffer Address. */ + __virtio64 addr; + /* Buffer Length. */ + __virtio32 len; + /* Buffer ID. */ + __virtio16 id; + /* The flags depending on descriptor type. */ + __virtio16 flags; +}; + /* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ struct vring_desc { /* Address (guest-physical). */ @@ -86,6 +99,10 @@ struct vring_used_elem { __virtio32 id; /* Total length of the descriptor chain which was used (written to) */ __virtio32 len; + /* Index of the descriptor that needs to write, used by packed ring. */ + u16 idx; + /* Wrap counter for this used desc, used by packed ring. */ + bool wrap_counter; }; struct vring_used { -- 2.7.4