[dpdk-dev] [PATCH 19/40] net/virtio: move config definitions to generic header
David Marchand
david.marchand at redhat.com
Wed Jan 6 17:01:31 CET 2021
On Sun, Dec 20, 2020 at 10:15 PM Maxime Coquelin
<maxime.coquelin at redhat.com> wrote:
> diff --git a/drivers/net/virtio/virtio.h b/drivers/net/virtio/virtio.h
> index eeeb5dba4f..5169436c9f 100644
> --- a/drivers/net/virtio/virtio.h
> +++ b/drivers/net/virtio/virtio.h
> @@ -106,6 +106,50 @@
> #define VIRTIO_MAX_VIRTQUEUE_PAIRS 8
> #define VIRTIO_MAX_VIRTQUEUES (VIRTIO_MAX_VIRTQUEUE_PAIRS * 2 + 1)
>
> +/* VirtIO device IDs. */
> +#define VIRTIO_ID_NETWORK 0x01
> +#define VIRTIO_ID_BLOCK 0x02
> +#define VIRTIO_ID_CONSOLE 0x03
> +#define VIRTIO_ID_ENTROPY 0x04
> +#define VIRTIO_ID_BALLOON 0x05
> +#define VIRTIO_ID_IOMEMORY 0x06
> +#define VIRTIO_ID_9P 0x09
> +
> +/* Status byte for guest to report progress. */
> +#define VIRTIO_CONFIG_STATUS_RESET 0x00
> +#define VIRTIO_CONFIG_STATUS_ACK 0x01
> +#define VIRTIO_CONFIG_STATUS_DRIVER 0x02
> +#define VIRTIO_CONFIG_STATUS_DRIVER_OK 0x04
> +#define VIRTIO_CONFIG_STATUS_FEATURES_OK 0x08
> +#define VIRTIO_CONFIG_STATUS_DEV_NEED_RESET 0x40
> +#define VIRTIO_CONFIG_STATUS_FAILED 0x80
> +
> +/*
> + * This structure is just a reference to read
> + * net device specific config space; it just a chodu structure
chodu ? :-)
> + *
> + */
> +struct virtio_net_config {
> + /* The config defining mac address (if VIRTIO_NET_F_MAC) */
> + uint8_t mac[RTE_ETHER_ADDR_LEN];
> + /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */
> + uint16_t status;
> + uint16_t max_virtqueue_pairs;
> + uint16_t mtu;
> + /*
> + * speed, in units of 1Mb. All values 0 to INT_MAX are legal.
> + * Any other value stands for unknown.
> + */
> + uint32_t speed;
> + /*
> + * 0x00 - half duplex
> + * 0x01 - full duplex
> + * Any other value stands for unknown.
> + */
> + uint8_t duplex;
> +
> +} __rte_packed;
> +
> struct virtio_hw {
> struct virtqueue **vqs;
> uint64_t guest_features;
> @@ -159,7 +203,7 @@ struct virtio_ops {
> /*
> * While virtio_hw is stored in shared memory, this structure stores
> * some infos that may vary in the multiple process model locally.
> - * For example, the vtpci_ops pointer.
> + * For example, the virtio_ops pointer.
It should be in a previous patch (I suggested removing this comment earlier).
--
David Marchand
More information about the dev
mailing list