mmc: rtsx_pci: Enable MMC_CAP_ERASE to allow erase/discard/trim requests
[linux/fpc-iii.git] / drivers / usb / gadget / function / rndis.h
blobef92eb66d8adf91fac1cc7dea85490ebc2f0895a
1 /*
2 * RNDIS Definitions for Remote NDIS
4 * Authors: Benedikt Spranger, Pengutronix
5 * Robert Schwebel, Pengutronix
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2, as published by the Free Software Foundation.
11 * This software was originally developed in conformance with
12 * Microsoft's Remote NDIS Specification License Agreement.
15 #ifndef _LINUX_RNDIS_H
16 #define _LINUX_RNDIS_H
18 #include <linux/rndis.h>
19 #include "u_ether.h"
20 #include "ndis.h"
22 #define RNDIS_MAXIMUM_FRAME_SIZE 1518
23 #define RNDIS_MAX_TOTAL_SIZE 1558
25 typedef struct rndis_init_msg_type
27 __le32 MessageType;
28 __le32 MessageLength;
29 __le32 RequestID;
30 __le32 MajorVersion;
31 __le32 MinorVersion;
32 __le32 MaxTransferSize;
33 } rndis_init_msg_type;
35 typedef struct rndis_init_cmplt_type
37 __le32 MessageType;
38 __le32 MessageLength;
39 __le32 RequestID;
40 __le32 Status;
41 __le32 MajorVersion;
42 __le32 MinorVersion;
43 __le32 DeviceFlags;
44 __le32 Medium;
45 __le32 MaxPacketsPerTransfer;
46 __le32 MaxTransferSize;
47 __le32 PacketAlignmentFactor;
48 __le32 AFListOffset;
49 __le32 AFListSize;
50 } rndis_init_cmplt_type;
52 typedef struct rndis_halt_msg_type
54 __le32 MessageType;
55 __le32 MessageLength;
56 __le32 RequestID;
57 } rndis_halt_msg_type;
59 typedef struct rndis_query_msg_type
61 __le32 MessageType;
62 __le32 MessageLength;
63 __le32 RequestID;
64 __le32 OID;
65 __le32 InformationBufferLength;
66 __le32 InformationBufferOffset;
67 __le32 DeviceVcHandle;
68 } rndis_query_msg_type;
70 typedef struct rndis_query_cmplt_type
72 __le32 MessageType;
73 __le32 MessageLength;
74 __le32 RequestID;
75 __le32 Status;
76 __le32 InformationBufferLength;
77 __le32 InformationBufferOffset;
78 } rndis_query_cmplt_type;
80 typedef struct rndis_set_msg_type
82 __le32 MessageType;
83 __le32 MessageLength;
84 __le32 RequestID;
85 __le32 OID;
86 __le32 InformationBufferLength;
87 __le32 InformationBufferOffset;
88 __le32 DeviceVcHandle;
89 } rndis_set_msg_type;
91 typedef struct rndis_set_cmplt_type
93 __le32 MessageType;
94 __le32 MessageLength;
95 __le32 RequestID;
96 __le32 Status;
97 } rndis_set_cmplt_type;
99 typedef struct rndis_reset_msg_type
101 __le32 MessageType;
102 __le32 MessageLength;
103 __le32 Reserved;
104 } rndis_reset_msg_type;
106 typedef struct rndis_reset_cmplt_type
108 __le32 MessageType;
109 __le32 MessageLength;
110 __le32 Status;
111 __le32 AddressingReset;
112 } rndis_reset_cmplt_type;
114 typedef struct rndis_indicate_status_msg_type
116 __le32 MessageType;
117 __le32 MessageLength;
118 __le32 Status;
119 __le32 StatusBufferLength;
120 __le32 StatusBufferOffset;
121 } rndis_indicate_status_msg_type;
123 typedef struct rndis_keepalive_msg_type
125 __le32 MessageType;
126 __le32 MessageLength;
127 __le32 RequestID;
128 } rndis_keepalive_msg_type;
130 typedef struct rndis_keepalive_cmplt_type
132 __le32 MessageType;
133 __le32 MessageLength;
134 __le32 RequestID;
135 __le32 Status;
136 } rndis_keepalive_cmplt_type;
138 struct rndis_packet_msg_type
140 __le32 MessageType;
141 __le32 MessageLength;
142 __le32 DataOffset;
143 __le32 DataLength;
144 __le32 OOBDataOffset;
145 __le32 OOBDataLength;
146 __le32 NumOOBDataElements;
147 __le32 PerPacketInfoOffset;
148 __le32 PerPacketInfoLength;
149 __le32 VcHandle;
150 __le32 Reserved;
151 } __attribute__ ((packed));
153 struct rndis_config_parameter
155 __le32 ParameterNameOffset;
156 __le32 ParameterNameLength;
157 __le32 ParameterType;
158 __le32 ParameterValueOffset;
159 __le32 ParameterValueLength;
162 /* implementation specific */
163 enum rndis_state
165 RNDIS_UNINITIALIZED,
166 RNDIS_INITIALIZED,
167 RNDIS_DATA_INITIALIZED,
170 typedef struct rndis_resp_t
172 struct list_head list;
173 u8 *buf;
174 u32 length;
175 int send;
176 } rndis_resp_t;
178 typedef struct rndis_params
180 int confignr;
181 u8 used;
182 u16 saved_filter;
183 enum rndis_state state;
184 u32 medium;
185 u32 speed;
186 u32 media_state;
188 const u8 *host_mac;
189 u16 *filter;
190 struct net_device *dev;
192 u32 vendorID;
193 const char *vendorDescr;
194 void (*resp_avail)(void *v);
195 void *v;
196 struct list_head resp_queue;
197 } rndis_params;
199 /* RNDIS Message parser and other useless functions */
200 int rndis_msg_parser(struct rndis_params *params, u8 *buf);
201 struct rndis_params *rndis_register(void (*resp_avail)(void *v), void *v);
202 void rndis_deregister(struct rndis_params *params);
203 int rndis_set_param_dev(struct rndis_params *params, struct net_device *dev,
204 u16 *cdc_filter);
205 int rndis_set_param_vendor(struct rndis_params *params, u32 vendorID,
206 const char *vendorDescr);
207 int rndis_set_param_medium(struct rndis_params *params, u32 medium,
208 u32 speed);
209 void rndis_add_hdr(struct sk_buff *skb);
210 int rndis_rm_hdr(struct gether *port, struct sk_buff *skb,
211 struct sk_buff_head *list);
212 u8 *rndis_get_next_response(struct rndis_params *params, u32 *length);
213 void rndis_free_response(struct rndis_params *params, u8 *buf);
215 void rndis_uninit(struct rndis_params *params);
216 int rndis_signal_connect(struct rndis_params *params);
217 int rndis_signal_disconnect(struct rndis_params *params);
218 int rndis_state(struct rndis_params *params);
219 extern void rndis_set_host_mac(struct rndis_params *params, const u8 *addr);
221 #endif /* _LINUX_RNDIS_H */