hyperv_net.h 31 KB

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