summaryrefslogtreecommitdiff
path: root/net/tap.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2010-07-16 11:16:06 +0300
committerMichael S. Tsirkin <mst@redhat.com>2010-09-07 20:27:33 +0300
commit445d892f43e6a6031cd1aac292df433f821aa830 (patch)
tree3ebf888277076f28b8a5bf5adf9ef5eae1efcbaa /net/tap.c
parentef4252b149cf238480c45c06dcbd567d41ee7d76 (diff)
downloadqemu-445d892f43e6a6031cd1aac292df433f821aa830.tar.gz
tap: add APIs for vnet header length
Add APIs to control host header length. First user will be vhost-net. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'net/tap.c')
-rw-r--r--net/tap.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/net/tap.c b/net/tap.c
index 2866ff40e8..4afb314fde 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -232,6 +232,27 @@ int tap_has_vnet_hdr(VLANClientState *nc)
return !!s->host_vnet_hdr_len;
}
+int tap_has_vnet_hdr_len(VLANClientState *nc, int len)
+{
+ TAPState *s = DO_UPCAST(TAPState, nc, nc);
+
+ assert(nc->info->type == NET_CLIENT_TYPE_TAP);
+
+ return tap_probe_vnet_hdr_len(s->fd, len);
+}
+
+void tap_set_vnet_hdr_len(VLANClientState *nc, int len)
+{
+ TAPState *s = DO_UPCAST(TAPState, nc, nc);
+
+ assert(nc->info->type == NET_CLIENT_TYPE_TAP);
+ assert(len == sizeof(struct virtio_net_hdr_mrg_rxbuf) ||
+ len == sizeof(struct virtio_net_hdr));
+
+ tap_fd_set_vnet_hdr_len(s->fd, len);
+ s->host_vnet_hdr_len = len;
+}
+
void tap_using_vnet_hdr(VLANClientState *nc, int using_vnet_hdr)
{
TAPState *s = DO_UPCAST(TAPState, nc, nc);