summaryrefslogtreecommitdiff
path: root/include/linux/venet.h
blob: 0578d797c97383bd443997d42ed65bf1db1a7787 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
 * Copyright 2009 Novell.  All Rights Reserved.
 *
 * Virtual-Ethernet adapter
 *
 * Author:
 *      Gregory Haskins <ghaskins@novell.com>
 *
 * This file is free software; you can redistribute it and/or modify
 * it under the terms of version 2 of the GNU General Public License
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#ifndef _LINUX_VENET_H
#define _LINUX_VENET_H

#include <linux/types.h>

#define VENET_VERSION 1

#define VENET_TYPE "virtual-ethernet"

#define VENET_QUEUE_RX 0
#define VENET_QUEUE_TX 1

struct venet_capabilities {
	__u32 gid;
	__u32 bits;
};

#define VENET_CAP_GROUP_SG     0
#define VENET_CAP_GROUP_EVENTQ 1
#define VENET_CAP_GROUP_L4RO    2 /* layer-4 reassem offloading */

/* CAPABILITIES-GROUP SG */
#define VENET_CAP_SG     (1 << 0)
#define VENET_CAP_TSO4   (1 << 1)
#define VENET_CAP_TSO6   (1 << 2)
#define VENET_CAP_ECN    (1 << 3)
#define VENET_CAP_UFO    (1 << 4)
#define VENET_CAP_PMTD   (1 << 5) /* pre-mapped tx desc */

/* CAPABILITIES-GROUP EVENTQ */
#define VENET_CAP_EVQ_LINKSTATE  (1 << 0)
#define VENET_CAP_EVQ_TXC        (1 << 1) /* tx-complete */

struct venet_iov {
	__u32 len;
	__u64 ptr;
};

#define VENET_SG_FLAG_NEEDS_CSUM (1 << 0)
#define VENET_SG_FLAG_GSO        (1 << 1)
#define VENET_SG_FLAG_ECN        (1 << 2)

struct venet_sg {
	__u64            cookie;
	__u32            flags;
	__u32            len;     /* total length of all iovs */
	struct {
		__u16    start;	  /* csum starting position */
		__u16    offset;  /* offset to place csum */
	} csum;
	struct {
#define VENET_GSO_TYPE_TCPV4	0	/* IPv4 TCP (TSO) */
#define VENET_GSO_TYPE_UDP	1	/* IPv4 UDP (UFO) */
#define VENET_GSO_TYPE_TCPV6	2	/* IPv6 TCP */
		__u8     type;
		__u16    hdrlen;
		__u16    size;
	} gso;
	__u32            count;   /* nr of iovs */
	struct venet_iov iov[1];
};

struct venet_eventq_query {
	__u32 flags;
	__u32 evsize;  /* size of each event */
	__u32 dpid;    /* descriptor pool-id */
	__u32 qid;
	__u8  pad[16];
};

#define VENET_EVENT_LINKSTATE 0
#define VENET_EVENT_TXC       1

struct venet_event_header {
	__u32 flags;
	__u32 size;
	__u32 id;
};

struct venet_event_linkstate {
	struct venet_event_header header;
	__u8                      state; /* 0 = down, 1 = up */
};

struct venet_event_txc {
	struct venet_event_header header;
	__u32                     txqid;
	__u64                     cookie;
};

struct venet_l4ro_query {
	__u32 flags;
	__u32 dpid;    /* descriptor pool-id */
	__u32 pqid;    /* page queue-id */
	__u8  pad[20];
};


#define VSG_DESC_SIZE(count) (sizeof(struct venet_sg) + \
			      sizeof(struct venet_iov) * ((count) - 1))

#define VENET_FUNC_LINKUP    0
#define VENET_FUNC_LINKDOWN  1
#define VENET_FUNC_MACQUERY  2
#define VENET_FUNC_NEGCAP    3 /* negotiate capabilities */
#define VENET_FUNC_FLUSHRX   4
#define VENET_FUNC_PMTDQUERY 5
#define VENET_FUNC_EVQQUERY  6
#define VENET_FUNC_L4ROQUERY  7

#endif /* _LINUX_VENET_H */