aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2015-02-17 00:42:43 -0500
committerRusty Russell <rusty@rustcorp.com.au>2015-02-17 00:49:27 -0500
commite68c48f97547979c91de04b487d79dc0d3be7015 (patch)
treed3b336f91194aeccca1a91d3d3aa6a80cb1d57b2 /include
parent206ad06b2e88a3d826c99da8c8b3ed98e287ad87 (diff)
virtio_net: unconditionally define struct virtio_net_hdr_v1.
This was introduced in commit ed9ecb0415b97b5f9f91f146e1977bb372c74c6d, but only defined if !VIRTIO_NET_NO_LEGACY. We should always define it: easier for users to have conditional legacy code. Suggested-by: "Michael S. Tsirkin" <mst@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include')
-rw-r--r--include/uapi/linux/virtio_net.h54
1 files changed, 25 insertions, 29 deletions
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index 4a9b58113d6e..7bbee79ca293 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -74,39 +74,12 @@ struct virtio_net_config {
74 __u16 max_virtqueue_pairs; 74 __u16 max_virtqueue_pairs;
75} __attribute__((packed)); 75} __attribute__((packed));
76 76
77#ifndef VIRTIO_NET_NO_LEGACY
78/* This header comes first in the scatter-gather list.
79 * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, it must
80 * be the first element of the scatter-gather list. If you don't
81 * specify GSO or CSUM features, you can simply ignore the header. */
82struct virtio_net_hdr {
83#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset
84#define VIRTIO_NET_HDR_F_DATA_VALID 2 // Csum is valid
85 __u8 flags;
86#define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame
87#define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO)
88#define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO)
89#define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP
90#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set
91 __u8 gso_type;
92 __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */
93 __virtio16 gso_size; /* Bytes to append to hdr_len per frame */
94 __virtio16 csum_start; /* Position to start checksumming from */
95 __virtio16 csum_offset; /* Offset after that to place checksum */
96};
97
98/* This is the version of the header to use when the MRG_RXBUF
99 * feature has been negotiated. */
100struct virtio_net_hdr_mrg_rxbuf {
101 struct virtio_net_hdr hdr;
102 __virtio16 num_buffers; /* Number of merged rx buffers */
103};
104#else /* ... VIRTIO_NET_NO_LEGACY */
105/* 77/*
106 * This header comes first in the scatter-gather list. If you don't 78 * This header comes first in the scatter-gather list. If you don't
107 * specify GSO or CSUM features, you can simply ignore the header. 79 * specify GSO or CSUM features, you can simply ignore the header.
108 * 80 *
109 * This is bitwise-equivalent to the legacy struct virtio_net_hdr_mrg_rxbuf. 81 * This is bitwise-equivalent to the legacy struct virtio_net_hdr_mrg_rxbuf,
82 * only flattened.
110 */ 83 */
111struct virtio_net_hdr_v1 { 84struct virtio_net_hdr_v1 {
112#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 /* Use csum_start, csum_offset */ 85#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 /* Use csum_start, csum_offset */
@@ -124,6 +97,29 @@ struct virtio_net_hdr_v1 {
124 __virtio16 csum_offset; /* Offset after that to place checksum */ 97 __virtio16 csum_offset; /* Offset after that to place checksum */
125 __virtio16 num_buffers; /* Number of merged rx buffers */ 98 __virtio16 num_buffers; /* Number of merged rx buffers */
126}; 99};
100
101#ifndef VIRTIO_NET_NO_LEGACY
102/* This header comes first in the scatter-gather list.
103 * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, it must
104 * be the first element of the scatter-gather list. If you don't
105 * specify GSO or CSUM features, you can simply ignore the header. */
106struct virtio_net_hdr {
107 /* See VIRTIO_NET_HDR_F_* */
108 __u8 flags;
109 /* See VIRTIO_NET_HDR_GSO_* */
110 __u8 gso_type;
111 __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */
112 __virtio16 gso_size; /* Bytes to append to hdr_len per frame */
113 __virtio16 csum_start; /* Position to start checksumming from */
114 __virtio16 csum_offset; /* Offset after that to place checksum */
115};
116
117/* This is the version of the header to use when the MRG_RXBUF
118 * feature has been negotiated. */
119struct virtio_net_hdr_mrg_rxbuf {
120 struct virtio_net_hdr hdr;
121 __virtio16 num_buffers; /* Number of merged rx buffers */
122};
127#endif /* ...VIRTIO_NET_NO_LEGACY */ 123#endif /* ...VIRTIO_NET_NO_LEGACY */
128 124
129/* 125/*