Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-fixes
[pandora-kernel.git] / drivers / staging / csr / csr_wifi_sme_lib.h
1 /*****************************************************************************
2
3             (c) Cambridge Silicon Radio Limited 2012
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_SME_LIB_H__
14 #define CSR_WIFI_SME_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_sme_prim.h"
23 #include "csr_wifi_sme_task.h"
24
25
26 #ifndef CSR_WIFI_SME_LIB_DESTINATION_QUEUE
27 # ifdef CSR_WIFI_NME_ENABLE
28 # include "csr_wifi_nme_task.h"
29 # define CSR_WIFI_SME_LIB_DESTINATION_QUEUE CSR_WIFI_NME_IFACEQUEUE
30 # else
31 # define CSR_WIFI_SME_LIB_DESTINATION_QUEUE CSR_WIFI_SME_IFACEQUEUE
32 # endif
33 #endif
34
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 /*----------------------------------------------------------------------------*
41  *  CsrWifiSmeFreeUpstreamMessageContents
42  *
43  *  DESCRIPTION
44  *      Free the allocated memory in a CSR_WIFI_SME upstream message. Does not
45  *      free the message itself, and can only be used for upstream messages.
46  *
47  *  PARAMETERS
48  *      Deallocates the resources in a CSR_WIFI_SME upstream message
49  *----------------------------------------------------------------------------*/
50 void CsrWifiSmeFreeUpstreamMessageContents(u16 eventClass, void *message);
51
52 /*----------------------------------------------------------------------------*
53  *  CsrWifiSmeFreeDownstreamMessageContents
54  *
55  *  DESCRIPTION
56  *      Free the allocated memory in a CSR_WIFI_SME downstream message. Does not
57  *      free the message itself, and can only be used for downstream messages.
58  *
59  *  PARAMETERS
60  *      Deallocates the resources in a CSR_WIFI_SME downstream message
61  *----------------------------------------------------------------------------*/
62 void CsrWifiSmeFreeDownstreamMessageContents(u16 eventClass, void *message);
63
64 /*----------------------------------------------------------------------------*
65  * Enum to string functions
66  *----------------------------------------------------------------------------*/
67 const char* CsrWifiSme80211NetworkTypeToString(CsrWifiSme80211NetworkType value);
68 const char* CsrWifiSme80211PrivacyModeToString(CsrWifiSme80211PrivacyMode value);
69 const char* CsrWifiSme80211dTrustLevelToString(CsrWifiSme80211dTrustLevel value);
70 const char* CsrWifiSmeAmpStatusToString(CsrWifiSmeAmpStatus value);
71 const char* CsrWifiSmeAuthModeToString(CsrWifiSmeAuthMode value);
72 const char* CsrWifiSmeBasicUsabilityToString(CsrWifiSmeBasicUsability value);
73 const char* CsrWifiSmeBssTypeToString(CsrWifiSmeBssType value);
74 const char* CsrWifiSmeCoexSchemeToString(CsrWifiSmeCoexScheme value);
75 const char* CsrWifiSmeControlIndicationToString(CsrWifiSmeControlIndication value);
76 const char* CsrWifiSmeCtsProtectionTypeToString(CsrWifiSmeCtsProtectionType value);
77 const char* CsrWifiSmeD3AutoScanModeToString(CsrWifiSmeD3AutoScanMode value);
78 const char* CsrWifiSmeEncryptionToString(CsrWifiSmeEncryption value);
79 const char* CsrWifiSmeFirmwareDriverInterfaceToString(CsrWifiSmeFirmwareDriverInterface value);
80 const char* CsrWifiSmeHostPowerModeToString(CsrWifiSmeHostPowerMode value);
81 const char* CsrWifiSmeIEEE80211ReasonToString(CsrWifiSmeIEEE80211Reason value);
82 const char* CsrWifiSmeIEEE80211ResultToString(CsrWifiSmeIEEE80211Result value);
83 const char* CsrWifiSmeIndicationsToString(CsrWifiSmeIndications value);
84 const char* CsrWifiSmeKeyTypeToString(CsrWifiSmeKeyType value);
85 const char* CsrWifiSmeListActionToString(CsrWifiSmeListAction value);
86 const char* CsrWifiSmeMediaStatusToString(CsrWifiSmeMediaStatus value);
87 const char* CsrWifiSmeP2pCapabilityToString(CsrWifiSmeP2pCapability value);
88 const char* CsrWifiSmeP2pGroupCapabilityToString(CsrWifiSmeP2pGroupCapability value);
89 const char* CsrWifiSmeP2pNoaConfigMethodToString(CsrWifiSmeP2pNoaConfigMethod value);
90 const char* CsrWifiSmeP2pRoleToString(CsrWifiSmeP2pRole value);
91 const char* CsrWifiSmeP2pStatusToString(CsrWifiSmeP2pStatus value);
92 const char* CsrWifiSmePacketFilterModeToString(CsrWifiSmePacketFilterMode value);
93 const char* CsrWifiSmePowerSaveLevelToString(CsrWifiSmePowerSaveLevel value);
94 const char* CsrWifiSmePreambleTypeToString(CsrWifiSmePreambleType value);
95 const char* CsrWifiSmeRadioIFToString(CsrWifiSmeRadioIF value);
96 const char* CsrWifiSmeRegulatoryDomainToString(CsrWifiSmeRegulatoryDomain value);
97 const char* CsrWifiSmeRoamReasonToString(CsrWifiSmeRoamReason value);
98 const char* CsrWifiSmeScanTypeToString(CsrWifiSmeScanType value);
99 const char* CsrWifiSmeTrafficTypeToString(CsrWifiSmeTrafficType value);
100 const char* CsrWifiSmeTspecCtrlToString(CsrWifiSmeTspecCtrl value);
101 const char* CsrWifiSmeTspecResultCodeToString(CsrWifiSmeTspecResultCode value);
102 const char* CsrWifiSmeWepAuthModeToString(CsrWifiSmeWepAuthMode value);
103 const char* CsrWifiSmeWepCredentialTypeToString(CsrWifiSmeWepCredentialType value);
104 const char* CsrWifiSmeWmmModeToString(CsrWifiSmeWmmMode value);
105 const char* CsrWifiSmeWmmQosInfoToString(CsrWifiSmeWmmQosInfo value);
106 const char* CsrWifiSmeWpsConfigTypeToString(CsrWifiSmeWpsConfigType value);
107 const char* CsrWifiSmeWpsDeviceCategoryToString(CsrWifiSmeWpsDeviceCategory value);
108 const char* CsrWifiSmeWpsDeviceSubCategoryToString(CsrWifiSmeWpsDeviceSubCategory value);
109 const char* CsrWifiSmeWpsDpidToString(CsrWifiSmeWpsDpid value);
110 const char* CsrWifiSmeWpsRegistrationToString(CsrWifiSmeWpsRegistration value);
111
112
113 /*----------------------------------------------------------------------------*
114  * CsrPrim Type toString function.
115  * Converts a message type to the String name of the Message
116  *----------------------------------------------------------------------------*/
117 const char* CsrWifiSmePrimTypeToString(CsrPrim msgType);
118
119 /*----------------------------------------------------------------------------*
120  * Lookup arrays for PrimType name Strings
121  *----------------------------------------------------------------------------*/
122 extern const char *CsrWifiSmeUpstreamPrimNames[CSR_WIFI_SME_PRIM_UPSTREAM_COUNT];
123 extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT];
124
125 /*******************************************************************************
126
127   NAME
128     CsrWifiSmeActivateReqSend
129
130   DESCRIPTION
131     The WMA sends this primitive to activate the SME.
132     The WMA must activate the SME before it can send any other primitive.
133
134   PARAMETERS
135     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
136
137 *******************************************************************************/
138 #define CsrWifiSmeActivateReqCreate(msg__, dst__, src__) \
139     msg__ = kmalloc(sizeof(CsrWifiSmeActivateReq), GFP_KERNEL); \
140     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ACTIVATE_REQ, dst__, src__);
141
142 #define CsrWifiSmeActivateReqSendTo(dst__, src__) \
143     { \
144         CsrWifiSmeActivateReq *msg__; \
145         CsrWifiSmeActivateReqCreate(msg__, dst__, src__); \
146         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
147     }
148
149 #define CsrWifiSmeActivateReqSend(src__) \
150     CsrWifiSmeActivateReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
151
152 /*******************************************************************************
153
154   NAME
155     CsrWifiSmeActivateCfmSend
156
157   DESCRIPTION
158     The SME sends this primitive when the activation is complete.
159
160   PARAMETERS
161     queue  - Destination Task Queue
162     status - Reports the result of the request
163
164 *******************************************************************************/
165 #define CsrWifiSmeActivateCfmCreate(msg__, dst__, src__, status__) \
166     msg__ = kmalloc(sizeof(CsrWifiSmeActivateCfm), GFP_KERNEL); \
167     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ACTIVATE_CFM, dst__, src__); \
168     msg__->status = (status__);
169
170 #define CsrWifiSmeActivateCfmSendTo(dst__, src__, status__) \
171     { \
172         CsrWifiSmeActivateCfm *msg__; \
173         CsrWifiSmeActivateCfmCreate(msg__, dst__, src__, status__); \
174         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
175     }
176
177 #define CsrWifiSmeActivateCfmSend(dst__, status__) \
178     CsrWifiSmeActivateCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
179
180 /*******************************************************************************
181
182   NAME
183     CsrWifiSmeAdhocConfigGetReqSend
184
185   DESCRIPTION
186     This primitive gets the value of the adHocConfig parameter.
187
188   PARAMETERS
189     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
190
191 *******************************************************************************/
192 #define CsrWifiSmeAdhocConfigGetReqCreate(msg__, dst__, src__) \
193     msg__ = kmalloc(sizeof(CsrWifiSmeAdhocConfigGetReq), GFP_KERNEL); \
194     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_GET_REQ, dst__, src__);
195
196 #define CsrWifiSmeAdhocConfigGetReqSendTo(dst__, src__) \
197     { \
198         CsrWifiSmeAdhocConfigGetReq *msg__; \
199         CsrWifiSmeAdhocConfigGetReqCreate(msg__, dst__, src__); \
200         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
201     }
202
203 #define CsrWifiSmeAdhocConfigGetReqSend(src__) \
204     CsrWifiSmeAdhocConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
205
206 /*******************************************************************************
207
208   NAME
209     CsrWifiSmeAdhocConfigGetCfmSend
210
211   DESCRIPTION
212     This primitive reports the result of the request.
213
214   PARAMETERS
215     queue       - Destination Task Queue
216     status      - Reports the result of the request
217     adHocConfig - Contains the values used when starting an Ad-hoc (IBSS)
218                   connection.
219
220 *******************************************************************************/
221 #define CsrWifiSmeAdhocConfigGetCfmCreate(msg__, dst__, src__, status__, adHocConfig__) \
222     msg__ = kmalloc(sizeof(CsrWifiSmeAdhocConfigGetCfm), GFP_KERNEL); \
223     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_GET_CFM, dst__, src__); \
224     msg__->status = (status__); \
225     msg__->adHocConfig = (adHocConfig__);
226
227 #define CsrWifiSmeAdhocConfigGetCfmSendTo(dst__, src__, status__, adHocConfig__) \
228     { \
229         CsrWifiSmeAdhocConfigGetCfm *msg__; \
230         CsrWifiSmeAdhocConfigGetCfmCreate(msg__, dst__, src__, status__, adHocConfig__); \
231         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
232     }
233
234 #define CsrWifiSmeAdhocConfigGetCfmSend(dst__, status__, adHocConfig__) \
235     CsrWifiSmeAdhocConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, adHocConfig__)
236
237 /*******************************************************************************
238
239   NAME
240     CsrWifiSmeAdhocConfigSetReqSend
241
242   DESCRIPTION
243     This primitive sets the value of the adHocConfig parameter.
244
245   PARAMETERS
246     queue       - Message Source Task Queue (Cfm's will be sent to this Queue)
247     adHocConfig - Sets the values to use when starting an ad hoc network.
248
249 *******************************************************************************/
250 #define CsrWifiSmeAdhocConfigSetReqCreate(msg__, dst__, src__, adHocConfig__) \
251     msg__ = kmalloc(sizeof(CsrWifiSmeAdhocConfigSetReq), GFP_KERNEL); \
252     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_SET_REQ, dst__, src__); \
253     msg__->adHocConfig = (adHocConfig__);
254
255 #define CsrWifiSmeAdhocConfigSetReqSendTo(dst__, src__, adHocConfig__) \
256     { \
257         CsrWifiSmeAdhocConfigSetReq *msg__; \
258         CsrWifiSmeAdhocConfigSetReqCreate(msg__, dst__, src__, adHocConfig__); \
259         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
260     }
261
262 #define CsrWifiSmeAdhocConfigSetReqSend(src__, adHocConfig__) \
263     CsrWifiSmeAdhocConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, adHocConfig__)
264
265 /*******************************************************************************
266
267   NAME
268     CsrWifiSmeAdhocConfigSetCfmSend
269
270   DESCRIPTION
271     This primitive reports the result of the request.
272
273   PARAMETERS
274     queue  - Destination Task Queue
275     status - Reports the result of the request
276
277 *******************************************************************************/
278 #define CsrWifiSmeAdhocConfigSetCfmCreate(msg__, dst__, src__, status__) \
279     msg__ = kmalloc(sizeof(CsrWifiSmeAdhocConfigSetCfm), GFP_KERNEL); \
280     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_SET_CFM, dst__, src__); \
281     msg__->status = (status__);
282
283 #define CsrWifiSmeAdhocConfigSetCfmSendTo(dst__, src__, status__) \
284     { \
285         CsrWifiSmeAdhocConfigSetCfm *msg__; \
286         CsrWifiSmeAdhocConfigSetCfmCreate(msg__, dst__, src__, status__); \
287         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
288     }
289
290 #define CsrWifiSmeAdhocConfigSetCfmSend(dst__, status__) \
291     CsrWifiSmeAdhocConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
292
293 /*******************************************************************************
294
295   NAME
296     CsrWifiSmeAmpStatusChangeIndSend
297
298   DESCRIPTION
299     Indication of change to AMP activity.
300
301   PARAMETERS
302     queue        - Destination Task Queue
303     interfaceTag - Interface on which the AMP activity changed.
304     ampStatus    - The new status of AMP activity.Range: {AMP_ACTIVE,
305                    AMP_INACTIVE}.
306
307 *******************************************************************************/
308 #define CsrWifiSmeAmpStatusChangeIndCreate(msg__, dst__, src__, interfaceTag__, ampStatus__) \
309     msg__ = kmalloc(sizeof(CsrWifiSmeAmpStatusChangeInd), GFP_KERNEL); \
310     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_AMP_STATUS_CHANGE_IND, dst__, src__); \
311     msg__->interfaceTag = (interfaceTag__); \
312     msg__->ampStatus = (ampStatus__);
313
314 #define CsrWifiSmeAmpStatusChangeIndSendTo(dst__, src__, interfaceTag__, ampStatus__) \
315     { \
316         CsrWifiSmeAmpStatusChangeInd *msg__; \
317         CsrWifiSmeAmpStatusChangeIndCreate(msg__, dst__, src__, interfaceTag__, ampStatus__); \
318         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
319     }
320
321 #define CsrWifiSmeAmpStatusChangeIndSend(dst__, interfaceTag__, ampStatus__) \
322     CsrWifiSmeAmpStatusChangeIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, ampStatus__)
323
324 /*******************************************************************************
325
326   NAME
327     CsrWifiSmeAssociationCompleteIndSend
328
329   DESCRIPTION
330     The SME will send this primitive to all the tasks that have registered to
331     receive it whenever it completes an attempt to associate with an AP. If
332     the association was successful, status will be set to
333     CSR_WIFI_SME_STATUS_SUCCESS, otherwise status and deauthReason shall be
334     set to appropriate error codes.
335
336   PARAMETERS
337     queue          - Destination Task Queue
338     interfaceTag   - Interface Identifier; unique identifier of an interface
339     status         - Reports the result of the association procedure
340     connectionInfo - This parameter is relevant only if result is
341                      CSR_WIFI_SME_STATUS_SUCCESS:
342                      it points to the connection information for the new network
343     deauthReason   - This parameter is relevant only if result is not
344                      CSR_WIFI_SME_STATUS_SUCCESS:
345                      if the AP deauthorised the station, it gives the reason of
346                      the deauthorization
347
348 *******************************************************************************/
349 #define CsrWifiSmeAssociationCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__, deauthReason__) \
350     msg__ = kmalloc(sizeof(CsrWifiSmeAssociationCompleteInd), GFP_KERNEL); \
351     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND, dst__, src__); \
352     msg__->interfaceTag = (interfaceTag__); \
353     msg__->status = (status__); \
354     msg__->connectionInfo = (connectionInfo__); \
355     msg__->deauthReason = (deauthReason__);
356
357 #define CsrWifiSmeAssociationCompleteIndSendTo(dst__, src__, interfaceTag__, status__, connectionInfo__, deauthReason__) \
358     { \
359         CsrWifiSmeAssociationCompleteInd *msg__; \
360         CsrWifiSmeAssociationCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__, deauthReason__); \
361         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
362     }
363
364 #define CsrWifiSmeAssociationCompleteIndSend(dst__, interfaceTag__, status__, connectionInfo__, deauthReason__) \
365     CsrWifiSmeAssociationCompleteIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, connectionInfo__, deauthReason__)
366
367 /*******************************************************************************
368
369   NAME
370     CsrWifiSmeAssociationStartIndSend
371
372   DESCRIPTION
373     The SME will send this primitive to all the tasks that have registered to
374     receive it whenever it begins an attempt to associate with an AP.
375
376   PARAMETERS
377     queue        - Destination Task Queue
378     interfaceTag - Interface Identifier; unique identifier of an interface
379     address      - BSSID of the associating network
380     ssid         - Service Set identifier of the associating network
381
382 *******************************************************************************/
383 #define CsrWifiSmeAssociationStartIndCreate(msg__, dst__, src__, interfaceTag__, address__, ssid__) \
384     msg__ = kmalloc(sizeof(CsrWifiSmeAssociationStartInd), GFP_KERNEL); \
385     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ASSOCIATION_START_IND, dst__, src__); \
386     msg__->interfaceTag = (interfaceTag__); \
387     msg__->address = (address__); \
388     msg__->ssid = (ssid__);
389
390 #define CsrWifiSmeAssociationStartIndSendTo(dst__, src__, interfaceTag__, address__, ssid__) \
391     { \
392         CsrWifiSmeAssociationStartInd *msg__; \
393         CsrWifiSmeAssociationStartIndCreate(msg__, dst__, src__, interfaceTag__, address__, ssid__); \
394         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
395     }
396
397 #define CsrWifiSmeAssociationStartIndSend(dst__, interfaceTag__, address__, ssid__) \
398     CsrWifiSmeAssociationStartIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, address__, ssid__)
399
400 /*******************************************************************************
401
402   NAME
403     CsrWifiSmeBlacklistReqSend
404
405   DESCRIPTION
406     The wireless manager application should call this primitive to notify the
407     driver of any networks that should not be connected to. The interface
408     allows the wireless manager application to query, add, remove, and flush
409     the BSSIDs that the driver may not connect or roam to.
410     When this primitive adds to the black list the BSSID to which the SME is
411     currently connected, the SME will try to roam, if applicable, to another
412     BSSID in the same ESS; if the roaming procedure fails, the SME will
413     disconnect.
414
415   PARAMETERS
416     queue           - Message Source Task Queue (Cfm's will be sent to this Queue)
417     interfaceTag    - Interface Identifier; unique identifier of an interface
418     action          - The value of the CsrWifiSmeListAction parameter instructs
419                       the driver to modify or provide the list of blacklisted
420                       networks.
421     setAddressCount - Number of BSSIDs sent with this primitive
422     setAddresses    - Pointer to the list of BBSIDs sent with the primitive, set
423                       to NULL if none is sent.
424
425 *******************************************************************************/
426 #define CsrWifiSmeBlacklistReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressCount__, setAddresses__) \
427     msg__ = kmalloc(sizeof(CsrWifiSmeBlacklistReq), GFP_KERNEL); \
428     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_BLACKLIST_REQ, dst__, src__); \
429     msg__->interfaceTag = (interfaceTag__); \
430     msg__->action = (action__); \
431     msg__->setAddressCount = (setAddressCount__); \
432     msg__->setAddresses = (setAddresses__);
433
434 #define CsrWifiSmeBlacklistReqSendTo(dst__, src__, interfaceTag__, action__, setAddressCount__, setAddresses__) \
435     { \
436         CsrWifiSmeBlacklistReq *msg__; \
437         CsrWifiSmeBlacklistReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressCount__, setAddresses__); \
438         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
439     }
440
441 #define CsrWifiSmeBlacklistReqSend(src__, interfaceTag__, action__, setAddressCount__, setAddresses__) \
442     CsrWifiSmeBlacklistReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, setAddressCount__, setAddresses__)
443
444 /*******************************************************************************
445
446   NAME
447     CsrWifiSmeBlacklistCfmSend
448
449   DESCRIPTION
450     The SME will call this primitive when the action on the blacklist has
451     completed. For a GET action, this primitive also reports the list of
452     BBSIDs in the blacklist.
453
454   PARAMETERS
455     queue           - Destination Task Queue
456     interfaceTag    - Interface Identifier; unique identifier of an interface
457     status          - Reports the result of the request
458     action          - Action in the request
459     getAddressCount - This parameter is only relevant if action is
460                       CSR_WIFI_SME_LIST_ACTION_GET:
461                       number of BSSIDs sent with this primitive
462     getAddresses    - Pointer to the list of BBSIDs sent with the primitive, set
463                       to NULL if none is sent.
464
465 *******************************************************************************/
466 #define CsrWifiSmeBlacklistCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__) \
467     msg__ = kmalloc(sizeof(CsrWifiSmeBlacklistCfm), GFP_KERNEL); \
468     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_BLACKLIST_CFM, dst__, src__); \
469     msg__->interfaceTag = (interfaceTag__); \
470     msg__->status = (status__); \
471     msg__->action = (action__); \
472     msg__->getAddressCount = (getAddressCount__); \
473     msg__->getAddresses = (getAddresses__);
474
475 #define CsrWifiSmeBlacklistCfmSendTo(dst__, src__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__) \
476     { \
477         CsrWifiSmeBlacklistCfm *msg__; \
478         CsrWifiSmeBlacklistCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__); \
479         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
480     }
481
482 #define CsrWifiSmeBlacklistCfmSend(dst__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__) \
483     CsrWifiSmeBlacklistCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, action__, getAddressCount__, getAddresses__)
484
485 /*******************************************************************************
486
487   NAME
488     CsrWifiSmeCalibrationDataGetReqSend
489
490   DESCRIPTION
491     This primitive retrieves the Wi-Fi radio calibration data.
492
493   PARAMETERS
494     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
495
496 *******************************************************************************/
497 #define CsrWifiSmeCalibrationDataGetReqCreate(msg__, dst__, src__) \
498     msg__ = kmalloc(sizeof(CsrWifiSmeCalibrationDataGetReq), GFP_KERNEL); \
499     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_GET_REQ, dst__, src__);
500
501 #define CsrWifiSmeCalibrationDataGetReqSendTo(dst__, src__) \
502     { \
503         CsrWifiSmeCalibrationDataGetReq *msg__; \
504         CsrWifiSmeCalibrationDataGetReqCreate(msg__, dst__, src__); \
505         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
506     }
507
508 #define CsrWifiSmeCalibrationDataGetReqSend(src__) \
509     CsrWifiSmeCalibrationDataGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
510
511 /*******************************************************************************
512
513   NAME
514     CsrWifiSmeCalibrationDataGetCfmSend
515
516   DESCRIPTION
517     This primitive reports the result of the request.
518
519   PARAMETERS
520     queue                 - Destination Task Queue
521     status                - Reports the result of the request
522     calibrationDataLength - Number of bytes in the buffer pointed by
523                             calibrationData
524     calibrationData       - Pointer to a buffer of length calibrationDataLength
525                             containing the calibration data
526
527 *******************************************************************************/
528 #define CsrWifiSmeCalibrationDataGetCfmCreate(msg__, dst__, src__, status__, calibrationDataLength__, calibrationData__) \
529     msg__ = kmalloc(sizeof(CsrWifiSmeCalibrationDataGetCfm), GFP_KERNEL); \
530     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM, dst__, src__); \
531     msg__->status = (status__); \
532     msg__->calibrationDataLength = (calibrationDataLength__); \
533     msg__->calibrationData = (calibrationData__);
534
535 #define CsrWifiSmeCalibrationDataGetCfmSendTo(dst__, src__, status__, calibrationDataLength__, calibrationData__) \
536     { \
537         CsrWifiSmeCalibrationDataGetCfm *msg__; \
538         CsrWifiSmeCalibrationDataGetCfmCreate(msg__, dst__, src__, status__, calibrationDataLength__, calibrationData__); \
539         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
540     }
541
542 #define CsrWifiSmeCalibrationDataGetCfmSend(dst__, status__, calibrationDataLength__, calibrationData__) \
543     CsrWifiSmeCalibrationDataGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, calibrationDataLength__, calibrationData__)
544
545 /*******************************************************************************
546
547   NAME
548     CsrWifiSmeCalibrationDataSetReqSend
549
550   DESCRIPTION
551     This primitive sets the Wi-Fi radio calibration data.
552     The usage of the primitive with proper calibration data will avoid
553     time-consuming configuration after power-up.
554
555   PARAMETERS
556     queue                 - Message Source Task Queue (Cfm's will be sent to this Queue)
557     calibrationDataLength - Number of bytes in the buffer pointed by
558                             calibrationData
559     calibrationData       - Pointer to a buffer of length calibrationDataLength
560                             containing the calibration data
561
562 *******************************************************************************/
563 #define CsrWifiSmeCalibrationDataSetReqCreate(msg__, dst__, src__, calibrationDataLength__, calibrationData__) \
564     msg__ = kmalloc(sizeof(CsrWifiSmeCalibrationDataSetReq), GFP_KERNEL); \
565     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_SET_REQ, dst__, src__); \
566     msg__->calibrationDataLength = (calibrationDataLength__); \
567     msg__->calibrationData = (calibrationData__);
568
569 #define CsrWifiSmeCalibrationDataSetReqSendTo(dst__, src__, calibrationDataLength__, calibrationData__) \
570     { \
571         CsrWifiSmeCalibrationDataSetReq *msg__; \
572         CsrWifiSmeCalibrationDataSetReqCreate(msg__, dst__, src__, calibrationDataLength__, calibrationData__); \
573         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
574     }
575
576 #define CsrWifiSmeCalibrationDataSetReqSend(src__, calibrationDataLength__, calibrationData__) \
577     CsrWifiSmeCalibrationDataSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, calibrationDataLength__, calibrationData__)
578
579 /*******************************************************************************
580
581   NAME
582     CsrWifiSmeCalibrationDataSetCfmSend
583
584   DESCRIPTION
585     This primitive reports the result of the request.
586
587   PARAMETERS
588     queue  - Destination Task Queue
589     status - Reports the result of the request
590
591 *******************************************************************************/
592 #define CsrWifiSmeCalibrationDataSetCfmCreate(msg__, dst__, src__, status__) \
593     msg__ = kmalloc(sizeof(CsrWifiSmeCalibrationDataSetCfm), GFP_KERNEL); \
594     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_SET_CFM, dst__, src__); \
595     msg__->status = (status__);
596
597 #define CsrWifiSmeCalibrationDataSetCfmSendTo(dst__, src__, status__) \
598     { \
599         CsrWifiSmeCalibrationDataSetCfm *msg__; \
600         CsrWifiSmeCalibrationDataSetCfmCreate(msg__, dst__, src__, status__); \
601         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
602     }
603
604 #define CsrWifiSmeCalibrationDataSetCfmSend(dst__, status__) \
605     CsrWifiSmeCalibrationDataSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
606
607 /*******************************************************************************
608
609   NAME
610     CsrWifiSmeCcxConfigGetReqSend
611
612   DESCRIPTION
613     This primitive gets the value of the CcxConfig parameter.
614     CURRENTLY NOT SUPPORTED.
615
616   PARAMETERS
617     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
618     interfaceTag - Interface Identifier; unique identifier of an interface
619
620 *******************************************************************************/
621 #define CsrWifiSmeCcxConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \
622     msg__ = kmalloc(sizeof(CsrWifiSmeCcxConfigGetReq), GFP_KERNEL); \
623     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_GET_REQ, dst__, src__); \
624     msg__->interfaceTag = (interfaceTag__);
625
626 #define CsrWifiSmeCcxConfigGetReqSendTo(dst__, src__, interfaceTag__) \
627     { \
628         CsrWifiSmeCcxConfigGetReq *msg__; \
629         CsrWifiSmeCcxConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \
630         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
631     }
632
633 #define CsrWifiSmeCcxConfigGetReqSend(src__, interfaceTag__) \
634     CsrWifiSmeCcxConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
635
636 /*******************************************************************************
637
638   NAME
639     CsrWifiSmeCcxConfigGetCfmSend
640
641   DESCRIPTION
642     This primitive reports the result of the request.
643
644   PARAMETERS
645     queue        - Destination Task Queue
646     interfaceTag - Interface Identifier; unique identifier of an interface
647     status       - Reports the result of the request
648     ccxConfig    - Currently not supported
649
650 *******************************************************************************/
651 #define CsrWifiSmeCcxConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ccxConfig__) \
652     msg__ = kmalloc(sizeof(CsrWifiSmeCcxConfigGetCfm), GFP_KERNEL); \
653     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_GET_CFM, dst__, src__); \
654     msg__->interfaceTag = (interfaceTag__); \
655     msg__->status = (status__); \
656     msg__->ccxConfig = (ccxConfig__);
657
658 #define CsrWifiSmeCcxConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, ccxConfig__) \
659     { \
660         CsrWifiSmeCcxConfigGetCfm *msg__; \
661         CsrWifiSmeCcxConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ccxConfig__); \
662         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
663     }
664
665 #define CsrWifiSmeCcxConfigGetCfmSend(dst__, interfaceTag__, status__, ccxConfig__) \
666     CsrWifiSmeCcxConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, ccxConfig__)
667
668 /*******************************************************************************
669
670   NAME
671     CsrWifiSmeCcxConfigSetReqSend
672
673   DESCRIPTION
674     This primitive sets the value of the CcxConfig parameter.
675     CURRENTLY NOT SUPPORTED.
676
677   PARAMETERS
678     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
679     interfaceTag - Interface Identifier; unique identifier of an interface
680     ccxConfig    - Currently not supported
681
682 *******************************************************************************/
683 #define CsrWifiSmeCcxConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, ccxConfig__) \
684     msg__ = kmalloc(sizeof(CsrWifiSmeCcxConfigSetReq), GFP_KERNEL); \
685     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_SET_REQ, dst__, src__); \
686     msg__->interfaceTag = (interfaceTag__); \
687     msg__->ccxConfig = (ccxConfig__);
688
689 #define CsrWifiSmeCcxConfigSetReqSendTo(dst__, src__, interfaceTag__, ccxConfig__) \
690     { \
691         CsrWifiSmeCcxConfigSetReq *msg__; \
692         CsrWifiSmeCcxConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, ccxConfig__); \
693         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
694     }
695
696 #define CsrWifiSmeCcxConfigSetReqSend(src__, interfaceTag__, ccxConfig__) \
697     CsrWifiSmeCcxConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, ccxConfig__)
698
699 /*******************************************************************************
700
701   NAME
702     CsrWifiSmeCcxConfigSetCfmSend
703
704   DESCRIPTION
705     This primitive reports the result of the request.
706
707   PARAMETERS
708     queue        - Destination Task Queue
709     interfaceTag - Interface Identifier; unique identifier of an interface
710     status       - Reports the result of the request
711
712 *******************************************************************************/
713 #define CsrWifiSmeCcxConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
714     msg__ = kmalloc(sizeof(CsrWifiSmeCcxConfigSetCfm), GFP_KERNEL); \
715     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_SET_CFM, dst__, src__); \
716     msg__->interfaceTag = (interfaceTag__); \
717     msg__->status = (status__);
718
719 #define CsrWifiSmeCcxConfigSetCfmSendTo(dst__, src__, interfaceTag__, status__) \
720     { \
721         CsrWifiSmeCcxConfigSetCfm *msg__; \
722         CsrWifiSmeCcxConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
723         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
724     }
725
726 #define CsrWifiSmeCcxConfigSetCfmSend(dst__, interfaceTag__, status__) \
727     CsrWifiSmeCcxConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
728
729 /*******************************************************************************
730
731   NAME
732     CsrWifiSmeCloakedSsidsGetReqSend
733
734   DESCRIPTION
735     This primitive gets the value of the CloakedSsids parameter.
736
737   PARAMETERS
738     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
739
740 *******************************************************************************/
741 #define CsrWifiSmeCloakedSsidsGetReqCreate(msg__, dst__, src__) \
742     msg__ = kmalloc(sizeof(CsrWifiSmeCloakedSsidsGetReq), GFP_KERNEL); \
743     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_GET_REQ, dst__, src__);
744
745 #define CsrWifiSmeCloakedSsidsGetReqSendTo(dst__, src__) \
746     { \
747         CsrWifiSmeCloakedSsidsGetReq *msg__; \
748         CsrWifiSmeCloakedSsidsGetReqCreate(msg__, dst__, src__); \
749         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
750     }
751
752 #define CsrWifiSmeCloakedSsidsGetReqSend(src__) \
753     CsrWifiSmeCloakedSsidsGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
754
755 /*******************************************************************************
756
757   NAME
758     CsrWifiSmeCloakedSsidsGetCfmSend
759
760   DESCRIPTION
761     This primitive reports the result of the request.
762
763   PARAMETERS
764     queue        - Destination Task Queue
765     status       - Reports the result of the request
766     cloakedSsids - Reports list of cloaked SSIDs that are explicitly scanned for
767                    by the driver
768
769 *******************************************************************************/
770 #define CsrWifiSmeCloakedSsidsGetCfmCreate(msg__, dst__, src__, status__, cloakedSsids__) \
771     msg__ = kmalloc(sizeof(CsrWifiSmeCloakedSsidsGetCfm), GFP_KERNEL); \
772     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM, dst__, src__); \
773     msg__->status = (status__); \
774     msg__->cloakedSsids = (cloakedSsids__);
775
776 #define CsrWifiSmeCloakedSsidsGetCfmSendTo(dst__, src__, status__, cloakedSsids__) \
777     { \
778         CsrWifiSmeCloakedSsidsGetCfm *msg__; \
779         CsrWifiSmeCloakedSsidsGetCfmCreate(msg__, dst__, src__, status__, cloakedSsids__); \
780         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
781     }
782
783 #define CsrWifiSmeCloakedSsidsGetCfmSend(dst__, status__, cloakedSsids__) \
784     CsrWifiSmeCloakedSsidsGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, cloakedSsids__)
785
786 /*******************************************************************************
787
788   NAME
789     CsrWifiSmeCloakedSsidsSetReqSend
790
791   DESCRIPTION
792     This primitive sets the list of cloaked SSIDs for which the WMA possesses
793     profiles.
794     When the driver detects a cloaked AP, the SME will explicitly scan for it
795     using the list of cloaked SSIDs provided it, and, if the scan succeeds,
796     it will report the AP to the WMA either via CSR_WIFI_SME_SCAN_RESULT_IND
797     (if registered) or via CSR_WIFI_SCAN_RESULT_GET_CFM.
798
799   PARAMETERS
800     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
801     cloakedSsids - Sets the list of cloaked SSIDs
802
803 *******************************************************************************/
804 #define CsrWifiSmeCloakedSsidsSetReqCreate(msg__, dst__, src__, cloakedSsids__) \
805     msg__ = kmalloc(sizeof(CsrWifiSmeCloakedSsidsSetReq), GFP_KERNEL); \
806     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_SET_REQ, dst__, src__); \
807     msg__->cloakedSsids = (cloakedSsids__);
808
809 #define CsrWifiSmeCloakedSsidsSetReqSendTo(dst__, src__, cloakedSsids__) \
810     { \
811         CsrWifiSmeCloakedSsidsSetReq *msg__; \
812         CsrWifiSmeCloakedSsidsSetReqCreate(msg__, dst__, src__, cloakedSsids__); \
813         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
814     }
815
816 #define CsrWifiSmeCloakedSsidsSetReqSend(src__, cloakedSsids__) \
817     CsrWifiSmeCloakedSsidsSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, cloakedSsids__)
818
819 /*******************************************************************************
820
821   NAME
822     CsrWifiSmeCloakedSsidsSetCfmSend
823
824   DESCRIPTION
825     This primitive reports the result of the request.
826
827   PARAMETERS
828     queue  - Destination Task Queue
829     status - Reports the result of the request
830
831 *******************************************************************************/
832 #define CsrWifiSmeCloakedSsidsSetCfmCreate(msg__, dst__, src__, status__) \
833     msg__ = kmalloc(sizeof(CsrWifiSmeCloakedSsidsSetCfm), GFP_KERNEL); \
834     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_SET_CFM, dst__, src__); \
835     msg__->status = (status__);
836
837 #define CsrWifiSmeCloakedSsidsSetCfmSendTo(dst__, src__, status__) \
838     { \
839         CsrWifiSmeCloakedSsidsSetCfm *msg__; \
840         CsrWifiSmeCloakedSsidsSetCfmCreate(msg__, dst__, src__, status__); \
841         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
842     }
843
844 #define CsrWifiSmeCloakedSsidsSetCfmSend(dst__, status__) \
845     CsrWifiSmeCloakedSsidsSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
846
847 /*******************************************************************************
848
849   NAME
850     CsrWifiSmeCoexConfigGetReqSend
851
852   DESCRIPTION
853     This primitive gets the value of the CoexConfig parameter.
854
855   PARAMETERS
856     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
857
858 *******************************************************************************/
859 #define CsrWifiSmeCoexConfigGetReqCreate(msg__, dst__, src__) \
860     msg__ = kmalloc(sizeof(CsrWifiSmeCoexConfigGetReq), GFP_KERNEL); \
861     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_GET_REQ, dst__, src__);
862
863 #define CsrWifiSmeCoexConfigGetReqSendTo(dst__, src__) \
864     { \
865         CsrWifiSmeCoexConfigGetReq *msg__; \
866         CsrWifiSmeCoexConfigGetReqCreate(msg__, dst__, src__); \
867         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
868     }
869
870 #define CsrWifiSmeCoexConfigGetReqSend(src__) \
871     CsrWifiSmeCoexConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
872
873 /*******************************************************************************
874
875   NAME
876     CsrWifiSmeCoexConfigGetCfmSend
877
878   DESCRIPTION
879     This primitive reports the result of the request.
880
881   PARAMETERS
882     queue      - Destination Task Queue
883     status     - Reports the result of the request
884     coexConfig - Reports the parameters used to configure the coexistence
885                  behaviour
886
887 *******************************************************************************/
888 #define CsrWifiSmeCoexConfigGetCfmCreate(msg__, dst__, src__, status__, coexConfig__) \
889     msg__ = kmalloc(sizeof(CsrWifiSmeCoexConfigGetCfm), GFP_KERNEL); \
890     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_GET_CFM, dst__, src__); \
891     msg__->status = (status__); \
892     msg__->coexConfig = (coexConfig__);
893
894 #define CsrWifiSmeCoexConfigGetCfmSendTo(dst__, src__, status__, coexConfig__) \
895     { \
896         CsrWifiSmeCoexConfigGetCfm *msg__; \
897         CsrWifiSmeCoexConfigGetCfmCreate(msg__, dst__, src__, status__, coexConfig__); \
898         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
899     }
900
901 #define CsrWifiSmeCoexConfigGetCfmSend(dst__, status__, coexConfig__) \
902     CsrWifiSmeCoexConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, coexConfig__)
903
904 /*******************************************************************************
905
906   NAME
907     CsrWifiSmeCoexConfigSetReqSend
908
909   DESCRIPTION
910     This primitive sets the value of the CoexConfig parameter.
911
912   PARAMETERS
913     queue      - Message Source Task Queue (Cfm's will be sent to this Queue)
914     coexConfig - Configures the coexistence behaviour
915
916 *******************************************************************************/
917 #define CsrWifiSmeCoexConfigSetReqCreate(msg__, dst__, src__, coexConfig__) \
918     msg__ = kmalloc(sizeof(CsrWifiSmeCoexConfigSetReq), GFP_KERNEL); \
919     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_SET_REQ, dst__, src__); \
920     msg__->coexConfig = (coexConfig__);
921
922 #define CsrWifiSmeCoexConfigSetReqSendTo(dst__, src__, coexConfig__) \
923     { \
924         CsrWifiSmeCoexConfigSetReq *msg__; \
925         CsrWifiSmeCoexConfigSetReqCreate(msg__, dst__, src__, coexConfig__); \
926         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
927     }
928
929 #define CsrWifiSmeCoexConfigSetReqSend(src__, coexConfig__) \
930     CsrWifiSmeCoexConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, coexConfig__)
931
932 /*******************************************************************************
933
934   NAME
935     CsrWifiSmeCoexConfigSetCfmSend
936
937   DESCRIPTION
938     This primitive reports the result of the request.
939
940   PARAMETERS
941     queue  - Destination Task Queue
942     status - Reports the result of the request
943
944 *******************************************************************************/
945 #define CsrWifiSmeCoexConfigSetCfmCreate(msg__, dst__, src__, status__) \
946     msg__ = kmalloc(sizeof(CsrWifiSmeCoexConfigSetCfm), GFP_KERNEL); \
947     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_SET_CFM, dst__, src__); \
948     msg__->status = (status__);
949
950 #define CsrWifiSmeCoexConfigSetCfmSendTo(dst__, src__, status__) \
951     { \
952         CsrWifiSmeCoexConfigSetCfm *msg__; \
953         CsrWifiSmeCoexConfigSetCfmCreate(msg__, dst__, src__, status__); \
954         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
955     }
956
957 #define CsrWifiSmeCoexConfigSetCfmSend(dst__, status__) \
958     CsrWifiSmeCoexConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
959
960 /*******************************************************************************
961
962   NAME
963     CsrWifiSmeCoexInfoGetReqSend
964
965   DESCRIPTION
966     This primitive gets the value of the CoexInfo parameter.
967
968   PARAMETERS
969     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
970
971 *******************************************************************************/
972 #define CsrWifiSmeCoexInfoGetReqCreate(msg__, dst__, src__) \
973     msg__ = kmalloc(sizeof(CsrWifiSmeCoexInfoGetReq), GFP_KERNEL); \
974     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_INFO_GET_REQ, dst__, src__);
975
976 #define CsrWifiSmeCoexInfoGetReqSendTo(dst__, src__) \
977     { \
978         CsrWifiSmeCoexInfoGetReq *msg__; \
979         CsrWifiSmeCoexInfoGetReqCreate(msg__, dst__, src__); \
980         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
981     }
982
983 #define CsrWifiSmeCoexInfoGetReqSend(src__) \
984     CsrWifiSmeCoexInfoGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
985
986 /*******************************************************************************
987
988   NAME
989     CsrWifiSmeCoexInfoGetCfmSend
990
991   DESCRIPTION
992     This primitive reports the result of the request.
993
994   PARAMETERS
995     queue    - Destination Task Queue
996     status   - Reports the result of the request
997     coexInfo - Reports information and state related to coexistence.
998
999 *******************************************************************************/
1000 #define CsrWifiSmeCoexInfoGetCfmCreate(msg__, dst__, src__, status__, coexInfo__) \
1001     msg__ = kmalloc(sizeof(CsrWifiSmeCoexInfoGetCfm), GFP_KERNEL); \
1002     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_INFO_GET_CFM, dst__, src__); \
1003     msg__->status = (status__); \
1004     msg__->coexInfo = (coexInfo__);
1005
1006 #define CsrWifiSmeCoexInfoGetCfmSendTo(dst__, src__, status__, coexInfo__) \
1007     { \
1008         CsrWifiSmeCoexInfoGetCfm *msg__; \
1009         CsrWifiSmeCoexInfoGetCfmCreate(msg__, dst__, src__, status__, coexInfo__); \
1010         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1011     }
1012
1013 #define CsrWifiSmeCoexInfoGetCfmSend(dst__, status__, coexInfo__) \
1014     CsrWifiSmeCoexInfoGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, coexInfo__)
1015
1016 /*******************************************************************************
1017
1018   NAME
1019     CsrWifiSmeConnectReqSend
1020
1021   DESCRIPTION
1022     The wireless manager application calls this primitive to start the
1023     process of joining an 802.11 wireless network or to start an ad hoc
1024     network.
1025     The structure pointed by connectionConfig contains parameters describing
1026     the network to join or, in case of an ad hoc network, to host or join.
1027     The SME will select a network, perform the IEEE 802.11 Join, Authenticate
1028     and Associate exchanges.
1029     The SME selects the networks from the current scan list that match both
1030     the SSID and BSSID, however either or both of these may be the wildcard
1031     value. Using this rule, the following operations are possible:
1032       * To connect to a network by name, specify the SSID and set the BSSID to
1033         0xFF 0xFF 0xFF 0xFF 0xFF 0xFF. If there are two or more networks visible,
1034         the SME will select the one with the strongest signal.
1035       * To connect to a specific network, specify the BSSID. The SSID is
1036         optional, but if given it must match the SSID of the network. An empty
1037         SSID may be specified by setting the SSID length to zero. Please note
1038         that if the BSSID is specified (i.e. not equal to 0xFF 0xFF 0xFF 0xFF
1039         0xFF 0xFF), the SME will not attempt to roam if signal conditions become
1040         poor, even if there is an alternative AP with an SSID that matches the
1041         current network SSID.
1042       * To connect to any network matching the other parameters (i.e. security,
1043         etc), set the SSID length to zero and set the BSSID to 0xFF 0xFF 0xFF
1044         0xFF 0xFF 0xFF. In this case, the SME will order all available networks
1045         by their signal strengths and will iterate through this list until it
1046         successfully connects.
1047     NOTE: Specifying the BSSID will restrict the selection to one specific
1048     network. If SSID and BSSID are given, they must both match the network
1049     for it to be selected. To select a network based on the SSID only, the
1050     wireless manager application must set the BSSID to 0xFF 0xFF 0xFF 0xFF
1051     0xFF 0xFF.
1052     The SME will try to connect to each network that matches the provided
1053     parameters, one by one, until it succeeds or has tried unsuccessfully
1054     with all the matching networks.
1055     If there is no network that matches the parameters and the request allows
1056     to host an ad hoc network, the SME will advertise a new ad hoc network
1057     instead.
1058     If the SME cannot connect, it will notify the failure in the confirm.
1059
1060   PARAMETERS
1061     queue            - Message Source Task Queue (Cfm's will be sent to this Queue)
1062     interfaceTag     - Interface Identifier; unique identifier of an interface
1063     connectionConfig - Describes the candidate network to join or to host.
1064
1065 *******************************************************************************/
1066 #define CsrWifiSmeConnectReqCreate(msg__, dst__, src__, interfaceTag__, connectionConfig__) \
1067     msg__ = kmalloc(sizeof(CsrWifiSmeConnectReq), GFP_KERNEL); \
1068     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECT_REQ, dst__, src__); \
1069     msg__->interfaceTag = (interfaceTag__); \
1070     msg__->connectionConfig = (connectionConfig__);
1071
1072 #define CsrWifiSmeConnectReqSendTo(dst__, src__, interfaceTag__, connectionConfig__) \
1073     { \
1074         CsrWifiSmeConnectReq *msg__; \
1075         CsrWifiSmeConnectReqCreate(msg__, dst__, src__, interfaceTag__, connectionConfig__); \
1076         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1077     }
1078
1079 #define CsrWifiSmeConnectReqSend(src__, interfaceTag__, connectionConfig__) \
1080     CsrWifiSmeConnectReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, connectionConfig__)
1081
1082 /*******************************************************************************
1083
1084   NAME
1085     CsrWifiSmeConnectCfmSend
1086
1087   DESCRIPTION
1088     The SME calls this primitive when the connection exchange is complete or
1089     all connection attempts fail.
1090
1091   PARAMETERS
1092     queue        - Destination Task Queue
1093     interfaceTag - Interface Identifier; unique identifier of an interface
1094     status       - Reports the result of the request.
1095                    CSR_WIFI_SME_STATUS_NOT_FOUND: all attempts by the SME to
1096                    locate the requested AP failed
1097
1098 *******************************************************************************/
1099 #define CsrWifiSmeConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
1100     msg__ = kmalloc(sizeof(CsrWifiSmeConnectCfm), GFP_KERNEL); \
1101     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECT_CFM, dst__, src__); \
1102     msg__->interfaceTag = (interfaceTag__); \
1103     msg__->status = (status__);
1104
1105 #define CsrWifiSmeConnectCfmSendTo(dst__, src__, interfaceTag__, status__) \
1106     { \
1107         CsrWifiSmeConnectCfm *msg__; \
1108         CsrWifiSmeConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
1109         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1110     }
1111
1112 #define CsrWifiSmeConnectCfmSend(dst__, interfaceTag__, status__) \
1113     CsrWifiSmeConnectCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
1114
1115 /*******************************************************************************
1116
1117   NAME
1118     CsrWifiSmeConnectionConfigGetReqSend
1119
1120   DESCRIPTION
1121     This primitive gets the value of the ConnectionConfig parameter.
1122
1123   PARAMETERS
1124     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
1125     interfaceTag - Interface Identifier; unique identifier of an interface
1126
1127 *******************************************************************************/
1128 #define CsrWifiSmeConnectionConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \
1129     msg__ = kmalloc(sizeof(CsrWifiSmeConnectionConfigGetReq), GFP_KERNEL); \
1130     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_CONFIG_GET_REQ, dst__, src__); \
1131     msg__->interfaceTag = (interfaceTag__);
1132
1133 #define CsrWifiSmeConnectionConfigGetReqSendTo(dst__, src__, interfaceTag__) \
1134     { \
1135         CsrWifiSmeConnectionConfigGetReq *msg__; \
1136         CsrWifiSmeConnectionConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \
1137         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1138     }
1139
1140 #define CsrWifiSmeConnectionConfigGetReqSend(src__, interfaceTag__) \
1141     CsrWifiSmeConnectionConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
1142
1143 /*******************************************************************************
1144
1145   NAME
1146     CsrWifiSmeConnectionConfigGetCfmSend
1147
1148   DESCRIPTION
1149     This primitive reports the result of the request.
1150
1151   PARAMETERS
1152     queue            - Destination Task Queue
1153     interfaceTag     - Interface Identifier; unique identifier of an interface
1154     status           - Reports the result of the request
1155     connectionConfig - Parameters used by the SME for selecting a network
1156
1157 *******************************************************************************/
1158 #define CsrWifiSmeConnectionConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionConfig__) \
1159     msg__ = kmalloc(sizeof(CsrWifiSmeConnectionConfigGetCfm), GFP_KERNEL); \
1160     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM, dst__, src__); \
1161     msg__->interfaceTag = (interfaceTag__); \
1162     msg__->status = (status__); \
1163     msg__->connectionConfig = (connectionConfig__);
1164
1165 #define CsrWifiSmeConnectionConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionConfig__) \
1166     { \
1167         CsrWifiSmeConnectionConfigGetCfm *msg__; \
1168         CsrWifiSmeConnectionConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionConfig__); \
1169         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1170     }
1171
1172 #define CsrWifiSmeConnectionConfigGetCfmSend(dst__, interfaceTag__, status__, connectionConfig__) \
1173     CsrWifiSmeConnectionConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, connectionConfig__)
1174
1175 /*******************************************************************************
1176
1177   NAME
1178     CsrWifiSmeConnectionInfoGetReqSend
1179
1180   DESCRIPTION
1181     This primitive gets the value of the ConnectionInfo parameter.
1182
1183   PARAMETERS
1184     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
1185     interfaceTag - Interface Identifier; unique identifier of an interface
1186
1187 *******************************************************************************/
1188 #define CsrWifiSmeConnectionInfoGetReqCreate(msg__, dst__, src__, interfaceTag__) \
1189     msg__ = kmalloc(sizeof(CsrWifiSmeConnectionInfoGetReq), GFP_KERNEL); \
1190     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_INFO_GET_REQ, dst__, src__); \
1191     msg__->interfaceTag = (interfaceTag__);
1192
1193 #define CsrWifiSmeConnectionInfoGetReqSendTo(dst__, src__, interfaceTag__) \
1194     { \
1195         CsrWifiSmeConnectionInfoGetReq *msg__; \
1196         CsrWifiSmeConnectionInfoGetReqCreate(msg__, dst__, src__, interfaceTag__); \
1197         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1198     }
1199
1200 #define CsrWifiSmeConnectionInfoGetReqSend(src__, interfaceTag__) \
1201     CsrWifiSmeConnectionInfoGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
1202
1203 /*******************************************************************************
1204
1205   NAME
1206     CsrWifiSmeConnectionInfoGetCfmSend
1207
1208   DESCRIPTION
1209     This primitive reports the result of the request.
1210
1211   PARAMETERS
1212     queue          - Destination Task Queue
1213     interfaceTag   - Interface Identifier; unique identifier of an interface
1214     status         - Reports the result of the request
1215     connectionInfo - Information about the current connection
1216
1217 *******************************************************************************/
1218 #define CsrWifiSmeConnectionInfoGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__) \
1219     msg__ = kmalloc(sizeof(CsrWifiSmeConnectionInfoGetCfm), GFP_KERNEL); \
1220     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_INFO_GET_CFM, dst__, src__); \
1221     msg__->interfaceTag = (interfaceTag__); \
1222     msg__->status = (status__); \
1223     msg__->connectionInfo = (connectionInfo__);
1224
1225 #define CsrWifiSmeConnectionInfoGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionInfo__) \
1226     { \
1227         CsrWifiSmeConnectionInfoGetCfm *msg__; \
1228         CsrWifiSmeConnectionInfoGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__); \
1229         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1230     }
1231
1232 #define CsrWifiSmeConnectionInfoGetCfmSend(dst__, interfaceTag__, status__, connectionInfo__) \
1233     CsrWifiSmeConnectionInfoGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, connectionInfo__)
1234
1235 /*******************************************************************************
1236
1237   NAME
1238     CsrWifiSmeConnectionQualityIndSend
1239
1240   DESCRIPTION
1241     The SME sends this primitive to all the tasks that have registered to
1242     receive it whenever the value of the current connection quality
1243     parameters change by more than a certain configurable amount.
1244     The wireless manager application may configure the trigger thresholds for
1245     this indication using the field in smeConfig parameter of
1246     CSR_WIFI_SME_SME_CONFIG_SET_REQ.
1247     Connection quality messages can be suppressed by setting both thresholds
1248     to zero.
1249
1250   PARAMETERS
1251     queue        - Destination Task Queue
1252     interfaceTag - Interface Identifier; unique identifier of an interface
1253     linkQuality  - Indicates the quality of the link
1254
1255 *******************************************************************************/
1256 #define CsrWifiSmeConnectionQualityIndCreate(msg__, dst__, src__, interfaceTag__, linkQuality__) \
1257     msg__ = kmalloc(sizeof(CsrWifiSmeConnectionQualityInd), GFP_KERNEL); \
1258     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_QUALITY_IND, dst__, src__); \
1259     msg__->interfaceTag = (interfaceTag__); \
1260     msg__->linkQuality = (linkQuality__);
1261
1262 #define CsrWifiSmeConnectionQualityIndSendTo(dst__, src__, interfaceTag__, linkQuality__) \
1263     { \
1264         CsrWifiSmeConnectionQualityInd *msg__; \
1265         CsrWifiSmeConnectionQualityIndCreate(msg__, dst__, src__, interfaceTag__, linkQuality__); \
1266         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1267     }
1268
1269 #define CsrWifiSmeConnectionQualityIndSend(dst__, interfaceTag__, linkQuality__) \
1270     CsrWifiSmeConnectionQualityIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, linkQuality__)
1271
1272 /*******************************************************************************
1273
1274   NAME
1275     CsrWifiSmeConnectionStatsGetReqSend
1276
1277   DESCRIPTION
1278     This primitive gets the value of the ConnectionStats parameter.
1279
1280   PARAMETERS
1281     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
1282     interfaceTag - Interface Identifier; unique identifier of an interface
1283
1284 *******************************************************************************/
1285 #define CsrWifiSmeConnectionStatsGetReqCreate(msg__, dst__, src__, interfaceTag__) \
1286     msg__ = kmalloc(sizeof(CsrWifiSmeConnectionStatsGetReq), GFP_KERNEL); \
1287     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_STATS_GET_REQ, dst__, src__); \
1288     msg__->interfaceTag = (interfaceTag__);
1289
1290 #define CsrWifiSmeConnectionStatsGetReqSendTo(dst__, src__, interfaceTag__) \
1291     { \
1292         CsrWifiSmeConnectionStatsGetReq *msg__; \
1293         CsrWifiSmeConnectionStatsGetReqCreate(msg__, dst__, src__, interfaceTag__); \
1294         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1295     }
1296
1297 #define CsrWifiSmeConnectionStatsGetReqSend(src__, interfaceTag__) \
1298     CsrWifiSmeConnectionStatsGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
1299
1300 /*******************************************************************************
1301
1302   NAME
1303     CsrWifiSmeConnectionStatsGetCfmSend
1304
1305   DESCRIPTION
1306     This primitive reports the result of the request.
1307
1308   PARAMETERS
1309     queue           - Destination Task Queue
1310     interfaceTag    - Interface Identifier; unique identifier of an interface
1311     status          - Reports the result of the request
1312     connectionStats - Statistics for current connection.
1313
1314 *******************************************************************************/
1315 #define CsrWifiSmeConnectionStatsGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStats__) \
1316     msg__ = kmalloc(sizeof(CsrWifiSmeConnectionStatsGetCfm), GFP_KERNEL); \
1317     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_STATS_GET_CFM, dst__, src__); \
1318     msg__->interfaceTag = (interfaceTag__); \
1319     msg__->status = (status__); \
1320     msg__->connectionStats = (connectionStats__);
1321
1322 #define CsrWifiSmeConnectionStatsGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionStats__) \
1323     { \
1324         CsrWifiSmeConnectionStatsGetCfm *msg__; \
1325         CsrWifiSmeConnectionStatsGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStats__); \
1326         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1327     }
1328
1329 #define CsrWifiSmeConnectionStatsGetCfmSend(dst__, interfaceTag__, status__, connectionStats__) \
1330     CsrWifiSmeConnectionStatsGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, connectionStats__)
1331
1332 /*******************************************************************************
1333
1334   NAME
1335     CsrWifiSmeCoreDumpIndSend
1336
1337   DESCRIPTION
1338     The SME will send this primitive to all the tasks that have registered to
1339     receive Wi-Fi Chip core dump data.
1340     The core dump data may be fragmented and sent using more than one
1341     indication.
1342     To indicate that all the data has been sent, the last indication contains
1343     a 'length' of 0 and 'data' of NULL.
1344
1345   PARAMETERS
1346     queue      - Destination Task Queue
1347     dataLength - Number of bytes in the buffer pointed to by 'data'
1348     data       - Pointer to the buffer containing 'dataLength' bytes of core
1349                  dump data
1350
1351 *******************************************************************************/
1352 #define CsrWifiSmeCoreDumpIndCreate(msg__, dst__, src__, dataLength__, data__) \
1353     msg__ = kmalloc(sizeof(CsrWifiSmeCoreDumpInd), GFP_KERNEL); \
1354     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CORE_DUMP_IND, dst__, src__); \
1355     msg__->dataLength = (dataLength__); \
1356     msg__->data = (data__);
1357
1358 #define CsrWifiSmeCoreDumpIndSendTo(dst__, src__, dataLength__, data__) \
1359     { \
1360         CsrWifiSmeCoreDumpInd *msg__; \
1361         CsrWifiSmeCoreDumpIndCreate(msg__, dst__, src__, dataLength__, data__); \
1362         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1363     }
1364
1365 #define CsrWifiSmeCoreDumpIndSend(dst__, dataLength__, data__) \
1366     CsrWifiSmeCoreDumpIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, dataLength__, data__)
1367
1368 /*******************************************************************************
1369
1370   NAME
1371     CsrWifiSmeDeactivateReqSend
1372
1373   DESCRIPTION
1374     The WMA sends this primitive to deactivate the SME.
1375
1376   PARAMETERS
1377     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
1378
1379 *******************************************************************************/
1380 #define CsrWifiSmeDeactivateReqCreate(msg__, dst__, src__) \
1381     msg__ = kmalloc(sizeof(CsrWifiSmeDeactivateReq), GFP_KERNEL); \
1382     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DEACTIVATE_REQ, dst__, src__);
1383
1384 #define CsrWifiSmeDeactivateReqSendTo(dst__, src__) \
1385     { \
1386         CsrWifiSmeDeactivateReq *msg__; \
1387         CsrWifiSmeDeactivateReqCreate(msg__, dst__, src__); \
1388         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1389     }
1390
1391 #define CsrWifiSmeDeactivateReqSend(src__) \
1392     CsrWifiSmeDeactivateReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
1393
1394 /*******************************************************************************
1395
1396   NAME
1397     CsrWifiSmeDeactivateCfmSend
1398
1399   DESCRIPTION
1400     The SME sends this primitive when the deactivation is complete.
1401     The WMA cannot send any more primitives until it actives the SME again
1402     sending another CSR_WIFI_SME_ACTIVATE_REQ.
1403
1404   PARAMETERS
1405     queue  - Destination Task Queue
1406     status - Reports the result of the request
1407
1408 *******************************************************************************/
1409 #define CsrWifiSmeDeactivateCfmCreate(msg__, dst__, src__, status__) \
1410     msg__ = kmalloc(sizeof(CsrWifiSmeDeactivateCfm), GFP_KERNEL); \
1411     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DEACTIVATE_CFM, dst__, src__); \
1412     msg__->status = (status__);
1413
1414 #define CsrWifiSmeDeactivateCfmSendTo(dst__, src__, status__) \
1415     { \
1416         CsrWifiSmeDeactivateCfm *msg__; \
1417         CsrWifiSmeDeactivateCfmCreate(msg__, dst__, src__, status__); \
1418         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1419     }
1420
1421 #define CsrWifiSmeDeactivateCfmSend(dst__, status__) \
1422     CsrWifiSmeDeactivateCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
1423
1424 /*******************************************************************************
1425
1426   NAME
1427     CsrWifiSmeDisconnectReqSend
1428
1429   DESCRIPTION
1430     The wireless manager application may disconnect from the current network
1431     by calling this primitive
1432
1433   PARAMETERS
1434     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
1435     interfaceTag - Interface Identifier; unique identifier of an interface
1436
1437 *******************************************************************************/
1438 #define CsrWifiSmeDisconnectReqCreate(msg__, dst__, src__, interfaceTag__) \
1439     msg__ = kmalloc(sizeof(CsrWifiSmeDisconnectReq), GFP_KERNEL); \
1440     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DISCONNECT_REQ, dst__, src__); \
1441     msg__->interfaceTag = (interfaceTag__);
1442
1443 #define CsrWifiSmeDisconnectReqSendTo(dst__, src__, interfaceTag__) \
1444     { \
1445         CsrWifiSmeDisconnectReq *msg__; \
1446         CsrWifiSmeDisconnectReqCreate(msg__, dst__, src__, interfaceTag__); \
1447         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1448     }
1449
1450 #define CsrWifiSmeDisconnectReqSend(src__, interfaceTag__) \
1451     CsrWifiSmeDisconnectReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
1452
1453 /*******************************************************************************
1454
1455   NAME
1456     CsrWifiSmeDisconnectCfmSend
1457
1458   DESCRIPTION
1459     On reception of CSR_WIFI_SME_DISCONNECT_REQ the SME will perform a
1460     disconnect operation, sending a CsrWifiSmeMediaStatusInd with
1461     CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED and then call this primitive when
1462     disconnection is complete.
1463
1464   PARAMETERS
1465     queue        - Destination Task Queue
1466     interfaceTag - Interface Identifier; unique identifier of an interface
1467     status       - Reports the result of the request
1468
1469 *******************************************************************************/
1470 #define CsrWifiSmeDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
1471     msg__ = kmalloc(sizeof(CsrWifiSmeDisconnectCfm), GFP_KERNEL); \
1472     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DISCONNECT_CFM, dst__, src__); \
1473     msg__->interfaceTag = (interfaceTag__); \
1474     msg__->status = (status__);
1475
1476 #define CsrWifiSmeDisconnectCfmSendTo(dst__, src__, interfaceTag__, status__) \
1477     { \
1478         CsrWifiSmeDisconnectCfm *msg__; \
1479         CsrWifiSmeDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
1480         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1481     }
1482
1483 #define CsrWifiSmeDisconnectCfmSend(dst__, interfaceTag__, status__) \
1484     CsrWifiSmeDisconnectCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
1485
1486 /*******************************************************************************
1487
1488   NAME
1489     CsrWifiSmeErrorIndSend
1490
1491   DESCRIPTION
1492     Important error message indicating a error of some importance
1493
1494   PARAMETERS
1495     queue        - Destination Task Queue
1496     errorMessage - Contains the error message.
1497
1498 *******************************************************************************/
1499 #define CsrWifiSmeErrorIndCreate(msg__, dst__, src__, errorMessage__) \
1500     msg__ = kmalloc(sizeof(CsrWifiSmeErrorInd), GFP_KERNEL); \
1501     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ERROR_IND, dst__, src__); \
1502     msg__->errorMessage = (errorMessage__);
1503
1504 #define CsrWifiSmeErrorIndSendTo(dst__, src__, errorMessage__) \
1505     { \
1506         CsrWifiSmeErrorInd *msg__; \
1507         CsrWifiSmeErrorIndCreate(msg__, dst__, src__, errorMessage__); \
1508         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1509     }
1510
1511 #define CsrWifiSmeErrorIndSend(dst__, errorMessage__) \
1512     CsrWifiSmeErrorIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, errorMessage__)
1513
1514 /*******************************************************************************
1515
1516   NAME
1517     CsrWifiSmeEventMaskSetReqSend
1518
1519   DESCRIPTION
1520     The wireless manager application may register with the SME to receive
1521     notification of interesting events. Indications will be sent only if the
1522     wireless manager explicitly registers to be notified of that event.
1523     indMask is a bit mask of values defined in CsrWifiSmeIndicationsMask.
1524
1525   PARAMETERS
1526     queue   - Message Source Task Queue (Cfm's will be sent to this Queue)
1527     indMask - Set mask with values from CsrWifiSmeIndications
1528
1529 *******************************************************************************/
1530 #define CsrWifiSmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__) \
1531     msg__ = kmalloc(sizeof(CsrWifiSmeEventMaskSetReq), GFP_KERNEL); \
1532     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_EVENT_MASK_SET_REQ, dst__, src__); \
1533     msg__->indMask = (indMask__);
1534
1535 #define CsrWifiSmeEventMaskSetReqSendTo(dst__, src__, indMask__) \
1536     { \
1537         CsrWifiSmeEventMaskSetReq *msg__; \
1538         CsrWifiSmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__); \
1539         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1540     }
1541
1542 #define CsrWifiSmeEventMaskSetReqSend(src__, indMask__) \
1543     CsrWifiSmeEventMaskSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, indMask__)
1544
1545 /*******************************************************************************
1546
1547   NAME
1548     CsrWifiSmeEventMaskSetCfmSend
1549
1550   DESCRIPTION
1551     The SME calls the primitive to report the result of the request
1552     primitive.
1553
1554   PARAMETERS
1555     queue  - Destination Task Queue
1556     status - Reports the result of the request
1557
1558 *******************************************************************************/
1559 #define CsrWifiSmeEventMaskSetCfmCreate(msg__, dst__, src__, status__) \
1560     msg__ = kmalloc(sizeof(CsrWifiSmeEventMaskSetCfm), GFP_KERNEL); \
1561     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_EVENT_MASK_SET_CFM, dst__, src__); \
1562     msg__->status = (status__);
1563
1564 #define CsrWifiSmeEventMaskSetCfmSendTo(dst__, src__, status__) \
1565     { \
1566         CsrWifiSmeEventMaskSetCfm *msg__; \
1567         CsrWifiSmeEventMaskSetCfmCreate(msg__, dst__, src__, status__); \
1568         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1569     }
1570
1571 #define CsrWifiSmeEventMaskSetCfmSend(dst__, status__) \
1572     CsrWifiSmeEventMaskSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
1573
1574 /*******************************************************************************
1575
1576   NAME
1577     CsrWifiSmeHostConfigGetReqSend
1578
1579   DESCRIPTION
1580     This primitive gets the value of the hostConfig parameter.
1581
1582   PARAMETERS
1583     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
1584     interfaceTag - Interface Identifier; unique identifier of an interface
1585
1586 *******************************************************************************/
1587 #define CsrWifiSmeHostConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \
1588     msg__ = kmalloc(sizeof(CsrWifiSmeHostConfigGetReq), GFP_KERNEL); \
1589     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_GET_REQ, dst__, src__); \
1590     msg__->interfaceTag = (interfaceTag__);
1591
1592 #define CsrWifiSmeHostConfigGetReqSendTo(dst__, src__, interfaceTag__) \
1593     { \
1594         CsrWifiSmeHostConfigGetReq *msg__; \
1595         CsrWifiSmeHostConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \
1596         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1597     }
1598
1599 #define CsrWifiSmeHostConfigGetReqSend(src__, interfaceTag__) \
1600     CsrWifiSmeHostConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
1601
1602 /*******************************************************************************
1603
1604   NAME
1605     CsrWifiSmeHostConfigGetCfmSend
1606
1607   DESCRIPTION
1608     This primitive reports the result of the request.
1609
1610   PARAMETERS
1611     queue        - Destination Task Queue
1612     interfaceTag - Interface Identifier; unique identifier of an interface
1613     status       - Reports the result of the request
1614     hostConfig   - Current host power state.
1615
1616 *******************************************************************************/
1617 #define CsrWifiSmeHostConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, hostConfig__) \
1618     msg__ = kmalloc(sizeof(CsrWifiSmeHostConfigGetCfm), GFP_KERNEL); \
1619     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_GET_CFM, dst__, src__); \
1620     msg__->interfaceTag = (interfaceTag__); \
1621     msg__->status = (status__); \
1622     msg__->hostConfig = (hostConfig__);
1623
1624 #define CsrWifiSmeHostConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, hostConfig__) \
1625     { \
1626         CsrWifiSmeHostConfigGetCfm *msg__; \
1627         CsrWifiSmeHostConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, hostConfig__); \
1628         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1629     }
1630
1631 #define CsrWifiSmeHostConfigGetCfmSend(dst__, interfaceTag__, status__, hostConfig__) \
1632     CsrWifiSmeHostConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, hostConfig__)
1633
1634 /*******************************************************************************
1635
1636   NAME
1637     CsrWifiSmeHostConfigSetReqSend
1638
1639   DESCRIPTION
1640     This primitive sets the value of the hostConfig parameter.
1641
1642   PARAMETERS
1643     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
1644     interfaceTag - Interface Identifier; unique identifier of an interface
1645     hostConfig   - Communicates a change of host power state (for example, on
1646                    mains power, on battery power etc) and of the periodicity of
1647                    traffic data
1648
1649 *******************************************************************************/
1650 #define CsrWifiSmeHostConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, hostConfig__) \
1651     msg__ = kmalloc(sizeof(CsrWifiSmeHostConfigSetReq), GFP_KERNEL); \
1652     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_SET_REQ, dst__, src__); \
1653     msg__->interfaceTag = (interfaceTag__); \
1654     msg__->hostConfig = (hostConfig__);
1655
1656 #define CsrWifiSmeHostConfigSetReqSendTo(dst__, src__, interfaceTag__, hostConfig__) \
1657     { \
1658         CsrWifiSmeHostConfigSetReq *msg__; \
1659         CsrWifiSmeHostConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, hostConfig__); \
1660         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1661     }
1662
1663 #define CsrWifiSmeHostConfigSetReqSend(src__, interfaceTag__, hostConfig__) \
1664     CsrWifiSmeHostConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, hostConfig__)
1665
1666 /*******************************************************************************
1667
1668   NAME
1669     CsrWifiSmeHostConfigSetCfmSend
1670
1671   DESCRIPTION
1672     This primitive reports the result of the request.
1673
1674   PARAMETERS
1675     queue        - Destination Task Queue
1676     interfaceTag - Interface Identifier; unique identifier of an interface
1677     status       - Reports the result of the request
1678
1679 *******************************************************************************/
1680 #define CsrWifiSmeHostConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
1681     msg__ = kmalloc(sizeof(CsrWifiSmeHostConfigSetCfm), GFP_KERNEL); \
1682     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_SET_CFM, dst__, src__); \
1683     msg__->interfaceTag = (interfaceTag__); \
1684     msg__->status = (status__);
1685
1686 #define CsrWifiSmeHostConfigSetCfmSendTo(dst__, src__, interfaceTag__, status__) \
1687     { \
1688         CsrWifiSmeHostConfigSetCfm *msg__; \
1689         CsrWifiSmeHostConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
1690         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1691     }
1692
1693 #define CsrWifiSmeHostConfigSetCfmSend(dst__, interfaceTag__, status__) \
1694     CsrWifiSmeHostConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
1695
1696 /*******************************************************************************
1697
1698   NAME
1699     CsrWifiSmeIbssStationIndSend
1700
1701   DESCRIPTION
1702     The SME will send this primitive to indicate that a station has joined or
1703     left the ad-hoc network.
1704
1705   PARAMETERS
1706     queue       - Destination Task Queue
1707     address     - MAC address of the station that has joined or left
1708     isconnected - TRUE if the station joined, FALSE if the station left
1709
1710 *******************************************************************************/
1711 #define CsrWifiSmeIbssStationIndCreate(msg__, dst__, src__, address__, isconnected__) \
1712     msg__ = kmalloc(sizeof(CsrWifiSmeIbssStationInd), GFP_KERNEL); \
1713     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_IBSS_STATION_IND, dst__, src__); \
1714     msg__->address = (address__); \
1715     msg__->isconnected = (isconnected__);
1716
1717 #define CsrWifiSmeIbssStationIndSendTo(dst__, src__, address__, isconnected__) \
1718     { \
1719         CsrWifiSmeIbssStationInd *msg__; \
1720         CsrWifiSmeIbssStationIndCreate(msg__, dst__, src__, address__, isconnected__); \
1721         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1722     }
1723
1724 #define CsrWifiSmeIbssStationIndSend(dst__, address__, isconnected__) \
1725     CsrWifiSmeIbssStationIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, address__, isconnected__)
1726
1727 /*******************************************************************************
1728
1729   NAME
1730     CsrWifiSmeInfoIndSend
1731
1732   DESCRIPTION
1733     Message indicating a some info about current activity. Mostly of interest
1734     in testing but may be useful in the field.
1735
1736   PARAMETERS
1737     queue       - Destination Task Queue
1738     infoMessage - Contains the message.
1739
1740 *******************************************************************************/
1741 #define CsrWifiSmeInfoIndCreate(msg__, dst__, src__, infoMessage__) \
1742     msg__ = kmalloc(sizeof(CsrWifiSmeInfoInd), GFP_KERNEL); \
1743     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INFO_IND, dst__, src__); \
1744     msg__->infoMessage = (infoMessage__);
1745
1746 #define CsrWifiSmeInfoIndSendTo(dst__, src__, infoMessage__) \
1747     { \
1748         CsrWifiSmeInfoInd *msg__; \
1749         CsrWifiSmeInfoIndCreate(msg__, dst__, src__, infoMessage__); \
1750         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1751     }
1752
1753 #define CsrWifiSmeInfoIndSend(dst__, infoMessage__) \
1754     CsrWifiSmeInfoIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, infoMessage__)
1755
1756 /*******************************************************************************
1757
1758   NAME
1759     CsrWifiSmeInterfaceCapabilityGetReqSend
1760
1761   DESCRIPTION
1762     The Wireless Manager calls this primitive to ask the SME for the
1763     capabilities of the supported interfaces
1764
1765   PARAMETERS
1766     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
1767
1768 *******************************************************************************/
1769 #define CsrWifiSmeInterfaceCapabilityGetReqCreate(msg__, dst__, src__) \
1770     msg__ = kmalloc(sizeof(CsrWifiSmeInterfaceCapabilityGetReq), GFP_KERNEL); \
1771     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_REQ, dst__, src__);
1772
1773 #define CsrWifiSmeInterfaceCapabilityGetReqSendTo(dst__, src__) \
1774     { \
1775         CsrWifiSmeInterfaceCapabilityGetReq *msg__; \
1776         CsrWifiSmeInterfaceCapabilityGetReqCreate(msg__, dst__, src__); \
1777         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1778     }
1779
1780 #define CsrWifiSmeInterfaceCapabilityGetReqSend(src__) \
1781     CsrWifiSmeInterfaceCapabilityGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
1782
1783 /*******************************************************************************
1784
1785   NAME
1786     CsrWifiSmeInterfaceCapabilityGetCfmSend
1787
1788   DESCRIPTION
1789     This primitive reports the result of the request.
1790
1791   PARAMETERS
1792     queue         - Destination Task Queue
1793     status        - Result of the request
1794     numInterfaces - Number of the interfaces supported
1795     capBitmap     - Points to the list of capabilities bitmaps provided for each
1796                     interface.
1797                     The bits represent the following capabilities:
1798                     -bits 7 to 4-Reserved
1799                     -bit 3-AMP
1800                     -bit 2-P2P
1801                     -bit 1-AP
1802                     -bit 0-STA
1803
1804 *******************************************************************************/
1805 #define CsrWifiSmeInterfaceCapabilityGetCfmCreate(msg__, dst__, src__, status__, numInterfaces__, capBitmap__) \
1806     msg__ = kmalloc(sizeof(CsrWifiSmeInterfaceCapabilityGetCfm), GFP_KERNEL); \
1807     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_CFM, dst__, src__); \
1808     msg__->status = (status__); \
1809     msg__->numInterfaces = (numInterfaces__); \
1810     memcpy(msg__->capBitmap, (capBitmap__), sizeof(u8) * 2);
1811
1812 #define CsrWifiSmeInterfaceCapabilityGetCfmSendTo(dst__, src__, status__, numInterfaces__, capBitmap__) \
1813     { \
1814         CsrWifiSmeInterfaceCapabilityGetCfm *msg__; \
1815         CsrWifiSmeInterfaceCapabilityGetCfmCreate(msg__, dst__, src__, status__, numInterfaces__, capBitmap__); \
1816         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1817     }
1818
1819 #define CsrWifiSmeInterfaceCapabilityGetCfmSend(dst__, status__, numInterfaces__, capBitmap__) \
1820     CsrWifiSmeInterfaceCapabilityGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, numInterfaces__, capBitmap__)
1821
1822 /*******************************************************************************
1823
1824   NAME
1825     CsrWifiSmeKeyReqSend
1826
1827   DESCRIPTION
1828     The wireless manager application calls this primitive to add or remove
1829     keys that the chip should use for encryption of data.
1830     The interface allows the wireless manager application to add and remove
1831     keys according to the specified action.
1832
1833   PARAMETERS
1834     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
1835     interfaceTag - Interface Identifier; unique identifier of an interface
1836     action       - The value of the CsrWifiSmeListAction parameter instructs the
1837                    driver to modify or provide the list of keys.
1838                    CSR_WIFI_SME_LIST_ACTION_GET is not supported here.
1839     key          - Key to be added or removed
1840
1841 *******************************************************************************/
1842 #define CsrWifiSmeKeyReqCreate(msg__, dst__, src__, interfaceTag__, action__, key__) \
1843     msg__ = kmalloc(sizeof(CsrWifiSmeKeyReq), GFP_KERNEL); \
1844     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_KEY_REQ, dst__, src__); \
1845     msg__->interfaceTag = (interfaceTag__); \
1846     msg__->action = (action__); \
1847     msg__->key = (key__);
1848
1849 #define CsrWifiSmeKeyReqSendTo(dst__, src__, interfaceTag__, action__, key__) \
1850     { \
1851         CsrWifiSmeKeyReq *msg__; \
1852         CsrWifiSmeKeyReqCreate(msg__, dst__, src__, interfaceTag__, action__, key__); \
1853         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1854     }
1855
1856 #define CsrWifiSmeKeyReqSend(src__, interfaceTag__, action__, key__) \
1857     CsrWifiSmeKeyReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, key__)
1858
1859 /*******************************************************************************
1860
1861   NAME
1862     CsrWifiSmeKeyCfmSend
1863
1864   DESCRIPTION
1865     The SME calls the primitive to report the result of the request
1866     primitive.
1867
1868   PARAMETERS
1869     queue          - Destination Task Queue
1870     interfaceTag   - Interface Identifier; unique identifier of an interface
1871     status         - Reports the result of the request
1872     action         - Action in the request
1873     keyType        - Type of the key added/deleted
1874     peerMacAddress - Peer MAC Address of the key added/deleted
1875
1876 *******************************************************************************/
1877 #define CsrWifiSmeKeyCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, keyType__, peerMacAddress__) \
1878     msg__ = kmalloc(sizeof(CsrWifiSmeKeyCfm), GFP_KERNEL); \
1879     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_KEY_CFM, dst__, src__); \
1880     msg__->interfaceTag = (interfaceTag__); \
1881     msg__->status = (status__); \
1882     msg__->action = (action__); \
1883     msg__->keyType = (keyType__); \
1884     msg__->peerMacAddress = (peerMacAddress__);
1885
1886 #define CsrWifiSmeKeyCfmSendTo(dst__, src__, interfaceTag__, status__, action__, keyType__, peerMacAddress__) \
1887     { \
1888         CsrWifiSmeKeyCfm *msg__; \
1889         CsrWifiSmeKeyCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, keyType__, peerMacAddress__); \
1890         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1891     }
1892
1893 #define CsrWifiSmeKeyCfmSend(dst__, interfaceTag__, status__, action__, keyType__, peerMacAddress__) \
1894     CsrWifiSmeKeyCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, action__, keyType__, peerMacAddress__)
1895
1896 /*******************************************************************************
1897
1898   NAME
1899     CsrWifiSmeLinkQualityGetReqSend
1900
1901   DESCRIPTION
1902     This primitive gets the value of the LinkQuality parameter.
1903
1904   PARAMETERS
1905     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
1906     interfaceTag - Interface Identifier; unique identifier of an interface
1907
1908 *******************************************************************************/
1909 #define CsrWifiSmeLinkQualityGetReqCreate(msg__, dst__, src__, interfaceTag__) \
1910     msg__ = kmalloc(sizeof(CsrWifiSmeLinkQualityGetReq), GFP_KERNEL); \
1911     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_LINK_QUALITY_GET_REQ, dst__, src__); \
1912     msg__->interfaceTag = (interfaceTag__);
1913
1914 #define CsrWifiSmeLinkQualityGetReqSendTo(dst__, src__, interfaceTag__) \
1915     { \
1916         CsrWifiSmeLinkQualityGetReq *msg__; \
1917         CsrWifiSmeLinkQualityGetReqCreate(msg__, dst__, src__, interfaceTag__); \
1918         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1919     }
1920
1921 #define CsrWifiSmeLinkQualityGetReqSend(src__, interfaceTag__) \
1922     CsrWifiSmeLinkQualityGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
1923
1924 /*******************************************************************************
1925
1926   NAME
1927     CsrWifiSmeLinkQualityGetCfmSend
1928
1929   DESCRIPTION
1930     This primitive reports the result of the request.
1931
1932   PARAMETERS
1933     queue        - Destination Task Queue
1934     interfaceTag - Interface Identifier; unique identifier of an interface
1935     status       - Reports the result of the request
1936     linkQuality  - Indicates the quality of the link
1937
1938 *******************************************************************************/
1939 #define CsrWifiSmeLinkQualityGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, linkQuality__) \
1940     msg__ = kmalloc(sizeof(CsrWifiSmeLinkQualityGetCfm), GFP_KERNEL); \
1941     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_LINK_QUALITY_GET_CFM, dst__, src__); \
1942     msg__->interfaceTag = (interfaceTag__); \
1943     msg__->status = (status__); \
1944     msg__->linkQuality = (linkQuality__);
1945
1946 #define CsrWifiSmeLinkQualityGetCfmSendTo(dst__, src__, interfaceTag__, status__, linkQuality__) \
1947     { \
1948         CsrWifiSmeLinkQualityGetCfm *msg__; \
1949         CsrWifiSmeLinkQualityGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, linkQuality__); \
1950         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1951     }
1952
1953 #define CsrWifiSmeLinkQualityGetCfmSend(dst__, interfaceTag__, status__, linkQuality__) \
1954     CsrWifiSmeLinkQualityGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, linkQuality__)
1955
1956 /*******************************************************************************
1957
1958   NAME
1959     CsrWifiSmeMediaStatusIndSend
1960
1961   DESCRIPTION
1962     The SME sends this primitive to all the tasks that have registered to
1963     receive it when a network connection is established, lost or has moved to
1964     another AP.
1965
1966   PARAMETERS
1967     queue          - Destination Task Queue
1968     interfaceTag   - Interface Identifier; unique identifier of an interface
1969     mediaStatus    - Indicates the media status
1970     connectionInfo - This parameter is relevant only if the mediaStatus is
1971                      CSR_WIFI_SME_MEDIA_STATUS_CONNECTED:
1972                      it points to the connection information for the new network
1973     disassocReason - This parameter is relevant only if the mediaStatus is
1974                      CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED:
1975                      if a disassociation has occurred it gives the reason of the
1976                      disassociation
1977     deauthReason   - This parameter is relevant only if the mediaStatus is
1978                      CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED:
1979                      if a deauthentication has occurred it gives the reason of
1980                      the deauthentication
1981
1982 *******************************************************************************/
1983 #define CsrWifiSmeMediaStatusIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__) \
1984     msg__ = kmalloc(sizeof(CsrWifiSmeMediaStatusInd), GFP_KERNEL); \
1985     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MEDIA_STATUS_IND, dst__, src__); \
1986     msg__->interfaceTag = (interfaceTag__); \
1987     msg__->mediaStatus = (mediaStatus__); \
1988     msg__->connectionInfo = (connectionInfo__); \
1989     msg__->disassocReason = (disassocReason__); \
1990     msg__->deauthReason = (deauthReason__);
1991
1992 #define CsrWifiSmeMediaStatusIndSendTo(dst__, src__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__) \
1993     { \
1994         CsrWifiSmeMediaStatusInd *msg__; \
1995         CsrWifiSmeMediaStatusIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__); \
1996         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1997     }
1998
1999 #define CsrWifiSmeMediaStatusIndSend(dst__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__) \
2000     CsrWifiSmeMediaStatusIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__)
2001
2002 /*******************************************************************************
2003
2004   NAME
2005     CsrWifiSmeMibConfigGetReqSend
2006
2007   DESCRIPTION
2008     This primitive gets the value of the MibConfig parameter.
2009
2010   PARAMETERS
2011     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
2012
2013 *******************************************************************************/
2014 #define CsrWifiSmeMibConfigGetReqCreate(msg__, dst__, src__) \
2015     msg__ = kmalloc(sizeof(CsrWifiSmeMibConfigGetReq), GFP_KERNEL); \
2016     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_GET_REQ, dst__, src__);
2017
2018 #define CsrWifiSmeMibConfigGetReqSendTo(dst__, src__) \
2019     { \
2020         CsrWifiSmeMibConfigGetReq *msg__; \
2021         CsrWifiSmeMibConfigGetReqCreate(msg__, dst__, src__); \
2022         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2023     }
2024
2025 #define CsrWifiSmeMibConfigGetReqSend(src__) \
2026     CsrWifiSmeMibConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
2027
2028 /*******************************************************************************
2029
2030   NAME
2031     CsrWifiSmeMibConfigGetCfmSend
2032
2033   DESCRIPTION
2034     This primitive reports the result of the request.
2035
2036   PARAMETERS
2037     queue     - Destination Task Queue
2038     status    - Reports the result of the request
2039     mibConfig - Reports various IEEE 802.11 attributes as currently configured
2040
2041 *******************************************************************************/
2042 #define CsrWifiSmeMibConfigGetCfmCreate(msg__, dst__, src__, status__, mibConfig__) \
2043     msg__ = kmalloc(sizeof(CsrWifiSmeMibConfigGetCfm), GFP_KERNEL); \
2044     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_GET_CFM, dst__, src__); \
2045     msg__->status = (status__); \
2046     msg__->mibConfig = (mibConfig__);
2047
2048 #define CsrWifiSmeMibConfigGetCfmSendTo(dst__, src__, status__, mibConfig__) \
2049     { \
2050         CsrWifiSmeMibConfigGetCfm *msg__; \
2051         CsrWifiSmeMibConfigGetCfmCreate(msg__, dst__, src__, status__, mibConfig__); \
2052         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2053     }
2054
2055 #define CsrWifiSmeMibConfigGetCfmSend(dst__, status__, mibConfig__) \
2056     CsrWifiSmeMibConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, mibConfig__)
2057
2058 /*******************************************************************************
2059
2060   NAME
2061     CsrWifiSmeMibConfigSetReqSend
2062
2063   DESCRIPTION
2064     This primitive sets the value of the MibConfig parameter.
2065
2066   PARAMETERS
2067     queue     - Message Source Task Queue (Cfm's will be sent to this Queue)
2068     mibConfig - Conveys the desired value of various IEEE 802.11 attributes as
2069                 currently configured
2070
2071 *******************************************************************************/
2072 #define CsrWifiSmeMibConfigSetReqCreate(msg__, dst__, src__, mibConfig__) \
2073     msg__ = kmalloc(sizeof(CsrWifiSmeMibConfigSetReq), GFP_KERNEL); \
2074     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_SET_REQ, dst__, src__); \
2075     msg__->mibConfig = (mibConfig__);
2076
2077 #define CsrWifiSmeMibConfigSetReqSendTo(dst__, src__, mibConfig__) \
2078     { \
2079         CsrWifiSmeMibConfigSetReq *msg__; \
2080         CsrWifiSmeMibConfigSetReqCreate(msg__, dst__, src__, mibConfig__); \
2081         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2082     }
2083
2084 #define CsrWifiSmeMibConfigSetReqSend(src__, mibConfig__) \
2085     CsrWifiSmeMibConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, mibConfig__)
2086
2087 /*******************************************************************************
2088
2089   NAME
2090     CsrWifiSmeMibConfigSetCfmSend
2091
2092   DESCRIPTION
2093     This primitive reports the result of the request.
2094
2095   PARAMETERS
2096     queue  - Destination Task Queue
2097     status - Reports the result of the request
2098
2099 *******************************************************************************/
2100 #define CsrWifiSmeMibConfigSetCfmCreate(msg__, dst__, src__, status__) \
2101     msg__ = kmalloc(sizeof(CsrWifiSmeMibConfigSetCfm), GFP_KERNEL); \
2102     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_SET_CFM, dst__, src__); \
2103     msg__->status = (status__);
2104
2105 #define CsrWifiSmeMibConfigSetCfmSendTo(dst__, src__, status__) \
2106     { \
2107         CsrWifiSmeMibConfigSetCfm *msg__; \
2108         CsrWifiSmeMibConfigSetCfmCreate(msg__, dst__, src__, status__); \
2109         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2110     }
2111
2112 #define CsrWifiSmeMibConfigSetCfmSend(dst__, status__) \
2113     CsrWifiSmeMibConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
2114
2115 /*******************************************************************************
2116
2117   NAME
2118     CsrWifiSmeMibGetCfmSend
2119
2120   DESCRIPTION
2121     The SME calls this primitive to return the requested MIB variable values.
2122
2123   PARAMETERS
2124     queue              - Destination Task Queue
2125     status             - Reports the result of the request
2126     mibAttributeLength - Length of mibAttribute
2127     mibAttribute       - Points to the VarBind or VarBindList containing the
2128                          names and values of the MIB variables requested
2129
2130 *******************************************************************************/
2131 #define CsrWifiSmeMibGetCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__) \
2132     msg__ = kmalloc(sizeof(CsrWifiSmeMibGetCfm), GFP_KERNEL); \
2133     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_CFM, dst__, src__); \
2134     msg__->status = (status__); \
2135     msg__->mibAttributeLength = (mibAttributeLength__); \
2136     msg__->mibAttribute = (mibAttribute__);
2137
2138 #define CsrWifiSmeMibGetCfmSendTo(dst__, src__, status__, mibAttributeLength__, mibAttribute__) \
2139     { \
2140         CsrWifiSmeMibGetCfm *msg__; \
2141         CsrWifiSmeMibGetCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__); \
2142         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2143     }
2144
2145 #define CsrWifiSmeMibGetCfmSend(dst__, status__, mibAttributeLength__, mibAttribute__) \
2146     CsrWifiSmeMibGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, mibAttributeLength__, mibAttribute__)
2147
2148 /*******************************************************************************
2149
2150   NAME
2151     CsrWifiSmeMibGetNextReqSend
2152
2153   DESCRIPTION
2154     To read a sequence of MIB parameters, for example a table, call this
2155     primitive to find the name of the next MIB variable
2156
2157   PARAMETERS
2158     queue              - Message Source Task Queue (Cfm's will be sent to this Queue)
2159     mibAttributeLength - Length of mibAttribute
2160     mibAttribute       - Points to a VarBind or VarBindList containing the
2161                          name(s) of the MIB variable(s) to search from.
2162
2163 *******************************************************************************/
2164 #define CsrWifiSmeMibGetNextReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__) \
2165     msg__ = kmalloc(sizeof(CsrWifiSmeMibGetNextReq), GFP_KERNEL); \
2166     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_NEXT_REQ, dst__, src__); \
2167     msg__->mibAttributeLength = (mibAttributeLength__); \
2168     msg__->mibAttribute = (mibAttribute__);
2169
2170 #define CsrWifiSmeMibGetNextReqSendTo(dst__, src__, mibAttributeLength__, mibAttribute__) \
2171     { \
2172         CsrWifiSmeMibGetNextReq *msg__; \
2173         CsrWifiSmeMibGetNextReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__); \
2174         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2175     }
2176
2177 #define CsrWifiSmeMibGetNextReqSend(src__, mibAttributeLength__, mibAttribute__) \
2178     CsrWifiSmeMibGetNextReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, mibAttributeLength__, mibAttribute__)
2179
2180 /*******************************************************************************
2181
2182   NAME
2183     CsrWifiSmeMibGetNextCfmSend
2184
2185   DESCRIPTION
2186     The SME calls this primitive to return the requested MIB name(s).
2187     The wireless manager application can then read the value of the MIB
2188     variable using CSR_WIFI_SME_MIB_GET_REQ, using the names provided.
2189
2190   PARAMETERS
2191     queue              - Destination Task Queue
2192     status             - Reports the result of the request
2193     mibAttributeLength - Length of mibAttribute
2194     mibAttribute       - Points to a VarBind or VarBindList containing the
2195                          name(s) of the MIB variable(s) lexicographically
2196                          following the name(s) given in the request
2197
2198 *******************************************************************************/
2199 #define CsrWifiSmeMibGetNextCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__) \
2200     msg__ = kmalloc(sizeof(CsrWifiSmeMibGetNextCfm), GFP_KERNEL); \
2201     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_NEXT_CFM, dst__, src__); \
2202     msg__->status = (status__); \
2203     msg__->mibAttributeLength = (mibAttributeLength__); \
2204     msg__->mibAttribute = (mibAttribute__);
2205
2206 #define CsrWifiSmeMibGetNextCfmSendTo(dst__, src__, status__, mibAttributeLength__, mibAttribute__) \
2207     { \
2208         CsrWifiSmeMibGetNextCfm *msg__; \
2209         CsrWifiSmeMibGetNextCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__); \
2210         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2211     }
2212
2213 #define CsrWifiSmeMibGetNextCfmSend(dst__, status__, mibAttributeLength__, mibAttribute__) \
2214     CsrWifiSmeMibGetNextCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, mibAttributeLength__, mibAttribute__)
2215
2216 /*******************************************************************************
2217
2218   NAME
2219     CsrWifiSmeMibGetReqSend
2220
2221   DESCRIPTION
2222     The wireless manager application calls this primitive to retrieve one or
2223     more MIB variables.
2224
2225   PARAMETERS
2226     queue              - Message Source Task Queue (Cfm's will be sent to this Queue)
2227     mibAttributeLength - Length of mibAttribute
2228     mibAttribute       - Points to the VarBind or VarBindList containing the
2229                          names of the MIB variables to be retrieved
2230
2231 *******************************************************************************/
2232 #define CsrWifiSmeMibGetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__) \
2233     msg__ = kmalloc(sizeof(CsrWifiSmeMibGetReq), GFP_KERNEL); \
2234     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_REQ, dst__, src__); \
2235     msg__->mibAttributeLength = (mibAttributeLength__); \
2236     msg__->mibAttribute = (mibAttribute__);
2237
2238 #define CsrWifiSmeMibGetReqSendTo(dst__, src__, mibAttributeLength__, mibAttribute__) \
2239     { \
2240         CsrWifiSmeMibGetReq *msg__; \
2241         CsrWifiSmeMibGetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__); \
2242         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2243     }
2244
2245 #define CsrWifiSmeMibGetReqSend(src__, mibAttributeLength__, mibAttribute__) \
2246     CsrWifiSmeMibGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, mibAttributeLength__, mibAttribute__)
2247
2248 /*******************************************************************************
2249
2250   NAME
2251     CsrWifiSmeMibSetReqSend
2252
2253   DESCRIPTION
2254     The SME provides raw access to the MIB on the chip, which may be used by
2255     some configuration or diagnostic utilities, but is not normally needed by
2256     the wireless manager application.
2257     The MIB access functions use BER encoded names (OID) of the MIB
2258     parameters and BER encoded values, as described in the chip Host
2259     Interface Protocol Specification.
2260     The MIB parameters are described in 'Wi-Fi 5.0.0 Management Information
2261     Base Reference Guide'.
2262     The wireless manager application calls this primitive to set one or more
2263     MIB variables
2264
2265   PARAMETERS
2266     queue              - Message Source Task Queue (Cfm's will be sent to this Queue)
2267     mibAttributeLength - Length of mibAttribute
2268     mibAttribute       - Points to the VarBind or VarBindList containing the
2269                          names and values of the MIB variables to set
2270
2271 *******************************************************************************/
2272 #define CsrWifiSmeMibSetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__) \
2273     msg__ = kmalloc(sizeof(CsrWifiSmeMibSetReq), GFP_KERNEL); \
2274     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_SET_REQ, dst__, src__); \
2275     msg__->mibAttributeLength = (mibAttributeLength__); \
2276     msg__->mibAttribute = (mibAttribute__);
2277
2278 #define CsrWifiSmeMibSetReqSendTo(dst__, src__, mibAttributeLength__, mibAttribute__) \
2279     { \
2280         CsrWifiSmeMibSetReq *msg__; \
2281         CsrWifiSmeMibSetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__); \
2282         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2283     }
2284
2285 #define CsrWifiSmeMibSetReqSend(src__, mibAttributeLength__, mibAttribute__) \
2286     CsrWifiSmeMibSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, mibAttributeLength__, mibAttribute__)
2287
2288 /*******************************************************************************
2289
2290   NAME
2291     CsrWifiSmeMibSetCfmSend
2292
2293   DESCRIPTION
2294     The SME calls the primitive to report the result of the set primitive.
2295
2296   PARAMETERS
2297     queue  - Destination Task Queue
2298     status - Reports the result of the request
2299
2300 *******************************************************************************/
2301 #define CsrWifiSmeMibSetCfmCreate(msg__, dst__, src__, status__) \
2302     msg__ = kmalloc(sizeof(CsrWifiSmeMibSetCfm), GFP_KERNEL); \
2303     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_SET_CFM, dst__, src__); \
2304     msg__->status = (status__);
2305
2306 #define CsrWifiSmeMibSetCfmSendTo(dst__, src__, status__) \
2307     { \
2308         CsrWifiSmeMibSetCfm *msg__; \
2309         CsrWifiSmeMibSetCfmCreate(msg__, dst__, src__, status__); \
2310         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2311     }
2312
2313 #define CsrWifiSmeMibSetCfmSend(dst__, status__) \
2314     CsrWifiSmeMibSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
2315
2316 /*******************************************************************************
2317
2318   NAME
2319     CsrWifiSmeMicFailureIndSend
2320
2321   DESCRIPTION
2322     The SME sends this primitive to all the tasks that have registered to
2323     receive it whenever the chip firmware reports a MIC failure.
2324
2325   PARAMETERS
2326     queue         - Destination Task Queue
2327     interfaceTag  - Interface Identifier; unique identifier of an interface
2328     secondFailure - TRUE if this indication is for a second failure in 60
2329                     seconds
2330     count         - The number of MIC failure events since the connection was
2331                     established
2332     address       - MAC address of the transmitter that caused the MIC failure
2333     keyType       - Type of key for which the failure occurred
2334
2335 *******************************************************************************/
2336 #define CsrWifiSmeMicFailureIndCreate(msg__, dst__, src__, interfaceTag__, secondFailure__, count__, address__, keyType__) \
2337     msg__ = kmalloc(sizeof(CsrWifiSmeMicFailureInd), GFP_KERNEL); \
2338     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIC_FAILURE_IND, dst__, src__); \
2339     msg__->interfaceTag = (interfaceTag__); \
2340     msg__->secondFailure = (secondFailure__); \
2341     msg__->count = (count__); \
2342     msg__->address = (address__); \
2343     msg__->keyType = (keyType__);
2344
2345 #define CsrWifiSmeMicFailureIndSendTo(dst__, src__, interfaceTag__, secondFailure__, count__, address__, keyType__) \
2346     { \
2347         CsrWifiSmeMicFailureInd *msg__; \
2348         CsrWifiSmeMicFailureIndCreate(msg__, dst__, src__, interfaceTag__, secondFailure__, count__, address__, keyType__); \
2349         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2350     }
2351
2352 #define CsrWifiSmeMicFailureIndSend(dst__, interfaceTag__, secondFailure__, count__, address__, keyType__) \
2353     CsrWifiSmeMicFailureIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, secondFailure__, count__, address__, keyType__)
2354
2355 /*******************************************************************************
2356
2357   NAME
2358     CsrWifiSmeMulticastAddressReqSend
2359
2360   DESCRIPTION
2361     The wireless manager application calls this primitive to specify the
2362     multicast addresses which the chip should recognise. The interface allows
2363     the wireless manager application to query, add, remove and flush the
2364     multicast addresses for the network interface according to the specified
2365     action.
2366
2367   PARAMETERS
2368     queue             - Message Source Task Queue (Cfm's will be sent to this Queue)
2369     interfaceTag      - Interface Identifier; unique identifier of an interface
2370     action            - The value of the CsrWifiSmeListAction parameter
2371                         instructs the driver to modify or provide the list of
2372                         MAC addresses.
2373     setAddressesCount - Number of MAC addresses sent with the primitive
2374     setAddresses      - Pointer to the list of MAC Addresses sent with the
2375                         primitive, set to NULL if none is sent.
2376
2377 *******************************************************************************/
2378 #define CsrWifiSmeMulticastAddressReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \
2379     msg__ = kmalloc(sizeof(CsrWifiSmeMulticastAddressReq), GFP_KERNEL); \
2380     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MULTICAST_ADDRESS_REQ, dst__, src__); \
2381     msg__->interfaceTag = (interfaceTag__); \
2382     msg__->action = (action__); \
2383     msg__->setAddressesCount = (setAddressesCount__); \
2384     msg__->setAddresses = (setAddresses__);
2385
2386 #define CsrWifiSmeMulticastAddressReqSendTo(dst__, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \
2387     { \
2388         CsrWifiSmeMulticastAddressReq *msg__; \
2389         CsrWifiSmeMulticastAddressReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__); \
2390         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2391     }
2392
2393 #define CsrWifiSmeMulticastAddressReqSend(src__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \
2394     CsrWifiSmeMulticastAddressReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__)
2395
2396 /*******************************************************************************
2397
2398   NAME
2399     CsrWifiSmeMulticastAddressCfmSend
2400
2401   DESCRIPTION
2402     The SME will call this primitive when the operation is complete. For a
2403     GET action, this primitive reports the current list of MAC addresses.
2404
2405   PARAMETERS
2406     queue             - Destination Task Queue
2407     interfaceTag      - Interface Identifier; unique identifier of an interface
2408     status            - Reports the result of the request
2409     action            - Action in the request
2410     getAddressesCount - This parameter is only relevant if action is
2411                         CSR_WIFI_SME_LIST_ACTION_GET:
2412                         number of MAC addresses sent with the primitive
2413     getAddresses      - Pointer to the list of MAC Addresses sent with the
2414                         primitive, set to NULL if none is sent.
2415
2416 *******************************************************************************/
2417 #define CsrWifiSmeMulticastAddressCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__) \
2418     msg__ = kmalloc(sizeof(CsrWifiSmeMulticastAddressCfm), GFP_KERNEL); \
2419     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MULTICAST_ADDRESS_CFM, dst__, src__); \
2420     msg__->interfaceTag = (interfaceTag__); \
2421     msg__->status = (status__); \
2422     msg__->action = (action__); \
2423     msg__->getAddressesCount = (getAddressesCount__); \
2424     msg__->getAddresses = (getAddresses__);
2425
2426 #define CsrWifiSmeMulticastAddressCfmSendTo(dst__, src__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__) \
2427     { \
2428         CsrWifiSmeMulticastAddressCfm *msg__; \
2429         CsrWifiSmeMulticastAddressCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__); \
2430         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2431     }
2432
2433 #define CsrWifiSmeMulticastAddressCfmSend(dst__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__) \
2434     CsrWifiSmeMulticastAddressCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__)
2435
2436 /*******************************************************************************
2437
2438   NAME
2439     CsrWifiSmePacketFilterSetReqSend
2440
2441   DESCRIPTION
2442     The wireless manager application should call this primitive to enable or
2443     disable filtering of broadcast packets: uninteresting broadcast packets
2444     will be dropped by the Wi-Fi chip, instead of passing them up to the
2445     host.
2446     This has the advantage of saving power in the host application processor
2447     as it removes the need to process unwanted packets.
2448     All broadcast packets are filtered according to the filter and the filter
2449     mode provided, except ARP packets, which are filtered using
2450     arpFilterAddress.
2451     Filters are not cumulative: only the parameters specified in the most
2452     recent successful request are significant.
2453     For more information, see 'UniFi Firmware API Specification'.
2454
2455   PARAMETERS
2456     queue            - Message Source Task Queue (Cfm's will be sent to this Queue)
2457     interfaceTag     - Interface Identifier; unique identifier of an interface
2458     filterLength     - Length of the filter in bytes.
2459                        filterLength=0 disables the filter previously set
2460     filter           - Points to the first byte of the filter provided, if any.
2461                        This shall include zero or more instance of the
2462                        information elements of one of these types
2463                          * Traffic Classification (TCLAS) elements
2464                          * WMM-SA TCLAS elements
2465     mode             - Specifies whether the filter selects or excludes packets
2466                        matching the filter
2467     arpFilterAddress - IPv4 address to be used for filtering the ARP packets.
2468                          * If the specified address is the IPv4 broadcast address
2469                            (255.255.255.255), all ARP packets are reported to the
2470                            host,
2471                          * If the specified address is NOT the IPv4 broadcast
2472                            address, only ARP packets with the specified address in
2473                            the Source or Target Protocol Address fields are reported
2474                            to the host
2475
2476 *******************************************************************************/
2477 #define CsrWifiSmePacketFilterSetReqCreate(msg__, dst__, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__) \
2478     msg__ = kmalloc(sizeof(CsrWifiSmePacketFilterSetReq), GFP_KERNEL); \
2479     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PACKET_FILTER_SET_REQ, dst__, src__); \
2480     msg__->interfaceTag = (interfaceTag__); \
2481     msg__->filterLength = (filterLength__); \
2482     msg__->filter = (filter__); \
2483     msg__->mode = (mode__); \
2484     msg__->arpFilterAddress = (arpFilterAddress__);
2485
2486 #define CsrWifiSmePacketFilterSetReqSendTo(dst__, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__) \
2487     { \
2488         CsrWifiSmePacketFilterSetReq *msg__; \
2489         CsrWifiSmePacketFilterSetReqCreate(msg__, dst__, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__); \
2490         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2491     }
2492
2493 #define CsrWifiSmePacketFilterSetReqSend(src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__) \
2494     CsrWifiSmePacketFilterSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__)
2495
2496 /*******************************************************************************
2497
2498   NAME
2499     CsrWifiSmePacketFilterSetCfmSend
2500
2501   DESCRIPTION
2502     The SME calls the primitive to report the result of the set primitive.
2503
2504   PARAMETERS
2505     queue        - Destination Task Queue
2506     interfaceTag - Interface Identifier; unique identifier of an interface
2507     status       - Reports the result of the request
2508
2509 *******************************************************************************/
2510 #define CsrWifiSmePacketFilterSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
2511     msg__ = kmalloc(sizeof(CsrWifiSmePacketFilterSetCfm), GFP_KERNEL); \
2512     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PACKET_FILTER_SET_CFM, dst__, src__); \
2513     msg__->interfaceTag = (interfaceTag__); \
2514     msg__->status = (status__);
2515
2516 #define CsrWifiSmePacketFilterSetCfmSendTo(dst__, src__, interfaceTag__, status__) \
2517     { \
2518         CsrWifiSmePacketFilterSetCfm *msg__; \
2519         CsrWifiSmePacketFilterSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
2520         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2521     }
2522
2523 #define CsrWifiSmePacketFilterSetCfmSend(dst__, interfaceTag__, status__) \
2524     CsrWifiSmePacketFilterSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
2525
2526 /*******************************************************************************
2527
2528   NAME
2529     CsrWifiSmePermanentMacAddressGetReqSend
2530
2531   DESCRIPTION
2532     This primitive retrieves the MAC address stored in EEPROM
2533
2534   PARAMETERS
2535     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
2536
2537 *******************************************************************************/
2538 #define CsrWifiSmePermanentMacAddressGetReqCreate(msg__, dst__, src__) \
2539     msg__ = kmalloc(sizeof(CsrWifiSmePermanentMacAddressGetReq), GFP_KERNEL); \
2540     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_REQ, dst__, src__);
2541
2542 #define CsrWifiSmePermanentMacAddressGetReqSendTo(dst__, src__) \
2543     { \
2544         CsrWifiSmePermanentMacAddressGetReq *msg__; \
2545         CsrWifiSmePermanentMacAddressGetReqCreate(msg__, dst__, src__); \
2546         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2547     }
2548
2549 #define CsrWifiSmePermanentMacAddressGetReqSend(src__) \
2550     CsrWifiSmePermanentMacAddressGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
2551
2552 /*******************************************************************************
2553
2554   NAME
2555     CsrWifiSmePermanentMacAddressGetCfmSend
2556
2557   DESCRIPTION
2558     This primitive reports the result of the request.
2559
2560   PARAMETERS
2561     queue               - Destination Task Queue
2562     status              - Reports the result of the request
2563     permanentMacAddress - MAC address stored in the EEPROM
2564
2565 *******************************************************************************/
2566 #define CsrWifiSmePermanentMacAddressGetCfmCreate(msg__, dst__, src__, status__, permanentMacAddress__) \
2567     msg__ = kmalloc(sizeof(CsrWifiSmePermanentMacAddressGetCfm), GFP_KERNEL); \
2568     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_CFM, dst__, src__); \
2569     msg__->status = (status__); \
2570     msg__->permanentMacAddress = (permanentMacAddress__);
2571
2572 #define CsrWifiSmePermanentMacAddressGetCfmSendTo(dst__, src__, status__, permanentMacAddress__) \
2573     { \
2574         CsrWifiSmePermanentMacAddressGetCfm *msg__; \
2575         CsrWifiSmePermanentMacAddressGetCfmCreate(msg__, dst__, src__, status__, permanentMacAddress__); \
2576         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2577     }
2578
2579 #define CsrWifiSmePermanentMacAddressGetCfmSend(dst__, status__, permanentMacAddress__) \
2580     CsrWifiSmePermanentMacAddressGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, permanentMacAddress__)
2581
2582 /*******************************************************************************
2583
2584   NAME
2585     CsrWifiSmePmkidCandidateListIndSend
2586
2587   DESCRIPTION
2588     The SME will send this primitive to all the tasks that have registered to
2589     receive it when a new network supporting preauthentication and/or PMK
2590     caching is seen.
2591
2592   PARAMETERS
2593     queue                - Destination Task Queue
2594     interfaceTag         - Interface Identifier; unique identifier of an
2595                            interface
2596     pmkidCandidatesCount - Number of PMKID candidates provided
2597     pmkidCandidates      - Points to the first PMKID candidate
2598
2599 *******************************************************************************/
2600 #define CsrWifiSmePmkidCandidateListIndCreate(msg__, dst__, src__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__) \
2601     msg__ = kmalloc(sizeof(CsrWifiSmePmkidCandidateListInd), GFP_KERNEL); \
2602     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND, dst__, src__); \
2603     msg__->interfaceTag = (interfaceTag__); \
2604     msg__->pmkidCandidatesCount = (pmkidCandidatesCount__); \
2605     msg__->pmkidCandidates = (pmkidCandidates__);
2606
2607 #define CsrWifiSmePmkidCandidateListIndSendTo(dst__, src__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__) \
2608     { \
2609         CsrWifiSmePmkidCandidateListInd *msg__; \
2610         CsrWifiSmePmkidCandidateListIndCreate(msg__, dst__, src__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__); \
2611         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2612     }
2613
2614 #define CsrWifiSmePmkidCandidateListIndSend(dst__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__) \
2615     CsrWifiSmePmkidCandidateListIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__)
2616
2617 /*******************************************************************************
2618
2619   NAME
2620     CsrWifiSmePmkidReqSend
2621
2622   DESCRIPTION
2623     The wireless manager application calls this primitive to request an
2624     operation on the SME PMKID list.
2625     The action argument specifies the operation to perform.
2626     When the connection is complete, the wireless manager application may
2627     then send and receive EAPOL packets to complete WPA or WPA2
2628     authentication if appropriate.
2629     The wireless manager application can then pass the resulting encryption
2630     keys using this primitive.
2631
2632   PARAMETERS
2633     queue          - Message Source Task Queue (Cfm's will be sent to this Queue)
2634     interfaceTag   - Interface Identifier; unique identifier of an interface
2635     action         - The value of the CsrWifiSmeListAction parameter instructs
2636                      the driver to modify or provide the list of PMKIDs.
2637     setPmkidsCount - Number of PMKIDs sent with the primitive
2638     setPmkids      - Pointer to the list of PMKIDs sent with the primitive, set
2639                      to NULL if none is sent.
2640
2641 *******************************************************************************/
2642 #define CsrWifiSmePmkidReqCreate(msg__, dst__, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__) \
2643     msg__ = kmalloc(sizeof(CsrWifiSmePmkidReq), GFP_KERNEL); \
2644     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PMKID_REQ, dst__, src__); \
2645     msg__->interfaceTag = (interfaceTag__); \
2646     msg__->action = (action__); \
2647     msg__->setPmkidsCount = (setPmkidsCount__); \
2648     msg__->setPmkids = (setPmkids__);
2649
2650 #define CsrWifiSmePmkidReqSendTo(dst__, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__) \
2651     { \
2652         CsrWifiSmePmkidReq *msg__; \
2653         CsrWifiSmePmkidReqCreate(msg__, dst__, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__); \
2654         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2655     }
2656
2657 #define CsrWifiSmePmkidReqSend(src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__) \
2658     CsrWifiSmePmkidReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__)
2659
2660 /*******************************************************************************
2661
2662   NAME
2663     CsrWifiSmePmkidCfmSend
2664
2665   DESCRIPTION
2666     The SME will call this primitive when the operation is complete. For a
2667     GET action, this primitive reports the current list of PMKIDs
2668
2669   PARAMETERS
2670     queue          - Destination Task Queue
2671     interfaceTag   - Interface Identifier; unique identifier of an interface
2672     status         - Reports the result of the request
2673     action         - Action in the request
2674     getPmkidsCount - This parameter is only relevant if action is
2675                      CSR_WIFI_SME_LIST_ACTION_GET:
2676                      number of PMKIDs sent with the primitive
2677     getPmkids      - Pointer to the list of PMKIDs sent with the primitive, set
2678                      to NULL if none is sent.
2679
2680 *******************************************************************************/
2681 #define CsrWifiSmePmkidCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__) \
2682     msg__ = kmalloc(sizeof(CsrWifiSmePmkidCfm), GFP_KERNEL); \
2683     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PMKID_CFM, dst__, src__); \
2684     msg__->interfaceTag = (interfaceTag__); \
2685     msg__->status = (status__); \
2686     msg__->action = (action__); \
2687     msg__->getPmkidsCount = (getPmkidsCount__); \
2688     msg__->getPmkids = (getPmkids__);
2689
2690 #define CsrWifiSmePmkidCfmSendTo(dst__, src__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__) \
2691     { \
2692         CsrWifiSmePmkidCfm *msg__; \
2693         CsrWifiSmePmkidCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__); \
2694         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2695     }
2696
2697 #define CsrWifiSmePmkidCfmSend(dst__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__) \
2698     CsrWifiSmePmkidCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__)
2699
2700 /*******************************************************************************
2701
2702   NAME
2703     CsrWifiSmePowerConfigGetReqSend
2704
2705   DESCRIPTION
2706     This primitive gets the value of the PowerConfig parameter.
2707
2708   PARAMETERS
2709     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
2710
2711 *******************************************************************************/
2712 #define CsrWifiSmePowerConfigGetReqCreate(msg__, dst__, src__) \
2713     msg__ = kmalloc(sizeof(CsrWifiSmePowerConfigGetReq), GFP_KERNEL); \
2714     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_GET_REQ, dst__, src__);
2715
2716 #define CsrWifiSmePowerConfigGetReqSendTo(dst__, src__) \
2717     { \
2718         CsrWifiSmePowerConfigGetReq *msg__; \
2719         CsrWifiSmePowerConfigGetReqCreate(msg__, dst__, src__); \
2720         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2721     }
2722
2723 #define CsrWifiSmePowerConfigGetReqSend(src__) \
2724     CsrWifiSmePowerConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
2725
2726 /*******************************************************************************
2727
2728   NAME
2729     CsrWifiSmePowerConfigGetCfmSend
2730
2731   DESCRIPTION
2732     This primitive reports the result of the request.
2733
2734   PARAMETERS
2735     queue       - Destination Task Queue
2736     status      - Reports the result of the request
2737     powerConfig - Returns the current parameters for the power configuration of
2738                   the firmware
2739
2740 *******************************************************************************/
2741 #define CsrWifiSmePowerConfigGetCfmCreate(msg__, dst__, src__, status__, powerConfig__) \
2742     msg__ = kmalloc(sizeof(CsrWifiSmePowerConfigGetCfm), GFP_KERNEL); \
2743     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_GET_CFM, dst__, src__); \
2744     msg__->status = (status__); \
2745     msg__->powerConfig = (powerConfig__);
2746
2747 #define CsrWifiSmePowerConfigGetCfmSendTo(dst__, src__, status__, powerConfig__) \
2748     { \
2749         CsrWifiSmePowerConfigGetCfm *msg__; \
2750         CsrWifiSmePowerConfigGetCfmCreate(msg__, dst__, src__, status__, powerConfig__); \
2751         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2752     }
2753
2754 #define CsrWifiSmePowerConfigGetCfmSend(dst__, status__, powerConfig__) \
2755     CsrWifiSmePowerConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, powerConfig__)
2756
2757 /*******************************************************************************
2758
2759   NAME
2760     CsrWifiSmePowerConfigSetReqSend
2761
2762   DESCRIPTION
2763     This primitive sets the value of the PowerConfig parameter.
2764
2765   PARAMETERS
2766     queue       - Message Source Task Queue (Cfm's will be sent to this Queue)
2767     powerConfig - Power saving configuration
2768
2769 *******************************************************************************/
2770 #define CsrWifiSmePowerConfigSetReqCreate(msg__, dst__, src__, powerConfig__) \
2771     msg__ = kmalloc(sizeof(CsrWifiSmePowerConfigSetReq), GFP_KERNEL); \
2772     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_SET_REQ, dst__, src__); \
2773     msg__->powerConfig = (powerConfig__);
2774
2775 #define CsrWifiSmePowerConfigSetReqSendTo(dst__, src__, powerConfig__) \
2776     { \
2777         CsrWifiSmePowerConfigSetReq *msg__; \
2778         CsrWifiSmePowerConfigSetReqCreate(msg__, dst__, src__, powerConfig__); \
2779         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2780     }
2781
2782 #define CsrWifiSmePowerConfigSetReqSend(src__, powerConfig__) \
2783     CsrWifiSmePowerConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, powerConfig__)
2784
2785 /*******************************************************************************
2786
2787   NAME
2788     CsrWifiSmePowerConfigSetCfmSend
2789
2790   DESCRIPTION
2791     This primitive reports the result of the request.
2792
2793   PARAMETERS
2794     queue  - Destination Task Queue
2795     status - Reports the result of the request
2796
2797 *******************************************************************************/
2798 #define CsrWifiSmePowerConfigSetCfmCreate(msg__, dst__, src__, status__) \
2799     msg__ = kmalloc(sizeof(CsrWifiSmePowerConfigSetCfm), GFP_KERNEL); \
2800     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_SET_CFM, dst__, src__); \
2801     msg__->status = (status__);
2802
2803 #define CsrWifiSmePowerConfigSetCfmSendTo(dst__, src__, status__) \
2804     { \
2805         CsrWifiSmePowerConfigSetCfm *msg__; \
2806         CsrWifiSmePowerConfigSetCfmCreate(msg__, dst__, src__, status__); \
2807         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2808     }
2809
2810 #define CsrWifiSmePowerConfigSetCfmSend(dst__, status__) \
2811     CsrWifiSmePowerConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
2812
2813 /*******************************************************************************
2814
2815   NAME
2816     CsrWifiSmeRegulatoryDomainInfoGetReqSend
2817
2818   DESCRIPTION
2819     This primitive gets the value of the RegulatoryDomainInfo parameter.
2820
2821   PARAMETERS
2822     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
2823
2824 *******************************************************************************/
2825 #define CsrWifiSmeRegulatoryDomainInfoGetReqCreate(msg__, dst__, src__) \
2826     msg__ = kmalloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetReq), GFP_KERNEL); \
2827     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_REQ, dst__, src__);
2828
2829 #define CsrWifiSmeRegulatoryDomainInfoGetReqSendTo(dst__, src__) \
2830     { \
2831         CsrWifiSmeRegulatoryDomainInfoGetReq *msg__; \
2832         CsrWifiSmeRegulatoryDomainInfoGetReqCreate(msg__, dst__, src__); \
2833         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2834     }
2835
2836 #define CsrWifiSmeRegulatoryDomainInfoGetReqSend(src__) \
2837     CsrWifiSmeRegulatoryDomainInfoGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
2838
2839 /*******************************************************************************
2840
2841   NAME
2842     CsrWifiSmeRegulatoryDomainInfoGetCfmSend
2843
2844   DESCRIPTION
2845     This primitive reports the result of the request.
2846
2847   PARAMETERS
2848     queue      - Destination Task Queue
2849     status     - Reports the result of the request
2850     regDomInfo - Reports information and state related to regulatory domain
2851                  operation.
2852
2853 *******************************************************************************/
2854 #define CsrWifiSmeRegulatoryDomainInfoGetCfmCreate(msg__, dst__, src__, status__, regDomInfo__) \
2855     msg__ = kmalloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetCfm), GFP_KERNEL); \
2856     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_CFM, dst__, src__); \
2857     msg__->status = (status__); \
2858     msg__->regDomInfo = (regDomInfo__);
2859
2860 #define CsrWifiSmeRegulatoryDomainInfoGetCfmSendTo(dst__, src__, status__, regDomInfo__) \
2861     { \
2862         CsrWifiSmeRegulatoryDomainInfoGetCfm *msg__; \
2863         CsrWifiSmeRegulatoryDomainInfoGetCfmCreate(msg__, dst__, src__, status__, regDomInfo__); \
2864         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2865     }
2866
2867 #define CsrWifiSmeRegulatoryDomainInfoGetCfmSend(dst__, status__, regDomInfo__) \
2868     CsrWifiSmeRegulatoryDomainInfoGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, regDomInfo__)
2869
2870 /*******************************************************************************
2871
2872   NAME
2873     CsrWifiSmeRoamCompleteIndSend
2874
2875   DESCRIPTION
2876     The SME will send this primitive to all the tasks that have registered to
2877     receive it whenever it completes an attempt to roam to an AP. If the roam
2878     attempt was successful, status will be set to CSR_WIFI_SME_SUCCESS,
2879     otherwise it shall be set to the appropriate error code.
2880
2881   PARAMETERS
2882     queue        - Destination Task Queue
2883     interfaceTag - Interface Identifier; unique identifier of an interface
2884     status       - Reports the result of the roaming procedure
2885
2886 *******************************************************************************/
2887 #define CsrWifiSmeRoamCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__) \
2888     msg__ = kmalloc(sizeof(CsrWifiSmeRoamCompleteInd), GFP_KERNEL); \
2889     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAM_COMPLETE_IND, dst__, src__); \
2890     msg__->interfaceTag = (interfaceTag__); \
2891     msg__->status = (status__);
2892
2893 #define CsrWifiSmeRoamCompleteIndSendTo(dst__, src__, interfaceTag__, status__) \
2894     { \
2895         CsrWifiSmeRoamCompleteInd *msg__; \
2896         CsrWifiSmeRoamCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__); \
2897         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2898     }
2899
2900 #define CsrWifiSmeRoamCompleteIndSend(dst__, interfaceTag__, status__) \
2901     CsrWifiSmeRoamCompleteIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
2902
2903 /*******************************************************************************
2904
2905   NAME
2906     CsrWifiSmeRoamStartIndSend
2907
2908   DESCRIPTION
2909     The SME will send this primitive to all the tasks that have registered to
2910     receive it whenever it begins an attempt to roam to an AP.
2911     If the wireless manager application connect request specified the SSID
2912     and the BSSID was set to the broadcast address (0xFF 0xFF 0xFF 0xFF 0xFF
2913     0xFF), the SME monitors the signal quality and maintains a list of
2914     candidates to roam to. When the signal quality of the current connection
2915     falls below a threshold, and there is a candidate with better quality,
2916     the SME will attempt to the candidate AP.
2917     If the roaming procedure succeeds, the SME will also issue a Media
2918     Connect indication to inform the wireless manager application of the
2919     change.
2920     NOTE: to prevent the SME from initiating roaming the WMA must specify the
2921     BSSID in the connection request; this forces the SME to connect only to
2922     that AP.
2923     The wireless manager application can obtain statistics for roaming
2924     purposes using CSR_WIFI_SME_CONNECTION_QUALITY_IND and
2925     CSR_WIFI_SME_CONNECTION_STATS_GET_REQ.
2926     When the wireless manager application wishes to roam to another AP, it
2927     must issue a connection request specifying the BSSID of the desired AP.
2928
2929   PARAMETERS
2930     queue        - Destination Task Queue
2931     interfaceTag - Interface Identifier; unique identifier of an interface
2932     roamReason   - Indicates the reason for starting the roaming procedure
2933     reason80211  - Indicates the reason for deauthentication or disassociation
2934
2935 *******************************************************************************/
2936 #define CsrWifiSmeRoamStartIndCreate(msg__, dst__, src__, interfaceTag__, roamReason__, reason80211__) \
2937     msg__ = kmalloc(sizeof(CsrWifiSmeRoamStartInd), GFP_KERNEL); \
2938     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAM_START_IND, dst__, src__); \
2939     msg__->interfaceTag = (interfaceTag__); \
2940     msg__->roamReason = (roamReason__); \
2941     msg__->reason80211 = (reason80211__);
2942
2943 #define CsrWifiSmeRoamStartIndSendTo(dst__, src__, interfaceTag__, roamReason__, reason80211__) \
2944     { \
2945         CsrWifiSmeRoamStartInd *msg__; \
2946         CsrWifiSmeRoamStartIndCreate(msg__, dst__, src__, interfaceTag__, roamReason__, reason80211__); \
2947         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2948     }
2949
2950 #define CsrWifiSmeRoamStartIndSend(dst__, interfaceTag__, roamReason__, reason80211__) \
2951     CsrWifiSmeRoamStartIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, roamReason__, reason80211__)
2952
2953 /*******************************************************************************
2954
2955   NAME
2956     CsrWifiSmeRoamingConfigGetReqSend
2957
2958   DESCRIPTION
2959     This primitive gets the value of the RoamingConfig parameter.
2960
2961   PARAMETERS
2962     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
2963     interfaceTag - Interface Identifier; unique identifier of an interface
2964
2965 *******************************************************************************/
2966 #define CsrWifiSmeRoamingConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \
2967     msg__ = kmalloc(sizeof(CsrWifiSmeRoamingConfigGetReq), GFP_KERNEL); \
2968     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_GET_REQ, dst__, src__); \
2969     msg__->interfaceTag = (interfaceTag__);
2970
2971 #define CsrWifiSmeRoamingConfigGetReqSendTo(dst__, src__, interfaceTag__) \
2972     { \
2973         CsrWifiSmeRoamingConfigGetReq *msg__; \
2974         CsrWifiSmeRoamingConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \
2975         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2976     }
2977
2978 #define CsrWifiSmeRoamingConfigGetReqSend(src__, interfaceTag__) \
2979     CsrWifiSmeRoamingConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
2980
2981 /*******************************************************************************
2982
2983   NAME
2984     CsrWifiSmeRoamingConfigGetCfmSend
2985
2986   DESCRIPTION
2987     This primitive reports the result of the request.
2988
2989   PARAMETERS
2990     queue         - Destination Task Queue
2991     interfaceTag  - Interface Identifier; unique identifier of an interface
2992     status        - Reports the result of the request
2993     roamingConfig - Reports the roaming behaviour of the driver and firmware
2994
2995 *******************************************************************************/
2996 #define CsrWifiSmeRoamingConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, roamingConfig__) \
2997     msg__ = kmalloc(sizeof(CsrWifiSmeRoamingConfigGetCfm), GFP_KERNEL); \
2998     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_GET_CFM, dst__, src__); \
2999     msg__->interfaceTag = (interfaceTag__); \
3000     msg__->status = (status__); \
3001     msg__->roamingConfig = (roamingConfig__);
3002
3003 #define CsrWifiSmeRoamingConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, roamingConfig__) \
3004     { \
3005         CsrWifiSmeRoamingConfigGetCfm *msg__; \
3006         CsrWifiSmeRoamingConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, roamingConfig__); \
3007         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3008     }
3009
3010 #define CsrWifiSmeRoamingConfigGetCfmSend(dst__, interfaceTag__, status__, roamingConfig__) \
3011     CsrWifiSmeRoamingConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, roamingConfig__)
3012
3013 /*******************************************************************************
3014
3015   NAME
3016     CsrWifiSmeRoamingConfigSetReqSend
3017
3018   DESCRIPTION
3019     This primitive sets the value of the RoamingConfig parameter.
3020
3021   PARAMETERS
3022     queue         - Message Source Task Queue (Cfm's will be sent to this Queue)
3023     interfaceTag  - Interface Identifier; unique identifier of an interface
3024     roamingConfig - Desired roaming behaviour values
3025
3026 *******************************************************************************/
3027 #define CsrWifiSmeRoamingConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, roamingConfig__) \
3028     msg__ = kmalloc(sizeof(CsrWifiSmeRoamingConfigSetReq), GFP_KERNEL); \
3029     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_SET_REQ, dst__, src__); \
3030     msg__->interfaceTag = (interfaceTag__); \
3031     msg__->roamingConfig = (roamingConfig__);
3032
3033 #define CsrWifiSmeRoamingConfigSetReqSendTo(dst__, src__, interfaceTag__, roamingConfig__) \
3034     { \
3035         CsrWifiSmeRoamingConfigSetReq *msg__; \
3036         CsrWifiSmeRoamingConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, roamingConfig__); \
3037         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3038     }
3039
3040 #define CsrWifiSmeRoamingConfigSetReqSend(src__, interfaceTag__, roamingConfig__) \
3041     CsrWifiSmeRoamingConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, roamingConfig__)
3042
3043 /*******************************************************************************
3044
3045   NAME
3046     CsrWifiSmeRoamingConfigSetCfmSend
3047
3048   DESCRIPTION
3049     This primitive sets the value of the RoamingConfig parameter.
3050
3051   PARAMETERS
3052     queue        - Destination Task Queue
3053     interfaceTag - Interface Identifier; unique identifier of an interface
3054     status       - Reports the result of the request
3055
3056 *******************************************************************************/
3057 #define CsrWifiSmeRoamingConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
3058     msg__ = kmalloc(sizeof(CsrWifiSmeRoamingConfigSetCfm), GFP_KERNEL); \
3059     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_SET_CFM, dst__, src__); \
3060     msg__->interfaceTag = (interfaceTag__); \
3061     msg__->status = (status__);
3062
3063 #define CsrWifiSmeRoamingConfigSetCfmSendTo(dst__, src__, interfaceTag__, status__) \
3064     { \
3065         CsrWifiSmeRoamingConfigSetCfm *msg__; \
3066         CsrWifiSmeRoamingConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
3067         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3068     }
3069
3070 #define CsrWifiSmeRoamingConfigSetCfmSend(dst__, interfaceTag__, status__) \
3071     CsrWifiSmeRoamingConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
3072
3073 /*******************************************************************************
3074
3075   NAME
3076     CsrWifiSmeScanConfigGetReqSend
3077
3078   DESCRIPTION
3079     This primitive gets the value of the ScanConfig parameter.
3080
3081   PARAMETERS
3082     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
3083
3084 *******************************************************************************/
3085 #define CsrWifiSmeScanConfigGetReqCreate(msg__, dst__, src__) \
3086     msg__ = kmalloc(sizeof(CsrWifiSmeScanConfigGetReq), GFP_KERNEL); \
3087     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_GET_REQ, dst__, src__);
3088
3089 #define CsrWifiSmeScanConfigGetReqSendTo(dst__, src__) \
3090     { \
3091         CsrWifiSmeScanConfigGetReq *msg__; \
3092         CsrWifiSmeScanConfigGetReqCreate(msg__, dst__, src__); \
3093         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3094     }
3095
3096 #define CsrWifiSmeScanConfigGetReqSend(src__) \
3097     CsrWifiSmeScanConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
3098
3099 /*******************************************************************************
3100
3101   NAME
3102     CsrWifiSmeScanConfigGetCfmSend
3103
3104   DESCRIPTION
3105     This primitive reports the result of the request.
3106
3107   PARAMETERS
3108     queue      - Destination Task Queue
3109     status     - Reports the result of the request
3110     scanConfig - Returns the current parameters for the autonomous scanning
3111                  behaviour of the firmware
3112
3113 *******************************************************************************/
3114 #define CsrWifiSmeScanConfigGetCfmCreate(msg__, dst__, src__, status__, scanConfig__) \
3115     msg__ = kmalloc(sizeof(CsrWifiSmeScanConfigGetCfm), GFP_KERNEL); \
3116     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_GET_CFM, dst__, src__); \
3117     msg__->status = (status__); \
3118     msg__->scanConfig = (scanConfig__);
3119
3120 #define CsrWifiSmeScanConfigGetCfmSendTo(dst__, src__, status__, scanConfig__) \
3121     { \
3122         CsrWifiSmeScanConfigGetCfm *msg__; \
3123         CsrWifiSmeScanConfigGetCfmCreate(msg__, dst__, src__, status__, scanConfig__); \
3124         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3125     }
3126
3127 #define CsrWifiSmeScanConfigGetCfmSend(dst__, status__, scanConfig__) \
3128     CsrWifiSmeScanConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, scanConfig__)
3129
3130 /*******************************************************************************
3131
3132   NAME
3133     CsrWifiSmeScanConfigSetReqSend
3134
3135   DESCRIPTION
3136     This primitive sets the value of the ScanConfig parameter.
3137     The SME normally configures the firmware to perform autonomous scanning
3138     without involving the host.
3139     The firmware passes beacon / probe response or indicates loss of beacon
3140     on certain changes of state, for example:
3141       * A new AP is seen for the first time
3142       * An AP is no longer visible
3143       * The signal strength of an AP changes by more than a certain amount, as
3144         configured by the thresholds in the scanConfig parameter
3145     In addition to the autonomous scan, the wireless manager application may
3146     request a scan at any time using CSR_WIFI_SME_SCAN_FULL_REQ.
3147
3148   PARAMETERS
3149     queue      - Message Source Task Queue (Cfm's will be sent to this Queue)
3150     scanConfig - Reports the configuration for the autonomous scanning behaviour
3151                  of the firmware
3152
3153 *******************************************************************************/
3154 #define CsrWifiSmeScanConfigSetReqCreate(msg__, dst__, src__, scanConfig__) \
3155     msg__ = kmalloc(sizeof(CsrWifiSmeScanConfigSetReq), GFP_KERNEL); \
3156     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_SET_REQ, dst__, src__); \
3157     msg__->scanConfig = (scanConfig__);
3158
3159 #define CsrWifiSmeScanConfigSetReqSendTo(dst__, src__, scanConfig__) \
3160     { \
3161         CsrWifiSmeScanConfigSetReq *msg__; \
3162         CsrWifiSmeScanConfigSetReqCreate(msg__, dst__, src__, scanConfig__); \
3163         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3164     }
3165
3166 #define CsrWifiSmeScanConfigSetReqSend(src__, scanConfig__) \
3167     CsrWifiSmeScanConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, scanConfig__)
3168
3169 /*******************************************************************************
3170
3171   NAME
3172     CsrWifiSmeScanConfigSetCfmSend
3173
3174   DESCRIPTION
3175     This primitive reports the result of the request.
3176
3177   PARAMETERS
3178     queue  - Destination Task Queue
3179     status - Reports the result of the request
3180
3181 *******************************************************************************/
3182 #define CsrWifiSmeScanConfigSetCfmCreate(msg__, dst__, src__, status__) \
3183     msg__ = kmalloc(sizeof(CsrWifiSmeScanConfigSetCfm), GFP_KERNEL); \
3184     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_SET_CFM, dst__, src__); \
3185     msg__->status = (status__);
3186
3187 #define CsrWifiSmeScanConfigSetCfmSendTo(dst__, src__, status__) \
3188     { \
3189         CsrWifiSmeScanConfigSetCfm *msg__; \
3190         CsrWifiSmeScanConfigSetCfmCreate(msg__, dst__, src__, status__); \
3191         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3192     }
3193
3194 #define CsrWifiSmeScanConfigSetCfmSend(dst__, status__) \
3195     CsrWifiSmeScanConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
3196
3197 /*******************************************************************************
3198
3199   NAME
3200     CsrWifiSmeScanFullReqSend
3201
3202   DESCRIPTION
3203     The wireless manager application should call this primitive to request a
3204     full scan.
3205     Channels are scanned actively or passively according to the requirement
3206     set by regulatory domain.
3207     If the SME receives this primitive while a full scan is going on, the new
3208     request is buffered and it will be served after the current full scan is
3209     completed.
3210
3211   PARAMETERS
3212     queue            - Message Source Task Queue (Cfm's will be sent to this Queue)
3213     ssidCount        - Number of SSIDs provided.
3214                        If it is 0, the SME will attempt to detect any network
3215     ssid             - Points to the first SSID provided, if any.
3216     bssid            - BSS identifier.
3217                        If it is equal to FF-FF-FF-FF-FF, the SME will listen for
3218                        messages from any BSS.
3219                        If it is different from FF-FF-FF-FF-FF and any SSID is
3220                        provided, one SSID must match the network of the BSS.
3221     forceScan        - Forces the scan even if the SME is in a state which would
3222                        normally prevent it (e.g. autonomous scan is running).
3223     bssType          - Type of BSS to scan for
3224     scanType         - Type of scan to perform
3225     channelListCount - Number of channels provided.
3226                        If it is 0, the SME will initiate a scan of all the
3227                        supported channels that are permitted by the current
3228                        regulatory domain.
3229     channelList      - Points to the first channel , or NULL if channelListCount
3230                        is zero.
3231     probeIeLength    - Length of the information element in bytes to be sent
3232                        with the probe message.
3233     probeIe          - Points to the first byte of the information element to be
3234                        sent with the probe message.
3235
3236 *******************************************************************************/
3237 #define CsrWifiSmeScanFullReqCreate(msg__, dst__, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__) \
3238     msg__ = kmalloc(sizeof(CsrWifiSmeScanFullReq), GFP_KERNEL); \
3239     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_FULL_REQ, dst__, src__); \
3240     msg__->ssidCount = (ssidCount__); \
3241     msg__->ssid = (ssid__); \
3242     msg__->bssid = (bssid__); \
3243     msg__->forceScan = (forceScan__); \
3244     msg__->bssType = (bssType__); \
3245     msg__->scanType = (scanType__); \
3246     msg__->channelListCount = (channelListCount__); \
3247     msg__->channelList = (channelList__); \
3248     msg__->probeIeLength = (probeIeLength__); \
3249     msg__->probeIe = (probeIe__);
3250
3251 #define CsrWifiSmeScanFullReqSendTo(dst__, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__) \
3252     { \
3253         CsrWifiSmeScanFullReq *msg__; \
3254         CsrWifiSmeScanFullReqCreate(msg__, dst__, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__); \
3255         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3256     }
3257
3258 #define CsrWifiSmeScanFullReqSend(src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__) \
3259     CsrWifiSmeScanFullReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__)
3260
3261 /*******************************************************************************
3262
3263   NAME
3264     CsrWifiSmeScanFullCfmSend
3265
3266   DESCRIPTION
3267     The SME calls this primitive when the results from the scan are
3268     available.
3269
3270   PARAMETERS
3271     queue  - Destination Task Queue
3272     status - Reports the result of the request
3273
3274 *******************************************************************************/
3275 #define CsrWifiSmeScanFullCfmCreate(msg__, dst__, src__, status__) \
3276     msg__ = kmalloc(sizeof(CsrWifiSmeScanFullCfm), GFP_KERNEL); \
3277     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_FULL_CFM, dst__, src__); \
3278     msg__->status = (status__);
3279
3280 #define CsrWifiSmeScanFullCfmSendTo(dst__, src__, status__) \
3281     { \
3282         CsrWifiSmeScanFullCfm *msg__; \
3283         CsrWifiSmeScanFullCfmCreate(msg__, dst__, src__, status__); \
3284         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3285     }
3286
3287 #define CsrWifiSmeScanFullCfmSend(dst__, status__) \
3288     CsrWifiSmeScanFullCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
3289
3290 /*******************************************************************************
3291
3292   NAME
3293     CsrWifiSmeScanResultIndSend
3294
3295   DESCRIPTION
3296     The SME sends this primitive to all the tasks that have registered to
3297     receive it whenever a scan indication is received from the firmware.
3298
3299   PARAMETERS
3300     queue  - Destination Task Queue
3301     result - Points to a buffer containing a scan result.
3302
3303 *******************************************************************************/
3304 #define CsrWifiSmeScanResultIndCreate(msg__, dst__, src__, result__) \
3305     msg__ = kmalloc(sizeof(CsrWifiSmeScanResultInd), GFP_KERNEL); \
3306     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULT_IND, dst__, src__); \
3307     msg__->result = (result__);
3308
3309 #define CsrWifiSmeScanResultIndSendTo(dst__, src__, result__) \
3310     { \
3311         CsrWifiSmeScanResultInd *msg__; \
3312         CsrWifiSmeScanResultIndCreate(msg__, dst__, src__, result__); \
3313         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3314     }
3315
3316 #define CsrWifiSmeScanResultIndSend(dst__, result__) \
3317     CsrWifiSmeScanResultIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, result__)
3318
3319 /*******************************************************************************
3320
3321   NAME
3322     CsrWifiSmeScanResultsFlushReqSend
3323
3324   DESCRIPTION
3325     The Wireless Manager calls this primitive to ask the SME to delete all
3326     scan results from its cache, except for the scan result of any currently
3327     connected network.
3328     As scan results are received by the SME from the firmware, they are
3329     cached in the SME memory.
3330     Any time the Wireless Manager requests scan results, they are returned
3331     from the SME internal cache.
3332     For some applications it may be desirable to clear this cache prior to
3333     requesting that a scan be performed; this will ensure that the cache then
3334     only contains the networks detected in the most recent scan.
3335
3336   PARAMETERS
3337     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
3338
3339 *******************************************************************************/
3340 #define CsrWifiSmeScanResultsFlushReqCreate(msg__, dst__, src__) \
3341     msg__ = kmalloc(sizeof(CsrWifiSmeScanResultsFlushReq), GFP_KERNEL); \
3342     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_FLUSH_REQ, dst__, src__);
3343
3344 #define CsrWifiSmeScanResultsFlushReqSendTo(dst__, src__) \
3345     { \
3346         CsrWifiSmeScanResultsFlushReq *msg__; \
3347         CsrWifiSmeScanResultsFlushReqCreate(msg__, dst__, src__); \
3348         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3349     }
3350
3351 #define CsrWifiSmeScanResultsFlushReqSend(src__) \
3352     CsrWifiSmeScanResultsFlushReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
3353
3354 /*******************************************************************************
3355
3356   NAME
3357     CsrWifiSmeScanResultsFlushCfmSend
3358
3359   DESCRIPTION
3360     The SME will call this primitive when the cache has been cleared.
3361
3362   PARAMETERS
3363     queue  - Destination Task Queue
3364     status - Reports the result of the request
3365
3366 *******************************************************************************/
3367 #define CsrWifiSmeScanResultsFlushCfmCreate(msg__, dst__, src__, status__) \
3368     msg__ = kmalloc(sizeof(CsrWifiSmeScanResultsFlushCfm), GFP_KERNEL); \
3369     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_FLUSH_CFM, dst__, src__); \
3370     msg__->status = (status__);
3371
3372 #define CsrWifiSmeScanResultsFlushCfmSendTo(dst__, src__, status__) \
3373     { \
3374         CsrWifiSmeScanResultsFlushCfm *msg__; \
3375         CsrWifiSmeScanResultsFlushCfmCreate(msg__, dst__, src__, status__); \
3376         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3377     }
3378
3379 #define CsrWifiSmeScanResultsFlushCfmSend(dst__, status__) \
3380     CsrWifiSmeScanResultsFlushCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
3381
3382 /*******************************************************************************
3383
3384   NAME
3385     CsrWifiSmeScanResultsGetReqSend
3386
3387   DESCRIPTION
3388     The wireless manager application calls this primitive to retrieve the
3389     current set of scan results, either after receiving a successful
3390     CSR_WIFI_SME_SCAN_FULL_CFM, or to get autonomous scan results.
3391
3392   PARAMETERS
3393     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
3394
3395 *******************************************************************************/
3396 #define CsrWifiSmeScanResultsGetReqCreate(msg__, dst__, src__) \
3397     msg__ = kmalloc(sizeof(CsrWifiSmeScanResultsGetReq), GFP_KERNEL); \
3398     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_GET_REQ, dst__, src__);
3399
3400 #define CsrWifiSmeScanResultsGetReqSendTo(dst__, src__) \
3401     { \
3402         CsrWifiSmeScanResultsGetReq *msg__; \
3403         CsrWifiSmeScanResultsGetReqCreate(msg__, dst__, src__); \
3404         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3405     }
3406
3407 #define CsrWifiSmeScanResultsGetReqSend(src__) \
3408     CsrWifiSmeScanResultsGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
3409
3410 /*******************************************************************************
3411
3412   NAME
3413     CsrWifiSmeScanResultsGetCfmSend
3414
3415   DESCRIPTION
3416     The SME sends this primitive to provide the current set of scan results.
3417
3418   PARAMETERS
3419     queue            - Destination Task Queue
3420     status           - Reports the result of the request
3421     scanResultsCount - Number of scan results
3422     scanResults      - Points to a buffer containing an array of
3423                        CsrWifiSmeScanResult structures.
3424
3425 *******************************************************************************/
3426 #define CsrWifiSmeScanResultsGetCfmCreate(msg__, dst__, src__, status__, scanResultsCount__, scanResults__) \
3427     msg__ = kmalloc(sizeof(CsrWifiSmeScanResultsGetCfm), GFP_KERNEL); \
3428     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_GET_CFM, dst__, src__); \
3429     msg__->status = (status__); \
3430     msg__->scanResultsCount = (scanResultsCount__); \
3431     msg__->scanResults = (scanResults__);
3432
3433 #define CsrWifiSmeScanResultsGetCfmSendTo(dst__, src__, status__, scanResultsCount__, scanResults__) \
3434     { \
3435         CsrWifiSmeScanResultsGetCfm *msg__; \
3436         CsrWifiSmeScanResultsGetCfmCreate(msg__, dst__, src__, status__, scanResultsCount__, scanResults__); \
3437         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3438     }
3439
3440 #define CsrWifiSmeScanResultsGetCfmSend(dst__, status__, scanResultsCount__, scanResults__) \
3441     CsrWifiSmeScanResultsGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, scanResultsCount__, scanResults__)
3442
3443 /*******************************************************************************
3444
3445   NAME
3446     CsrWifiSmeSetReqSend
3447
3448   DESCRIPTION
3449     Used to pass custom data to the SME. Format is the same as 802.11 Info
3450     Elements => | Id | Length | Data
3451     1) Cmanr Test Mode "Id:0 Length:1 Data:0x00 = OFF 0x01 = ON" "0x00 0x01
3452     (0x00|0x01)"
3453
3454   PARAMETERS
3455     queue      - Message Source Task Queue (Cfm's will be sent to this Queue)
3456     dataLength - Number of bytes in the buffer pointed to by 'data'
3457     data       - Pointer to the buffer containing 'dataLength' bytes
3458
3459 *******************************************************************************/
3460 #define CsrWifiSmeSetReqCreate(msg__, dst__, src__, dataLength__, data__) \
3461     msg__ = kmalloc(sizeof(CsrWifiSmeSetReq), GFP_KERNEL); \
3462     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SET_REQ, dst__, src__); \
3463     msg__->dataLength = (dataLength__); \
3464     msg__->data = (data__);
3465
3466 #define CsrWifiSmeSetReqSendTo(dst__, src__, dataLength__, data__) \
3467     { \
3468         CsrWifiSmeSetReq *msg__; \
3469         CsrWifiSmeSetReqCreate(msg__, dst__, src__, dataLength__, data__); \
3470         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3471     }
3472
3473 #define CsrWifiSmeSetReqSend(src__, dataLength__, data__) \
3474     CsrWifiSmeSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, dataLength__, data__)
3475
3476 /*******************************************************************************
3477
3478   NAME
3479     CsrWifiSmeSmeCommonConfigGetReqSend
3480
3481   DESCRIPTION
3482     This primitive gets the value of the Sme common parameter.
3483
3484   PARAMETERS
3485     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
3486
3487 *******************************************************************************/
3488 #define CsrWifiSmeSmeCommonConfigGetReqCreate(msg__, dst__, src__) \
3489     msg__ = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigGetReq), GFP_KERNEL); \
3490     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_GET_REQ, dst__, src__);
3491
3492 #define CsrWifiSmeSmeCommonConfigGetReqSendTo(dst__, src__) \
3493     { \
3494         CsrWifiSmeSmeCommonConfigGetReq *msg__; \
3495         CsrWifiSmeSmeCommonConfigGetReqCreate(msg__, dst__, src__); \
3496         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3497     }
3498
3499 #define CsrWifiSmeSmeCommonConfigGetReqSend(src__) \
3500     CsrWifiSmeSmeCommonConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
3501
3502 /*******************************************************************************
3503
3504   NAME
3505     CsrWifiSmeSmeCommonConfigGetCfmSend
3506
3507   DESCRIPTION
3508     This primitive reports the result of the request.
3509
3510   PARAMETERS
3511     queue        - Destination Task Queue
3512     status       - Reports the result of the request
3513     deviceConfig - Configuration options in the SME
3514
3515 *******************************************************************************/
3516 #define CsrWifiSmeSmeCommonConfigGetCfmCreate(msg__, dst__, src__, status__, deviceConfig__) \
3517     msg__ = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigGetCfm), GFP_KERNEL); \
3518     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_GET_CFM, dst__, src__); \
3519     msg__->status = (status__); \
3520     msg__->deviceConfig = (deviceConfig__);
3521
3522 #define CsrWifiSmeSmeCommonConfigGetCfmSendTo(dst__, src__, status__, deviceConfig__) \
3523     { \
3524         CsrWifiSmeSmeCommonConfigGetCfm *msg__; \
3525         CsrWifiSmeSmeCommonConfigGetCfmCreate(msg__, dst__, src__, status__, deviceConfig__); \
3526         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3527     }
3528
3529 #define CsrWifiSmeSmeCommonConfigGetCfmSend(dst__, status__, deviceConfig__) \
3530     CsrWifiSmeSmeCommonConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, deviceConfig__)
3531
3532 /*******************************************************************************
3533
3534   NAME
3535     CsrWifiSmeSmeCommonConfigSetReqSend
3536
3537   DESCRIPTION
3538     This primitive sets the value of the Sme common.
3539
3540   PARAMETERS
3541     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
3542     deviceConfig - Configuration options in the SME
3543
3544 *******************************************************************************/
3545 #define CsrWifiSmeSmeCommonConfigSetReqCreate(msg__, dst__, src__, deviceConfig__) \
3546     msg__ = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigSetReq), GFP_KERNEL); \
3547     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_SET_REQ, dst__, src__); \
3548     msg__->deviceConfig = (deviceConfig__);
3549
3550 #define CsrWifiSmeSmeCommonConfigSetReqSendTo(dst__, src__, deviceConfig__) \
3551     { \
3552         CsrWifiSmeSmeCommonConfigSetReq *msg__; \
3553         CsrWifiSmeSmeCommonConfigSetReqCreate(msg__, dst__, src__, deviceConfig__); \
3554         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3555     }
3556
3557 #define CsrWifiSmeSmeCommonConfigSetReqSend(src__, deviceConfig__) \
3558     CsrWifiSmeSmeCommonConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, deviceConfig__)
3559
3560 /*******************************************************************************
3561
3562   NAME
3563     CsrWifiSmeSmeCommonConfigSetCfmSend
3564
3565   DESCRIPTION
3566     Reports the result of the request
3567
3568   PARAMETERS
3569     queue  - Destination Task Queue
3570     status - Reports the result of the request
3571
3572 *******************************************************************************/
3573 #define CsrWifiSmeSmeCommonConfigSetCfmCreate(msg__, dst__, src__, status__) \
3574     msg__ = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigSetCfm), GFP_KERNEL); \
3575     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_SET_CFM, dst__, src__); \
3576     msg__->status = (status__);
3577
3578 #define CsrWifiSmeSmeCommonConfigSetCfmSendTo(dst__, src__, status__) \
3579     { \
3580         CsrWifiSmeSmeCommonConfigSetCfm *msg__; \
3581         CsrWifiSmeSmeCommonConfigSetCfmCreate(msg__, dst__, src__, status__); \
3582         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3583     }
3584
3585 #define CsrWifiSmeSmeCommonConfigSetCfmSend(dst__, status__) \
3586     CsrWifiSmeSmeCommonConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
3587
3588 /*******************************************************************************
3589
3590   NAME
3591     CsrWifiSmeSmeStaConfigGetReqSend
3592
3593   DESCRIPTION
3594     This primitive gets the value of the SmeStaConfig parameter.
3595
3596   PARAMETERS
3597     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
3598     interfaceTag - Interface Identifier; unique identifier of an interface
3599
3600 *******************************************************************************/
3601 #define CsrWifiSmeSmeStaConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \
3602     msg__ = kmalloc(sizeof(CsrWifiSmeSmeStaConfigGetReq), GFP_KERNEL); \
3603     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_GET_REQ, dst__, src__); \
3604     msg__->interfaceTag = (interfaceTag__);
3605
3606 #define CsrWifiSmeSmeStaConfigGetReqSendTo(dst__, src__, interfaceTag__) \
3607     { \
3608         CsrWifiSmeSmeStaConfigGetReq *msg__; \
3609         CsrWifiSmeSmeStaConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \
3610         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3611     }
3612
3613 #define CsrWifiSmeSmeStaConfigGetReqSend(src__, interfaceTag__) \
3614     CsrWifiSmeSmeStaConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
3615
3616 /*******************************************************************************
3617
3618   NAME
3619     CsrWifiSmeSmeStaConfigGetCfmSend
3620
3621   DESCRIPTION
3622     This primitive reports the result of the request.
3623
3624   PARAMETERS
3625     queue        - Destination Task Queue
3626     interfaceTag - Interface Identifier; unique identifier of an interface
3627     status       - Reports the result of the request
3628     smeConfig    - Current SME Station Parameters
3629
3630 *******************************************************************************/
3631 #define CsrWifiSmeSmeStaConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, smeConfig__) \
3632     msg__ = kmalloc(sizeof(CsrWifiSmeSmeStaConfigGetCfm), GFP_KERNEL); \
3633     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_GET_CFM, dst__, src__); \
3634     msg__->interfaceTag = (interfaceTag__); \
3635     msg__->status = (status__); \
3636     msg__->smeConfig = (smeConfig__);
3637
3638 #define CsrWifiSmeSmeStaConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, smeConfig__) \
3639     { \
3640         CsrWifiSmeSmeStaConfigGetCfm *msg__; \
3641         CsrWifiSmeSmeStaConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, smeConfig__); \
3642         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3643     }
3644
3645 #define CsrWifiSmeSmeStaConfigGetCfmSend(dst__, interfaceTag__, status__, smeConfig__) \
3646     CsrWifiSmeSmeStaConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, smeConfig__)
3647
3648 /*******************************************************************************
3649
3650   NAME
3651     CsrWifiSmeSmeStaConfigSetReqSend
3652
3653   DESCRIPTION
3654     This primitive sets the value of the SmeConfig parameter.
3655
3656   PARAMETERS
3657     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
3658     interfaceTag - Interface Identifier; unique identifier of an interface
3659     smeConfig    - SME Station Parameters to be set
3660
3661 *******************************************************************************/
3662 #define CsrWifiSmeSmeStaConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, smeConfig__) \
3663     msg__ = kmalloc(sizeof(CsrWifiSmeSmeStaConfigSetReq), GFP_KERNEL); \
3664     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_SET_REQ, dst__, src__); \
3665     msg__->interfaceTag = (interfaceTag__); \
3666     msg__->smeConfig = (smeConfig__);
3667
3668 #define CsrWifiSmeSmeStaConfigSetReqSendTo(dst__, src__, interfaceTag__, smeConfig__) \
3669     { \
3670         CsrWifiSmeSmeStaConfigSetReq *msg__; \
3671         CsrWifiSmeSmeStaConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, smeConfig__); \
3672         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3673     }
3674
3675 #define CsrWifiSmeSmeStaConfigSetReqSend(src__, interfaceTag__, smeConfig__) \
3676     CsrWifiSmeSmeStaConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, smeConfig__)
3677
3678 /*******************************************************************************
3679
3680   NAME
3681     CsrWifiSmeSmeStaConfigSetCfmSend
3682
3683   DESCRIPTION
3684     This primitive reports the result of the request.
3685
3686   PARAMETERS
3687     queue        - Destination Task Queue
3688     interfaceTag - Interface Identifier; unique identifier of an interface
3689     status       - Reports the result of the request
3690
3691 *******************************************************************************/
3692 #define CsrWifiSmeSmeStaConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
3693     msg__ = kmalloc(sizeof(CsrWifiSmeSmeStaConfigSetCfm), GFP_KERNEL); \
3694     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_SET_CFM, dst__, src__); \
3695     msg__->interfaceTag = (interfaceTag__); \
3696     msg__->status = (status__);
3697
3698 #define CsrWifiSmeSmeStaConfigSetCfmSendTo(dst__, src__, interfaceTag__, status__) \
3699     { \
3700         CsrWifiSmeSmeStaConfigSetCfm *msg__; \
3701         CsrWifiSmeSmeStaConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
3702         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3703     }
3704
3705 #define CsrWifiSmeSmeStaConfigSetCfmSend(dst__, interfaceTag__, status__) \
3706     CsrWifiSmeSmeStaConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
3707
3708 /*******************************************************************************
3709
3710   NAME
3711     CsrWifiSmeStationMacAddressGetReqSend
3712
3713   DESCRIPTION
3714     This primitives is used to retrieve the current MAC address used by the
3715     station.
3716
3717   PARAMETERS
3718     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
3719
3720 *******************************************************************************/
3721 #define CsrWifiSmeStationMacAddressGetReqCreate(msg__, dst__, src__) \
3722     msg__ = kmalloc(sizeof(CsrWifiSmeStationMacAddressGetReq), GFP_KERNEL); \
3723     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_REQ, dst__, src__);
3724
3725 #define CsrWifiSmeStationMacAddressGetReqSendTo(dst__, src__) \
3726     { \
3727         CsrWifiSmeStationMacAddressGetReq *msg__; \
3728         CsrWifiSmeStationMacAddressGetReqCreate(msg__, dst__, src__); \
3729         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3730     }
3731
3732 #define CsrWifiSmeStationMacAddressGetReqSend(src__) \
3733     CsrWifiSmeStationMacAddressGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
3734
3735 /*******************************************************************************
3736
3737   NAME
3738     CsrWifiSmeStationMacAddressGetCfmSend
3739
3740   DESCRIPTION
3741     This primitive reports the result of the request.
3742
3743   PARAMETERS
3744     queue             - Destination Task Queue
3745     status            - Reports the result of the request
3746     stationMacAddress - Current MAC address of the station.
3747
3748 *******************************************************************************/
3749 #define CsrWifiSmeStationMacAddressGetCfmCreate(msg__, dst__, src__, status__, stationMacAddress__) \
3750     msg__ = kmalloc(sizeof(CsrWifiSmeStationMacAddressGetCfm), GFP_KERNEL); \
3751     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_CFM, dst__, src__); \
3752     msg__->status = (status__); \
3753     memcpy(msg__->stationMacAddress, (stationMacAddress__), sizeof(CsrWifiMacAddress) * 2);
3754
3755 #define CsrWifiSmeStationMacAddressGetCfmSendTo(dst__, src__, status__, stationMacAddress__) \
3756     { \
3757         CsrWifiSmeStationMacAddressGetCfm *msg__; \
3758         CsrWifiSmeStationMacAddressGetCfmCreate(msg__, dst__, src__, status__, stationMacAddress__); \
3759         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3760     }
3761
3762 #define CsrWifiSmeStationMacAddressGetCfmSend(dst__, status__, stationMacAddress__) \
3763     CsrWifiSmeStationMacAddressGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, stationMacAddress__)
3764
3765 /*******************************************************************************
3766
3767   NAME
3768     CsrWifiSmeTspecReqSend
3769
3770   DESCRIPTION
3771     The wireless manager application should call this primitive to use the
3772     TSPEC feature.
3773     The chip supports the use of TSPECs and TCLAS for the use of IEEE
3774     802.11/WMM Quality of Service features.
3775     The API allows the wireless manager application to supply a correctly
3776     formatted TSPEC and TCLAS pair to the driver.
3777     After performing basic validation, the driver negotiates the installation
3778     of the TSPEC with the AP as defined by the 802.11 specification.
3779     The driver retains all TSPEC and TCLAS pairs until they are specifically
3780     removed.
3781     It is not compulsory for a TSPEC to have a TCLAS (NULL is used to
3782     indicate that no TCLAS is supplied), while a TCLASS always require a
3783     TSPEC.
3784     The format of the TSPEC element is specified in 'WMM (including WMM Power
3785     Save) Specification - Version 1.1' and 'ANSI/IEEE Std 802.11-REVmb/D3.0'.
3786     For more information, see 'UniFi Configuring WMM and WMM-PS'.
3787
3788   PARAMETERS
3789     queue         - Message Source Task Queue (Cfm's will be sent to this Queue)
3790     interfaceTag  - Interface Identifier; unique identifier of an interface
3791     action        - Specifies the action to be carried out on the list of TSPECs.
3792                     CSR_WIFI_SME_LIST_ACTION_FLUSH is not applicable here.
3793     transactionId - Unique Transaction ID for the TSPEC, as assigned by the
3794                     driver
3795     strict        - If it set to false, allows the SME to perform automatic
3796                     TSPEC negotiation
3797     ctrlMask      - Additional TSPEC configuration for CCX.
3798                     Set mask with values from CsrWifiSmeTspecCtrl.
3799                     CURRENTLY NOT SUPPORTED
3800     tspecLength   - Length of the TSPEC.
3801     tspec         - Points to the first byte of the TSPEC
3802     tclasLength   - Length of the TCLAS.
3803                     If it is equal to 0, no TCLASS is provided for the TSPEC
3804     tclas         - Points to the first byte of the TCLAS, if any.
3805
3806 *******************************************************************************/
3807 #define CsrWifiSmeTspecReqCreate(msg__, dst__, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__) \
3808     msg__ = kmalloc(sizeof(CsrWifiSmeTspecReq), GFP_KERNEL); \
3809     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_TSPEC_REQ, dst__, src__); \
3810     msg__->interfaceTag = (interfaceTag__); \
3811     msg__->action = (action__); \
3812     msg__->transactionId = (transactionId__); \
3813     msg__->strict = (strict__); \
3814     msg__->ctrlMask = (ctrlMask__); \
3815     msg__->tspecLength = (tspecLength__); \
3816     msg__->tspec = (tspec__); \
3817     msg__->tclasLength = (tclasLength__); \
3818     msg__->tclas = (tclas__);
3819
3820 #define CsrWifiSmeTspecReqSendTo(dst__, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__) \
3821     { \
3822         CsrWifiSmeTspecReq *msg__; \
3823         CsrWifiSmeTspecReqCreate(msg__, dst__, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__); \
3824         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3825     }
3826
3827 #define CsrWifiSmeTspecReqSend(src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__) \
3828     CsrWifiSmeTspecReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__)
3829
3830 /*******************************************************************************
3831
3832   NAME
3833     CsrWifiSmeTspecIndSend
3834
3835   DESCRIPTION
3836     The SME will send this primitive to all the task that have registered to
3837     receive it when a status change in the TSPEC occurs.
3838
3839   PARAMETERS
3840     queue           - Destination Task Queue
3841     interfaceTag    - Interface Identifier; unique identifier of an interface
3842     transactionId   - Unique Transaction ID for the TSPEC, as assigned by the
3843                       driver
3844     tspecResultCode - Specifies the TSPEC operation requested by the peer
3845                       station
3846     tspecLength     - Length of the TSPEC.
3847     tspec           - Points to the first byte of the TSPEC
3848
3849 *******************************************************************************/
3850 #define CsrWifiSmeTspecIndCreate(msg__, dst__, src__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \
3851     msg__ = kmalloc(sizeof(CsrWifiSmeTspecInd), GFP_KERNEL); \
3852     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_TSPEC_IND, dst__, src__); \
3853     msg__->interfaceTag = (interfaceTag__); \
3854     msg__->transactionId = (transactionId__); \
3855     msg__->tspecResultCode = (tspecResultCode__); \
3856     msg__->tspecLength = (tspecLength__); \
3857     msg__->tspec = (tspec__);
3858
3859 #define CsrWifiSmeTspecIndSendTo(dst__, src__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \
3860     { \
3861         CsrWifiSmeTspecInd *msg__; \
3862         CsrWifiSmeTspecIndCreate(msg__, dst__, src__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__); \
3863         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3864     }
3865
3866 #define CsrWifiSmeTspecIndSend(dst__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \
3867     CsrWifiSmeTspecIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__)
3868
3869 /*******************************************************************************
3870
3871   NAME
3872     CsrWifiSmeTspecCfmSend
3873
3874   DESCRIPTION
3875     The SME calls the primitive to report the result of the TSpec primitive
3876     request.
3877
3878   PARAMETERS
3879     queue           - Destination Task Queue
3880     interfaceTag    - Interface Identifier; unique identifier of an interface
3881     status          - Reports the result of the request
3882     transactionId   - Unique Transaction ID for the TSPEC, as assigned by the
3883                       driver
3884     tspecResultCode - Specifies the result of the negotiated TSPEC operation
3885     tspecLength     - Length of the TSPEC.
3886     tspec           - Points to the first byte of the TSPEC
3887
3888 *******************************************************************************/
3889 #define CsrWifiSmeTspecCfmCreate(msg__, dst__, src__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \
3890     msg__ = kmalloc(sizeof(CsrWifiSmeTspecCfm), GFP_KERNEL); \
3891     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_TSPEC_CFM, dst__, src__); \
3892     msg__->interfaceTag = (interfaceTag__); \
3893     msg__->status = (status__); \
3894     msg__->transactionId = (transactionId__); \
3895     msg__->tspecResultCode = (tspecResultCode__); \
3896     msg__->tspecLength = (tspecLength__); \
3897     msg__->tspec = (tspec__);
3898
3899 #define CsrWifiSmeTspecCfmSendTo(dst__, src__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \
3900     { \
3901         CsrWifiSmeTspecCfm *msg__; \
3902         CsrWifiSmeTspecCfmCreate(msg__, dst__, src__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__); \
3903         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3904     }
3905
3906 #define CsrWifiSmeTspecCfmSend(dst__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \
3907     CsrWifiSmeTspecCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__)
3908
3909 /*******************************************************************************
3910
3911   NAME
3912     CsrWifiSmeVersionsGetReqSend
3913
3914   DESCRIPTION
3915     This primitive gets the value of the Versions parameter.
3916
3917   PARAMETERS
3918     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
3919
3920 *******************************************************************************/
3921 #define CsrWifiSmeVersionsGetReqCreate(msg__, dst__, src__) \
3922     msg__ = kmalloc(sizeof(CsrWifiSmeVersionsGetReq), GFP_KERNEL); \
3923     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_VERSIONS_GET_REQ, dst__, src__);
3924
3925 #define CsrWifiSmeVersionsGetReqSendTo(dst__, src__) \
3926     { \
3927         CsrWifiSmeVersionsGetReq *msg__; \
3928         CsrWifiSmeVersionsGetReqCreate(msg__, dst__, src__); \
3929         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3930     }
3931
3932 #define CsrWifiSmeVersionsGetReqSend(src__) \
3933     CsrWifiSmeVersionsGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
3934
3935 /*******************************************************************************
3936
3937   NAME
3938     CsrWifiSmeVersionsGetCfmSend
3939
3940   DESCRIPTION
3941     This primitive reports the result of the request.
3942
3943   PARAMETERS
3944     queue    - Destination Task Queue
3945     status   - Reports the result of the request
3946     versions - Version IDs of the product
3947
3948 *******************************************************************************/
3949 #define CsrWifiSmeVersionsGetCfmCreate(msg__, dst__, src__, status__, versions__) \
3950     msg__ = kmalloc(sizeof(CsrWifiSmeVersionsGetCfm), GFP_KERNEL); \
3951     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_VERSIONS_GET_CFM, dst__, src__); \
3952     msg__->status = (status__); \
3953     msg__->versions = (versions__);
3954
3955 #define CsrWifiSmeVersionsGetCfmSendTo(dst__, src__, status__, versions__) \
3956     { \
3957         CsrWifiSmeVersionsGetCfm *msg__; \
3958         CsrWifiSmeVersionsGetCfmCreate(msg__, dst__, src__, status__, versions__); \
3959         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3960     }
3961
3962 #define CsrWifiSmeVersionsGetCfmSend(dst__, status__, versions__) \
3963     CsrWifiSmeVersionsGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, versions__)
3964
3965 /*******************************************************************************
3966
3967   NAME
3968     CsrWifiSmeWifiFlightmodeReqSend
3969
3970   DESCRIPTION
3971     The wireless manager application may call this primitive on boot-up of
3972     the platform to ensure that the chip is placed in a mode that prevents
3973     any emission of RF energy.
3974     This primitive is an alternative to CSR_WIFI_SME_WIFI_ON_REQ.
3975     As in CSR_WIFI_SME_WIFI_ON_REQ, it causes the download of the patch file
3976     (if any) and the programming of the initial MIB settings (if supplied by
3977     the WMA), but it also ensures that the chip is left in its lowest
3978     possible power-mode with the radio subsystems disabled.
3979     This feature is useful on platforms where power cannot be removed from
3980     the chip (leaving the chip not initialised will cause it to consume more
3981     power so calling this function ensures that the chip is initialised into
3982     a low power mode but without entering a state where it could emit any RF
3983     energy).
3984     NOTE: this primitive does not cause the Wi-Fi to change state: Wi-Fi
3985     stays conceptually off. Configuration primitives can be sent after
3986     CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ and the configuration will be maintained.
3987     Requests that require the state of the Wi-Fi to be ON will return
3988     CSR_WIFI_SME_STATUS_WIFI_OFF in their confirms.
3989
3990   PARAMETERS
3991     queue         - Message Source Task Queue (Cfm's will be sent to this Queue)
3992     address       - Optionally specifies a station MAC address.
3993                     In normal use, the manager should set the address to 0xFF
3994                     0xFF 0xFF 0xFF 0xFF 0xFF, which will cause the chip to use
3995                     the MAC address in the MIB.
3996     mibFilesCount - Number of provided data blocks with initial MIB values
3997     mibFiles      - Points to the first data block with initial MIB values.
3998                     These data blocks are typically the contents of the provided
3999                     files ufmib.dat and localmib.dat, available from the host
4000                     file system, if they exist.
4001                     These files typically contain radio tuning and calibration
4002                     values.
4003                     More values can be created using the Host Tools.
4004
4005 *******************************************************************************/
4006 #define CsrWifiSmeWifiFlightmodeReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__) \
4007     msg__ = kmalloc(sizeof(CsrWifiSmeWifiFlightmodeReq), GFP_KERNEL); \
4008     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ, dst__, src__); \
4009     msg__->address = (address__); \
4010     msg__->mibFilesCount = (mibFilesCount__); \
4011     msg__->mibFiles = (mibFiles__);
4012
4013 #define CsrWifiSmeWifiFlightmodeReqSendTo(dst__, src__, address__, mibFilesCount__, mibFiles__) \
4014     { \
4015         CsrWifiSmeWifiFlightmodeReq *msg__; \
4016         CsrWifiSmeWifiFlightmodeReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__); \
4017         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
4018     }
4019
4020 #define CsrWifiSmeWifiFlightmodeReqSend(src__, address__, mibFilesCount__, mibFiles__) \
4021     CsrWifiSmeWifiFlightmodeReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, address__, mibFilesCount__, mibFiles__)
4022
4023 /*******************************************************************************
4024
4025   NAME
4026     CsrWifiSmeWifiFlightmodeCfmSend
4027
4028   DESCRIPTION
4029     The SME calls this primitive when the chip is initialised for low power
4030     mode and with the radio subsystem disabled. To leave flight mode, and
4031     enable Wi-Fi, the wireless manager application should call
4032     CSR_WIFI_SME_WIFI_ON_REQ.
4033
4034   PARAMETERS
4035     queue  - Destination Task Queue
4036     status - Reports the result of the request
4037
4038 *******************************************************************************/
4039 #define CsrWifiSmeWifiFlightmodeCfmCreate(msg__, dst__, src__, status__) \
4040     msg__ = kmalloc(sizeof(CsrWifiSmeWifiFlightmodeCfm), GFP_KERNEL); \
4041     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_FLIGHTMODE_CFM, dst__, src__); \
4042     msg__->status = (status__);
4043
4044 #define CsrWifiSmeWifiFlightmodeCfmSendTo(dst__, src__, status__) \
4045     { \
4046         CsrWifiSmeWifiFlightmodeCfm *msg__; \
4047         CsrWifiSmeWifiFlightmodeCfmCreate(msg__, dst__, src__, status__); \
4048         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
4049     }
4050
4051 #define CsrWifiSmeWifiFlightmodeCfmSend(dst__, status__) \
4052     CsrWifiSmeWifiFlightmodeCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
4053
4054 /*******************************************************************************
4055
4056   NAME
4057     CsrWifiSmeWifiOffReqSend
4058
4059   DESCRIPTION
4060     The wireless manager application calls this primitive to turn off the
4061     chip, thus saving power when Wi-Fi is not in use.
4062
4063   PARAMETERS
4064     queue  - Message Source Task Queue (Cfm's will be sent to this Queue)
4065
4066 *******************************************************************************/
4067 #define CsrWifiSmeWifiOffReqCreate(msg__, dst__, src__) \
4068     msg__ = kmalloc(sizeof(CsrWifiSmeWifiOffReq), GFP_KERNEL); \
4069     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_OFF_REQ, dst__, src__);
4070
4071 #define CsrWifiSmeWifiOffReqSendTo(dst__, src__) \
4072     { \
4073         CsrWifiSmeWifiOffReq *msg__; \
4074         CsrWifiSmeWifiOffReqCreate(msg__, dst__, src__); \
4075         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
4076     }
4077
4078 #define CsrWifiSmeWifiOffReqSend(src__) \
4079     CsrWifiSmeWifiOffReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
4080
4081 /*******************************************************************************
4082
4083   NAME
4084     CsrWifiSmeWifiOffIndSend
4085
4086   DESCRIPTION
4087     The SME sends this primitive to all the tasks that have registered to
4088     receive it to report that the chip has been turned off.
4089
4090   PARAMETERS
4091     queue  - Destination Task Queue
4092     reason - Indicates the reason why the Wi-Fi has been switched off.
4093
4094 *******************************************************************************/
4095 #define CsrWifiSmeWifiOffIndCreate(msg__, dst__, src__, reason__) \
4096     msg__ = kmalloc(sizeof(CsrWifiSmeWifiOffInd), GFP_KERNEL); \
4097     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_OFF_IND, dst__, src__); \
4098     msg__->reason = (reason__);
4099
4100 #define CsrWifiSmeWifiOffIndSendTo(dst__, src__, reason__) \
4101     { \
4102         CsrWifiSmeWifiOffInd *msg__; \
4103         CsrWifiSmeWifiOffIndCreate(msg__, dst__, src__, reason__); \
4104         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
4105     }
4106
4107 #define CsrWifiSmeWifiOffIndSend(dst__, reason__) \
4108     CsrWifiSmeWifiOffIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, reason__)
4109
4110 /*******************************************************************************
4111
4112   NAME
4113     CsrWifiSmeWifiOffCfmSend
4114
4115   DESCRIPTION
4116     After receiving CSR_WIFI_SME_WIFI_OFF_REQ, if the chip is connected to a
4117     network, the SME will perform a disconnect operation, will send a
4118     CSR_WIFI_SME_MEDIA_STATUS_IND with
4119     CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED, and then will call
4120     CSR_WIFI_SME_WIFI_OFF_CFM when the chip is off.
4121
4122   PARAMETERS
4123     queue  - Destination Task Queue
4124     status - Reports the result of the request
4125
4126 *******************************************************************************/
4127 #define CsrWifiSmeWifiOffCfmCreate(msg__, dst__, src__, status__) \
4128     msg__ = kmalloc(sizeof(CsrWifiSmeWifiOffCfm), GFP_KERNEL); \
4129     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_OFF_CFM, dst__, src__); \
4130     msg__->status = (status__);
4131
4132 #define CsrWifiSmeWifiOffCfmSendTo(dst__, src__, status__) \
4133     { \
4134         CsrWifiSmeWifiOffCfm *msg__; \
4135         CsrWifiSmeWifiOffCfmCreate(msg__, dst__, src__, status__); \
4136         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
4137     }
4138
4139 #define CsrWifiSmeWifiOffCfmSend(dst__, status__) \
4140     CsrWifiSmeWifiOffCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
4141
4142 /*******************************************************************************
4143
4144   NAME
4145     CsrWifiSmeWifiOnReqSend
4146
4147   DESCRIPTION
4148     The wireless manager application calls this primitive to turn on the
4149     Wi-Fi chip.
4150     If the Wi-Fi chip is currently off, the SME turns the Wi-Fi chip on,
4151     downloads the patch file (if any), and programs the initial MIB settings
4152     (if supplied by the WMA).
4153     The patch file is not provided with the SME API; its downloading is
4154     automatic and handled internally by the system.
4155     The MIB settings, when provided, override the default values that the
4156     firmware loads from EEPROM.
4157     If the Wi-Fi chip is already on, the SME takes no action and returns a
4158     successful status in the confirm.
4159
4160   PARAMETERS
4161     queue         - Message Source Task Queue (Cfm's will be sent to this Queue)
4162     address       - Optionally specifies a station MAC address.
4163                     In normal use, the manager should set the address to 0xFF
4164                     0xFF 0xFF 0xFF 0xFF 0xFF, which will cause the chip to use
4165                     the MAC address in the MIB
4166     mibFilesCount - Number of provided data blocks with initial MIB values
4167     mibFiles      - Points to the first data block with initial MIB values.
4168                     These data blocks are typically the contents of the provided
4169                     files ufmib.dat and localmib.dat, available from the host
4170                     file system, if they exist.
4171                     These files typically contain radio tuning and calibration
4172                     values.
4173                     More values can be created using the Host Tools.
4174
4175 *******************************************************************************/
4176 #define CsrWifiSmeWifiOnReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__) \
4177     msg__ = kmalloc(sizeof(CsrWifiSmeWifiOnReq), GFP_KERNEL); \
4178     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_ON_REQ, dst__, src__); \
4179     msg__->address = (address__); \
4180     msg__->mibFilesCount = (mibFilesCount__); \
4181     msg__->mibFiles = (mibFiles__);
4182
4183 #define CsrWifiSmeWifiOnReqSendTo(dst__, src__, address__, mibFilesCount__, mibFiles__) \
4184     { \
4185         CsrWifiSmeWifiOnReq *msg__; \
4186         CsrWifiSmeWifiOnReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__); \
4187         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
4188     }
4189
4190 #define CsrWifiSmeWifiOnReqSend(src__, address__, mibFilesCount__, mibFiles__) \
4191     CsrWifiSmeWifiOnReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, address__, mibFilesCount__, mibFiles__)
4192
4193 /*******************************************************************************
4194
4195   NAME
4196     CsrWifiSmeWifiOnIndSend
4197
4198   DESCRIPTION
4199     The SME sends this primitive to all tasks that have registered to receive
4200     it once the chip becomes available and ready to use.
4201
4202   PARAMETERS
4203     queue   - Destination Task Queue
4204     address - Current MAC address
4205
4206 *******************************************************************************/
4207 #define CsrWifiSmeWifiOnIndCreate(msg__, dst__, src__, address__) \
4208     msg__ = kmalloc(sizeof(CsrWifiSmeWifiOnInd), GFP_KERNEL); \
4209     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_ON_IND, dst__, src__); \
4210     msg__->address = (address__);
4211
4212 #define CsrWifiSmeWifiOnIndSendTo(dst__, src__, address__) \
4213     { \
4214         CsrWifiSmeWifiOnInd *msg__; \
4215         CsrWifiSmeWifiOnIndCreate(msg__, dst__, src__, address__); \
4216         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
4217     }
4218
4219 #define CsrWifiSmeWifiOnIndSend(dst__, address__) \
4220     CsrWifiSmeWifiOnIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, address__)
4221
4222 /*******************************************************************************
4223
4224   NAME
4225     CsrWifiSmeWifiOnCfmSend
4226
4227   DESCRIPTION
4228     The SME sends this primitive to the task that has sent the request once
4229     the chip has been initialised and is available for use.
4230
4231   PARAMETERS
4232     queue  - Destination Task Queue
4233     status - Reports the result of the request
4234
4235 *******************************************************************************/
4236 #define CsrWifiSmeWifiOnCfmCreate(msg__, dst__, src__, status__) \
4237     msg__ = kmalloc(sizeof(CsrWifiSmeWifiOnCfm), GFP_KERNEL); \
4238     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_ON_CFM, dst__, src__); \
4239     msg__->status = (status__);
4240
4241 #define CsrWifiSmeWifiOnCfmSendTo(dst__, src__, status__) \
4242     { \
4243         CsrWifiSmeWifiOnCfm *msg__; \
4244         CsrWifiSmeWifiOnCfmCreate(msg__, dst__, src__, status__); \
4245         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
4246     }
4247
4248 #define CsrWifiSmeWifiOnCfmSend(dst__, status__) \
4249     CsrWifiSmeWifiOnCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
4250
4251 /*******************************************************************************
4252
4253   NAME
4254     CsrWifiSmeWpsConfigurationReqSend
4255
4256   DESCRIPTION
4257     This primitive passes the WPS information for the device to SME. This may
4258     be accepted only if no interface is active.
4259
4260   PARAMETERS
4261     queue     - Message Source Task Queue (Cfm's will be sent to this Queue)
4262     wpsConfig - WPS config.
4263
4264 *******************************************************************************/
4265 #define CsrWifiSmeWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__) \
4266     msg__ = kmalloc(sizeof(CsrWifiSmeWpsConfigurationReq), GFP_KERNEL); \
4267     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WPS_CONFIGURATION_REQ, dst__, src__); \
4268     msg__->wpsConfig = (wpsConfig__);
4269
4270 #define CsrWifiSmeWpsConfigurationReqSendTo(dst__, src__, wpsConfig__) \
4271     { \
4272         CsrWifiSmeWpsConfigurationReq *msg__; \
4273         CsrWifiSmeWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__); \
4274         CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
4275     }
4276
4277 #define CsrWifiSmeWpsConfigurationReqSend(src__, wpsConfig__) \
4278     CsrWifiSmeWpsConfigurationReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, wpsConfig__)
4279
4280 /*******************************************************************************
4281
4282   NAME
4283     CsrWifiSmeWpsConfigurationCfmSend
4284
4285   DESCRIPTION
4286     Confirm.
4287
4288   PARAMETERS
4289     queue  - Destination Task Queue
4290     status - Status of the request.
4291
4292 *******************************************************************************/
4293 #define CsrWifiSmeWpsConfigurationCfmCreate(msg__, dst__, src__, status__) \
4294     msg__ = kmalloc(sizeof(CsrWifiSmeWpsConfigurationCfm), GFP_KERNEL); \
4295     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WPS_CONFIGURATION_CFM, dst__, src__); \
4296     msg__->status = (status__);
4297
4298 #define CsrWifiSmeWpsConfigurationCfmSendTo(dst__, src__, status__) \
4299     { \
4300         CsrWifiSmeWpsConfigurationCfm *msg__; \
4301         CsrWifiSmeWpsConfigurationCfmCreate(msg__, dst__, src__, status__); \
4302         CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
4303     }
4304
4305 #define CsrWifiSmeWpsConfigurationCfmSend(dst__, status__) \
4306     CsrWifiSmeWpsConfigurationCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
4307
4308
4309 #ifdef __cplusplus
4310 }
4311 #endif
4312
4313 #endif /* CSR_WIFI_SME_LIB_H__ */