|
@@ -56,6 +56,7 @@
|
|
|
#define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow
|
|
|
* Steering */
|
|
|
#define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
|
|
|
+#define VIRTIO_NET_F_DEVICE_STATS 50 /* Device can provide device-level statistics. */
|
|
|
#define VIRTIO_NET_F_VQ_NOTF_COAL 52 /* Device supports virtqueue notification coalescing */
|
|
|
#define VIRTIO_NET_F_NOTF_COAL 53 /* Device supports notifications coalescing */
|
|
|
#define VIRTIO_NET_F_GUEST_USO4 54 /* Guest can handle USOv4 in. */
|
|
@@ -406,4 +407,146 @@ struct virtio_net_ctrl_coal_vq {
|
|
|
struct virtio_net_ctrl_coal coal;
|
|
|
};
|
|
|
|
|
|
+/*
|
|
|
+ * Device Statistics
|
|
|
+ */
|
|
|
+#define VIRTIO_NET_CTRL_STATS 8
|
|
|
+#define VIRTIO_NET_CTRL_STATS_QUERY 0
|
|
|
+#define VIRTIO_NET_CTRL_STATS_GET 1
|
|
|
+
|
|
|
+struct virtio_net_stats_capabilities {
|
|
|
+
|
|
|
+#define VIRTIO_NET_STATS_TYPE_CVQ (1ULL << 32)
|
|
|
+
|
|
|
+#define VIRTIO_NET_STATS_TYPE_RX_BASIC (1ULL << 0)
|
|
|
+#define VIRTIO_NET_STATS_TYPE_RX_CSUM (1ULL << 1)
|
|
|
+#define VIRTIO_NET_STATS_TYPE_RX_GSO (1ULL << 2)
|
|
|
+#define VIRTIO_NET_STATS_TYPE_RX_SPEED (1ULL << 3)
|
|
|
+
|
|
|
+#define VIRTIO_NET_STATS_TYPE_TX_BASIC (1ULL << 16)
|
|
|
+#define VIRTIO_NET_STATS_TYPE_TX_CSUM (1ULL << 17)
|
|
|
+#define VIRTIO_NET_STATS_TYPE_TX_GSO (1ULL << 18)
|
|
|
+#define VIRTIO_NET_STATS_TYPE_TX_SPEED (1ULL << 19)
|
|
|
+
|
|
|
+ uint64_t supported_stats_types[1];
|
|
|
+};
|
|
|
+
|
|
|
+struct virtio_net_ctrl_queue_stats {
|
|
|
+ struct {
|
|
|
+ uint16_t vq_index;
|
|
|
+ uint16_t reserved[3];
|
|
|
+ uint64_t types_bitmap[1];
|
|
|
+ } stats[1];
|
|
|
+};
|
|
|
+
|
|
|
+struct virtio_net_stats_reply_hdr {
|
|
|
+#define VIRTIO_NET_STATS_TYPE_REPLY_CVQ 32
|
|
|
+
|
|
|
+#define VIRTIO_NET_STATS_TYPE_REPLY_RX_BASIC 0
|
|
|
+#define VIRTIO_NET_STATS_TYPE_REPLY_RX_CSUM 1
|
|
|
+#define VIRTIO_NET_STATS_TYPE_REPLY_RX_GSO 2
|
|
|
+#define VIRTIO_NET_STATS_TYPE_REPLY_RX_SPEED 3
|
|
|
+
|
|
|
+#define VIRTIO_NET_STATS_TYPE_REPLY_TX_BASIC 16
|
|
|
+#define VIRTIO_NET_STATS_TYPE_REPLY_TX_CSUM 17
|
|
|
+#define VIRTIO_NET_STATS_TYPE_REPLY_TX_GSO 18
|
|
|
+#define VIRTIO_NET_STATS_TYPE_REPLY_TX_SPEED 19
|
|
|
+ uint8_t type;
|
|
|
+ uint8_t reserved;
|
|
|
+ uint16_t vq_index;
|
|
|
+ uint16_t reserved1;
|
|
|
+ uint16_t size;
|
|
|
+};
|
|
|
+
|
|
|
+struct virtio_net_stats_cvq {
|
|
|
+ struct virtio_net_stats_reply_hdr hdr;
|
|
|
+
|
|
|
+ uint64_t command_num;
|
|
|
+ uint64_t ok_num;
|
|
|
+};
|
|
|
+
|
|
|
+struct virtio_net_stats_rx_basic {
|
|
|
+ struct virtio_net_stats_reply_hdr hdr;
|
|
|
+
|
|
|
+ uint64_t rx_notifications;
|
|
|
+
|
|
|
+ uint64_t rx_packets;
|
|
|
+ uint64_t rx_bytes;
|
|
|
+
|
|
|
+ uint64_t rx_interrupts;
|
|
|
+
|
|
|
+ uint64_t rx_drops;
|
|
|
+ uint64_t rx_drop_overruns;
|
|
|
+};
|
|
|
+
|
|
|
+struct virtio_net_stats_tx_basic {
|
|
|
+ struct virtio_net_stats_reply_hdr hdr;
|
|
|
+
|
|
|
+ uint64_t tx_notifications;
|
|
|
+
|
|
|
+ uint64_t tx_packets;
|
|
|
+ uint64_t tx_bytes;
|
|
|
+
|
|
|
+ uint64_t tx_interrupts;
|
|
|
+
|
|
|
+ uint64_t tx_drops;
|
|
|
+ uint64_t tx_drop_malformed;
|
|
|
+};
|
|
|
+
|
|
|
+struct virtio_net_stats_rx_csum {
|
|
|
+ struct virtio_net_stats_reply_hdr hdr;
|
|
|
+
|
|
|
+ uint64_t rx_csum_valid;
|
|
|
+ uint64_t rx_needs_csum;
|
|
|
+ uint64_t rx_csum_none;
|
|
|
+ uint64_t rx_csum_bad;
|
|
|
+};
|
|
|
+
|
|
|
+struct virtio_net_stats_tx_csum {
|
|
|
+ struct virtio_net_stats_reply_hdr hdr;
|
|
|
+
|
|
|
+ uint64_t tx_csum_none;
|
|
|
+ uint64_t tx_needs_csum;
|
|
|
+};
|
|
|
+
|
|
|
+struct virtio_net_stats_rx_gso {
|
|
|
+ struct virtio_net_stats_reply_hdr hdr;
|
|
|
+
|
|
|
+ uint64_t rx_gso_packets;
|
|
|
+ uint64_t rx_gso_bytes;
|
|
|
+ uint64_t rx_gso_packets_coalesced;
|
|
|
+ uint64_t rx_gso_bytes_coalesced;
|
|
|
+};
|
|
|
+
|
|
|
+struct virtio_net_stats_tx_gso {
|
|
|
+ struct virtio_net_stats_reply_hdr hdr;
|
|
|
+
|
|
|
+ uint64_t tx_gso_packets;
|
|
|
+ uint64_t tx_gso_bytes;
|
|
|
+ uint64_t tx_gso_segments;
|
|
|
+ uint64_t tx_gso_segments_bytes;
|
|
|
+ uint64_t tx_gso_packets_noseg;
|
|
|
+ uint64_t tx_gso_bytes_noseg;
|
|
|
+};
|
|
|
+
|
|
|
+struct virtio_net_stats_rx_speed {
|
|
|
+ struct virtio_net_stats_reply_hdr hdr;
|
|
|
+
|
|
|
+ /* rx_{packets,bytes}_allowance_exceeded are too long. So rename to
|
|
|
+ * short name.
|
|
|
+ */
|
|
|
+ uint64_t rx_ratelimit_packets;
|
|
|
+ uint64_t rx_ratelimit_bytes;
|
|
|
+};
|
|
|
+
|
|
|
+struct virtio_net_stats_tx_speed {
|
|
|
+ struct virtio_net_stats_reply_hdr hdr;
|
|
|
+
|
|
|
+ /* tx_{packets,bytes}_allowance_exceeded are too long. So rename to
|
|
|
+ * short name.
|
|
|
+ */
|
|
|
+ uint64_t tx_ratelimit_packets;
|
|
|
+ uint64_t tx_ratelimit_bytes;
|
|
|
+};
|
|
|
+
|
|
|
#endif /* _LINUX_VIRTIO_NET_H */
|