rndisreg.h revision 1.2 1 /* $NetBSD: rndisreg.h,v 1.2 2019/02/15 08:54:02 nonaka Exp $ */
2 /* NetBSD: if_urndisreg.h,v 1.4 2018/11/09 21:57:09 maya Exp */
3 /* $OpenBSD: if_urndisreg.h,v 1.14 2010/07/08 18:22:01 ckuethe Exp $ */
4
5 /*
6 * Copyright (c) 2010 Jonathan Armani <armani (at) openbsd.org>
7 * Copyright (c) 2010 Fabien Romano <fabien (at) openbsd.org>
8 * Copyright (c) 2010 Michael Knudsen <mk (at) openbsd.org>
9 * All rights reserved.
10 *
11 * Permission to use, copy, modify, and distribute this software for any
12 * purpose with or without fee is hereby granted, provided that the above
13 * copyright notice and this permission notice appear in all copies.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
16 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
18 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
21 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 */
23
24 #ifndef _DEV_IC_RNDISREG_H_
25 #define _DEV_IC_RNDISREG_H_
26
27 /* Canonical major/minor version as of 22th Aug. 2016. */
28 #define RNDIS_VERSION_MAJOR 0x00000001
29 #define RNDIS_VERSION_MINOR 0x00000000
30
31 #define RNDIS_STATUS_SUCCESS 0x00000000L
32 #define RNDIS_STATUS_PENDING 0x00000103L
33 #define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BL
34 #define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CL
35 #define RNDIS_STATUS_OFFLOAD_CURRENT_CONFIG 0x40020006
36 #define RNDIS_STATUS_BUFFER_OVERFLOW 0x80000005L
37 #define RNDIS_STATUS_FAILURE 0xC0000001L
38 #define RNDIS_STATUS_RESOURCES 0xC000009AL
39 #define RNDIS_STATUS_NOT_SUPPORTED 0xC00000BBL
40 #define RNDIS_STATUS_INVALID_DATA 0xC0010015L
41
42 #define OID_GEN_SUPPORTED_LIST 0x00010101
43 #define OID_GEN_HARDWARE_STATUS 0x00010102
44 #define OID_GEN_MEDIA_SUPPORTED 0x00010103
45 #define OID_GEN_MEDIA_IN_USE 0x00010104
46 #define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
47 #define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
48 #define OID_GEN_LINK_SPEED 0x00010107
49 #define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
50 #define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
51 #define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
52 #define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
53 #define OID_GEN_VENDOR_ID 0x0001010C
54 #define OID_GEN_VENDOR_DESCRIPTION 0x0001010D
55 #define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
56 #define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
57 #define OID_GEN_DRIVER_VERSION 0x00010110
58 #define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
59 #define OID_GEN_PROTOCOL_OPTIONS 0x00010112
60 #define OID_GEN_MAC_OPTIONS 0x00010113
61 #define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
62 #define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
63 #define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
64 #define OID_GEN_SUPPORTED_GUIDS 0x00010117
65 #define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
66 #define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
67 #define OID_GEN_MACHINE_NAME 0x0001021A
68 #define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
69 #define OID_GEN_VLAN_ID 0x0001021C
70
71 #define OID_802_3_PERMANENT_ADDRESS 0x01010101
72 #define OID_802_3_CURRENT_ADDRESS 0x01010102
73 #define OID_802_3_MULTICAST_LIST 0x01010103
74 #define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
75 #define OID_802_3_MAC_OPTIONS 0x01010105
76 #define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
77 #define OID_802_3_XMIT_ONE_COLLISION 0x01020102
78 #define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
79 #define OID_802_3_XMIT_DEFERRED 0x01020201
80 #define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
81 #define OID_802_3_RCV_OVERRUN 0x01020203
82 #define OID_802_3_XMIT_UNDERRUN 0x01020204
83 #define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
84 #define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
85 #define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
86
87 #define OID_TCP_OFFLOAD_PARAMETERS 0xFC01020C
88
89 #define RNDIS_MEDIUM_802_3 0x00000000
90
91 #define RNDIS_MAJOR_VERSION 0x00000001U
92 #define RNDIS_MINOR_VERSION 0x00000000U
93
94 /* Device flags */
95 #define RNDIS_DF_CONNECTIONLESS 0x00000001
96 #define RNDIS_DF_CONNECTION_ORIENTED 0x00000002
97
98 /*
99 * Common RNDIS message header.
100 */
101 struct rndis_msghdr {
102 uint32_t rm_type;
103 uint32_t rm_len;
104 };
105
106 /*
107 * RNDIS data message
108 */
109 #define REMOTE_NDIS_PACKET_MSG 0x00000001
110
111
112 struct rndis_packet_msg {
113 uint32_t rm_type;
114 uint32_t rm_len;
115 uint32_t rm_dataoffset;
116 uint32_t rm_datalen;
117 uint32_t rm_oobdataoffset;
118 uint32_t rm_oobdatalen;
119 uint32_t rm_oobdataelements;
120 uint32_t rm_pktinfooffset;
121 uint32_t rm_pktinfolen;
122 uint32_t rm_vchandle;
123 uint32_t rm_reserved;
124 };
125
126 /* Per-packet-info for RNDIS data message */
127 struct rndis_pktinfo {
128 uint32_t rm_size;
129 uint32_t rm_type;
130 uint32_t rm_pktinfooffset;
131 uint8_t rm_data[0];
132 };
133
134 #define NDIS_PKTINFO_TYPE_CSUM 0
135 #define NDIS_PKTINFO_TYPE_IPSEC 1
136 #define NDIS_PKTINFO_TYPE_LSO 2
137 #define NDIS_PKTINFO_TYPE_CLASSIFY 3
138 /* reserved 4 */
139 #define NDIS_PKTINFO_TYPE_SGLIST 5
140 #define NDIS_PKTINFO_TYPE_VLAN 6
141 #define NDIS_PKTINFO_TYPE_ORIG 7
142 #define NDIS_PKTINFO_TYPE_PKT_CANCELID 8
143 #define NDIS_PKTINFO_TYPE_ORIG_NBLIST 9
144 #define NDIS_PKTINFO_TYPE_CACHE_NBLIST 10
145 #define NDIS_PKTINFO_TYPE_PKT_PAD 11
146
147 /*
148 * RNDIS control messages
149 */
150 struct rndis_comp_hdr {
151 uint32_t rm_type;
152 uint32_t rm_len;
153 uint32_t rm_rid;
154 uint32_t rm_status;
155 };
156
157 /* Initialize the device. */
158 #define REMOTE_NDIS_INITIALIZE_MSG 0x00000002
159 #define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002
160
161 struct rndis_init_req {
162 uint32_t rm_type;
163 uint32_t rm_len;
164 uint32_t rm_rid;
165 uint32_t rm_ver_major;
166 uint32_t rm_ver_minor;
167 uint32_t rm_max_xfersz;
168 };
169
170 struct rndis_init_comp {
171 uint32_t rm_type;
172 uint32_t rm_len;
173 uint32_t rm_rid;
174 uint32_t rm_status;
175 uint32_t rm_ver_major;
176 uint32_t rm_ver_minor;
177 uint32_t rm_devflags;
178 uint32_t rm_medium;
179 uint32_t rm_pktmaxcnt;
180 uint32_t rm_pktmaxsz;
181 uint32_t rm_align;
182 uint32_t rm_aflistoffset;
183 uint32_t rm_aflistsz;
184 };
185
186 /* Halt the device. No response sent. */
187 #define REMOTE_NDIS_HALT_MSG 0x00000003
188
189 struct rndis_halt_req {
190 uint32_t rm_type;
191 uint32_t rm_len;
192 uint32_t rm_rid;
193 };
194
195 /* Send a query object. */
196 #define REMOTE_NDIS_QUERY_MSG 0x00000004
197 #define REMOTE_NDIS_QUERY_CMPLT 0x80000004
198
199 struct rndis_query_req {
200 uint32_t rm_type;
201 uint32_t rm_len;
202 uint32_t rm_rid;
203 uint32_t rm_oid;
204 uint32_t rm_infobuflen;
205 uint32_t rm_infobufoffset;
206 uint32_t rm_devicevchdl;
207 };
208
209 struct rndis_query_comp {
210 uint32_t rm_type;
211 uint32_t rm_len;
212 uint32_t rm_rid;
213 uint32_t rm_status;
214 uint32_t rm_infobuflen;
215 uint32_t rm_infobufoffset;
216 };
217
218 /* Send a set object request. */
219 #define REMOTE_NDIS_SET_MSG 0x00000005
220 #define REMOTE_NDIS_SET_CMPLT 0x80000005
221
222 struct rndis_set_req {
223 uint32_t rm_type;
224 uint32_t rm_len;
225 uint32_t rm_rid;
226 uint32_t rm_oid;
227 uint32_t rm_infobuflen;
228 uint32_t rm_infobufoffset;
229 uint32_t rm_devicevchdl;
230 };
231
232 struct rndis_set_comp {
233 uint32_t rm_type;
234 uint32_t rm_len;
235 uint32_t rm_rid;
236 uint32_t rm_status;
237 };
238
239 #define REMOTE_NDIS_SET_PARAM_NUMERIC 0x00000000
240 #define REMOTE_NDIS_SET_PARAM_STRING 0x00000002
241
242 struct rndis_set_parameter {
243 uint32_t rm_nameoffset;
244 uint32_t rm_namelen;
245 uint32_t rm_type;
246 uint32_t rm_valueoffset;
247 uint32_t rm_valuelen;
248 };
249
250 /* Perform a soft reset on the device. */
251 #define REMOTE_NDIS_RESET_MSG 0x00000006
252 #define REMOTE_NDIS_RESET_CMPLT 0x80000006
253
254 struct rndis_reset_req {
255 uint32_t rm_type;
256 uint32_t rm_len;
257 uint32_t rm_rid;
258 };
259
260 struct rndis_reset_comp {
261 uint32_t rm_type;
262 uint32_t rm_len;
263 uint32_t rm_status;
264 uint32_t rm_adrreset;
265 };
266
267 /* 802.3 link-state or undefined message error. */
268 #define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007
269
270 /* Keepalive messsage. May be sent by device. */
271 #define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008
272 #define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008
273
274 struct rndis_keepalive_req {
275 uint32_t rm_type;
276 uint32_t rm_len;
277 uint32_t rm_rid;
278 };
279
280 struct rndis_keepalive_comp {
281 uint32_t rm_type;
282 uint32_t rm_len;
283 uint32_t rm_rid;
284 uint32_t rm_status;
285 };
286
287 /* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
288 #define RNDIS_PACKET_TYPE_DIRECTED 0x00000001
289 #define RNDIS_PACKET_TYPE_MULTICAST 0x00000002
290 #define RNDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
291 #define RNDIS_PACKET_TYPE_BROADCAST 0x00000008
292 #define RNDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
293 #define RNDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
294 #define RNDIS_PACKET_TYPE_SMT 0x00000040
295 #define RNDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
296 #define RNDIS_PACKET_TYPE_GROUP 0x00001000
297 #define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
298 #define RNDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
299 #define RNDIS_PACKET_TYPE_MAC_FRAME 0x00008000
300
301 /* Rndis offsets */
302 #define RNDIS_HEADER_OFFSET (sizeof(struct rndis_msghdr))
303 #define RNDIS_DATA_OFFSET (sizeof(struct rndis_packet_msg) - \
304 RNDIS_HEADER_OFFSET)
305
306 #endif /* _DEV_IC_RNDISREG_H_ */
307