From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EFF2CA09FD; Sun, 20 Dec 2020 22:20:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 332AACCAC; Sun, 20 Dec 2020 22:15:39 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id 39E4ACD88 for ; Sun, 20 Dec 2020 22:15:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608498933; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RXFAUI5HgvS/l5y+kr6lETqeNfT6E7gmrenbLKgZB2k=; b=hmEiwLQbvmmf8q0ssWYL3xKB+Ljezi/JrrRqkhai2S0hLn2fnBoViJX5ji+arN4nxE/2Il vCr7iAU+2Bs4RTGbvQxpFZnBEPTpbqDp+tQBKOp2+NJrw5gk4Xn/suNuNkL/HdUBInaORo k3vr6gPJm+DJoUyFPlVuoU9ognPoVas= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-267-BvSiVw3gNoyo4lbLlZYOHA-1; Sun, 20 Dec 2020 16:15:29 -0500 X-MC-Unique: BvSiVw3gNoyo4lbLlZYOHA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ACD4BBBEE2; Sun, 20 Dec 2020 21:15:28 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.36.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1236360C43; Sun, 20 Dec 2020 21:15:26 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbo.xia@intel.com, olivier.matz@6wind.com, amorenoz@redhat.com, david.marchand@redhat.com Cc: Maxime Coquelin Date: Sun, 20 Dec 2020 22:13:43 +0100 Message-Id: <20201220211405.313012-19-maxime.coquelin@redhat.com> In-Reply-To: <20201220211405.313012-1-maxime.coquelin@redhat.com> References: <20201220211405.313012-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-dev] [PATCH 18/40] net/virtio: move virtqueue defines in generic header X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch moves the virtqueues defines from PCI header to the genreric one. Signed-off-by: Maxime Coquelin --- drivers/net/virtio/virtio.h | 18 ++++++++++++++++++ drivers/net/virtio/virtio_ethdev.h | 3 ++- drivers/net/virtio/virtio_pci.h | 17 ----------------- .../net/virtio/virtio_user/virtio_user_dev.h | 2 +- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/drivers/net/virtio/virtio.h b/drivers/net/virtio/virtio.h index 9e787803a4..eeeb5dba4f 100644 --- a/drivers/net/virtio/virtio.h +++ b/drivers/net/virtio/virtio.h @@ -88,6 +88,24 @@ #define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ #define VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */ +/* + * Each virtqueue indirect descriptor list must be physically contiguous. + * To allow us to malloc(9) each list individually, limit the number + * supported to what will fit in one page. With 4KB pages, this is a limit + * of 256 descriptors. If there is ever a need for more, we can switch to + * contigmalloc(9) for the larger allocations, similar to what + * bus_dmamem_alloc(9) does. + * + * Note the sizeof(struct vring_desc) is 16 bytes. + */ +#define VIRTIO_MAX_INDIRECT ((int)(PAGE_SIZE / 16)) + +/* + * Maximum number of virtqueues per device. + */ +#define VIRTIO_MAX_VIRTQUEUE_PAIRS 8 +#define VIRTIO_MAX_VIRTQUEUES (VIRTIO_MAX_VIRTQUEUE_PAIRS * 2 + 1) + struct virtio_hw { struct virtqueue **vqs; uint64_t guest_features; diff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h index 13395937c8..6fc373f484 100644 --- a/drivers/net/virtio/virtio_ethdev.h +++ b/drivers/net/virtio/virtio_ethdev.h @@ -7,7 +7,8 @@ #include -#include "virtio_pci.h" +#include "virtio.h" +#include #ifndef PAGE_SIZE #define PAGE_SIZE 4096 diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h index b02e5c15f5..249f9754cc 100644 --- a/drivers/net/virtio/virtio_pci.h +++ b/drivers/net/virtio/virtio_pci.h @@ -67,23 +67,6 @@ struct virtnet_ctl; #define VIRTIO_CONFIG_STATUS_DEV_NEED_RESET 0x40 #define VIRTIO_CONFIG_STATUS_FAILED 0x80 -/* - * Each virtqueue indirect descriptor list must be physically contiguous. - * To allow us to malloc(9) each list individually, limit the number - * supported to what will fit in one page. With 4KB pages, this is a limit - * of 256 descriptors. If there is ever a need for more, we can switch to - * contigmalloc(9) for the larger allocations, similar to what - * bus_dmamem_alloc(9) does. - * - * Note the sizeof(struct vring_desc) is 16 bytes. - */ -#define VIRTIO_MAX_INDIRECT ((int) (PAGE_SIZE / 16)) - -/* - * Maximum number of virtqueues per device. - */ -#define VIRTIO_MAX_VIRTQUEUE_PAIRS 8 -#define VIRTIO_MAX_VIRTQUEUES (VIRTIO_MAX_VIRTQUEUE_PAIRS * 2 + 1) /* Common configuration */ #define VIRTIO_PCI_CAP_COMMON_CFG 1 diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h index 59f4dd1f24..0eb481ae21 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.h +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h @@ -7,7 +7,7 @@ #include #include -#include "../virtio_pci.h" +#include "../virtio.h" #include "../virtio_ring.h" enum virtio_user_backend_type { -- 2.29.2