hyperv_net.h 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165
  1. /*
  2. *
  3. * Copyright (c) 2011, Microsoft Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms and conditions of the GNU General Public License,
  7. * version 2, as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  16. * Place - Suite 330, Boston, MA 02111-1307 USA.
  17. *
  18. * Authors:
  19. * Haiyang Zhang <haiyangz@microsoft.com>
  20. * Hank Janssen <hjanssen@microsoft.com>
  21. * K. Y. Srinivasan <kys@microsoft.com>
  22. *
  23. */
  24. #ifndef _HYPERV_NET_H
  25. #define _HYPERV_NET_H
  26. #include <linux/list.h>
  27. #include <linux/hyperv.h>
  28. /* Fwd declaration */
  29. struct hv_netvsc_packet;
  30. /* Represent the xfer page packet which contains 1 or more netvsc packet */
  31. struct xferpage_packet {
  32. struct list_head list_ent;
  33. /* # of netvsc packets this xfer packet contains */
  34. u32 count;
  35. };
  36. /*
  37. * Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame
  38. * within the RNDIS
  39. */
  40. struct hv_netvsc_packet {
  41. /* Bookkeeping stuff */
  42. struct list_head list_ent;
  43. struct hv_device *device;
  44. bool is_data_pkt;
  45. /*
  46. * Valid only for receives when we break a xfer page packet
  47. * into multiple netvsc packets
  48. */
  49. struct xferpage_packet *xfer_page_pkt;
  50. union {
  51. struct {
  52. u64 recv_completion_tid;
  53. void *recv_completion_ctx;
  54. void (*recv_completion)(void *context);
  55. } recv;
  56. struct {
  57. u64 send_completion_tid;
  58. void *send_completion_ctx;
  59. void (*send_completion)(void *context);
  60. } send;
  61. } completion;
  62. /* This points to the memory after page_buf */
  63. void *extension;
  64. u32 total_data_buflen;
  65. /* Points to the send/receive buffer where the ethernet frame is */
  66. void *data;
  67. u32 page_buf_cnt;
  68. struct hv_page_buffer page_buf[0];
  69. };
  70. struct netvsc_device_info {
  71. unsigned char mac_adr[6];
  72. bool link_state; /* 0 - link up, 1 - link down */
  73. int ring_size;
  74. };
  75. enum rndis_device_state {
  76. RNDIS_DEV_UNINITIALIZED = 0,
  77. RNDIS_DEV_INITIALIZING,
  78. RNDIS_DEV_INITIALIZED,
  79. RNDIS_DEV_DATAINITIALIZED,
  80. };
  81. struct rndis_device {
  82. struct netvsc_device *net_dev;
  83. enum rndis_device_state state;
  84. bool link_state;
  85. atomic_t new_req_id;
  86. spinlock_t request_lock;
  87. struct list_head req_list;
  88. unsigned char hw_mac_adr[ETH_ALEN];
  89. };
  90. /* Interface */
  91. int netvsc_device_add(struct hv_device *device, void *additional_info);
  92. int netvsc_device_remove(struct hv_device *device);
  93. int netvsc_send(struct hv_device *device,
  94. struct hv_netvsc_packet *packet);
  95. void netvsc_linkstatus_callback(struct hv_device *device_obj,
  96. unsigned int status);
  97. int netvsc_recv_callback(struct hv_device *device_obj,
  98. struct hv_netvsc_packet *packet);
  99. int rndis_filter_open(struct hv_device *dev);
  100. int rndis_filter_close(struct hv_device *dev);
  101. int rndis_filter_device_add(struct hv_device *dev,
  102. void *additional_info);
  103. void rndis_filter_device_remove(struct hv_device *dev);
  104. int rndis_filter_receive(struct hv_device *dev,
  105. struct hv_netvsc_packet *pkt);
  106. int rndis_filter_send(struct hv_device *dev,
  107. struct hv_netvsc_packet *pkt);
  108. int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter);
  109. #define NVSP_INVALID_PROTOCOL_VERSION ((u32)0xFFFFFFFF)
  110. #define NVSP_PROTOCOL_VERSION_1 2
  111. #define NVSP_PROTOCOL_VERSION_2 0x30002
  112. enum {
  113. NVSP_MSG_TYPE_NONE = 0,
  114. /* Init Messages */
  115. NVSP_MSG_TYPE_INIT = 1,
  116. NVSP_MSG_TYPE_INIT_COMPLETE = 2,
  117. NVSP_VERSION_MSG_START = 100,
  118. /* Version 1 Messages */
  119. NVSP_MSG1_TYPE_SEND_NDIS_VER = NVSP_VERSION_MSG_START,
  120. NVSP_MSG1_TYPE_SEND_RECV_BUF,
  121. NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE,
  122. NVSP_MSG1_TYPE_REVOKE_RECV_BUF,
  123. NVSP_MSG1_TYPE_SEND_SEND_BUF,
  124. NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE,
  125. NVSP_MSG1_TYPE_REVOKE_SEND_BUF,
  126. NVSP_MSG1_TYPE_SEND_RNDIS_PKT,
  127. NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE,
  128. /* Version 2 messages */
  129. NVSP_MSG2_TYPE_SEND_CHIMNEY_DELEGATED_BUF,
  130. NVSP_MSG2_TYPE_SEND_CHIMNEY_DELEGATED_BUF_COMP,
  131. NVSP_MSG2_TYPE_REVOKE_CHIMNEY_DELEGATED_BUF,
  132. NVSP_MSG2_TYPE_RESUME_CHIMNEY_RX_INDICATION,
  133. NVSP_MSG2_TYPE_TERMINATE_CHIMNEY,
  134. NVSP_MSG2_TYPE_TERMINATE_CHIMNEY_COMP,
  135. NVSP_MSG2_TYPE_INDICATE_CHIMNEY_EVENT,
  136. NVSP_MSG2_TYPE_SEND_CHIMNEY_PKT,
  137. NVSP_MSG2_TYPE_SEND_CHIMNEY_PKT_COMP,
  138. NVSP_MSG2_TYPE_POST_CHIMNEY_RECV_REQ,
  139. NVSP_MSG2_TYPE_POST_CHIMNEY_RECV_REQ_COMP,
  140. NVSP_MSG2_TYPE_ALLOC_RXBUF,
  141. NVSP_MSG2_TYPE_ALLOC_RXBUF_COMP,
  142. NVSP_MSG2_TYPE_FREE_RXBUF,
  143. NVSP_MSG2_TYPE_SEND_VMQ_RNDIS_PKT,
  144. NVSP_MSG2_TYPE_SEND_VMQ_RNDIS_PKT_COMP,
  145. NVSP_MSG2_TYPE_SEND_NDIS_CONFIG,
  146. NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE,
  147. NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE_COMP,
  148. };
  149. enum {
  150. NVSP_STAT_NONE = 0,
  151. NVSP_STAT_SUCCESS,
  152. NVSP_STAT_FAIL,
  153. NVSP_STAT_PROTOCOL_TOO_NEW,
  154. NVSP_STAT_PROTOCOL_TOO_OLD,
  155. NVSP_STAT_INVALID_RNDIS_PKT,
  156. NVSP_STAT_BUSY,
  157. NVSP_STAT_PROTOCOL_UNSUPPORTED,
  158. NVSP_STAT_MAX,
  159. };
  160. struct nvsp_message_header {
  161. u32 msg_type;
  162. };
  163. /* Init Messages */
  164. /*
  165. * This message is used by the VSC to initialize the channel after the channels
  166. * has been opened. This message should never include anything other then
  167. * versioning (i.e. this message will be the same for ever).
  168. */
  169. struct nvsp_message_init {
  170. u32 min_protocol_ver;
  171. u32 max_protocol_ver;
  172. } __packed;
  173. /*
  174. * This message is used by the VSP to complete the initialization of the
  175. * channel. This message should never include anything other then versioning
  176. * (i.e. this message will be the same for ever).
  177. */
  178. struct nvsp_message_init_complete {
  179. u32 negotiated_protocol_ver;
  180. u32 max_mdl_chain_len;
  181. u32 status;
  182. } __packed;
  183. union nvsp_message_init_uber {
  184. struct nvsp_message_init init;
  185. struct nvsp_message_init_complete init_complete;
  186. } __packed;
  187. /* Version 1 Messages */
  188. /*
  189. * This message is used by the VSC to send the NDIS version to the VSP. The VSP
  190. * can use this information when handling OIDs sent by the VSC.
  191. */
  192. struct nvsp_1_message_send_ndis_version {
  193. u32 ndis_major_ver;
  194. u32 ndis_minor_ver;
  195. } __packed;
  196. /*
  197. * This message is used by the VSC to send a receive buffer to the VSP. The VSP
  198. * can then use the receive buffer to send data to the VSC.
  199. */
  200. struct nvsp_1_message_send_receive_buffer {
  201. u32 gpadl_handle;
  202. u16 id;
  203. } __packed;
  204. struct nvsp_1_receive_buffer_section {
  205. u32 offset;
  206. u32 sub_alloc_size;
  207. u32 num_sub_allocs;
  208. u32 end_offset;
  209. } __packed;
  210. /*
  211. * This message is used by the VSP to acknowledge a receive buffer send by the
  212. * VSC. This message must be sent by the VSP before the VSP uses the receive
  213. * buffer.
  214. */
  215. struct nvsp_1_message_send_receive_buffer_complete {
  216. u32 status;
  217. u32 num_sections;
  218. /*
  219. * The receive buffer is split into two parts, a large suballocation
  220. * section and a small suballocation section. These sections are then
  221. * suballocated by a certain size.
  222. */
  223. /*
  224. * For example, the following break up of the receive buffer has 6
  225. * large suballocations and 10 small suballocations.
  226. */
  227. /*
  228. * | Large Section | | Small Section |
  229. * ------------------------------------------------------------
  230. * | | | | | | | | | | | | | | | | | |
  231. * | |
  232. * LargeOffset SmallOffset
  233. */
  234. struct nvsp_1_receive_buffer_section sections[1];
  235. } __packed;
  236. /*
  237. * This message is sent by the VSC to revoke the receive buffer. After the VSP
  238. * completes this transaction, the vsp should never use the receive buffer
  239. * again.
  240. */
  241. struct nvsp_1_message_revoke_receive_buffer {
  242. u16 id;
  243. };
  244. /*
  245. * This message is used by the VSC to send a send buffer to the VSP. The VSC
  246. * can then use the send buffer to send data to the VSP.
  247. */
  248. struct nvsp_1_message_send_send_buffer {
  249. u32 gpadl_handle;
  250. u16 id;
  251. } __packed;
  252. /*
  253. * This message is used by the VSP to acknowledge a send buffer sent by the
  254. * VSC. This message must be sent by the VSP before the VSP uses the sent
  255. * buffer.
  256. */
  257. struct nvsp_1_message_send_send_buffer_complete {
  258. u32 status;
  259. /*
  260. * The VSC gets to choose the size of the send buffer and the VSP gets
  261. * to choose the sections size of the buffer. This was done to enable
  262. * dynamic reconfigurations when the cost of GPA-direct buffers
  263. * decreases.
  264. */
  265. u32 section_size;
  266. } __packed;
  267. /*
  268. * This message is sent by the VSC to revoke the send buffer. After the VSP
  269. * completes this transaction, the vsp should never use the send buffer again.
  270. */
  271. struct nvsp_1_message_revoke_send_buffer {
  272. u16 id;
  273. };
  274. /*
  275. * This message is used by both the VSP and the VSC to send a RNDIS message to
  276. * the opposite channel endpoint.
  277. */
  278. struct nvsp_1_message_send_rndis_packet {
  279. /*
  280. * This field is specified by RNIDS. They assume there's two different
  281. * channels of communication. However, the Network VSP only has one.
  282. * Therefore, the channel travels with the RNDIS packet.
  283. */
  284. u32 channel_type;
  285. /*
  286. * This field is used to send part or all of the data through a send
  287. * buffer. This values specifies an index into the send buffer. If the
  288. * index is 0xFFFFFFFF, then the send buffer is not being used and all
  289. * of the data was sent through other VMBus mechanisms.
  290. */
  291. u32 send_buf_section_index;
  292. u32 send_buf_section_size;
  293. } __packed;
  294. /*
  295. * This message is used by both the VSP and the VSC to complete a RNDIS message
  296. * to the opposite channel endpoint. At this point, the initiator of this
  297. * message cannot use any resources associated with the original RNDIS packet.
  298. */
  299. struct nvsp_1_message_send_rndis_packet_complete {
  300. u32 status;
  301. };
  302. union nvsp_1_message_uber {
  303. struct nvsp_1_message_send_ndis_version send_ndis_ver;
  304. struct nvsp_1_message_send_receive_buffer send_recv_buf;
  305. struct nvsp_1_message_send_receive_buffer_complete
  306. send_recv_buf_complete;
  307. struct nvsp_1_message_revoke_receive_buffer revoke_recv_buf;
  308. struct nvsp_1_message_send_send_buffer send_send_buf;
  309. struct nvsp_1_message_send_send_buffer_complete send_send_buf_complete;
  310. struct nvsp_1_message_revoke_send_buffer revoke_send_buf;
  311. struct nvsp_1_message_send_rndis_packet send_rndis_pkt;
  312. struct nvsp_1_message_send_rndis_packet_complete
  313. send_rndis_pkt_complete;
  314. } __packed;
  315. /*
  316. * Network VSP protocol version 2 messages:
  317. */
  318. struct nvsp_2_vsc_capability {
  319. union {
  320. u64 data;
  321. struct {
  322. u64 vmq:1;
  323. u64 chimney:1;
  324. u64 sriov:1;
  325. u64 ieee8021q:1;
  326. u64 correlation_id:1;
  327. };
  328. };
  329. } __packed;
  330. struct nvsp_2_send_ndis_config {
  331. u32 mtu;
  332. u32 reserved;
  333. struct nvsp_2_vsc_capability capability;
  334. } __packed;
  335. /* Allocate receive buffer */
  336. struct nvsp_2_alloc_rxbuf {
  337. /* Allocation ID to match the allocation request and response */
  338. u32 alloc_id;
  339. /* Length of the VM shared memory receive buffer that needs to
  340. * be allocated
  341. */
  342. u32 len;
  343. } __packed;
  344. /* Allocate receive buffer complete */
  345. struct nvsp_2_alloc_rxbuf_comp {
  346. /* The NDIS_STATUS code for buffer allocation */
  347. u32 status;
  348. u32 alloc_id;
  349. /* GPADL handle for the allocated receive buffer */
  350. u32 gpadl_handle;
  351. /* Receive buffer ID */
  352. u64 recv_buf_id;
  353. } __packed;
  354. struct nvsp_2_free_rxbuf {
  355. u64 recv_buf_id;
  356. } __packed;
  357. union nvsp_2_message_uber {
  358. struct nvsp_2_send_ndis_config send_ndis_config;
  359. struct nvsp_2_alloc_rxbuf alloc_rxbuf;
  360. struct nvsp_2_alloc_rxbuf_comp alloc_rxbuf_comp;
  361. struct nvsp_2_free_rxbuf free_rxbuf;
  362. } __packed;
  363. union nvsp_all_messages {
  364. union nvsp_message_init_uber init_msg;
  365. union nvsp_1_message_uber v1_msg;
  366. union nvsp_2_message_uber v2_msg;
  367. } __packed;
  368. /* ALL Messages */
  369. struct nvsp_message {
  370. struct nvsp_message_header hdr;
  371. union nvsp_all_messages msg;
  372. } __packed;
  373. #define NETVSC_MTU 65536
  374. #define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*2) /* 2MB */
  375. #define NETVSC_RECEIVE_BUFFER_ID 0xcafe
  376. #define NETVSC_RECEIVE_SG_COUNT 1
  377. /* Preallocated receive packets */
  378. #define NETVSC_RECEIVE_PACKETLIST_COUNT 256
  379. #define NETVSC_PACKET_SIZE 2048
  380. /* Per netvsc channel-specific */
  381. struct netvsc_device {
  382. struct hv_device *dev;
  383. u32 nvsp_version;
  384. atomic_t num_outstanding_sends;
  385. bool start_remove;
  386. bool destroy;
  387. /*
  388. * List of free preallocated hv_netvsc_packet to represent receive
  389. * packet
  390. */
  391. struct list_head recv_pkt_list;
  392. spinlock_t recv_pkt_list_lock;
  393. /* Receive buffer allocated by us but manages by NetVSP */
  394. void *recv_buf;
  395. u32 recv_buf_size;
  396. u32 recv_buf_gpadl_handle;
  397. u32 recv_section_cnt;
  398. struct nvsp_1_receive_buffer_section *recv_section;
  399. /* Used for NetVSP initialization protocol */
  400. struct completion channel_init_wait;
  401. struct nvsp_message channel_init_pkt;
  402. struct nvsp_message revoke_packet;
  403. /* unsigned char HwMacAddr[HW_MACADDR_LEN]; */
  404. struct net_device *ndev;
  405. /* Holds rndis device info */
  406. void *extension;
  407. };
  408. /* Status codes */
  409. #ifndef STATUS_SUCCESS
  410. #define STATUS_SUCCESS (0x00000000L)
  411. #endif
  412. #ifndef STATUS_UNSUCCESSFUL
  413. #define STATUS_UNSUCCESSFUL (0xC0000001L)
  414. #endif
  415. #ifndef STATUS_PENDING
  416. #define STATUS_PENDING (0x00000103L)
  417. #endif
  418. #ifndef STATUS_INSUFFICIENT_RESOURCES
  419. #define STATUS_INSUFFICIENT_RESOURCES (0xC000009AL)
  420. #endif
  421. #ifndef STATUS_BUFFER_OVERFLOW
  422. #define STATUS_BUFFER_OVERFLOW (0x80000005L)
  423. #endif
  424. #ifndef STATUS_NOT_SUPPORTED
  425. #define STATUS_NOT_SUPPORTED (0xC00000BBL)
  426. #endif
  427. #define RNDIS_STATUS_SUCCESS (STATUS_SUCCESS)
  428. #define RNDIS_STATUS_PENDING (STATUS_PENDING)
  429. #define RNDIS_STATUS_NOT_RECOGNIZED (0x00010001L)
  430. #define RNDIS_STATUS_NOT_COPIED (0x00010002L)
  431. #define RNDIS_STATUS_NOT_ACCEPTED (0x00010003L)
  432. #define RNDIS_STATUS_CALL_ACTIVE (0x00010007L)
  433. #define RNDIS_STATUS_ONLINE (0x40010003L)
  434. #define RNDIS_STATUS_RESET_START (0x40010004L)
  435. #define RNDIS_STATUS_RESET_END (0x40010005L)
  436. #define RNDIS_STATUS_RING_STATUS (0x40010006L)
  437. #define RNDIS_STATUS_CLOSED (0x40010007L)
  438. #define RNDIS_STATUS_WAN_LINE_UP (0x40010008L)
  439. #define RNDIS_STATUS_WAN_LINE_DOWN (0x40010009L)
  440. #define RNDIS_STATUS_WAN_FRAGMENT (0x4001000AL)
  441. #define RNDIS_STATUS_MEDIA_CONNECT (0x4001000BL)
  442. #define RNDIS_STATUS_MEDIA_DISCONNECT (0x4001000CL)
  443. #define RNDIS_STATUS_HARDWARE_LINE_UP (0x4001000DL)
  444. #define RNDIS_STATUS_HARDWARE_LINE_DOWN (0x4001000EL)
  445. #define RNDIS_STATUS_INTERFACE_UP (0x4001000FL)
  446. #define RNDIS_STATUS_INTERFACE_DOWN (0x40010010L)
  447. #define RNDIS_STATUS_MEDIA_BUSY (0x40010011L)
  448. #define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION (0x40010012L)
  449. #define RNDIS_STATUS_WW_INDICATION RDIA_SPECIFIC_INDICATION
  450. #define RNDIS_STATUS_LINK_SPEED_CHANGE (0x40010013L)
  451. #define RNDIS_STATUS_NOT_RESETTABLE (0x80010001L)
  452. #define RNDIS_STATUS_SOFT_ERRORS (0x80010003L)
  453. #define RNDIS_STATUS_HARD_ERRORS (0x80010004L)
  454. #define RNDIS_STATUS_BUFFER_OVERFLOW (STATUS_BUFFER_OVERFLOW)
  455. #define RNDIS_STATUS_FAILURE (STATUS_UNSUCCESSFUL)
  456. #define RNDIS_STATUS_RESOURCES (STATUS_INSUFFICIENT_RESOURCES)
  457. #define RNDIS_STATUS_CLOSING (0xC0010002L)
  458. #define RNDIS_STATUS_BAD_VERSION (0xC0010004L)
  459. #define RNDIS_STATUS_BAD_CHARACTERISTICS (0xC0010005L)
  460. #define RNDIS_STATUS_ADAPTER_NOT_FOUND (0xC0010006L)
  461. #define RNDIS_STATUS_OPEN_FAILED (0xC0010007L)
  462. #define RNDIS_STATUS_DEVICE_FAILED (0xC0010008L)
  463. #define RNDIS_STATUS_MULTICAST_FULL (0xC0010009L)
  464. #define RNDIS_STATUS_MULTICAST_EXISTS (0xC001000AL)
  465. #define RNDIS_STATUS_MULTICAST_NOT_FOUND (0xC001000BL)
  466. #define RNDIS_STATUS_REQUEST_ABORTED (0xC001000CL)
  467. #define RNDIS_STATUS_RESET_IN_PROGRESS (0xC001000DL)
  468. #define RNDIS_STATUS_CLOSING_INDICATING (0xC001000EL)
  469. #define RNDIS_STATUS_NOT_SUPPORTED (STATUS_NOT_SUPPORTED)
  470. #define RNDIS_STATUS_INVALID_PACKET (0xC001000FL)
  471. #define RNDIS_STATUS_OPEN_LIST_FULL (0xC0010010L)
  472. #define RNDIS_STATUS_ADAPTER_NOT_READY (0xC0010011L)
  473. #define RNDIS_STATUS_ADAPTER_NOT_OPEN (0xC0010012L)
  474. #define RNDIS_STATUS_NOT_INDICATING (0xC0010013L)
  475. #define RNDIS_STATUS_INVALID_LENGTH (0xC0010014L)
  476. #define RNDIS_STATUS_INVALID_DATA (0xC0010015L)
  477. #define RNDIS_STATUS_BUFFER_TOO_SHORT (0xC0010016L)
  478. #define RNDIS_STATUS_INVALID_OID (0xC0010017L)
  479. #define RNDIS_STATUS_ADAPTER_REMOVED (0xC0010018L)
  480. #define RNDIS_STATUS_UNSUPPORTED_MEDIA (0xC0010019L)
  481. #define RNDIS_STATUS_GROUP_ADDRESS_IN_USE (0xC001001AL)
  482. #define RNDIS_STATUS_FILE_NOT_FOUND (0xC001001BL)
  483. #define RNDIS_STATUS_ERROR_READING_FILE (0xC001001CL)
  484. #define RNDIS_STATUS_ALREADY_MAPPED (0xC001001DL)
  485. #define RNDIS_STATUS_RESOURCE_CONFLICT (0xC001001EL)
  486. #define RNDIS_STATUS_NO_CABLE (0xC001001FL)
  487. #define RNDIS_STATUS_INVALID_SAP (0xC0010020L)
  488. #define RNDIS_STATUS_SAP_IN_USE (0xC0010021L)
  489. #define RNDIS_STATUS_INVALID_ADDRESS (0xC0010022L)
  490. #define RNDIS_STATUS_VC_NOT_ACTIVATED (0xC0010023L)
  491. #define RNDIS_STATUS_DEST_OUT_OF_ORDER (0xC0010024L)
  492. #define RNDIS_STATUS_VC_NOT_AVAILABLE (0xC0010025L)
  493. #define RNDIS_STATUS_CELLRATE_NOT_AVAILABLE (0xC0010026L)
  494. #define RNDIS_STATUS_INCOMPATABLE_QOS (0xC0010027L)
  495. #define RNDIS_STATUS_AAL_PARAMS_UNSUPPORTED (0xC0010028L)
  496. #define RNDIS_STATUS_NO_ROUTE_TO_DESTINATION (0xC0010029L)
  497. #define RNDIS_STATUS_TOKEN_RING_OPEN_ERROR (0xC0011000L)
  498. /* Object Identifiers used by NdisRequest Query/Set Information */
  499. /* General Objects */
  500. #define RNDIS_OID_GEN_SUPPORTED_LIST 0x00010101
  501. #define RNDIS_OID_GEN_HARDWARE_STATUS 0x00010102
  502. #define RNDIS_OID_GEN_MEDIA_SUPPORTED 0x00010103
  503. #define RNDIS_OID_GEN_MEDIA_IN_USE 0x00010104
  504. #define RNDIS_OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
  505. #define RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
  506. #define RNDIS_OID_GEN_LINK_SPEED 0x00010107
  507. #define RNDIS_OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
  508. #define RNDIS_OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
  509. #define RNDIS_OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
  510. #define RNDIS_OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
  511. #define RNDIS_OID_GEN_VENDOR_ID 0x0001010C
  512. #define RNDIS_OID_GEN_VENDOR_DESCRIPTION 0x0001010D
  513. #define RNDIS_OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
  514. #define RNDIS_OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
  515. #define RNDIS_OID_GEN_DRIVER_VERSION 0x00010110
  516. #define RNDIS_OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
  517. #define RNDIS_OID_GEN_PROTOCOL_OPTIONS 0x00010112
  518. #define RNDIS_OID_GEN_MAC_OPTIONS 0x00010113
  519. #define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
  520. #define RNDIS_OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
  521. #define RNDIS_OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
  522. #define RNDIS_OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
  523. #define RNDIS_OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
  524. #define RNDIS_OID_GEN_MACHINE_NAME 0x0001021A
  525. #define RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
  526. #define RNDIS_OID_GEN_XMIT_OK 0x00020101
  527. #define RNDIS_OID_GEN_RCV_OK 0x00020102
  528. #define RNDIS_OID_GEN_XMIT_ERROR 0x00020103
  529. #define RNDIS_OID_GEN_RCV_ERROR 0x00020104
  530. #define RNDIS_OID_GEN_RCV_NO_BUFFER 0x00020105
  531. #define RNDIS_OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
  532. #define RNDIS_OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
  533. #define RNDIS_OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
  534. #define RNDIS_OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
  535. #define RNDIS_OID_GEN_BROADCAST_BYTES_XMIT 0x00020205
  536. #define RNDIS_OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
  537. #define RNDIS_OID_GEN_DIRECTED_BYTES_RCV 0x00020207
  538. #define RNDIS_OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
  539. #define RNDIS_OID_GEN_MULTICAST_BYTES_RCV 0x00020209
  540. #define RNDIS_OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
  541. #define RNDIS_OID_GEN_BROADCAST_BYTES_RCV 0x0002020B
  542. #define RNDIS_OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
  543. #define RNDIS_OID_GEN_RCV_CRC_ERROR 0x0002020D
  544. #define RNDIS_OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
  545. #define RNDIS_OID_GEN_GET_TIME_CAPS 0x0002020F
  546. #define RNDIS_OID_GEN_GET_NETCARD_TIME 0x00020210
  547. /* These are connection-oriented general OIDs. */
  548. /* These replace the above OIDs for connection-oriented media. */
  549. #define RNDIS_OID_GEN_CO_SUPPORTED_LIST 0x00010101
  550. #define RNDIS_OID_GEN_CO_HARDWARE_STATUS 0x00010102
  551. #define RNDIS_OID_GEN_CO_MEDIA_SUPPORTED 0x00010103
  552. #define RNDIS_OID_GEN_CO_MEDIA_IN_USE 0x00010104
  553. #define RNDIS_OID_GEN_CO_LINK_SPEED 0x00010105
  554. #define RNDIS_OID_GEN_CO_VENDOR_ID 0x00010106
  555. #define RNDIS_OID_GEN_CO_VENDOR_DESCRIPTION 0x00010107
  556. #define RNDIS_OID_GEN_CO_DRIVER_VERSION 0x00010108
  557. #define RNDIS_OID_GEN_CO_PROTOCOL_OPTIONS 0x00010109
  558. #define RNDIS_OID_GEN_CO_MAC_OPTIONS 0x0001010A
  559. #define RNDIS_OID_GEN_CO_MEDIA_CONNECT_STATUS 0x0001010B
  560. #define RNDIS_OID_GEN_CO_VENDOR_DRIVER_VERSION 0x0001010C
  561. #define RNDIS_OID_GEN_CO_MINIMUM_LINK_SPEED 0x0001010D
  562. #define RNDIS_OID_GEN_CO_GET_TIME_CAPS 0x00010201
  563. #define RNDIS_OID_GEN_CO_GET_NETCARD_TIME 0x00010202
  564. /* These are connection-oriented statistics OIDs. */
  565. #define RNDIS_OID_GEN_CO_XMIT_PDUS_OK 0x00020101
  566. #define RNDIS_OID_GEN_CO_RCV_PDUS_OK 0x00020102
  567. #define RNDIS_OID_GEN_CO_XMIT_PDUS_ERROR 0x00020103
  568. #define RNDIS_OID_GEN_CO_RCV_PDUS_ERROR 0x00020104
  569. #define RNDIS_OID_GEN_CO_RCV_PDUS_NO_BUFFER 0x00020105
  570. #define RNDIS_OID_GEN_CO_RCV_CRC_ERROR 0x00020201
  571. #define RNDIS_OID_GEN_CO_TRANSMIT_QUEUE_LENGTH 0x00020202
  572. #define RNDIS_OID_GEN_CO_BYTES_XMIT 0x00020203
  573. #define RNDIS_OID_GEN_CO_BYTES_RCV 0x00020204
  574. #define RNDIS_OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205
  575. #define RNDIS_OID_GEN_CO_NETCARD_LOAD 0x00020206
  576. /* These are objects for Connection-oriented media call-managers. */
  577. #define RNDIS_OID_CO_ADD_PVC 0xFF000001
  578. #define RNDIS_OID_CO_DELETE_PVC 0xFF000002
  579. #define RNDIS_OID_CO_GET_CALL_INFORMATION 0xFF000003
  580. #define RNDIS_OID_CO_ADD_ADDRESS 0xFF000004
  581. #define RNDIS_OID_CO_DELETE_ADDRESS 0xFF000005
  582. #define RNDIS_OID_CO_GET_ADDRESSES 0xFF000006
  583. #define RNDIS_OID_CO_ADDRESS_CHANGE 0xFF000007
  584. #define RNDIS_OID_CO_SIGNALING_ENABLED 0xFF000008
  585. #define RNDIS_OID_CO_SIGNALING_DISABLED 0xFF000009
  586. /* 802.3 Objects (Ethernet) */
  587. #define RNDIS_OID_802_3_PERMANENT_ADDRESS 0x01010101
  588. #define RNDIS_OID_802_3_CURRENT_ADDRESS 0x01010102
  589. #define RNDIS_OID_802_3_MULTICAST_LIST 0x01010103
  590. #define RNDIS_OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
  591. #define RNDIS_OID_802_3_MAC_OPTIONS 0x01010105
  592. #define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001
  593. #define RNDIS_OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
  594. #define RNDIS_OID_802_3_XMIT_ONE_COLLISION 0x01020102
  595. #define RNDIS_OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
  596. #define RNDIS_OID_802_3_XMIT_DEFERRED 0x01020201
  597. #define RNDIS_OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
  598. #define RNDIS_OID_802_3_RCV_OVERRUN 0x01020203
  599. #define RNDIS_OID_802_3_XMIT_UNDERRUN 0x01020204
  600. #define RNDIS_OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
  601. #define RNDIS_OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
  602. #define RNDIS_OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
  603. /* Remote NDIS message types */
  604. #define REMOTE_NDIS_PACKET_MSG 0x00000001
  605. #define REMOTE_NDIS_INITIALIZE_MSG 0x00000002
  606. #define REMOTE_NDIS_HALT_MSG 0x00000003
  607. #define REMOTE_NDIS_QUERY_MSG 0x00000004
  608. #define REMOTE_NDIS_SET_MSG 0x00000005
  609. #define REMOTE_NDIS_RESET_MSG 0x00000006
  610. #define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007
  611. #define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008
  612. #define REMOTE_CONDIS_MP_CREATE_VC_MSG 0x00008001
  613. #define REMOTE_CONDIS_MP_DELETE_VC_MSG 0x00008002
  614. #define REMOTE_CONDIS_MP_ACTIVATE_VC_MSG 0x00008005
  615. #define REMOTE_CONDIS_MP_DEACTIVATE_VC_MSG 0x00008006
  616. #define REMOTE_CONDIS_INDICATE_STATUS_MSG 0x00008007
  617. /* Remote NDIS message completion types */
  618. #define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002
  619. #define REMOTE_NDIS_QUERY_CMPLT 0x80000004
  620. #define REMOTE_NDIS_SET_CMPLT 0x80000005
  621. #define REMOTE_NDIS_RESET_CMPLT 0x80000006
  622. #define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008
  623. #define REMOTE_CONDIS_MP_CREATE_VC_CMPLT 0x80008001
  624. #define REMOTE_CONDIS_MP_DELETE_VC_CMPLT 0x80008002
  625. #define REMOTE_CONDIS_MP_ACTIVATE_VC_CMPLT 0x80008005
  626. #define REMOTE_CONDIS_MP_DEACTIVATE_VC_CMPLT 0x80008006
  627. /*
  628. * Reserved message type for private communication between lower-layer host
  629. * driver and remote device, if necessary.
  630. */
  631. #define REMOTE_NDIS_BUS_MSG 0xff000001
  632. /* Defines for DeviceFlags in struct rndis_initialize_complete */
  633. #define RNDIS_DF_CONNECTIONLESS 0x00000001
  634. #define RNDIS_DF_CONNECTION_ORIENTED 0x00000002
  635. #define RNDIS_DF_RAW_DATA 0x00000004
  636. /* Remote NDIS medium types. */
  637. #define RNDIS_MEDIUM_802_3 0x00000000
  638. #define RNDIS_MEDIUM_802_5 0x00000001
  639. #define RNDIS_MEDIUM_FDDI 0x00000002
  640. #define RNDIS_MEDIUM_WAN 0x00000003
  641. #define RNDIS_MEDIUM_LOCAL_TALK 0x00000004
  642. #define RNDIS_MEDIUM_ARCNET_RAW 0x00000006
  643. #define RNDIS_MEDIUM_ARCNET_878_2 0x00000007
  644. #define RNDIS_MEDIUM_ATM 0x00000008
  645. #define RNDIS_MEDIUM_WIRELESS_WAN 0x00000009
  646. #define RNDIS_MEDIUM_IRDA 0x0000000a
  647. #define RNDIS_MEDIUM_CO_WAN 0x0000000b
  648. /* Not a real medium, defined as an upper-bound */
  649. #define RNDIS_MEDIUM_MAX 0x0000000d
  650. /* Remote NDIS medium connection states. */
  651. #define RNDIS_MEDIA_STATE_CONNECTED 0x00000000
  652. #define RNDIS_MEDIA_STATE_DISCONNECTED 0x00000001
  653. /* Remote NDIS version numbers */
  654. #define RNDIS_MAJOR_VERSION 0x00000001
  655. #define RNDIS_MINOR_VERSION 0x00000000
  656. /* NdisInitialize message */
  657. struct rndis_initialize_request {
  658. u32 req_id;
  659. u32 major_ver;
  660. u32 minor_ver;
  661. u32 max_xfer_size;
  662. };
  663. /* Response to NdisInitialize */
  664. struct rndis_initialize_complete {
  665. u32 req_id;
  666. u32 status;
  667. u32 major_ver;
  668. u32 minor_ver;
  669. u32 dev_flags;
  670. u32 medium;
  671. u32 max_pkt_per_msg;
  672. u32 max_xfer_size;
  673. u32 pkt_alignment_factor;
  674. u32 af_list_offset;
  675. u32 af_list_size;
  676. };
  677. /* Call manager devices only: Information about an address family */
  678. /* supported by the device is appended to the response to NdisInitialize. */
  679. struct rndis_co_address_family {
  680. u32 address_family;
  681. u32 major_ver;
  682. u32 minor_ver;
  683. };
  684. /* NdisHalt message */
  685. struct rndis_halt_request {
  686. u32 req_id;
  687. };
  688. /* NdisQueryRequest message */
  689. struct rndis_query_request {
  690. u32 req_id;
  691. u32 oid;
  692. u32 info_buflen;
  693. u32 info_buf_offset;
  694. u32 dev_vc_handle;
  695. };
  696. /* Response to NdisQueryRequest */
  697. struct rndis_query_complete {
  698. u32 req_id;
  699. u32 status;
  700. u32 info_buflen;
  701. u32 info_buf_offset;
  702. };
  703. /* NdisSetRequest message */
  704. struct rndis_set_request {
  705. u32 req_id;
  706. u32 oid;
  707. u32 info_buflen;
  708. u32 info_buf_offset;
  709. u32 dev_vc_handle;
  710. };
  711. /* Response to NdisSetRequest */
  712. struct rndis_set_complete {
  713. u32 req_id;
  714. u32 status;
  715. };
  716. /* NdisReset message */
  717. struct rndis_reset_request {
  718. u32 reserved;
  719. };
  720. /* Response to NdisReset */
  721. struct rndis_reset_complete {
  722. u32 status;
  723. u32 addressing_reset;
  724. };
  725. /* NdisMIndicateStatus message */
  726. struct rndis_indicate_status {
  727. u32 status;
  728. u32 status_buflen;
  729. u32 status_buf_offset;
  730. };
  731. /* Diagnostic information passed as the status buffer in */
  732. /* struct rndis_indicate_status messages signifying error conditions. */
  733. struct rndis_diagnostic_info {
  734. u32 diag_status;
  735. u32 error_offset;
  736. };
  737. /* NdisKeepAlive message */
  738. struct rndis_keepalive_request {
  739. u32 req_id;
  740. };
  741. /* Response to NdisKeepAlive */
  742. struct rndis_keepalive_complete {
  743. u32 req_id;
  744. u32 status;
  745. };
  746. /*
  747. * Data message. All Offset fields contain byte offsets from the beginning of
  748. * struct rndis_packet. All Length fields are in bytes. VcHandle is set
  749. * to 0 for connectionless data, otherwise it contains the VC handle.
  750. */
  751. struct rndis_packet {
  752. u32 data_offset;
  753. u32 data_len;
  754. u32 oob_data_offset;
  755. u32 oob_data_len;
  756. u32 num_oob_data_elements;
  757. u32 per_pkt_info_offset;
  758. u32 per_pkt_info_len;
  759. u32 vc_handle;
  760. u32 reserved;
  761. };
  762. /* Optional Out of Band data associated with a Data message. */
  763. struct rndis_oobd {
  764. u32 size;
  765. u32 type;
  766. u32 class_info_offset;
  767. };
  768. /* Packet extension field contents associated with a Data message. */
  769. struct rndis_per_packet_info {
  770. u32 size;
  771. u32 type;
  772. u32 per_pkt_info_offset;
  773. };
  774. /* Format of Information buffer passed in a SetRequest for the OID */
  775. /* OID_GEN_RNDIS_CONFIG_PARAMETER. */
  776. struct rndis_config_parameter_info {
  777. u32 parameter_name_offset;
  778. u32 parameter_name_length;
  779. u32 parameter_type;
  780. u32 parameter_value_offset;
  781. u32 parameter_value_length;
  782. };
  783. /* Values for ParameterType in struct rndis_config_parameter_info */
  784. #define RNDIS_CONFIG_PARAM_TYPE_INTEGER 0
  785. #define RNDIS_CONFIG_PARAM_TYPE_STRING 2
  786. /* CONDIS Miniport messages for connection oriented devices */
  787. /* that do not implement a call manager. */
  788. /* CoNdisMiniportCreateVc message */
  789. struct rcondis_mp_create_vc {
  790. u32 req_id;
  791. u32 ndis_vc_handle;
  792. };
  793. /* Response to CoNdisMiniportCreateVc */
  794. struct rcondis_mp_create_vc_complete {
  795. u32 req_id;
  796. u32 dev_vc_handle;
  797. u32 status;
  798. };
  799. /* CoNdisMiniportDeleteVc message */
  800. struct rcondis_mp_delete_vc {
  801. u32 req_id;
  802. u32 dev_vc_handle;
  803. };
  804. /* Response to CoNdisMiniportDeleteVc */
  805. struct rcondis_mp_delete_vc_complete {
  806. u32 req_id;
  807. u32 status;
  808. };
  809. /* CoNdisMiniportQueryRequest message */
  810. struct rcondis_mp_query_request {
  811. u32 req_id;
  812. u32 request_type;
  813. u32 oid;
  814. u32 dev_vc_handle;
  815. u32 info_buflen;
  816. u32 info_buf_offset;
  817. };
  818. /* CoNdisMiniportSetRequest message */
  819. struct rcondis_mp_set_request {
  820. u32 req_id;
  821. u32 request_type;
  822. u32 oid;
  823. u32 dev_vc_handle;
  824. u32 info_buflen;
  825. u32 info_buf_offset;
  826. };
  827. /* CoNdisIndicateStatus message */
  828. struct rcondis_indicate_status {
  829. u32 ndis_vc_handle;
  830. u32 status;
  831. u32 status_buflen;
  832. u32 status_buf_offset;
  833. };
  834. /* CONDIS Call/VC parameters */
  835. struct rcondis_specific_parameters {
  836. u32 parameter_type;
  837. u32 parameter_length;
  838. u32 parameter_lffset;
  839. };
  840. struct rcondis_media_parameters {
  841. u32 flags;
  842. u32 reserved1;
  843. u32 reserved2;
  844. struct rcondis_specific_parameters media_specific;
  845. };
  846. struct rndis_flowspec {
  847. u32 token_rate;
  848. u32 token_bucket_size;
  849. u32 peak_bandwidth;
  850. u32 latency;
  851. u32 delay_variation;
  852. u32 service_type;
  853. u32 max_sdu_size;
  854. u32 minimum_policed_size;
  855. };
  856. struct rcondis_call_manager_parameters {
  857. struct rndis_flowspec transmit;
  858. struct rndis_flowspec receive;
  859. struct rcondis_specific_parameters call_mgr_specific;
  860. };
  861. /* CoNdisMiniportActivateVc message */
  862. struct rcondis_mp_activate_vc_request {
  863. u32 req_id;
  864. u32 flags;
  865. u32 dev_vc_handle;
  866. u32 media_params_offset;
  867. u32 media_params_length;
  868. u32 call_mgr_params_offset;
  869. u32 call_mgr_params_length;
  870. };
  871. /* Response to CoNdisMiniportActivateVc */
  872. struct rcondis_mp_activate_vc_complete {
  873. u32 req_id;
  874. u32 status;
  875. };
  876. /* CoNdisMiniportDeactivateVc message */
  877. struct rcondis_mp_deactivate_vc_request {
  878. u32 req_id;
  879. u32 flags;
  880. u32 dev_vc_handle;
  881. };
  882. /* Response to CoNdisMiniportDeactivateVc */
  883. struct rcondis_mp_deactivate_vc_complete {
  884. u32 req_id;
  885. u32 status;
  886. };
  887. /* union with all of the RNDIS messages */
  888. union rndis_message_container {
  889. struct rndis_packet pkt;
  890. struct rndis_initialize_request init_req;
  891. struct rndis_halt_request halt_req;
  892. struct rndis_query_request query_req;
  893. struct rndis_set_request set_req;
  894. struct rndis_reset_request reset_req;
  895. struct rndis_keepalive_request keep_alive_req;
  896. struct rndis_indicate_status indicate_status;
  897. struct rndis_initialize_complete init_complete;
  898. struct rndis_query_complete query_complete;
  899. struct rndis_set_complete set_complete;
  900. struct rndis_reset_complete reset_complete;
  901. struct rndis_keepalive_complete keep_alive_complete;
  902. struct rcondis_mp_create_vc co_miniport_create_vc;
  903. struct rcondis_mp_delete_vc co_miniport_delete_vc;
  904. struct rcondis_indicate_status co_indicate_status;
  905. struct rcondis_mp_activate_vc_request co_miniport_activate_vc;
  906. struct rcondis_mp_deactivate_vc_request co_miniport_deactivate_vc;
  907. struct rcondis_mp_create_vc_complete co_miniport_create_vc_complete;
  908. struct rcondis_mp_delete_vc_complete co_miniport_delete_vc_complete;
  909. struct rcondis_mp_activate_vc_complete co_miniport_activate_vc_complete;
  910. struct rcondis_mp_deactivate_vc_complete
  911. co_miniport_deactivate_vc_complete;
  912. };
  913. /* Remote NDIS message format */
  914. struct rndis_message {
  915. u32 ndis_msg_type;
  916. /* Total length of this message, from the beginning */
  917. /* of the sruct rndis_message, in bytes. */
  918. u32 msg_len;
  919. /* Actual message */
  920. union rndis_message_container msg;
  921. };
  922. struct rndis_filter_packet {
  923. void *completion_ctx;
  924. void (*completion)(void *context);
  925. struct rndis_message msg;
  926. };
  927. /* Handy macros */
  928. /* get the size of an RNDIS message. Pass in the message type, */
  929. /* struct rndis_set_request, struct rndis_packet for example */
  930. #define RNDIS_MESSAGE_SIZE(msg) \
  931. (sizeof(msg) + (sizeof(struct rndis_message) - \
  932. sizeof(union rndis_message_container)))
  933. /* get pointer to info buffer with message pointer */
  934. #define MESSAGE_TO_INFO_BUFFER(msg) \
  935. (((unsigned char *)(msg)) + msg->info_buf_offset)
  936. /* get pointer to status buffer with message pointer */
  937. #define MESSAGE_TO_STATUS_BUFFER(msg) \
  938. (((unsigned char *)(msg)) + msg->status_buf_offset)
  939. /* get pointer to OOBD buffer with message pointer */
  940. #define MESSAGE_TO_OOBD_BUFFER(msg) \
  941. (((unsigned char *)(msg)) + msg->oob_data_offset)
  942. /* get pointer to data buffer with message pointer */
  943. #define MESSAGE_TO_DATA_BUFFER(msg) \
  944. (((unsigned char *)(msg)) + msg->per_pkt_info_offset)
  945. /* get pointer to contained message from NDIS_MESSAGE pointer */
  946. #define RNDIS_MESSAGE_PTR_TO_MESSAGE_PTR(rndis_msg) \
  947. ((void *) &rndis_msg->msg)
  948. /* get pointer to contained message from NDIS_MESSAGE pointer */
  949. #define RNDIS_MESSAGE_RAW_PTR_TO_MESSAGE_PTR(rndis_msg) \
  950. ((void *) rndis_msg)
  951. #define __struct_bcount(x)
  952. #define RNDIS_HEADER_SIZE (sizeof(struct rndis_message) - \
  953. sizeof(union rndis_message_container))
  954. #define NDIS_PACKET_TYPE_DIRECTED 0x00000001
  955. #define NDIS_PACKET_TYPE_MULTICAST 0x00000002
  956. #define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
  957. #define NDIS_PACKET_TYPE_BROADCAST 0x00000008
  958. #define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
  959. #define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
  960. #define NDIS_PACKET_TYPE_SMT 0x00000040
  961. #define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
  962. #define NDIS_PACKET_TYPE_GROUP 0x00000100
  963. #define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00000200
  964. #define NDIS_PACKET_TYPE_FUNCTIONAL 0x00000400
  965. #define NDIS_PACKET_TYPE_MAC_FRAME 0x00000800
  966. #endif /* _HYPERV_NET_H */