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