History

Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost

Pull virtio updates from Michael Tsirkin: - Some bug fixes - The new vdpa subsystem with two first drivers * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: virtio-balloon: Revert "virtio-balloon: Switch back to OOM handler for VIRTIO_BALLOON_F_DEFLATE_ON_OOM" vdpa: move to drivers/vdpa virtio: Intel IFC VF driver for VDPA vdpasim: vDPA device simulator vhost: introduce vDPA-based backend virtio: introduce a vDPA based transport vDPA: introduce vDPA bus vringh: IOTLB support vhost: factor out IOTLB vhost: allow per device message handler vhost: refine vhost and vringh kconfig virtio-balloon: Switch back to OOM handler for VIRTIO_BALLOON_F_DEFLATE_ON_OOM virtio-net: Introduce hash report feature virtio-net: Introduce RSS receive steering feature virtio-net: Introduce extended RSC feature tools/virtio: option to build an out of tree module

Linus Torvalds committed 6 years ago

Commit 9bb71522 parents ae46d2a 835a6a640 files · +4310 −249Browse files

Showing the changes to include/uapi/linux (3 of 40 files). Show all

Unified · Split

3 files
  1. include/uapi/linux/vhost.h +24 −0
  2. include/uapi/linux/vhost_types.h +8 −0
  3. include/uapi/linux/virtio_net.h +98 −4
