From: Maxime Coquelin Date: Tue, 26 Jan 2021 10:16:15 +0000 (+0100) Subject: net/virtio: move virtqueue defines in generic header X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7990d039dc58c18308e0bd4d801a22f36f44af90;p=dpdk.git net/virtio: move virtqueue defines in generic header This patch moves the virtqueues defines from PCI header to the generic one. Signed-off-by: Maxime Coquelin Reviewed-by: Chenbo Xia --- diff --git a/drivers/net/virtio/virtio.h b/drivers/net/virtio/virtio.h index cdfee5d182..0c2b3525d5 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..873327d989 100644 --- a/drivers/net/virtio/virtio_ethdev.h +++ b/drivers/net/virtio/virtio_ethdev.h @@ -7,7 +7,9 @@ #include -#include "virtio_pci.h" +#include + +#include "virtio.h" #ifndef PAGE_SIZE #define PAGE_SIZE 4096 diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h index 9fe87e639d..d339994cab 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 b3776cc7a0..ab62463a5b 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.h +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h @@ -7,7 +7,8 @@ #include #include -#include "../virtio_pci.h" + +#include "../virtio.h" #include "../virtio_ring.h" enum virtio_user_backend_type {