Staging: csr: remove __cplusplus nonsense from the .h files
[firefly-linux-kernel-4.4.55.git] / drivers / staging / csr / csr_wifi_nme_lib.h
1 /*****************************************************************************
2
3             (c) Cambridge Silicon Radio Limited 2011
4             All rights reserved and confidential information of CSR
5
6             Refer to LICENSE.txt included with this source for details
7             on the license terms.
8
9 *****************************************************************************/
10
11 /* Note: this is an auto-generated file. */
12
13 #ifndef CSR_WIFI_NME_LIB_H__
14 #define CSR_WIFI_NME_LIB_H__
15
16 #include "csr_sched.h"
17 #include "csr_macro.h"
18 #include "csr_msg_transport.h"
19
20 #include "csr_wifi_lib.h"
21
22 #include "csr_wifi_nme_prim.h"
23 #include "csr_wifi_nme_task.h"
24
25
26 #ifndef CSR_WIFI_NME_ENABLE
27 #error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_lib.h
28 #endif
29
30 /*----------------------------------------------------------------------------*
31  *  CsrWifiNmeFreeUpstreamMessageContents
32  *
33  *  DESCRIPTION
34  *      Free the allocated memory in a CSR_WIFI_NME upstream message. Does not
35  *      free the message itself, and can only be used for upstream messages.
36  *
37  *  PARAMETERS
38  *      Deallocates the resources in a CSR_WIFI_NME upstream message
39  *----------------------------------------------------------------------------*/
40 void CsrWifiNmeFreeUpstreamMessageContents(u16 eventClass, void *message);
41
42 /*----------------------------------------------------------------------------*
43  *  CsrWifiNmeFreeDownstreamMessageContents
44  *
45  *  DESCRIPTION
46  *      Free the allocated memory in a CSR_WIFI_NME downstream message. Does not
47  *      free the message itself, and can only be used for downstream messages.
48  *
49  *  PARAMETERS
50  *      Deallocates the resources in a CSR_WIFI_NME downstream message
51  *----------------------------------------------------------------------------*/
52 void CsrWifiNmeFreeDownstreamMessageContents(u16 eventClass, void *message);
53
54 /*----------------------------------------------------------------------------*
55  * Enum to string functions
56  *----------------------------------------------------------------------------*/
57 const char* CsrWifiNmeAuthModeToString(CsrWifiNmeAuthMode value);
58 const char* CsrWifiNmeBssTypeToString(CsrWifiNmeBssType value);
59 const char* CsrWifiNmeCcxOptionsMaskToString(CsrWifiNmeCcxOptionsMask value);
60 const char* CsrWifiNmeConfigActionToString(CsrWifiNmeConfigAction value);
61 const char* CsrWifiNmeConnectionStatusToString(CsrWifiNmeConnectionStatus value);
62 const char* CsrWifiNmeCredentialTypeToString(CsrWifiNmeCredentialType value);
63 const char* CsrWifiNmeEapMethodToString(CsrWifiNmeEapMethod value);
64 const char* CsrWifiNmeEncryptionToString(CsrWifiNmeEncryption value);
65 const char* CsrWifiNmeIndicationsToString(CsrWifiNmeIndications value);
66 const char* CsrWifiNmeSecErrorToString(CsrWifiNmeSecError value);
67 const char* CsrWifiNmeSimCardTypeToString(CsrWifiNmeSimCardType value);
68 const char* CsrWifiNmeUmtsAuthResultToString(CsrWifiNmeUmtsAuthResult value);
69 const char* CsrWifiNmeWmmQosInfoToString(CsrWifiNmeWmmQosInfo value);
70
71
72 /*----------------------------------------------------------------------------*
73  * CsrPrim Type toString function.
74  * Converts a message type to the String name of the Message
75  *----------------------------------------------------------------------------*/
76 const char* CsrWifiNmePrimTypeToString(CsrPrim msgType);
77
78 /*----------------------------------------------------------------------------*
79  * Lookup arrays for PrimType name Strings
80  *----------------------------------------------------------------------------*/
81 extern const char *CsrWifiNmeUpstreamPrimNames[CSR_WIFI_NME_PRIM_UPSTREAM_COUNT];
82 extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_COUNT];
83
84 /*******************************************************************************
85
86   NAME
87     CsrWifiNmeConnectionStatusGetReqSend
88
89   DESCRIPTION
90     Requests the current connection status of the NME.
91
92   PARAMETERS
93     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
94     interfaceTag - Interface Identifier; unique identifier of an interface
95
96 *******************************************************************************/
97 #define CsrWifiNmeConnectionStatusGetReqCreate(msg__, dst__, src__, interfaceTag__) \
98     msg__ = kmalloc(sizeof(CsrWifiNmeConnectionStatusGetReq), GFP_KERNEL); \
99     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_CONNECTION_STATUS_GET_REQ, dst__, src__); \
100     msg__->interfaceTag = (interfaceTag__);
101
102 #define CsrWifiNmeConnectionStatusGetReqSendTo(dst__, src__, interfaceTag__) \
103     { \
104         CsrWifiNmeConnectionStatusGetReq *msg__; \
105         CsrWifiNmeConnectionStatusGetReqCreate(msg__, dst__, src__, interfaceTag__); \
106         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
107     }
108
109 #define CsrWifiNmeConnectionStatusGetReqSend(src__, interfaceTag__) \
110     CsrWifiNmeConnectionStatusGetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__)
111
112 /*******************************************************************************
113
114   NAME
115     CsrWifiNmeConnectionStatusGetCfmSend
116
117   DESCRIPTION
118     Reports the connection status of the NME.
119
120   PARAMETERS
121     queue            - Destination Task Queue
122     interfaceTag     - Interface Identifier; unique identifier of an interface
123     status           - Indicates the success or otherwise of the requested
124                        operation.
125     connectionStatus - NME current connection status
126
127 *******************************************************************************/
128 #define CsrWifiNmeConnectionStatusGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStatus__) \
129     msg__ = kmalloc(sizeof(CsrWifiNmeConnectionStatusGetCfm), GFP_KERNEL); \
130     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_CONNECTION_STATUS_GET_CFM, dst__, src__); \
131     msg__->interfaceTag = (interfaceTag__); \
132     msg__->status = (status__); \
133     msg__->connectionStatus = (connectionStatus__);
134
135 #define CsrWifiNmeConnectionStatusGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionStatus__) \
136     { \
137         CsrWifiNmeConnectionStatusGetCfm *msg__; \
138         CsrWifiNmeConnectionStatusGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStatus__); \
139         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
140     }
141
142 #define CsrWifiNmeConnectionStatusGetCfmSend(dst__, interfaceTag__, status__, connectionStatus__) \
143     CsrWifiNmeConnectionStatusGetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, connectionStatus__)
144
145 /*******************************************************************************
146
147   NAME
148     CsrWifiNmeEventMaskSetReqSend
149
150   DESCRIPTION
151     The wireless manager application may register with the NME to receive
152     notification of interesting events. Indications will be sent only if the
153     wireless manager explicitly registers to be notified of that event.
154     indMask is a bit mask of values defined in CsrWifiNmeIndicationsMask.
155
156   PARAMETERS
157     queue   - Message Source Task Queue (Cfm's will be sent to this Queue)
158     indMask - Set mask with values from CsrWifiNmeIndications
159
160 *******************************************************************************/
161 #define CsrWifiNmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__) \
162     msg__ = kmalloc(sizeof(CsrWifiNmeEventMaskSetReq), GFP_KERNEL); \
163     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_EVENT_MASK_SET_REQ, dst__, src__); \
164     msg__->indMask = (indMask__);
165
166 #define CsrWifiNmeEventMaskSetReqSendTo(dst__, src__, indMask__) \
167     { \
168         CsrWifiNmeEventMaskSetReq *msg__; \
169         CsrWifiNmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__); \
170         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
171     }
172
173 #define CsrWifiNmeEventMaskSetReqSend(src__, indMask__) \
174     CsrWifiNmeEventMaskSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, indMask__)
175
176 /*******************************************************************************
177
178   NAME
179     CsrWifiNmeEventMaskSetCfmSend
180
181   DESCRIPTION
182     The NME calls the primitive to report the result of the request
183     primitive.
184
185   PARAMETERS
186     queue  - Destination Task Queue
187     status - Reports the result of the request
188
189 *******************************************************************************/
190 #define CsrWifiNmeEventMaskSetCfmCreate(msg__, dst__, src__, status__) \
191     msg__ = kmalloc(sizeof(CsrWifiNmeEventMaskSetCfm), GFP_KERNEL); \
192     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_EVENT_MASK_SET_CFM, dst__, src__); \
193     msg__->status = (status__);
194
195 #define CsrWifiNmeEventMaskSetCfmSendTo(dst__, src__, status__) \
196     { \
197         CsrWifiNmeEventMaskSetCfm *msg__; \
198         CsrWifiNmeEventMaskSetCfmCreate(msg__, dst__, src__, status__); \
199         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
200     }
201
202 #define CsrWifiNmeEventMaskSetCfmSend(dst__, status__) \
203     CsrWifiNmeEventMaskSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
204
205 /*******************************************************************************
206
207   NAME
208     CsrWifiNmeProfileConnectReqSend
209
210   DESCRIPTION
211     Requests the NME to attempt to connect to the specified profile.
212     Overrides any current connection attempt.
213
214   PARAMETERS
215     queue           - Message Source Task Queue (Cfm's will be sent to this Queue)
216     interfaceTag    - Interface Identifier; unique identifier of an interface
217     profileIdentity - Identity (BSSID, SSID) of profile to be connected to.
218                       It must match an existing profile in the NME.
219
220 *******************************************************************************/
221 #define CsrWifiNmeProfileConnectReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentity__) \
222     msg__ = kmalloc(sizeof(CsrWifiNmeProfileConnectReq), GFP_KERNEL); \
223     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_CONNECT_REQ, dst__, src__); \
224     msg__->interfaceTag = (interfaceTag__); \
225     msg__->profileIdentity = (profileIdentity__);
226
227 #define CsrWifiNmeProfileConnectReqSendTo(dst__, src__, interfaceTag__, profileIdentity__) \
228     { \
229         CsrWifiNmeProfileConnectReq *msg__; \
230         CsrWifiNmeProfileConnectReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentity__); \
231         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
232     }
233
234 #define CsrWifiNmeProfileConnectReqSend(src__, interfaceTag__, profileIdentity__) \
235     CsrWifiNmeProfileConnectReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, profileIdentity__)
236
237 /*******************************************************************************
238
239   NAME
240     CsrWifiNmeProfileConnectCfmSend
241
242   DESCRIPTION
243     Reports the status of the NME PROFILE CONNECT REQ. If unsuccessful the
244     connectAttempt parameters contain details of the APs that the NME
245     attempted to connect to before reporting the failure of the request.
246
247   PARAMETERS
248     queue                - Destination Task Queue
249     interfaceTag         - Interface Identifier; unique identifier of an
250                            interface
251     status               - Indicates the success or otherwise of the requested
252                            operation.
253     connectAttemptsCount - This parameter is relevant only if
254                            status!=CSR_WIFI_NME_STATUS_SUCCESS.
255                            Number of connection attempt elements provided with
256                            this primitive
257     connectAttempts      - This parameter is relevant only if
258                            status!=CSR_WIFI_NME_STATUS_SUCCESS.
259                            Points to the list of connection attempt elements
260                            provided with this primitive
261                            Each element of the list provides information about
262                            an AP on which the connection attempt was made and
263                            the error that occurred during the attempt.
264
265 *******************************************************************************/
266 #define CsrWifiNmeProfileConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) \
267     msg__ = kmalloc(sizeof(CsrWifiNmeProfileConnectCfm), GFP_KERNEL); \
268     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_CONNECT_CFM, dst__, src__); \
269     msg__->interfaceTag = (interfaceTag__); \
270     msg__->status = (status__); \
271     msg__->connectAttemptsCount = (connectAttemptsCount__); \
272     msg__->connectAttempts = (connectAttempts__);
273
274 #define CsrWifiNmeProfileConnectCfmSendTo(dst__, src__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) \
275     { \
276         CsrWifiNmeProfileConnectCfm *msg__; \
277         CsrWifiNmeProfileConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__); \
278         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
279     }
280
281 #define CsrWifiNmeProfileConnectCfmSend(dst__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) \
282     CsrWifiNmeProfileConnectCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__)
283
284 /*******************************************************************************
285
286   NAME
287     CsrWifiNmeProfileDeleteAllReqSend
288
289   DESCRIPTION
290     Deletes all profiles present in the NME, but does NOT modify the
291     preferred profile list.
292
293   PARAMETERS
294     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
295
296 *******************************************************************************/
297 #define CsrWifiNmeProfileDeleteAllReqCreate(msg__, dst__, src__) \
298     msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteAllReq), GFP_KERNEL); \
299     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ, dst__, src__);
300
301 #define CsrWifiNmeProfileDeleteAllReqSendTo(dst__, src__) \
302     { \
303         CsrWifiNmeProfileDeleteAllReq *msg__; \
304         CsrWifiNmeProfileDeleteAllReqCreate(msg__, dst__, src__); \
305         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
306     }
307
308 #define CsrWifiNmeProfileDeleteAllReqSend(src__) \
309     CsrWifiNmeProfileDeleteAllReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__)
310
311 /*******************************************************************************
312
313   NAME
314     CsrWifiNmeProfileDeleteAllCfmSend
315
316   DESCRIPTION
317     Reports the status of the CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ.
318     Returns always CSR_WIFI_NME_STATUS_SUCCESS.
319
320   PARAMETERS
321     queue  - Destination Task Queue
322     status - Indicates the success or otherwise of the requested operation, but
323              in this case it always set to success.
324
325 *******************************************************************************/
326 #define CsrWifiNmeProfileDeleteAllCfmCreate(msg__, dst__, src__, status__) \
327     msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteAllCfm), GFP_KERNEL); \
328     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_ALL_CFM, dst__, src__); \
329     msg__->status = (status__);
330
331 #define CsrWifiNmeProfileDeleteAllCfmSendTo(dst__, src__, status__) \
332     { \
333         CsrWifiNmeProfileDeleteAllCfm *msg__; \
334         CsrWifiNmeProfileDeleteAllCfmCreate(msg__, dst__, src__, status__); \
335         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
336     }
337
338 #define CsrWifiNmeProfileDeleteAllCfmSend(dst__, status__) \
339     CsrWifiNmeProfileDeleteAllCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
340
341 /*******************************************************************************
342
343   NAME
344     CsrWifiNmeProfileDeleteReqSend
345
346   DESCRIPTION
347     Will delete the profile with a matching identity, but does NOT modify the
348     preferred profile list.
349
350   PARAMETERS
351     queue           - Message Source Task Queue (Cfm's will be sent to this Queue)
352     profileIdentity - Identity (BSSID, SSID) of profile to be deleted.
353
354 *******************************************************************************/
355 #define CsrWifiNmeProfileDeleteReqCreate(msg__, dst__, src__, profileIdentity__) \
356     msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteReq), GFP_KERNEL); \
357     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_REQ, dst__, src__); \
358     msg__->profileIdentity = (profileIdentity__);
359
360 #define CsrWifiNmeProfileDeleteReqSendTo(dst__, src__, profileIdentity__) \
361     { \
362         CsrWifiNmeProfileDeleteReq *msg__; \
363         CsrWifiNmeProfileDeleteReqCreate(msg__, dst__, src__, profileIdentity__); \
364         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
365     }
366
367 #define CsrWifiNmeProfileDeleteReqSend(src__, profileIdentity__) \
368     CsrWifiNmeProfileDeleteReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, profileIdentity__)
369
370 /*******************************************************************************
371
372   NAME
373     CsrWifiNmeProfileDeleteCfmSend
374
375   DESCRIPTION
376     Reports the status of the CSR_WIFI_NME_PROFILE_DELETE_REQ.
377     Returns CSR_WIFI_NME_STATUS_NOT_FOUND if there is no matching profile.
378
379   PARAMETERS
380     queue  - Destination Task Queue
381     status - Indicates the success or otherwise of the requested operation.
382
383 *******************************************************************************/
384 #define CsrWifiNmeProfileDeleteCfmCreate(msg__, dst__, src__, status__) \
385     msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteCfm), GFP_KERNEL); \
386     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_CFM, dst__, src__); \
387     msg__->status = (status__);
388
389 #define CsrWifiNmeProfileDeleteCfmSendTo(dst__, src__, status__) \
390     { \
391         CsrWifiNmeProfileDeleteCfm *msg__; \
392         CsrWifiNmeProfileDeleteCfmCreate(msg__, dst__, src__, status__); \
393         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
394     }
395
396 #define CsrWifiNmeProfileDeleteCfmSend(dst__, status__) \
397     CsrWifiNmeProfileDeleteCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
398
399 /*******************************************************************************
400
401   NAME
402     CsrWifiNmeProfileDisconnectIndSend
403
404   DESCRIPTION
405     Indication generated from the NME (if an application subscribes to
406     receive it) that informs that application that the current profile
407     connection has disconnected. The indication will contain information
408     about APs that it attempted to maintain the connection via i.e. in the
409     case of failed roaming.
410
411   PARAMETERS
412     queue                - Destination Task Queue
413     interfaceTag         - Interface Identifier; unique identifier of an
414                            interface
415     connectAttemptsCount - Number of connection attempt elements provided with
416                            this primitive
417     connectAttempts      - Points to the list of connection attempt elements
418                            provided with this primitive
419                            Each element of the list provides information about
420                            an AP on which the connection attempt was made and
421                            the error occurred during the attempt.
422
423 *******************************************************************************/
424 #define CsrWifiNmeProfileDisconnectIndCreate(msg__, dst__, src__, interfaceTag__, connectAttemptsCount__, connectAttempts__) \
425     msg__ = kmalloc(sizeof(CsrWifiNmeProfileDisconnectInd), GFP_KERNEL); \
426     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DISCONNECT_IND, dst__, src__); \
427     msg__->interfaceTag = (interfaceTag__); \
428     msg__->connectAttemptsCount = (connectAttemptsCount__); \
429     msg__->connectAttempts = (connectAttempts__);
430
431 #define CsrWifiNmeProfileDisconnectIndSendTo(dst__, src__, interfaceTag__, connectAttemptsCount__, connectAttempts__) \
432     { \
433         CsrWifiNmeProfileDisconnectInd *msg__; \
434         CsrWifiNmeProfileDisconnectIndCreate(msg__, dst__, src__, interfaceTag__, connectAttemptsCount__, connectAttempts__); \
435         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
436     }
437
438 #define CsrWifiNmeProfileDisconnectIndSend(dst__, interfaceTag__, connectAttemptsCount__, connectAttempts__) \
439     CsrWifiNmeProfileDisconnectIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, connectAttemptsCount__, connectAttempts__)
440
441 /*******************************************************************************
442
443   NAME
444     CsrWifiNmeProfileOrderSetReqSend
445
446   DESCRIPTION
447     Defines the preferred order that profiles present in the NME should be
448     used during the NME auto-connect behaviour.
449     If profileIdentitysCount == 0, it removes any existing preferred profile
450     list already present in the NME, effectively disabling the auto-connect
451     behaviour.
452     NOTE: Profile identities that do not match any profile stored in the NME
453     are ignored during the auto-connect procedure.
454     NOTE: during auto-connect the NME will only attempt to join an existing
455     adhoc network and it will never attempt to host an adhoc network; for
456     hosting and adhoc network, use CSR_WIFI_NME_PROFILE_CONNECT_REQ
457
458   PARAMETERS
459     queue                 - Message Source Task Queue (Cfm's will be sent to this Queue)
460     interfaceTag          - Interface Identifier; unique identifier of an
461                             interface
462     profileIdentitysCount - The number of profiles identities in the list.
463     profileIdentitys      - Points to the list of profile identities.
464
465 *******************************************************************************/
466 #define CsrWifiNmeProfileOrderSetReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) \
467     msg__ = kmalloc(sizeof(CsrWifiNmeProfileOrderSetReq), GFP_KERNEL); \
468     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_ORDER_SET_REQ, dst__, src__); \
469     msg__->interfaceTag = (interfaceTag__); \
470     msg__->profileIdentitysCount = (profileIdentitysCount__); \
471     msg__->profileIdentitys = (profileIdentitys__);
472
473 #define CsrWifiNmeProfileOrderSetReqSendTo(dst__, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) \
474     { \
475         CsrWifiNmeProfileOrderSetReq *msg__; \
476         CsrWifiNmeProfileOrderSetReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__); \
477         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
478     }
479
480 #define CsrWifiNmeProfileOrderSetReqSend(src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) \
481     CsrWifiNmeProfileOrderSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__)
482
483 /*******************************************************************************
484
485   NAME
486     CsrWifiNmeProfileOrderSetCfmSend
487
488   DESCRIPTION
489     Confirmation to UNIFI_NME_PROFILE_ORDER_SET.request.
490
491   PARAMETERS
492     queue        - Destination Task Queue
493     interfaceTag - Interface Identifier; unique identifier of an interface
494     status       - Indicates the success or otherwise of the requested
495                    operation.
496
497 *******************************************************************************/
498 #define CsrWifiNmeProfileOrderSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
499     msg__ = kmalloc(sizeof(CsrWifiNmeProfileOrderSetCfm), GFP_KERNEL); \
500     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_ORDER_SET_CFM, dst__, src__); \
501     msg__->interfaceTag = (interfaceTag__); \
502     msg__->status = (status__);
503
504 #define CsrWifiNmeProfileOrderSetCfmSendTo(dst__, src__, interfaceTag__, status__) \
505     { \
506         CsrWifiNmeProfileOrderSetCfm *msg__; \
507         CsrWifiNmeProfileOrderSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
508         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
509     }
510
511 #define CsrWifiNmeProfileOrderSetCfmSend(dst__, interfaceTag__, status__) \
512     CsrWifiNmeProfileOrderSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__)
513
514 /*******************************************************************************
515
516   NAME
517     CsrWifiNmeProfileSetReqSend
518
519   DESCRIPTION
520     Creates or updates an existing profile in the NME that matches the unique
521     identity of the profile. Each profile is identified by the combination of
522     BSSID and SSID. The profile contains all the required credentials for
523     attempting to connect to the network. Creating or updating a profile via
524     the NME PROFILE SET REQ does NOT add the profile to the preferred profile
525     list within the NME used for the NME auto-connect behaviour.
526
527   PARAMETERS
528     queue   - Message Source Task Queue (Cfm's will be sent to this Queue)
529     profile - Specifies the identity and credentials of the network.
530
531 *******************************************************************************/
532 #define CsrWifiNmeProfileSetReqCreate(msg__, dst__, src__, profile__) \
533     msg__ = kmalloc(sizeof(CsrWifiNmeProfileSetReq), GFP_KERNEL); \
534     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_SET_REQ, dst__, src__); \
535     msg__->profile = (profile__);
536
537 #define CsrWifiNmeProfileSetReqSendTo(dst__, src__, profile__) \
538     { \
539         CsrWifiNmeProfileSetReq *msg__; \
540         CsrWifiNmeProfileSetReqCreate(msg__, dst__, src__, profile__); \
541         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
542     }
543
544 #define CsrWifiNmeProfileSetReqSend(src__, profile__) \
545     CsrWifiNmeProfileSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, profile__)
546
547 /*******************************************************************************
548
549   NAME
550     CsrWifiNmeProfileSetCfmSend
551
552   DESCRIPTION
553     Reports the status of the NME PROFILE SET REQ; the request will only fail
554     if the details specified in the profile contains an invalid combination
555     of parameters for example specifying the profile as cloaked but not
556     specifying the SSID. The NME doesn't limit the number of profiles that
557     may be created. The NME assumes that the entity configuring it is aware
558     of the appropriate limits.
559
560   PARAMETERS
561     queue  - Destination Task Queue
562     status - Indicates the success or otherwise of the requested operation.
563
564 *******************************************************************************/
565 #define CsrWifiNmeProfileSetCfmCreate(msg__, dst__, src__, status__) \
566     msg__ = kmalloc(sizeof(CsrWifiNmeProfileSetCfm), GFP_KERNEL); \
567     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_SET_CFM, dst__, src__); \
568     msg__->status = (status__);
569
570 #define CsrWifiNmeProfileSetCfmSendTo(dst__, src__, status__) \
571     { \
572         CsrWifiNmeProfileSetCfm *msg__; \
573         CsrWifiNmeProfileSetCfmCreate(msg__, dst__, src__, status__); \
574         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
575     }
576
577 #define CsrWifiNmeProfileSetCfmSend(dst__, status__) \
578     CsrWifiNmeProfileSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
579
580 /*******************************************************************************
581
582   NAME
583     CsrWifiNmeProfileUpdateIndSend
584
585   DESCRIPTION
586     Indication generated from the NME (if an application subscribes to
587     receive it) that informs that application that the contained profile has
588     changed.
589     For example, either the credentials EAP-FAST PAC file or the session data
590     within the profile has changed.
591     It is up to the application whether it stores this updated profile or
592     not.
593
594   PARAMETERS
595     queue        - Destination Task Queue
596     interfaceTag - Interface Identifier; unique identifier of an interface
597     profile      - The identity and credentials of the network.
598
599 *******************************************************************************/
600 #define CsrWifiNmeProfileUpdateIndCreate(msg__, dst__, src__, interfaceTag__, profile__) \
601     msg__ = kmalloc(sizeof(CsrWifiNmeProfileUpdateInd), GFP_KERNEL); \
602     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_UPDATE_IND, dst__, src__); \
603     msg__->interfaceTag = (interfaceTag__); \
604     msg__->profile = (profile__);
605
606 #define CsrWifiNmeProfileUpdateIndSendTo(dst__, src__, interfaceTag__, profile__) \
607     { \
608         CsrWifiNmeProfileUpdateInd *msg__; \
609         CsrWifiNmeProfileUpdateIndCreate(msg__, dst__, src__, interfaceTag__, profile__); \
610         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
611     }
612
613 #define CsrWifiNmeProfileUpdateIndSend(dst__, interfaceTag__, profile__) \
614     CsrWifiNmeProfileUpdateIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, profile__)
615
616 /*******************************************************************************
617
618   NAME
619     CsrWifiNmeSimGsmAuthIndSend
620
621   DESCRIPTION
622     Indication generated from the NME (if an application subscribes to
623     receive it) that requests the UICC Manager to perform a GSM
624     authentication on behalf of the NME. This indication is generated when
625     the NME is attempting to connect to a profile configured for EAP-SIM. An
626     application MUST register to receive this indication for the NME to
627     support the EAP-SIM credential types. Otherwise the NME has no route to
628     obtain the information from the UICC. EAP-SIM authentication requires 2
629     or 3 GSM authentication rounds and therefore 2 or 3 RANDS (GSM Random
630     Challenges) are included.
631
632   PARAMETERS
633     queue       - Destination Task Queue
634     randsLength - GSM RAND is 16 bytes long hence valid values are 32 (2 RANDS)
635                   or 48 (3 RANDs).
636     rands       - 2 or 3 RANDs values.
637
638 *******************************************************************************/
639 #define CsrWifiNmeSimGsmAuthIndCreate(msg__, dst__, src__, randsLength__, rands__) \
640     msg__ = kmalloc(sizeof(CsrWifiNmeSimGsmAuthInd), GFP_KERNEL); \
641     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_GSM_AUTH_IND, dst__, src__); \
642     msg__->randsLength = (randsLength__); \
643     msg__->rands = (rands__);
644
645 #define CsrWifiNmeSimGsmAuthIndSendTo(dst__, src__, randsLength__, rands__) \
646     { \
647         CsrWifiNmeSimGsmAuthInd *msg__; \
648         CsrWifiNmeSimGsmAuthIndCreate(msg__, dst__, src__, randsLength__, rands__); \
649         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
650     }
651
652 #define CsrWifiNmeSimGsmAuthIndSend(dst__, randsLength__, rands__) \
653     CsrWifiNmeSimGsmAuthIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, randsLength__, rands__)
654
655 /*******************************************************************************
656
657   NAME
658     CsrWifiNmeSimGsmAuthResSend
659
660   DESCRIPTION
661     Response from the application that received the NME SIM GSM AUTH IND. For
662     each GSM authentication round a GSM Ciphering key (Kc) and a signed
663     response (SRES) are produced. Since 2 or 3 GSM authentication rounds are
664     used the 2 or 3 Kc's obtained respectively are combined into one buffer
665     and similarly the 2 or 3 SRES's obtained are combined into another
666     buffer. The order of Kc values (SRES values respectively) in their buffer
667     is the same as that of their corresponding RAND values in the incoming
668     indication.
669
670   PARAMETERS
671     status     - Indicates the outcome of the requested operation:
672                  STATUS_SUCCESS or STATUS_ERROR
673     kcsLength  - Length in Bytes of Kc buffer. Legal values are: 16 or 24.
674     kcs        - Kc buffer holding 2 or 3 Kc values.
675     sresLength - Length in Bytes of SRES buffer. Legal values are: 8 or 12.
676     sres       - SRES buffer holding 2 or 3 SRES values.
677
678 *******************************************************************************/
679 #define CsrWifiNmeSimGsmAuthResCreate(msg__, dst__, src__, status__, kcsLength__, kcs__, sresLength__, sres__) \
680     msg__ = kmalloc(sizeof(CsrWifiNmeSimGsmAuthRes), GFP_KERNEL); \
681     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_GSM_AUTH_RES, dst__, src__); \
682     msg__->status = (status__); \
683     msg__->kcsLength = (kcsLength__); \
684     msg__->kcs = (kcs__); \
685     msg__->sresLength = (sresLength__); \
686     msg__->sres = (sres__);
687
688 #define CsrWifiNmeSimGsmAuthResSendTo(dst__, src__, status__, kcsLength__, kcs__, sresLength__, sres__) \
689     { \
690         CsrWifiNmeSimGsmAuthRes *msg__; \
691         CsrWifiNmeSimGsmAuthResCreate(msg__, dst__, src__, status__, kcsLength__, kcs__, sresLength__, sres__); \
692         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
693     }
694
695 #define CsrWifiNmeSimGsmAuthResSend(src__, status__, kcsLength__, kcs__, sresLength__, sres__) \
696     CsrWifiNmeSimGsmAuthResSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, status__, kcsLength__, kcs__, sresLength__, sres__)
697
698 /*******************************************************************************
699
700   NAME
701     CsrWifiNmeSimImsiGetIndSend
702
703   DESCRIPTION
704     Indication generated from the NME (if an application subscribes to
705     receive it) that requests the IMSI and UICC type from the UICC Manager.
706     This indication is generated when the NME is attempting to connect to a
707     profile configured for EAP-SIM/AKA. An application MUST register to
708     receive this indication for the NME to support the EAP-SIM/AKA credential
709     types. Otherwise the NME has no route to obtain the information from the
710     UICC.
711
712   PARAMETERS
713     queue  - Destination Task Queue
714
715 *******************************************************************************/
716 #define CsrWifiNmeSimImsiGetIndCreate(msg__, dst__, src__) \
717     msg__ = kmalloc(sizeof(CsrWifiNmeSimImsiGetInd), GFP_KERNEL); \
718     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_IMSI_GET_IND, dst__, src__);
719
720 #define CsrWifiNmeSimImsiGetIndSendTo(dst__, src__) \
721     { \
722         CsrWifiNmeSimImsiGetInd *msg__; \
723         CsrWifiNmeSimImsiGetIndCreate(msg__, dst__, src__); \
724         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
725     }
726
727 #define CsrWifiNmeSimImsiGetIndSend(dst__) \
728     CsrWifiNmeSimImsiGetIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE)
729
730 /*******************************************************************************
731
732   NAME
733     CsrWifiNmeSimImsiGetResSend
734
735   DESCRIPTION
736     Response from the application that received the NME SIM IMSI GET IND.
737
738   PARAMETERS
739     status   - Indicates the outcome of the requested operation: STATUS_SUCCESS
740                or STATUS_ERROR.
741     imsi     - The value of the IMSI obtained from the UICC.
742     cardType - The UICC type (GSM only (SIM), UMTS only (USIM), Both).
743
744 *******************************************************************************/
745 #define CsrWifiNmeSimImsiGetResCreate(msg__, dst__, src__, status__, imsi__, cardType__) \
746     msg__ = kmalloc(sizeof(CsrWifiNmeSimImsiGetRes), GFP_KERNEL); \
747     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_IMSI_GET_RES, dst__, src__); \
748     msg__->status = (status__); \
749     msg__->imsi = (imsi__); \
750     msg__->cardType = (cardType__);
751
752 #define CsrWifiNmeSimImsiGetResSendTo(dst__, src__, status__, imsi__, cardType__) \
753     { \
754         CsrWifiNmeSimImsiGetRes *msg__; \
755         CsrWifiNmeSimImsiGetResCreate(msg__, dst__, src__, status__, imsi__, cardType__); \
756         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
757     }
758
759 #define CsrWifiNmeSimImsiGetResSend(src__, status__, imsi__, cardType__) \
760     CsrWifiNmeSimImsiGetResSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, status__, imsi__, cardType__)
761
762 /*******************************************************************************
763
764   NAME
765     CsrWifiNmeSimUmtsAuthIndSend
766
767   DESCRIPTION
768     Indication generated from the NME (if an application subscribes to
769     receive it) that requests the UICC Manager to perform a UMTS
770     authentication on behalf of the NME. This indication is generated when
771     the NME is attempting to connect to a profile configured for EAP-AKA. An
772     application MUST register to receive this indication for the NME to
773     support the EAP-AKA credential types. Otherwise the NME has no route to
774     obtain the information from the USIM. EAP-AKA requires one UMTS
775     authentication round and therefore only one RAND and one AUTN values are
776     included.
777
778   PARAMETERS
779     queue  - Destination Task Queue
780     rand   - UMTS RAND value.
781     autn   - UMTS AUTN value.
782
783 *******************************************************************************/
784 #define CsrWifiNmeSimUmtsAuthIndCreate(msg__, dst__, src__, rand__, autn__) \
785     msg__ = kmalloc(sizeof(CsrWifiNmeSimUmtsAuthInd), GFP_KERNEL); \
786     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_UMTS_AUTH_IND, dst__, src__); \
787     memcpy(msg__->rand, (rand__), sizeof(u8) * 16); \
788     memcpy(msg__->autn, (autn__), sizeof(u8) * 16);
789
790 #define CsrWifiNmeSimUmtsAuthIndSendTo(dst__, src__, rand__, autn__) \
791     { \
792         CsrWifiNmeSimUmtsAuthInd *msg__; \
793         CsrWifiNmeSimUmtsAuthIndCreate(msg__, dst__, src__, rand__, autn__); \
794         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
795     }
796
797 #define CsrWifiNmeSimUmtsAuthIndSend(dst__, rand__, autn__) \
798     CsrWifiNmeSimUmtsAuthIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, rand__, autn__)
799
800 /*******************************************************************************
801
802   NAME
803     CsrWifiNmeSimUmtsAuthResSend
804
805   DESCRIPTION
806     Response from the application that received the NME SIM UMTS AUTH IND.
807     The values of umtsCipherKey, umtsIntegrityKey, resParameterLength and
808     resParameter are only meanigful when result = UMTS_AUTH_RESULT_SUCCESS.
809     The value of auts is only meaningful when
810     result=UMTS_AUTH_RESULT_SYNC_FAIL.
811
812   PARAMETERS
813     status             - Indicates the outcome of the requested operation:
814                          STATUS_SUCCESS or STATUS_ERROR.
815     result             - The result of UMTS authentication as performed by the
816                          UICC which could be: Success, Authentication Reject or
817                          Synchronisation Failure. For all these 3 outcomes the
818                          value of status is success.
819     umtsCipherKey      - The UMTS Cipher Key as calculated and returned by the
820                          UICC.
821     umtsIntegrityKey   - The UMTS Integrity Key as calculated and returned by
822                          the UICC.
823     resParameterLength - The length (in bytes) of the RES parameter (min=4; max
824                          = 16).
825     resParameter       - The RES parameter as calculated and returned by the
826                          UICC.
827     auts               - The AUTS parameter as calculated and returned by the
828                          UICC.
829
830 *******************************************************************************/
831 #define CsrWifiNmeSimUmtsAuthResCreate(msg__, dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \
832     msg__ = kmalloc(sizeof(CsrWifiNmeSimUmtsAuthRes), GFP_KERNEL); \
833     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_UMTS_AUTH_RES, dst__, src__); \
834     msg__->status = (status__); \
835     msg__->result = (result__); \
836     memcpy(msg__->umtsCipherKey, (umtsCipherKey__), sizeof(u8) * 16); \
837     memcpy(msg__->umtsIntegrityKey, (umtsIntegrityKey__), sizeof(u8) * 16); \
838     msg__->resParameterLength = (resParameterLength__); \
839     msg__->resParameter = (resParameter__); \
840     memcpy(msg__->auts, (auts__), sizeof(u8) * 14);
841
842 #define CsrWifiNmeSimUmtsAuthResSendTo(dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \
843     { \
844         CsrWifiNmeSimUmtsAuthRes *msg__; \
845         CsrWifiNmeSimUmtsAuthResCreate(msg__, dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__); \
846         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
847     }
848
849 #define CsrWifiNmeSimUmtsAuthResSend(src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \
850     CsrWifiNmeSimUmtsAuthResSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__)
851
852 /*******************************************************************************
853
854   NAME
855     CsrWifiNmeWpsCancelReqSend
856
857   DESCRIPTION
858     Requests the NME to cancel any WPS procedure that it is currently
859     performing. This includes WPS registrar activities started because of
860     CSR_WIFI_NME_AP_REGISTER.request
861
862   PARAMETERS
863     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
864     interfaceTag - Interface Identifier; unique identifier of an interface
865
866 *******************************************************************************/
867 #define CsrWifiNmeWpsCancelReqCreate(msg__, dst__, src__, interfaceTag__) \
868     msg__ = kmalloc(sizeof(CsrWifiNmeWpsCancelReq), GFP_KERNEL); \
869     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CANCEL_REQ, dst__, src__); \
870     msg__->interfaceTag = (interfaceTag__);
871
872 #define CsrWifiNmeWpsCancelReqSendTo(dst__, src__, interfaceTag__) \
873     { \
874         CsrWifiNmeWpsCancelReq *msg__; \
875         CsrWifiNmeWpsCancelReqCreate(msg__, dst__, src__, interfaceTag__); \
876         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
877     }
878
879 #define CsrWifiNmeWpsCancelReqSend(src__, interfaceTag__) \
880     CsrWifiNmeWpsCancelReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__)
881
882 /*******************************************************************************
883
884   NAME
885     CsrWifiNmeWpsCancelCfmSend
886
887   DESCRIPTION
888     Reports the status of the NME WPS REQ, the request is always SUCCESSFUL.
889
890   PARAMETERS
891     queue        - Destination Task Queue
892     interfaceTag - Interface Identifier; unique identifier of an interface
893     status       - Only returns CSR_WIFI_NME_STATUS_SUCCESS
894
895 *******************************************************************************/
896 #define CsrWifiNmeWpsCancelCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
897     msg__ = kmalloc(sizeof(CsrWifiNmeWpsCancelCfm), GFP_KERNEL); \
898     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CANCEL_CFM, dst__, src__); \
899     msg__->interfaceTag = (interfaceTag__); \
900     msg__->status = (status__);
901
902 #define CsrWifiNmeWpsCancelCfmSendTo(dst__, src__, interfaceTag__, status__) \
903     { \
904         CsrWifiNmeWpsCancelCfm *msg__; \
905         CsrWifiNmeWpsCancelCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
906         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
907     }
908
909 #define CsrWifiNmeWpsCancelCfmSend(dst__, interfaceTag__, status__) \
910     CsrWifiNmeWpsCancelCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__)
911
912 /*******************************************************************************
913
914   NAME
915     CsrWifiNmeWpsCfmSend
916
917   DESCRIPTION
918     Reports the status of the NME WPS REQ.
919     If CSR_WIFI_NME_STATUS_SUCCESS, the profile parameter contains the
920     identity and credentials of the AP.
921
922   PARAMETERS
923     queue        - Destination Task Queue
924     interfaceTag - Interface Identifier; unique identifier of an interface
925     status       - Indicates the success or otherwise of the requested
926                    operation.
927     profile      - This parameter is relevant only if
928                    status==CSR_WIFI_NME_STATUS_SUCCESS.
929                    The identity and credentials of the network.
930
931 *******************************************************************************/
932 #define CsrWifiNmeWpsCfmCreate(msg__, dst__, src__, interfaceTag__, status__, profile__) \
933     msg__ = kmalloc(sizeof(CsrWifiNmeWpsCfm), GFP_KERNEL); \
934     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CFM, dst__, src__); \
935     msg__->interfaceTag = (interfaceTag__); \
936     msg__->status = (status__); \
937     msg__->profile = (profile__);
938
939 #define CsrWifiNmeWpsCfmSendTo(dst__, src__, interfaceTag__, status__, profile__) \
940     { \
941         CsrWifiNmeWpsCfm *msg__; \
942         CsrWifiNmeWpsCfmCreate(msg__, dst__, src__, interfaceTag__, status__, profile__); \
943         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
944     }
945
946 #define CsrWifiNmeWpsCfmSend(dst__, interfaceTag__, status__, profile__) \
947     CsrWifiNmeWpsCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, profile__)
948
949 /*******************************************************************************
950
951   NAME
952     CsrWifiNmeWpsConfigSetReqSend
953
954   DESCRIPTION
955     This primitive passes the WPS information for the device to NME. This may
956     be accepted only if no interface is active.
957
958   PARAMETERS
959     queue     - Message Source Task Queue (Cfm's will be sent to this Queue)
960     wpsConfig - WPS config.
961
962 *******************************************************************************/
963 #define CsrWifiNmeWpsConfigSetReqCreate(msg__, dst__, src__, wpsConfig__) \
964     msg__ = kmalloc(sizeof(CsrWifiNmeWpsConfigSetReq), GFP_KERNEL); \
965     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CONFIG_SET_REQ, dst__, src__); \
966     msg__->wpsConfig = (wpsConfig__);
967
968 #define CsrWifiNmeWpsConfigSetReqSendTo(dst__, src__, wpsConfig__) \
969     { \
970         CsrWifiNmeWpsConfigSetReq *msg__; \
971         CsrWifiNmeWpsConfigSetReqCreate(msg__, dst__, src__, wpsConfig__); \
972         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
973     }
974
975 #define CsrWifiNmeWpsConfigSetReqSend(src__, wpsConfig__) \
976     CsrWifiNmeWpsConfigSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, wpsConfig__)
977
978 /*******************************************************************************
979
980   NAME
981     CsrWifiNmeWpsConfigSetCfmSend
982
983   DESCRIPTION
984     Confirm.
985
986   PARAMETERS
987     queue  - Destination Task Queue
988     status - Status of the request.
989
990 *******************************************************************************/
991 #define CsrWifiNmeWpsConfigSetCfmCreate(msg__, dst__, src__, status__) \
992     msg__ = kmalloc(sizeof(CsrWifiNmeWpsConfigSetCfm), GFP_KERNEL); \
993     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CONFIG_SET_CFM, dst__, src__); \
994     msg__->status = (status__);
995
996 #define CsrWifiNmeWpsConfigSetCfmSendTo(dst__, src__, status__) \
997     { \
998         CsrWifiNmeWpsConfigSetCfm *msg__; \
999         CsrWifiNmeWpsConfigSetCfmCreate(msg__, dst__, src__, status__); \
1000         CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
1001     }
1002
1003 #define CsrWifiNmeWpsConfigSetCfmSend(dst__, status__) \
1004     CsrWifiNmeWpsConfigSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
1005
1006 /*******************************************************************************
1007
1008   NAME
1009     CsrWifiNmeWpsReqSend
1010
1011   DESCRIPTION
1012     Requests the NME to look for WPS enabled APs and attempt to perform WPS
1013     to determine the appropriate security credentials to connect to the AP.
1014     If the PIN == '00000000' then 'push button mode' is indicated, otherwise
1015     the PIN has to match that of the AP. 4 digit pin is passed by sending the
1016     pin digits in pin[0]..pin[3] and rest of the contents filled with '-'.
1017
1018   PARAMETERS
1019     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
1020     interfaceTag - Interface Identifier; unique identifier of an interface
1021     pin          - PIN value.
1022     ssid         - Service Set identifier
1023     bssid        - ID of Basic Service Set for which a WPS connection attempt is
1024                    being made.
1025
1026 *******************************************************************************/
1027 #define CsrWifiNmeWpsReqCreate(msg__, dst__, src__, interfaceTag__, pin__, ssid__, bssid__) \
1028     msg__ = kmalloc(sizeof(CsrWifiNmeWpsReq), GFP_KERNEL); \
1029     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_REQ, dst__, src__); \
1030     msg__->interfaceTag = (interfaceTag__); \
1031     memcpy(msg__->pin, (pin__), sizeof(u8) * 8); \
1032     msg__->ssid = (ssid__); \
1033     msg__->bssid = (bssid__);
1034
1035 #define CsrWifiNmeWpsReqSendTo(dst__, src__, interfaceTag__, pin__, ssid__, bssid__) \
1036     { \
1037         CsrWifiNmeWpsReq *msg__; \
1038         CsrWifiNmeWpsReqCreate(msg__, dst__, src__, interfaceTag__, pin__, ssid__, bssid__); \
1039         CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
1040     }
1041
1042 #define CsrWifiNmeWpsReqSend(src__, interfaceTag__, pin__, ssid__, bssid__) \
1043     CsrWifiNmeWpsReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, pin__, ssid__, bssid__)
1044
1045 #endif /* CSR_WIFI_NME_LIB_H__ */