Statistics
| Branch: | Revision:

root / net / tap-linux.h @ a9899996

History | View | Annotate | Download (1.8 kB)

1 76682299 Mark McLoughlin
/*
2 76682299 Mark McLoughlin
 *  Universal TUN/TAP device driver.
3 76682299 Mark McLoughlin
 *  Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com>
4 76682299 Mark McLoughlin
 *
5 76682299 Mark McLoughlin
 *  This program is free software; you can redistribute it and/or modify
6 76682299 Mark McLoughlin
 *  it under the terms of the GNU General Public License as published by
7 76682299 Mark McLoughlin
 *  the Free Software Foundation; either version 2 of the License, or
8 76682299 Mark McLoughlin
 *  (at your option) any later version.
9 76682299 Mark McLoughlin
 *
10 76682299 Mark McLoughlin
 *  This program is distributed in the hope that it will be useful,
11 76682299 Mark McLoughlin
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 76682299 Mark McLoughlin
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 76682299 Mark McLoughlin
 *  GNU General Public License for more details.
14 76682299 Mark McLoughlin
 */
15 76682299 Mark McLoughlin
16 76682299 Mark McLoughlin
#ifndef QEMU_TAP_H
17 76682299 Mark McLoughlin
#define QEMU_TAP_H
18 76682299 Mark McLoughlin
19 8e0f8e5b Mark McLoughlin
#include <stdint.h>
20 ed7193ec Anthony Liguori
#ifdef __linux__
21 71f4effc Alexander Graf
22 76682299 Mark McLoughlin
#include <linux/ioctl.h>
23 76682299 Mark McLoughlin
24 76682299 Mark McLoughlin
/* Ioctl defines */
25 76682299 Mark McLoughlin
#define TUNSETIFF     _IOW('T', 202, int)
26 8e0f8e5b Mark McLoughlin
#define TUNGETFEATURES _IOR('T', 207, unsigned int)
27 b1c28b46 Mark McLoughlin
#define TUNSETOFFLOAD  _IOW('T', 208, unsigned int)
28 8e0f8e5b Mark McLoughlin
#define TUNGETIFF      _IOR('T', 210, unsigned int)
29 76682299 Mark McLoughlin
#define TUNSETSNDBUF   _IOW('T', 212, int)
30 445d892f Michael S. Tsirkin
#define TUNGETVNETHDRSZ _IOR('T', 215, int)
31 445d892f Michael S. Tsirkin
#define TUNSETVNETHDRSZ _IOW('T', 216, int)
32 76682299 Mark McLoughlin
33 71f4effc Alexander Graf
#endif
34 71f4effc Alexander Graf
35 76682299 Mark McLoughlin
/* TUNSETIFF ifr flags */
36 76682299 Mark McLoughlin
#define IFF_TAP                0x0002
37 76682299 Mark McLoughlin
#define IFF_NO_PI        0x1000
38 8e0f8e5b Mark McLoughlin
#define IFF_VNET_HDR        0x4000
39 8e0f8e5b Mark McLoughlin
40 b1c28b46 Mark McLoughlin
/* Features for GSO (TUNSETOFFLOAD). */
41 b1c28b46 Mark McLoughlin
#define TUN_F_CSUM        0x01        /* You can hand me unchecksummed packets. */
42 b1c28b46 Mark McLoughlin
#define TUN_F_TSO4        0x02        /* I can handle TSO for IPv4 packets */
43 b1c28b46 Mark McLoughlin
#define TUN_F_TSO6        0x04        /* I can handle TSO for IPv6 packets */
44 b1c28b46 Mark McLoughlin
#define TUN_F_TSO_ECN        0x08        /* I can handle TSO with ECN bits. */
45 6c9f58ba Sridhar Samudrala
#define TUN_F_UFO        0x10        /* I can handle UFO packets */
46 b1c28b46 Mark McLoughlin
47 8e0f8e5b Mark McLoughlin
struct virtio_net_hdr
48 8e0f8e5b Mark McLoughlin
{
49 8e0f8e5b Mark McLoughlin
    uint8_t flags;
50 8e0f8e5b Mark McLoughlin
    uint8_t gso_type;
51 8e0f8e5b Mark McLoughlin
    uint16_t hdr_len;
52 8e0f8e5b Mark McLoughlin
    uint16_t gso_size;
53 8e0f8e5b Mark McLoughlin
    uint16_t csum_start;
54 8e0f8e5b Mark McLoughlin
    uint16_t csum_offset;
55 8e0f8e5b Mark McLoughlin
};
56 76682299 Mark McLoughlin
57 ef4252b1 Michael S. Tsirkin
struct virtio_net_hdr_mrg_rxbuf
58 ef4252b1 Michael S. Tsirkin
{
59 ef4252b1 Michael S. Tsirkin
    struct virtio_net_hdr hdr;
60 ef4252b1 Michael S. Tsirkin
    uint16_t num_buffers;   /* Number of merged rx buffers */
61 ef4252b1 Michael S. Tsirkin
};
62 ef4252b1 Michael S. Tsirkin
63 76682299 Mark McLoughlin
#endif /* QEMU_TAP_H */