From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2628EA0524; Wed, 6 Jan 2021 16:53:31 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E17021609B5; Wed, 6 Jan 2021 16:53:30 +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 68AD01609A0 for ; Wed, 6 Jan 2021 16:53:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609948409; 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: in-reply-to:in-reply-to:references:references; bh=6kC9aA2HxtLGCdZHfYVa6Sik1/EmCmVXeM064r1e23E=; b=ZIb7sm++GLqiI6TY+MiNjnA+Fnoe59rftuJ21v/N2C7fpZfISi8J//InwArtzm1/iD+Pf2 mwjzMHDfx58A3NL8J/twV5jzuorD2NxR4dBHptIsqeo1USNMbjgZp5+QJWj889EB9EMyDw o9xhmRBy/0GI2XnJKtERdfoe533PMjg= Received: from mail-vk1-f198.google.com (mail-vk1-f198.google.com [209.85.221.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-94-zPTwWTvJMwaBsJeZfLsTIw-1; Wed, 06 Jan 2021 10:53:25 -0500 X-MC-Unique: zPTwWTvJMwaBsJeZfLsTIw-1 Received: by mail-vk1-f198.google.com with SMTP id h15so1730634vka.10 for ; Wed, 06 Jan 2021 07:53:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6kC9aA2HxtLGCdZHfYVa6Sik1/EmCmVXeM064r1e23E=; b=epTyWmno8vgr6qhJLz8NJO5cyz33QNq2TksS0SDJjpHjxDtakflSYjx+jpF7DU6qGA Vwax8BKE5AVJzMrTGwrI4QfoiG7rm+E/JDeQlAFXDnZnQVbgNOzyd7CL3/OOqV+JnFvM dsjX/iPynC5C3vTo4GCkxaYso+5WUqK1uKqeW3PZDwjCeJgX86X1veuXBj0iuoE5A7r8 sUZEkDb4UAsS1E6TZM2KgxhvJiy8HlUFVd1T3iBYVyMCLfTSVC7wyY1lYc3WI/fEm83/ Z9dmKG6GG0XZopa74NJjSXRFVhEDS2BmvEGLF2Ybq9NUstAxP+C+WAf1yUaBx92orFxK MURw== X-Gm-Message-State: AOAM531n347KPrF8DMmk9Ra+RwuBjUa58VI6W3lrQTi+nq+ti97NbWmg V55dh5WxsgxuvT+ODRKg2Ahdq2jEbz57ESzhDmT9AhOOS239LLpTUWHva7b7/ySO4vYkPJmhjJE 1dZsfVxp3cikAq8tAKQg= X-Received: by 2002:a1f:cec1:: with SMTP id e184mr4104051vkg.17.1609948404940; Wed, 06 Jan 2021 07:53:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxeS11euecFRu6x0HNB7emUsZYDGHMdAgMYvHQWj0130iPBm9+JTNCZDFi/YrGmyw27hUsSYI1YYHapUKbWZJI= X-Received: by 2002:a1f:cec1:: with SMTP id e184mr4104037vkg.17.1609948404675; Wed, 06 Jan 2021 07:53:24 -0800 (PST) MIME-Version: 1.0 References: <20201220211405.313012-1-maxime.coquelin@redhat.com> <20201220211405.313012-19-maxime.coquelin@redhat.com> In-Reply-To: <20201220211405.313012-19-maxime.coquelin@redhat.com> From: David Marchand Date: Wed, 6 Jan 2021 16:53:13 +0100 Message-ID: To: Maxime Coquelin Cc: dev , "Xia, Chenbo" , Olivier Matz , Adrian Moreno Zapata Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" 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 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. > -#include "../virtio_pci.h" > +#include "../virtio.h" > #include "../virtio_ring.h" > > enum virtio_user_backend_type { > -- > 2.29.2 > -- David Marchand