Re: [dpdk-dev] [PATCH 19/40] net/virtio: move config definitions to generic header
From: Maxime Coquelin <hidden>
Date: 2021-01-15 11:01:30
On 1/6/21 5:01 PM, David Marchand wrote:
On Sun, Dec 20, 2020 at 10:15 PM Maxime Coquelin [off-list ref] wrote:quoted
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 structurechodu ? :-)
I guess shadow was meant here, given the start of the sentence. Will fix it.
quoted
+ * + */ +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).
Yes, I guess it was squashed here by mistake during a rebase. I didn't remove the comment