include/uapi/linux/vhost.h+24−0
@@ -116,4 +116,28 @@ · 115 unmodified lines
116116 #define VHOST_VSOCK_SET_GUEST_CID _IOW(VHOST_VIRTIO, 0x60, __u64)
117117 #define VHOST_VSOCK_SET_RUNNING _IOW(VHOST_VIRTIO, 0x61, int)
118118
119+/* VHOST_VDPA specific defines */
120+
121+/* Get the device id. The device ids follow the same definition of
122+ * the device id defined in virtio-spec.
123+ */
124+#define VHOST_VDPA_GET_DEVICE_ID _IOR(VHOST_VIRTIO, 0x70, __u32)
125+/* Get and set the status. The status bits follow the same definition
126+ * of the device status defined in virtio-spec.
127+ */
128+#define VHOST_VDPA_GET_STATUS _IOR(VHOST_VIRTIO, 0x71, __u8)
129+#define VHOST_VDPA_SET_STATUS _IOW(VHOST_VIRTIO, 0x72, __u8)
130+/* Get and set the device config. The device config follows the same
131+ * definition of the device config defined in virtio-spec.
132+ */
133+#define VHOST_VDPA_GET_CONFIG _IOR(VHOST_VIRTIO, 0x73, \
134+ struct vhost_vdpa_config)
135+#define VHOST_VDPA_SET_CONFIG _IOW(VHOST_VIRTIO, 0x74, \
136+ struct vhost_vdpa_config)
137+/* Enable/disable the ring. */
138+#define VHOST_VDPA_SET_VRING_ENABLE _IOW(VHOST_VIRTIO, 0x75, \
139+ struct vhost_vring_state)
140+/* Get the max ring size. */
141+#define VHOST_VDPA_GET_VRING_NUM _IOR(VHOST_VIRTIO, 0x76, __u16)
142+
119143 #endif
include/uapi/linux/vhost_types.h+8−0
@@ -119,6 +119,14 @@ struct vhost_scsi_target { · 118 unmodified lines
119119 unsigned short reserved;
120120 };
121121
122+/* VHOST_VDPA specific definitions */
123+
124+struct vhost_vdpa_config {
125+ __u32 off;
126+ __u32 len;
127+ __u8 buf[0];
128+};
129+
122130 /* Feature bits */
123131 /* Log all write descriptors. Can be changed while device is active. */
124132 #define VHOST_F_LOG_ALL 26
include/uapi/linux/virtio_net.h+98−4
@@ -57,6 +57,9 @@ · 56 unmodified lines
5757 * Steering */
5858 #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
5959
60+#define VIRTIO_NET_F_HASH_REPORT 57 /* Supports hash report */
61+#define VIRTIO_NET_F_RSS 60 /* Supports RSS RX steering */
62+#define VIRTIO_NET_F_RSC_EXT 61 /* extended coalescing info */
6063 #define VIRTIO_NET_F_STANDBY 62 /* Act as standby for another device
6164 * with the same MAC.
6265 */
@@ -69,6 +72,17 @@ · 6 unmodified lines
6972 #define VIRTIO_NET_S_LINK_UP 1 /* Link is up */
7073 #define VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */
7174
75+/* supported/enabled hash types */
76+#define VIRTIO_NET_RSS_HASH_TYPE_IPv4 (1 << 0)
77+#define VIRTIO_NET_RSS_HASH_TYPE_TCPv4 (1 << 1)
78+#define VIRTIO_NET_RSS_HASH_TYPE_UDPv4 (1 << 2)
79+#define VIRTIO_NET_RSS_HASH_TYPE_IPv6 (1 << 3)
80+#define VIRTIO_NET_RSS_HASH_TYPE_TCPv6 (1 << 4)
81+#define VIRTIO_NET_RSS_HASH_TYPE_UDPv6 (1 << 5)
82+#define VIRTIO_NET_RSS_HASH_TYPE_IP_EX (1 << 6)
83+#define VIRTIO_NET_RSS_HASH_TYPE_TCP_EX (1 << 7)
84+#define VIRTIO_NET_RSS_HASH_TYPE_UDP_EX (1 << 8)
85+
7286 struct virtio_net_config {
7387 /* The config defining mac address (if VIRTIO_NET_F_MAC) */
7488 __u8 mac[ETH_ALEN];
@@ -92,6 +106,12 @@ struct virtio_net_config { · 17 unmodified lines
92106 * Any other value stands for unknown.
93107 */
94108 __u8 duplex;
109+ /* maximum size of RSS key */
110+ __u8 rss_max_key_size;
111+ /* maximum number of indirection table entries */
112+ __le16 rss_max_indirection_table_length;
113+ /* bitmask of supported VIRTIO_NET_RSS_HASH_ types */
114+ __le32 supported_hash_types;
95115 } __attribute__((packed));
96116
97117 /*
@@ -104,6 +124,7 @@ struct virtio_net_config { · 6 unmodified lines
104124 struct virtio_net_hdr_v1 {
105125 #define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 /* Use csum_start, csum_offset */
106126 #define VIRTIO_NET_HDR_F_DATA_VALID 2 /* Csum is valid */
127+#define VIRTIO_NET_HDR_F_RSC_INFO 4 /* rsc info in csum_ fields */
107128 __u8 flags;
108129 #define VIRTIO_NET_HDR_GSO_NONE 0 /* Not a GSO frame */
109130 #define VIRTIO_NET_HDR_GSO_TCPV4 1 /* GSO frame, IPv4 TCP (TSO) */
@@ -113,11 +134,46 @@ struct virtio_net_hdr_v1 { · 3 unmodified lines
113134 __u8 gso_type;
114135 __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */
115136 __virtio16 gso_size; /* Bytes to append to hdr_len per frame */
116− __virtio16 csum_start; /* Position to start checksumming from */
117− __virtio16 csum_offset; /* Offset after that to place checksum */
137+ union {
138+ struct {
139+ __virtio16 csum_start;
140+ __virtio16 csum_offset;
141+ };
142+ /* Checksum calculation */
143+ struct {
144+ /* Position to start checksumming from */
145+ __virtio16 start;
146+ /* Offset after that to place checksum */
147+ __virtio16 offset;
148+ } csum;
149+ /* Receive Segment Coalescing */
150+ struct {
151+ /* Number of coalesced segments */
152+ __le16 segments;
153+ /* Number of duplicated acks */
154+ __le16 dup_acks;
155+ } rsc;
156+ };
118157 __virtio16 num_buffers; /* Number of merged rx buffers */
119158 };
120159
160+struct virtio_net_hdr_v1_hash {
161+ struct virtio_net_hdr_v1 hdr;
162+ __le32 hash_value;
163+#define VIRTIO_NET_HASH_REPORT_NONE 0
164+#define VIRTIO_NET_HASH_REPORT_IPv4 1
165+#define VIRTIO_NET_HASH_REPORT_TCPv4 2
166+#define VIRTIO_NET_HASH_REPORT_UDPv4 3
167+#define VIRTIO_NET_HASH_REPORT_IPv6 4
168+#define VIRTIO_NET_HASH_REPORT_TCPv6 5
169+#define VIRTIO_NET_HASH_REPORT_UDPv6 6
170+#define VIRTIO_NET_HASH_REPORT_IPv6_EX 7
171+#define VIRTIO_NET_HASH_REPORT_TCPv6_EX 8
172+#define VIRTIO_NET_HASH_REPORT_UDPv6_EX 9
173+ __le16 hash_report;
174+ __le16 padding;
175+};
176+
121177 #ifndef VIRTIO_NET_NO_LEGACY
122178 /* This header comes first in the scatter-gather list.
123179 * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, it must
@@ -228,7 +284,9 @@ struct virtio_net_ctrl_mac { · 104 unmodified lines
228284
229285 /*
230286 * Control Receive Flow Steering
231− *
287+ */
288+#define VIRTIO_NET_CTRL_MQ 4
289+/*
232290 * The command VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET
233291 * enables Receive Flow Steering, specifying the number of the transmit and
234292 * receive queues that will be used. After the command is consumed and acked by
@@ -241,11 +299,47 @@ struct virtio_net_ctrl_mq { · 6 unmodified lines
241299 __virtio16 virtqueue_pairs;
242300 };
243301
244−#define VIRTIO_NET_CTRL_MQ 4
245302 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0
246303 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1
247304 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000
248305
306+/*
307+ * The command VIRTIO_NET_CTRL_MQ_RSS_CONFIG has the same effect as
308+ * VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET does and additionally configures
309+ * the receive steering to use a hash calculated for incoming packet
310+ * to decide on receive virtqueue to place the packet. The command
311+ * also provides parameters to calculate a hash and receive virtqueue.
312+ */
313+struct virtio_net_rss_config {
314+ __le32 hash_types;
315+ __le16 indirection_table_mask;
316+ __le16 unclassified_queue;
317+ __le16 indirection_table[1/* + indirection_table_mask */];
318+ __le16 max_tx_vq;
319+ __u8 hash_key_length;
320+ __u8 hash_key_data[/* hash_key_length */];
321+};
322+
323+ #define VIRTIO_NET_CTRL_MQ_RSS_CONFIG 1
324+
325+/*
326+ * The command VIRTIO_NET_CTRL_MQ_HASH_CONFIG requests the device
327+ * to include in the virtio header of the packet the value of the
328+ * calculated hash and the report type of hash. It also provides
329+ * parameters for hash calculation. The command requires feature
330+ * VIRTIO_NET_F_HASH_REPORT to be negotiated to extend the
331+ * layout of virtio header as defined in virtio_net_hdr_v1_hash.
332+ */
333+struct virtio_net_hash_config {
334+ __le32 hash_types;
335+ /* for compatibility with virtio_net_rss_config */
336+ __le16 reserved[4];
337+ __u8 hash_key_length;
338+ __u8 hash_key_data[/* hash_key_length */];
339+};
340+
341+ #define VIRTIO_NET_CTRL_MQ_HASH_CONFIG 2
342+
249343 /*
250344 * Control network offloads
251345 *