aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@hp.com>2009-02-04 04:02:34 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-04 19:35:11 -0500
commit2a41f71d3bd97dde3305b4e1c43ab0eca46e7c71 (patch)
treed739c170b843ff322ff0897465adbca5cd7041c7 /include/linux
parent073a24364fe6de7eef0a3dec0ec7d48e56624092 (diff)
virtio_net: Add a virtqueue for outbound control commands
This will be used for RX mode, MAC filter table, VLAN filtering, etc... The control transaction consists of one or more "out" sg entries and one or more "in" sg entries. The first out entry contains a header defining the class and command. Additional out entries may provide data for the command. The last in entry provides a status response back from the command. Virtqueues typically run asynchronous, running a callback function when there's data in the channel. We can't readily make use of this in the command paths where we need to use this. Instead, we kick the virtqueue and spin. The kick causes an I/O write, triggering an immediate trap into the hypervisor. Signed-off-by: Alex Williamson <alex.williamson@hp.com> Acked-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/virtio_net.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index d8e362d52fd8..245eda829aa8 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -23,6 +23,7 @@
23#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */ 23#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */
24#define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */ 24#define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */
25#define VIRTIO_NET_F_STATUS 16 /* virtio_net_config.status available */ 25#define VIRTIO_NET_F_STATUS 16 /* virtio_net_config.status available */
26#define VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */
26 27
27#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ 28#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */
28 29
@@ -59,4 +60,21 @@ struct virtio_net_hdr_mrg_rxbuf {
59 __u16 num_buffers; /* Number of merged rx buffers */ 60 __u16 num_buffers; /* Number of merged rx buffers */
60}; 61};
61 62
63/*
64 * Control virtqueue data structures
65 *
66 * The control virtqueue expects a header in the first sg entry
67 * and an ack/status response in the last entry. Data for the
68 * command goes in between.
69 */
70struct virtio_net_ctrl_hdr {
71 __u8 class;
72 __u8 cmd;
73} __attribute__((packed));
74
75typedef __u8 virtio_net_ctrl_ack;
76
77#define VIRTIO_NET_OK 0
78#define VIRTIO_NET_ERR 1
79
62#endif /* _LINUX_VIRTIO_NET_H */ 80#endif /* _LINUX_VIRTIO_NET_H */