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