]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/linux-26-headers/include/linux/virtio_net.h
Update
[l4.git] / l4 / pkg / linux-26-headers / include / linux / virtio_net.h
index 172a7f00780cc41398e54bd1e5c4314c6b1c9627..ec32293a00db057eb7559c2e7cadce01deb3ef22 100644 (file)
 #include <linux/types.h>
 #include <linux/virtio_ids.h>
 #include <linux/virtio_config.h>
+#include <linux/virtio_types.h>
 #include <linux/if_ether.h>
 
 /* The feature bitmap for virtio net */
 #define VIRTIO_NET_F_CSUM      0       /* Host handles pkts w/ partial csum */
 #define VIRTIO_NET_F_GUEST_CSUM        1       /* Guest handles pkts w/ partial csum */
+#define VIRTIO_NET_F_CTRL_GUEST_OFFLOADS 2 /* Dynamic offload configuration. */
 #define VIRTIO_NET_F_MAC       5       /* Host has given MAC address. */
-#define VIRTIO_NET_F_GSO       6       /* Host handles pkts w/ any GSO type */
 #define VIRTIO_NET_F_GUEST_TSO4        7       /* Guest can handle TSOv4 in. */
 #define VIRTIO_NET_F_GUEST_TSO6        8       /* Guest can handle TSOv6 in. */
 #define VIRTIO_NET_F_GUEST_ECN 9       /* Guest can handle TSO[6] w/ ECN in. */
                                         * Steering */
 #define VIRTIO_NET_F_CTRL_MAC_ADDR 23  /* Set MAC address */
 
+#ifndef VIRTIO_NET_NO_LEGACY
+#define VIRTIO_NET_F_GSO       6       /* Host handles pkts w/ any GSO type */
+#endif /* VIRTIO_NET_NO_LEGACY */
+
 #define VIRTIO_NET_S_LINK_UP   1       /* Link is up */
 #define VIRTIO_NET_S_ANNOUNCE  2       /* Announcement is needed */
 
@@ -70,32 +75,53 @@ struct virtio_net_config {
        __u16 max_virtqueue_pairs;
 } __attribute__((packed));
 
+/*
+ * This header comes first in the scatter-gather list.  If you don't
+ * specify GSO or CSUM features, you can simply ignore the header.
+ *
+ * This is bitwise-equivalent to the legacy struct virtio_net_hdr_mrg_rxbuf,
+ * only flattened.
+ */
+struct virtio_net_hdr_v1 {
+#define VIRTIO_NET_HDR_F_NEEDS_CSUM    1       /* Use csum_start, csum_offset */
+#define VIRTIO_NET_HDR_F_DATA_VALID    2       /* Csum is valid */
+       __u8 flags;
+#define VIRTIO_NET_HDR_GSO_NONE                0       /* Not a GSO frame */
+#define VIRTIO_NET_HDR_GSO_TCPV4       1       /* GSO frame, IPv4 TCP (TSO) */
+#define VIRTIO_NET_HDR_GSO_UDP         3       /* GSO frame, IPv4 UDP (UFO) */
+#define VIRTIO_NET_HDR_GSO_TCPV6       4       /* GSO frame, IPv6 TCP */
+#define VIRTIO_NET_HDR_GSO_ECN         0x80    /* TCP has ECN set */
+       __u8 gso_type;
+       __virtio16 hdr_len;     /* Ethernet + IP + tcp/udp hdrs */
+       __virtio16 gso_size;    /* Bytes to append to hdr_len per frame */
+       __virtio16 csum_start;  /* Position to start checksumming from */
+       __virtio16 csum_offset; /* Offset after that to place checksum */
+       __virtio16 num_buffers; /* Number of merged rx buffers */
+};
+
+#ifndef VIRTIO_NET_NO_LEGACY
 /* This header comes first in the scatter-gather list.
- * If VIRTIO_F_ANY_LAYOUT is not negotiated, it must
+ * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, it must
  * be the first element of the scatter-gather list.  If you don't
  * specify GSO or CSUM features, you can simply ignore the header. */
 struct virtio_net_hdr {
-#define VIRTIO_NET_HDR_F_NEEDS_CSUM    1       // Use csum_start, csum_offset
-#define VIRTIO_NET_HDR_F_DATA_VALID    2       // Csum is valid
+       /* See VIRTIO_NET_HDR_F_* */
        __u8 flags;
-#define VIRTIO_NET_HDR_GSO_NONE                0       // Not a GSO frame
-#define VIRTIO_NET_HDR_GSO_TCPV4       1       // GSO frame, IPv4 TCP (TSO)
-#define VIRTIO_NET_HDR_GSO_UDP         3       // GSO frame, IPv4 UDP (UFO)
-#define VIRTIO_NET_HDR_GSO_TCPV6       4       // GSO frame, IPv6 TCP
-#define VIRTIO_NET_HDR_GSO_ECN         0x80    // TCP has ECN set
+       /* See VIRTIO_NET_HDR_GSO_* */
        __u8 gso_type;
-       __u16 hdr_len;          /* Ethernet + IP + tcp/udp hdrs */
-       __u16 gso_size;         /* Bytes to append to hdr_len per frame */
-       __u16 csum_start;       /* Position to start checksumming from */
-       __u16 csum_offset;      /* Offset after that to place checksum */
+       __virtio16 hdr_len;             /* Ethernet + IP + tcp/udp hdrs */
+       __virtio16 gso_size;            /* Bytes to append to hdr_len per frame */
+       __virtio16 csum_start;  /* Position to start checksumming from */
+       __virtio16 csum_offset; /* Offset after that to place checksum */
 };
 
 /* This is the version of the header to use when the MRG_RXBUF
  * feature has been negotiated. */
 struct virtio_net_hdr_mrg_rxbuf {
        struct virtio_net_hdr hdr;
-       __u16 num_buffers;      /* Number of merged rx buffers */
+       __virtio16 num_buffers; /* Number of merged rx buffers */
 };
+#endif /* ...VIRTIO_NET_NO_LEGACY */
 
 /*
  * Control virtqueue data structures
@@ -149,7 +175,7 @@ typedef __u8 virtio_net_ctrl_ack;
  * VIRTIO_NET_F_CTRL_MAC_ADDR feature is available.
  */
 struct virtio_net_ctrl_mac {
-       __u32 entries;
+       __virtio32 entries;
        __u8 macs[][ETH_ALEN];
 } __attribute__((packed));
 
@@ -193,7 +219,7 @@ struct virtio_net_ctrl_mac {
  * specified.
  */
 struct virtio_net_ctrl_mq {
-       __u16 virtqueue_pairs;
+       __virtio16 virtqueue_pairs;
 };
 
 #define VIRTIO_NET_CTRL_MQ   4
@@ -201,4 +227,19 @@ struct virtio_net_ctrl_mq {
  #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN        1
  #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX        0x8000
 
+/*
+ * Control network offloads
+ *
+ * Reconfigures the network offloads that Guest can handle.
+ *
+ * Available with the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature bit.
+ *
+ * Command data format matches the feature bit mask exactly.
+ *
+ * See VIRTIO_NET_F_GUEST_* for the list of offloads
+ * that can be enabled/disabled.
+ */
+#define VIRTIO_NET_CTRL_GUEST_OFFLOADS   5
+#define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET        0
+
 #endif /* _LINUX_VIRTIO_NET_H */