aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/virtio_net.h
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@hp.com>2009-02-04 09:02:34 +0000
committerDavid S. Miller <davem@davemloft.net>2009-02-04 16:35:11 -0800
commit2a41f71d3bd97dde3305b4e1c43ab0eca46e7c71 (patch)
treed739c170b843ff322ff0897465adbca5cd7041c7 /include/linux/virtio_net.h
parents2io: Formatting log message (diff)
downloadwireguard-linux-2a41f71d3bd97dde3305b4e1c43ab0eca46e7c71.tar.xz
wireguard-linux-2a41f71d3bd97dde3305b4e1c43ab0eca46e7c71.zip
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/virtio_net.h')
-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 @@
#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */
#define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */
#define VIRTIO_NET_F_STATUS 16 /* virtio_net_config.status available */
+#define VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */
#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */
@@ -59,4 +60,21 @@ struct virtio_net_hdr_mrg_rxbuf {
__u16 num_buffers; /* Number of merged rx buffers */
};
+/*
+ * Control virtqueue data structures
+ *
+ * The control virtqueue expects a header in the first sg entry
+ * and an ack/status response in the last entry. Data for the
+ * command goes in between.
+ */
+struct virtio_net_ctrl_hdr {
+ __u8 class;
+ __u8 cmd;
+} __attribute__((packed));
+
+typedef __u8 virtio_net_ctrl_ack;
+
+#define VIRTIO_NET_OK 0
+#define VIRTIO_NET_ERR 1
+
#endif /* _LINUX_VIRTIO_NET_H */