From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B3A7BA0A02; Fri, 15 Jan 2021 11:55:27 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 67E79140F03; Fri, 15 Jan 2021 11:55:27 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mails.dpdk.org (Postfix) with ESMTP id 654E8140EFE for ; Fri, 15 Jan 2021 11:55:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610708125; 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=0zpt3/52wIqF8XMPNvksuP1Oug1de8LQ4pbym0yCPjg=; b=QUhKVvEejsuTJ3lzHHIA73JFr79Z4rXISoGhVtpvdiiFLhvIfoLPNx55A2+HmIVp3V9OQk k56r8fZZXpIafnnB3gD2bmjQYL9mEdr3ryp1khkq8d4PA5qyUGyGI/XyqgAdztDdkzsHiv vRAapjD9G5/caVVwK8EbqFAsBeO1qYM= 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-522-v3PmejaJPpmeAW4j5MCQ_A-1; Fri, 15 Jan 2021 05:55:22 -0500 X-MC-Unique: v3PmejaJPpmeAW4j5MCQ_A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DEF76107AD34; Fri, 15 Jan 2021 10:55:21 +0000 (UTC) Received: from [10.36.110.24] (unknown [10.36.110.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CC4C510023B9; Fri, 15 Jan 2021 10:55:15 +0000 (UTC) To: David Marchand Cc: dev , "Xia, Chenbo" , Olivier Matz , Adrian Moreno Zapata References: <20201220211405.313012-1-maxime.coquelin@redhat.com> <20201220211405.313012-19-maxime.coquelin@redhat.com> From: Maxime Coquelin Message-ID: <97045c1c-2026-3574-8b34-5debb8aeef71@redhat.com> Date: Fri, 15 Jan 2021 11:55:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 18/40] net/virtio: move virtqueue defines in generic header X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" On 1/6/21 4:53 PM, David Marchand wrote: > On Sun, Dec 20, 2020 at 10:15 PM Maxime Coquelin > wrote: >> >> This patch moves the virtqueues defines from PCI header >> to the genreric one. > > > generic* > >> >> 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 > > The coding style recommends group headers inclusion: first system > headers, then dpdk shared headers and finally "local" headers. > https://doc.dpdk.org/guides/contributing/coding_style.html#header-includes > > >> >> #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 > > Same comment, for readability, add an empty line here. Fixed it, and also above one. Thanks, Maxime >> -#include "../virtio_pci.h" >> +#include "../virtio.h" >> #include "../virtio_ring.h" >> >> enum virtio_user_backend_type { >> -- >> 2.29.2 >> > > >