8825172724a8e1f43a04491bd8d55ee34ad5731e
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / staging / csr / csr_wifi_sme_ap_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_AP_LIB_H__
14 #define CSR_WIFI_SME_AP_LIB_H__
15
16 #include "csr_pmem.h"
17 #include "csr_sched.h"
18 #include "csr_macro.h"
19 #include "csr_msg_transport.h"
20
21 #include "csr_wifi_lib.h"
22
23 #include "csr_wifi_sme_ap_prim.h"
24 #include "csr_wifi_sme_task.h"
25
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #ifndef CSR_WIFI_AP_ENABLE
32 #error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_sme_ap_lib.h
33 #endif
34
35 /*----------------------------------------------------------------------------*
36  *  CsrWifiSmeApFreeUpstreamMessageContents
37  *
38  *  DESCRIPTION
39  *      Free the allocated memory in a CSR_WIFI_SME_AP 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_AP upstream message
44  *----------------------------------------------------------------------------*/
45 void CsrWifiSmeApFreeUpstreamMessageContents(u16 eventClass, void *message);
46
47 /*----------------------------------------------------------------------------*
48  *  CsrWifiSmeApFreeDownstreamMessageContents
49  *
50  *  DESCRIPTION
51  *      Free the allocated memory in a CSR_WIFI_SME_AP 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_AP downstream message
56  *----------------------------------------------------------------------------*/
57 void CsrWifiSmeApFreeDownstreamMessageContents(u16 eventClass, void *message);
58
59 /*----------------------------------------------------------------------------*
60  * Enum to string functions
61  *----------------------------------------------------------------------------*/
62 const char* CsrWifiSmeApAccessTypeToString(CsrWifiSmeApAccessType value);
63 const char* CsrWifiSmeApAuthSupportToString(CsrWifiSmeApAuthSupport value);
64 const char* CsrWifiSmeApAuthTypeToString(CsrWifiSmeApAuthType value);
65 const char* CsrWifiSmeApDirectionToString(CsrWifiSmeApDirection value);
66 const char* CsrWifiSmeApPhySupportToString(CsrWifiSmeApPhySupport value);
67 const char* CsrWifiSmeApTypeToString(CsrWifiSmeApType value);
68
69
70 /*----------------------------------------------------------------------------*
71  * CsrPrim Type toString function.
72  * Converts a message type to the String name of the Message
73  *----------------------------------------------------------------------------*/
74 const char* CsrWifiSmeApPrimTypeToString(CsrPrim msgType);
75
76 /*----------------------------------------------------------------------------*
77  * Lookup arrays for PrimType name Strings
78  *----------------------------------------------------------------------------*/
79 extern const char *CsrWifiSmeApUpstreamPrimNames[CSR_WIFI_SME_AP_PRIM_UPSTREAM_COUNT];
80 extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_COUNT];
81
82 /*******************************************************************************
83
84   NAME
85     CsrWifiSmeApActiveBaGetReqSend
86
87   DESCRIPTION
88     This primitive used to retrieve information related to the active block
89     ack sessions
90
91   PARAMETERS
92     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
93     interfaceTag -
94
95 *******************************************************************************/
96 #define CsrWifiSmeApActiveBaGetReqCreate(msg__, dst__, src__, interfaceTag__) \
97     msg__ = kmalloc(sizeof(CsrWifiSmeApActiveBaGetReq), GFP_KERNEL); \
98     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ACTIVE_BA_GET_REQ, dst__, src__); \
99     msg__->interfaceTag = (interfaceTag__);
100
101 #define CsrWifiSmeApActiveBaGetReqSendTo(dst__, src__, interfaceTag__) \
102     { \
103         CsrWifiSmeApActiveBaGetReq *msg__; \
104         CsrWifiSmeApActiveBaGetReqCreate(msg__, dst__, src__, interfaceTag__); \
105         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
106     }
107
108 #define CsrWifiSmeApActiveBaGetReqSend(src__, interfaceTag__) \
109     CsrWifiSmeApActiveBaGetReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__)
110
111 /*******************************************************************************
112
113   NAME
114     CsrWifiSmeApActiveBaGetCfmSend
115
116   DESCRIPTION
117     This primitive carries the information related to the active ba sessions
118
119   PARAMETERS
120     queue            - Destination Task Queue
121     interfaceTag     -
122     status           - Reports the result of the request
123     activeBaCount    - Number of active block ack session
124     activeBaSessions - Points to a buffer containing an array of
125                        CsrWifiSmeApBaSession structures.
126
127 *******************************************************************************/
128 #define CsrWifiSmeApActiveBaGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, activeBaCount__, activeBaSessions__) \
129     msg__ = kmalloc(sizeof(CsrWifiSmeApActiveBaGetCfm), GFP_KERNEL); \
130     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ACTIVE_BA_GET_CFM, dst__, src__); \
131     msg__->interfaceTag = (interfaceTag__); \
132     msg__->status = (status__); \
133     msg__->activeBaCount = (activeBaCount__); \
134     msg__->activeBaSessions = (activeBaSessions__);
135
136 #define CsrWifiSmeApActiveBaGetCfmSendTo(dst__, src__, interfaceTag__, status__, activeBaCount__, activeBaSessions__) \
137     { \
138         CsrWifiSmeApActiveBaGetCfm *msg__; \
139         CsrWifiSmeApActiveBaGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, activeBaCount__, activeBaSessions__); \
140         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
141     }
142
143 #define CsrWifiSmeApActiveBaGetCfmSend(dst__, interfaceTag__, status__, activeBaCount__, activeBaSessions__) \
144     CsrWifiSmeApActiveBaGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, activeBaCount__, activeBaSessions__)
145
146 /*******************************************************************************
147
148   NAME
149     CsrWifiSmeApBaDeleteReqSend
150
151   DESCRIPTION
152     This primitive is used to delete an active block ack session
153
154   PARAMETERS
155     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
156     interfaceTag -
157     reason       -
158     baSession    - BA session to be deleted
159
160 *******************************************************************************/
161 #define CsrWifiSmeApBaDeleteReqCreate(msg__, dst__, src__, interfaceTag__, reason__, baSession__) \
162     msg__ = kmalloc(sizeof(CsrWifiSmeApBaDeleteReq), GFP_KERNEL); \
163     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BA_DELETE_REQ, dst__, src__); \
164     msg__->interfaceTag = (interfaceTag__); \
165     msg__->reason = (reason__); \
166     msg__->baSession = (baSession__);
167
168 #define CsrWifiSmeApBaDeleteReqSendTo(dst__, src__, interfaceTag__, reason__, baSession__) \
169     { \
170         CsrWifiSmeApBaDeleteReq *msg__; \
171         CsrWifiSmeApBaDeleteReqCreate(msg__, dst__, src__, interfaceTag__, reason__, baSession__); \
172         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
173     }
174
175 #define CsrWifiSmeApBaDeleteReqSend(src__, interfaceTag__, reason__, baSession__) \
176     CsrWifiSmeApBaDeleteReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, reason__, baSession__)
177
178 /*******************************************************************************
179
180   NAME
181     CsrWifiSmeApBaDeleteCfmSend
182
183   DESCRIPTION
184     This primitive confirms the BA is deleted
185
186   PARAMETERS
187     queue        - Destination Task Queue
188     interfaceTag -
189     status       - Reports the result of the request
190     baSession    - deleted BA session
191
192 *******************************************************************************/
193 #define CsrWifiSmeApBaDeleteCfmCreate(msg__, dst__, src__, interfaceTag__, status__, baSession__) \
194     msg__ = kmalloc(sizeof(CsrWifiSmeApBaDeleteCfm), GFP_KERNEL); \
195     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BA_DELETE_CFM, dst__, src__); \
196     msg__->interfaceTag = (interfaceTag__); \
197     msg__->status = (status__); \
198     msg__->baSession = (baSession__);
199
200 #define CsrWifiSmeApBaDeleteCfmSendTo(dst__, src__, interfaceTag__, status__, baSession__) \
201     { \
202         CsrWifiSmeApBaDeleteCfm *msg__; \
203         CsrWifiSmeApBaDeleteCfmCreate(msg__, dst__, src__, interfaceTag__, status__, baSession__); \
204         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
205     }
206
207 #define CsrWifiSmeApBaDeleteCfmSend(dst__, interfaceTag__, status__, baSession__) \
208     CsrWifiSmeApBaDeleteCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, baSession__)
209
210 /*******************************************************************************
211
212   NAME
213     CsrWifiSmeApBeaconingStartReqSend
214
215   DESCRIPTION
216     This primitive requests the SME to start AP or GO functionality
217
218   PARAMETERS
219     queue           - Message Source Task Queue (Cfm's will be sent to this Queue)
220     interfaceTag    -
221     initialPresence - Set to 0, if Not in a group fomration phase, set to 1 ,
222                       during group formation phase
223     apType          - apType : Legacy AP or P2PGO
224     cloakSsid       - cloakSsid flag.
225     ssid            - ssid.
226     ifIndex         - Radio Interface
227     channel         - channel.
228     maxConnections  - Maximum Stations + P2PClients allowed
229     apCredentials   - AP security credeitals used to advertise in beacon /probe
230                       response
231     smeApConfig     - AP configuration
232     p2pGoParam      - P2P specific GO parameters. Ignored if it is a leagacy AP
233
234 *******************************************************************************/
235 #define CsrWifiSmeApBeaconingStartReqCreate(msg__, dst__, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) \
236     msg__ = kmalloc(sizeof(CsrWifiSmeApBeaconingStartReq), GFP_KERNEL); \
237     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_START_REQ, dst__, src__); \
238     msg__->interfaceTag = (interfaceTag__); \
239     msg__->initialPresence = (initialPresence__); \
240     msg__->apType = (apType__); \
241     msg__->cloakSsid = (cloakSsid__); \
242     msg__->ssid = (ssid__); \
243     msg__->ifIndex = (ifIndex__); \
244     msg__->channel = (channel__); \
245     msg__->maxConnections = (maxConnections__); \
246     msg__->apCredentials = (apCredentials__); \
247     msg__->smeApConfig = (smeApConfig__); \
248     msg__->p2pGoParam = (p2pGoParam__);
249
250 #define CsrWifiSmeApBeaconingStartReqSendTo(dst__, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) \
251     { \
252         CsrWifiSmeApBeaconingStartReq *msg__; \
253         CsrWifiSmeApBeaconingStartReqCreate(msg__, dst__, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__); \
254         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
255     }
256
257 #define CsrWifiSmeApBeaconingStartReqSend(src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) \
258     CsrWifiSmeApBeaconingStartReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__)
259
260 /*******************************************************************************
261
262   NAME
263     CsrWifiSmeApBeaconingStartCfmSend
264
265   DESCRIPTION
266     This primitive confirms the completion of the request along with the
267     status
268
269   PARAMETERS
270     queue        - Destination Task Queue
271     interfaceTag -
272     status       -
273     secIeLength  -
274     secIe        -
275
276 *******************************************************************************/
277 #define CsrWifiSmeApBeaconingStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, secIeLength__, secIe__) \
278     msg__ = kmalloc(sizeof(CsrWifiSmeApBeaconingStartCfm), GFP_KERNEL); \
279     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_START_CFM, dst__, src__); \
280     msg__->interfaceTag = (interfaceTag__); \
281     msg__->status = (status__); \
282     msg__->secIeLength = (secIeLength__); \
283     msg__->secIe = (secIe__);
284
285 #define CsrWifiSmeApBeaconingStartCfmSendTo(dst__, src__, interfaceTag__, status__, secIeLength__, secIe__) \
286     { \
287         CsrWifiSmeApBeaconingStartCfm *msg__; \
288         CsrWifiSmeApBeaconingStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, secIeLength__, secIe__); \
289         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
290     }
291
292 #define CsrWifiSmeApBeaconingStartCfmSend(dst__, interfaceTag__, status__, secIeLength__, secIe__) \
293     CsrWifiSmeApBeaconingStartCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, secIeLength__, secIe__)
294
295 /*******************************************************************************
296
297   NAME
298     CsrWifiSmeApBeaconingStopReqSend
299
300   DESCRIPTION
301     This primitive requests the SME to STOP AP or P2PGO operation
302
303   PARAMETERS
304     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
305     interfaceTag -
306
307 *******************************************************************************/
308 #define CsrWifiSmeApBeaconingStopReqCreate(msg__, dst__, src__, interfaceTag__) \
309     msg__ = kmalloc(sizeof(CsrWifiSmeApBeaconingStopReq), GFP_KERNEL); \
310     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_STOP_REQ, dst__, src__); \
311     msg__->interfaceTag = (interfaceTag__);
312
313 #define CsrWifiSmeApBeaconingStopReqSendTo(dst__, src__, interfaceTag__) \
314     { \
315         CsrWifiSmeApBeaconingStopReq *msg__; \
316         CsrWifiSmeApBeaconingStopReqCreate(msg__, dst__, src__, interfaceTag__); \
317         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
318     }
319
320 #define CsrWifiSmeApBeaconingStopReqSend(src__, interfaceTag__) \
321     CsrWifiSmeApBeaconingStopReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__)
322
323 /*******************************************************************************
324
325   NAME
326     CsrWifiSmeApBeaconingStopCfmSend
327
328   DESCRIPTION
329     This primitive confirms AP or P2PGO operation is terminated
330
331   PARAMETERS
332     queue        - Destination Task Queue
333     interfaceTag -
334     status       -
335
336 *******************************************************************************/
337 #define CsrWifiSmeApBeaconingStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
338     msg__ = kmalloc(sizeof(CsrWifiSmeApBeaconingStopCfm), GFP_KERNEL); \
339     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_STOP_CFM, dst__, src__); \
340     msg__->interfaceTag = (interfaceTag__); \
341     msg__->status = (status__);
342
343 #define CsrWifiSmeApBeaconingStopCfmSendTo(dst__, src__, interfaceTag__, status__) \
344     { \
345         CsrWifiSmeApBeaconingStopCfm *msg__; \
346         CsrWifiSmeApBeaconingStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
347         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
348     }
349
350 #define CsrWifiSmeApBeaconingStopCfmSend(dst__, interfaceTag__, status__) \
351     CsrWifiSmeApBeaconingStopCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
352
353 /*******************************************************************************
354
355   NAME
356     CsrWifiSmeApErrorIndSend
357
358   DESCRIPTION
359     This primitve is sent by SME to indicate some error in AP operationi
360     after AP operations were started successfully and continuing the AP
361     operation may lead to undesired behaviour. It is the responsibility of
362     the upper layers to stop AP operation if needed
363
364   PARAMETERS
365     queue        - Destination Task Queue
366     interfaceTag - Range 0-1
367     apType       -
368     status       - Contains the error status
369
370 *******************************************************************************/
371 #define CsrWifiSmeApErrorIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__) \
372     msg__ = kmalloc(sizeof(CsrWifiSmeApErrorInd), GFP_KERNEL); \
373     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ERROR_IND, dst__, src__); \
374     msg__->interfaceTag = (interfaceTag__); \
375     msg__->apType = (apType__); \
376     msg__->status = (status__);
377
378 #define CsrWifiSmeApErrorIndSendTo(dst__, src__, interfaceTag__, apType__, status__) \
379     { \
380         CsrWifiSmeApErrorInd *msg__; \
381         CsrWifiSmeApErrorIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__); \
382         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
383     }
384
385 #define CsrWifiSmeApErrorIndSend(dst__, interfaceTag__, apType__, status__) \
386     CsrWifiSmeApErrorIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, apType__, status__)
387
388 /*******************************************************************************
389
390   NAME
391     CsrWifiSmeApStaConnectStartIndSend
392
393   DESCRIPTION
394     This primitive indicates that a stations request to join the group/BSS is
395     accepted
396
397   PARAMETERS
398     queue          - Destination Task Queue
399     interfaceTag   -
400     peerMacAddress -
401
402 *******************************************************************************/
403 #define CsrWifiSmeApStaConnectStartIndCreate(msg__, dst__, src__, interfaceTag__, peerMacAddress__) \
404     msg__ = kmalloc(sizeof(CsrWifiSmeApStaConnectStartInd), GFP_KERNEL); \
405     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_CONNECT_START_IND, dst__, src__); \
406     msg__->interfaceTag = (interfaceTag__); \
407     msg__->peerMacAddress = (peerMacAddress__);
408
409 #define CsrWifiSmeApStaConnectStartIndSendTo(dst__, src__, interfaceTag__, peerMacAddress__) \
410     { \
411         CsrWifiSmeApStaConnectStartInd *msg__; \
412         CsrWifiSmeApStaConnectStartIndCreate(msg__, dst__, src__, interfaceTag__, peerMacAddress__); \
413         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
414     }
415
416 #define CsrWifiSmeApStaConnectStartIndSend(dst__, interfaceTag__, peerMacAddress__) \
417     CsrWifiSmeApStaConnectStartIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, peerMacAddress__)
418
419 /*******************************************************************************
420
421   NAME
422     CsrWifiSmeApStaDisconnectReqSend
423
424   DESCRIPTION
425     This primitive tells SME to deauth ot disassociate a particular station
426     within BSS
427
428   PARAMETERS
429     queue          - Message Source Task Queue (Cfm's will be sent to this Queue)
430     interfaceTag   -
431     deauthReason   -
432     disassocReason -
433     peerMacaddress -
434     keepBlocking   - If TRUE, the station is blocked. If FALSE and the station
435                      is connected, disconnect the station. If FALSE and the
436                      station is not connected, no action is taken.
437
438 *******************************************************************************/
439 #define CsrWifiSmeApStaDisconnectReqCreate(msg__, dst__, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) \
440     msg__ = kmalloc(sizeof(CsrWifiSmeApStaDisconnectReq), GFP_KERNEL); \
441     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_DISCONNECT_REQ, dst__, src__); \
442     msg__->interfaceTag = (interfaceTag__); \
443     msg__->deauthReason = (deauthReason__); \
444     msg__->disassocReason = (disassocReason__); \
445     msg__->peerMacaddress = (peerMacaddress__); \
446     msg__->keepBlocking = (keepBlocking__);
447
448 #define CsrWifiSmeApStaDisconnectReqSendTo(dst__, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) \
449     { \
450         CsrWifiSmeApStaDisconnectReq *msg__; \
451         CsrWifiSmeApStaDisconnectReqCreate(msg__, dst__, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__); \
452         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
453     }
454
455 #define CsrWifiSmeApStaDisconnectReqSend(src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) \
456     CsrWifiSmeApStaDisconnectReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__)
457
458 /*******************************************************************************
459
460   NAME
461     CsrWifiSmeApStaDisconnectCfmSend
462
463   DESCRIPTION
464     This primitive confirms the station is disconnected
465
466   PARAMETERS
467     queue          - Destination Task Queue
468     interfaceTag   -
469     status         -
470     peerMacaddress -
471
472 *******************************************************************************/
473 #define CsrWifiSmeApStaDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, peerMacaddress__) \
474     msg__ = kmalloc(sizeof(CsrWifiSmeApStaDisconnectCfm), GFP_KERNEL); \
475     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_DISCONNECT_CFM, dst__, src__); \
476     msg__->interfaceTag = (interfaceTag__); \
477     msg__->status = (status__); \
478     msg__->peerMacaddress = (peerMacaddress__);
479
480 #define CsrWifiSmeApStaDisconnectCfmSendTo(dst__, src__, interfaceTag__, status__, peerMacaddress__) \
481     { \
482         CsrWifiSmeApStaDisconnectCfm *msg__; \
483         CsrWifiSmeApStaDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, peerMacaddress__); \
484         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
485     }
486
487 #define CsrWifiSmeApStaDisconnectCfmSend(dst__, interfaceTag__, status__, peerMacaddress__) \
488     CsrWifiSmeApStaDisconnectCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, peerMacaddress__)
489
490 /*******************************************************************************
491
492   NAME
493     CsrWifiSmeApStaNotifyIndSend
494
495   DESCRIPTION
496     This primitive indicates that a station has joined or a previously joined
497     station has left the BSS/group
498
499   PARAMETERS
500     queue             - Destination Task Queue
501     interfaceTag      -
502     mediaStatus       -
503     peerMacAddress    -
504     peerDeviceAddress -
505     disassocReason    -
506     deauthReason      -
507     WpsRegistration   -
508     secIeLength       -
509     secIe             -
510     groupKeyId        -
511     seqNumber         -
512
513 *******************************************************************************/
514 #define CsrWifiSmeApStaNotifyIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \
515     msg__ = kmalloc(sizeof(CsrWifiSmeApStaNotifyInd), GFP_KERNEL); \
516     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_NOTIFY_IND, dst__, src__); \
517     msg__->interfaceTag = (interfaceTag__); \
518     msg__->mediaStatus = (mediaStatus__); \
519     msg__->peerMacAddress = (peerMacAddress__); \
520     msg__->peerDeviceAddress = (peerDeviceAddress__); \
521     msg__->disassocReason = (disassocReason__); \
522     msg__->deauthReason = (deauthReason__); \
523     msg__->WpsRegistration = (WpsRegistration__); \
524     msg__->secIeLength = (secIeLength__); \
525     msg__->secIe = (secIe__); \
526     msg__->groupKeyId = (groupKeyId__); \
527     memcpy(msg__->seqNumber, (seqNumber__), sizeof(u16) * 8);
528
529 #define CsrWifiSmeApStaNotifyIndSendTo(dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \
530     { \
531         CsrWifiSmeApStaNotifyInd *msg__; \
532         CsrWifiSmeApStaNotifyIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__); \
533         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
534     }
535
536 #define CsrWifiSmeApStaNotifyIndSend(dst__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \
537     CsrWifiSmeApStaNotifyIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__)
538
539 /*******************************************************************************
540
541   NAME
542     CsrWifiSmeApWmmParamUpdateReqSend
543
544   DESCRIPTION
545     Application uses this primitive to update the WMM parameters on the fly
546
547   PARAMETERS
548     queue         - Message Source Task Queue (Cfm's will be sent to this Queue)
549     interfaceTag  -
550     wmmApParams   - WMM parameters to be used for local firmware queue
551                     configuration
552     wmmApBcParams - WMM parameters to be advertised in beacon/probe response
553
554 *******************************************************************************/
555 #define CsrWifiSmeApWmmParamUpdateReqCreate(msg__, dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \
556     msg__ = kmalloc(sizeof(CsrWifiSmeApWmmParamUpdateReq), GFP_KERNEL); \
557     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_REQ, dst__, src__); \
558     msg__->interfaceTag = (interfaceTag__); \
559     memcpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \
560     memcpy(msg__->wmmApBcParams, (wmmApBcParams__), sizeof(CsrWifiSmeWmmAcParams) * 4);
561
562 #define CsrWifiSmeApWmmParamUpdateReqSendTo(dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \
563     { \
564         CsrWifiSmeApWmmParamUpdateReq *msg__; \
565         CsrWifiSmeApWmmParamUpdateReqCreate(msg__, dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__); \
566         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
567     }
568
569 #define CsrWifiSmeApWmmParamUpdateReqSend(src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \
570     CsrWifiSmeApWmmParamUpdateReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, wmmApParams__, wmmApBcParams__)
571
572 /*******************************************************************************
573
574   NAME
575     CsrWifiSmeApWmmParamUpdateCfmSend
576
577   DESCRIPTION
578     A confirm for CSR_WIFI_SME_AP_WMM_PARAM_UPDATE.request
579
580   PARAMETERS
581     queue        - Destination Task Queue
582     interfaceTag -
583     status       -
584
585 *******************************************************************************/
586 #define CsrWifiSmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
587     msg__ = kmalloc(sizeof(CsrWifiSmeApWmmParamUpdateCfm), GFP_KERNEL); \
588     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_CFM, dst__, src__); \
589     msg__->interfaceTag = (interfaceTag__); \
590     msg__->status = (status__);
591
592 #define CsrWifiSmeApWmmParamUpdateCfmSendTo(dst__, src__, interfaceTag__, status__) \
593     { \
594         CsrWifiSmeApWmmParamUpdateCfm *msg__; \
595         CsrWifiSmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
596         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
597     }
598
599 #define CsrWifiSmeApWmmParamUpdateCfmSend(dst__, interfaceTag__, status__) \
600     CsrWifiSmeApWmmParamUpdateCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
601
602 /*******************************************************************************
603
604   NAME
605     CsrWifiSmeApWpsConfigurationReqSend
606
607   DESCRIPTION
608     This primitive passes the WPS information for the device to SME. This may
609     be accepted only if no interface is active.
610
611   PARAMETERS
612     queue     - Message Source Task Queue (Cfm's will be sent to this Queue)
613     wpsConfig - WPS config.
614
615 *******************************************************************************/
616 #define CsrWifiSmeApWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__) \
617     msg__ = kmalloc(sizeof(CsrWifiSmeApWpsConfigurationReq), GFP_KERNEL); \
618     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_CONFIGURATION_REQ, dst__, src__); \
619     msg__->wpsConfig = (wpsConfig__);
620
621 #define CsrWifiSmeApWpsConfigurationReqSendTo(dst__, src__, wpsConfig__) \
622     { \
623         CsrWifiSmeApWpsConfigurationReq *msg__; \
624         CsrWifiSmeApWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__); \
625         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
626     }
627
628 #define CsrWifiSmeApWpsConfigurationReqSend(src__, wpsConfig__) \
629     CsrWifiSmeApWpsConfigurationReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, wpsConfig__)
630
631 /*******************************************************************************
632
633   NAME
634     CsrWifiSmeApWpsConfigurationCfmSend
635
636   DESCRIPTION
637     Confirm.
638
639   PARAMETERS
640     queue  - Destination Task Queue
641     status - Status of the request.
642
643 *******************************************************************************/
644 #define CsrWifiSmeApWpsConfigurationCfmCreate(msg__, dst__, src__, status__) \
645     msg__ = kmalloc(sizeof(CsrWifiSmeApWpsConfigurationCfm), GFP_KERNEL); \
646     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_CONFIGURATION_CFM, dst__, src__); \
647     msg__->status = (status__);
648
649 #define CsrWifiSmeApWpsConfigurationCfmSendTo(dst__, src__, status__) \
650     { \
651         CsrWifiSmeApWpsConfigurationCfm *msg__; \
652         CsrWifiSmeApWpsConfigurationCfmCreate(msg__, dst__, src__, status__); \
653         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
654     }
655
656 #define CsrWifiSmeApWpsConfigurationCfmSend(dst__, status__) \
657     CsrWifiSmeApWpsConfigurationCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
658
659 /*******************************************************************************
660
661   NAME
662     CsrWifiSmeApWpsRegistrationFinishedReqSend
663
664   DESCRIPTION
665     This primitive tells SME that WPS registration procedure has finished
666
667   PARAMETERS
668     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
669     interfaceTag -
670
671 *******************************************************************************/
672 #define CsrWifiSmeApWpsRegistrationFinishedReqCreate(msg__, dst__, src__, interfaceTag__) \
673     msg__ = kmalloc(sizeof(CsrWifiSmeApWpsRegistrationFinishedReq), GFP_KERNEL); \
674     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_REQ, dst__, src__); \
675     msg__->interfaceTag = (interfaceTag__);
676
677 #define CsrWifiSmeApWpsRegistrationFinishedReqSendTo(dst__, src__, interfaceTag__) \
678     { \
679         CsrWifiSmeApWpsRegistrationFinishedReq *msg__; \
680         CsrWifiSmeApWpsRegistrationFinishedReqCreate(msg__, dst__, src__, interfaceTag__); \
681         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
682     }
683
684 #define CsrWifiSmeApWpsRegistrationFinishedReqSend(src__, interfaceTag__) \
685     CsrWifiSmeApWpsRegistrationFinishedReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__)
686
687 /*******************************************************************************
688
689   NAME
690     CsrWifiSmeApWpsRegistrationFinishedCfmSend
691
692   DESCRIPTION
693     A confirm for UNIFI_MGT_AP_WPS_REGISTRATION_FINISHED.request
694
695   PARAMETERS
696     queue        - Destination Task Queue
697     interfaceTag -
698     status       -
699
700 *******************************************************************************/
701 #define CsrWifiSmeApWpsRegistrationFinishedCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
702     msg__ = kmalloc(sizeof(CsrWifiSmeApWpsRegistrationFinishedCfm), GFP_KERNEL); \
703     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_CFM, dst__, src__); \
704     msg__->interfaceTag = (interfaceTag__); \
705     msg__->status = (status__);
706
707 #define CsrWifiSmeApWpsRegistrationFinishedCfmSendTo(dst__, src__, interfaceTag__, status__) \
708     { \
709         CsrWifiSmeApWpsRegistrationFinishedCfm *msg__; \
710         CsrWifiSmeApWpsRegistrationFinishedCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
711         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
712     }
713
714 #define CsrWifiSmeApWpsRegistrationFinishedCfmSend(dst__, interfaceTag__, status__) \
715     CsrWifiSmeApWpsRegistrationFinishedCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
716
717 /*******************************************************************************
718
719   NAME
720     CsrWifiSmeApWpsRegistrationStartedReqSend
721
722   DESCRIPTION
723     This primitive tells SME that WPS registration procedure has started
724
725   PARAMETERS
726     queue                    - Message Source Task Queue (Cfm's will be sent to this Queue)
727     interfaceTag             -
728     SelectedDevicePasswordId -
729     SelectedconfigMethod     -
730
731 *******************************************************************************/
732 #define CsrWifiSmeApWpsRegistrationStartedReqCreate(msg__, dst__, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) \
733     msg__ = kmalloc(sizeof(CsrWifiSmeApWpsRegistrationStartedReq), GFP_KERNEL); \
734     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_REQ, dst__, src__); \
735     msg__->interfaceTag = (interfaceTag__); \
736     msg__->SelectedDevicePasswordId = (SelectedDevicePasswordId__); \
737     msg__->SelectedconfigMethod = (SelectedconfigMethod__);
738
739 #define CsrWifiSmeApWpsRegistrationStartedReqSendTo(dst__, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) \
740     { \
741         CsrWifiSmeApWpsRegistrationStartedReq *msg__; \
742         CsrWifiSmeApWpsRegistrationStartedReqCreate(msg__, dst__, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__); \
743         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
744     }
745
746 #define CsrWifiSmeApWpsRegistrationStartedReqSend(src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) \
747     CsrWifiSmeApWpsRegistrationStartedReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__)
748
749 /*******************************************************************************
750
751   NAME
752     CsrWifiSmeApWpsRegistrationStartedCfmSend
753
754   DESCRIPTION
755     A confirm for UNIFI_MGT_AP_WPS_REGISTRATION_STARTED.request
756
757   PARAMETERS
758     queue        - Destination Task Queue
759     interfaceTag -
760     status       -
761
762 *******************************************************************************/
763 #define CsrWifiSmeApWpsRegistrationStartedCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
764     msg__ = kmalloc(sizeof(CsrWifiSmeApWpsRegistrationStartedCfm), GFP_KERNEL); \
765     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_CFM, dst__, src__); \
766     msg__->interfaceTag = (interfaceTag__); \
767     msg__->status = (status__);
768
769 #define CsrWifiSmeApWpsRegistrationStartedCfmSendTo(dst__, src__, interfaceTag__, status__) \
770     { \
771         CsrWifiSmeApWpsRegistrationStartedCfm *msg__; \
772         CsrWifiSmeApWpsRegistrationStartedCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
773         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
774     }
775
776 #define CsrWifiSmeApWpsRegistrationStartedCfmSend(dst__, interfaceTag__, status__) \
777     CsrWifiSmeApWpsRegistrationStartedCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
778
779
780 #ifdef __cplusplus
781 }
782 #endif
783
784 #endif /* CSR_WIFI_SME_AP_LIB_H__ */