Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp760855imm; Mon, 2 Jul 2018 22:42:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdGcO8rxmUXrbVAmNNXrutRu/XotIz4tqSuj2iLJQz1wX2f+TFIeVImdQoDe9RgzqPsETf2 X-Received: by 2002:a62:591a:: with SMTP id n26-v6mr14041901pfb.94.1530596540473; Mon, 02 Jul 2018 22:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530596540; cv=none; d=google.com; s=arc-20160816; b=l1Vmj19gr7oTGuqd4g1fsvVuS76NbKsbMSK6LwWkOhqC74KAkgawZnpJE6Ep5gkTru Yyqs0UeNvik6rLsSsZBdjOLDooVZejPR5qkIab79l2meoZmfH0zRyWx7q+8vXWkPtozW MCXyF6zUC/LZswsKNzriDFUT12tpV5g4DKwkRKUBVPw4CzWldIoOjHMVgOglS8tpiCgW 39dFIQSuc639iypL+rZ0yp9vje71z5cibJ+g45zneqPsxOKgX8O8C6cdSPFsQVUe59u9 x8d64U20Vvhl9q43FNykIGJd5XVsTAGmwgkMuNL1x7dVHDo8/gr12PwhUukCdGCXZonZ xyCw== 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=IX9e1G/2mpBvab5iiTFT+Az7l0+BKh/scV4vCJIoiY0=; b=lnMCf+iEtz4z64xkFrOHVrnMCmtOONsNQqye33yDYZIo+e53wceQ76FObqCxZp3Z24 Z9nDL8wa5jfGdsmz9rj2rMCPfp+Bx/eaK36jGQM3HKzVH40VysC46QeG5Gv+YntjykQl JHRrAOCietmyI37KRtCf6noAIxCfVpGRuVfby/AK10qrGnv6iU6D117nEctxVadAgBIf YGdcoKo40716EO7tEc9lOosgKrivm29brLNu7+DxvRn9fZ5Fh6xcy6H3ct0sVAWrzK0u b34H8hOxtIFExwx9hC7tcUFSaB9iCqZHZff5Vm3kVuCZ3QdjT3z4492qzz+KusVkX+1M P59g== 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 i62-v6si291239pge.93.2018.07.02.22.42.05; Mon, 02 Jul 2018 22:42:20 -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 S932917AbeGCFjD (ORCPT + 99 others); Tue, 3 Jul 2018 01:39:03 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50728 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932869AbeGCFjA (ORCPT ); Tue, 3 Jul 2018 01:39:00 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4C035401CDA7; Tue, 3 Jul 2018 05:39:00 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-60.pek2.redhat.com [10.72.12.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD7301117624; Tue, 3 Jul 2018 05:38:49 +0000 (UTC) From: Jason Wang To: mst@redhat.com, jasowang@redhat.com, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: wexu@redhat.com, tiwei.bie@intel.com, maxime.coquelin@redhat.com, jfreimann@redhat.com Subject: [PATCH net-next 6/8] virtio: introduce packed ring defines Date: Tue, 3 Jul 2018 13:38:02 +0800 Message-Id: <1530596284-4101-7-git-send-email-jasowang@redhat.com> In-Reply-To: <1530596284-4101-1-git-send-email-jasowang@redhat.com> References: <1530596284-4101-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 03 Jul 2018 05:39:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 03 Jul 2018 05:39:00 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.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 | 2 ++ include/uapi/linux/virtio_ring.h | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h index 449132c..947f6a3 100644 --- a/include/uapi/linux/virtio_config.h +++ b/include/uapi/linux/virtio_config.h @@ -75,6 +75,8 @@ */ #define VIRTIO_F_IOMMU_PLATFORM 33 +#define VIRTIO_F_RING_PACKED 34 + /* * Does the device support Single Root I/O Virtualization? */ diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h index 6d5d5fa..71c7a46 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,36 @@ * 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; +}; + +/* Enable events */ +#define RING_EVENT_FLAGS_ENABLE 0x0 +/* Disable events */ +#define RING_EVENT_FLAGS_DISABLE 0x1 +/* + * Enable events for a specific descriptor + * (as specified by Descriptor Ring Change Event Offset/Wrap Counter). + * Only valid if VIRTIO_F_RING_EVENT_IDX has been negotiated. + */ +#define RING_EVENT_FLAGS_DESC 0x2 +/* The value 0x3 is reserved */ + +struct vring_packed_desc_event { + /* Descriptor Ring Change Event Offset and Wrap Counter */ + __virtio16 off_wrap; + /* Descriptor Ring Change Event Flags */ + __virtio16 flags; +}; + /* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ struct vring_desc { /* Address (guest-physical). */ -- 2.7.4