hyperv_net.h 34 KB

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