Adding support for MOXA ART SoC. Testing port of linux-2.6.32.60-moxart.
[linux-3.6.7-moxart.git] / drivers / staging / csr / sme_mgt.c
blob58d1b3b7293224275c9d066993ce7d95e70bfff6
1 /*
2 * ---------------------------------------------------------------------------
3 * FILE: sme_mgt.c
5 * PURPOSE:
6 * This file contains the driver specific implementation of
7 * the SME MGT SAP.
8 * It is part of the porting exercise.
10 * Copyright (C) 2008-2009 by Cambridge Silicon Radio Ltd.
12 * Refer to LICENSE.txt included with this source code for details on
13 * the license terms.
15 * ---------------------------------------------------------------------------
18 #include "csr_wifi_hip_unifiversion.h"
19 #include "unifi_priv.h"
20 #include "csr_wifi_hip_conversions.h"
22 * This file implements the SME MGT API. It contains the following functions:
23 * CsrWifiSmeWifiFlightmodeCfmSend()
24 * CsrWifiSmeWifiOnCfmSend()
25 * CsrWifiSmeWifiOffCfmSend()
26 * CsrWifiSmeWifiOffIndSend()
27 * CsrWifiSmeScanFullCfmSend()
28 * CsrWifiSmeScanResultsGetCfmSend()
29 * CsrWifiSmeScanResultIndSend()
30 * CsrWifiSmeScanResultsFlushCfmSend()
31 * CsrWifiSmeConnectCfmSend()
32 * CsrWifiSmeMediaStatusIndSend()
33 * CsrWifiSmeDisconnectCfmSend()
34 * CsrWifiSmeKeyCfmSend()
35 * CsrWifiSmeMulticastAddressCfmSend()
36 * CsrWifiSmeSetValueCfmSend()
37 * CsrWifiSmeGetValueCfmSend()
38 * CsrWifiSmeMicFailureIndSend()
39 * CsrWifiSmePmkidCfmSend()
40 * CsrWifiSmePmkidCandidateListIndSend()
41 * CsrWifiSmeMibSetCfmSend()
42 * CsrWifiSmeMibGetCfmSend()
43 * CsrWifiSmeMibGetNextCfmSend()
44 * CsrWifiSmeConnectionQualityIndSend()
45 * CsrWifiSmePacketFilterSetCfmSend()
46 * CsrWifiSmeTspecCfmSend()
47 * CsrWifiSmeTspecIndSend()
48 * CsrWifiSmeBlacklistCfmSend()
49 * CsrWifiSmeEventMaskSetCfmSend()
50 * CsrWifiSmeRoamStartIndSend()
51 * CsrWifiSmeRoamCompleteIndSend()
52 * CsrWifiSmeAssociationStartIndSend()
53 * CsrWifiSmeAssociationCompleteIndSend()
54 * CsrWifiSmeIbssStationIndSend()
58 void CsrWifiSmeMicFailureIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
60 #ifdef CSR_SUPPORT_WEXT
61 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
62 CsrWifiSmeMicFailureInd* ind = (CsrWifiSmeMicFailureInd*)msg;
64 if (priv == NULL) {
65 unifi_error(NULL, "CsrWifiSmeMicFailureIndSend: invalid priv\n");
66 return;
69 unifi_trace(priv, UDBG1,
70 "CsrWifiSmeMicFailureIndSend: count=%d, KeyType=%d\n",
71 ind->count, ind->keyType);
73 wext_send_michaelmicfailure_event(priv, ind->count, ind->address, ind->keyType, ind->interfaceTag);
74 #endif
78 void CsrWifiSmePmkidCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
80 #ifdef CSR_SUPPORT_WEXT
81 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
82 CsrWifiSmePmkidCfm* cfm = (CsrWifiSmePmkidCfm*)msg;
84 if (priv == NULL) {
85 unifi_error(NULL, "CsrWifiSmePmkidCfmSend: Invalid ospriv.\n");
86 return;
90 * WEXT never does a GET operation the PMKIDs, so we don't need
91 * handle data returned in pmkids.
94 sme_complete_request(priv, cfm->status);
95 #endif
99 void CsrWifiSmePmkidCandidateListIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
101 #ifdef CSR_SUPPORT_WEXT
102 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
103 CsrWifiSmePmkidCandidateListInd* ind = (CsrWifiSmePmkidCandidateListInd*)msg;
104 int i;
106 if (priv->smepriv == NULL) {
107 unifi_error(priv, "CsrWifiSmePmkidCandidateListIndSend: invalid smepriv\n");
108 return;
111 for (i = 0; i < ind->pmkidCandidatesCount; i++)
113 wext_send_pmkid_candidate_event(priv, ind->pmkidCandidates[i].bssid, ind->pmkidCandidates[i].preAuthAllowed, ind->interfaceTag);
115 #endif
118 void CsrWifiSmeScanResultsFlushCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
122 void CsrWifiSmeScanResultsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
124 #ifdef CSR_SUPPORT_WEXT
125 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
126 CsrWifiSmeScanResultsGetCfm* cfm = (CsrWifiSmeScanResultsGetCfm*)msg;
127 int bytesRequired = cfm->scanResultsCount * sizeof(CsrWifiSmeScanResult);
128 int i;
129 u8* current_buff;
130 CsrWifiSmeScanResult* scanCopy;
132 if (priv == NULL) {
133 unifi_error(NULL, "CsrWifiSmeScanResultsGetCfmSend: Invalid ospriv.\n");
134 return;
137 /* Calc the size of the buffer reuired */
138 for (i = 0; i < cfm->scanResultsCount; ++i) {
139 const CsrWifiSmeScanResult *scan_result = &cfm->scanResults[i];
140 bytesRequired += scan_result->informationElementsLength;
143 /* Take a Copy of the scan Results :-) */
144 scanCopy = kmalloc(bytesRequired, GFP_KERNEL);
145 memcpy(scanCopy, cfm->scanResults, sizeof(CsrWifiSmeScanResult) * cfm->scanResultsCount);
147 /* Take a Copy of the Info Elements AND update the scan result pointers */
148 current_buff = (u8*)&scanCopy[cfm->scanResultsCount];
149 for (i = 0; i < cfm->scanResultsCount; ++i)
151 CsrWifiSmeScanResult *scan_result = &scanCopy[i];
152 memcpy(current_buff, scan_result->informationElements, scan_result->informationElementsLength);
153 scan_result->informationElements = current_buff;
154 current_buff += scan_result->informationElementsLength;
157 priv->sme_reply.reply_scan_results_count = cfm->scanResultsCount;
158 priv->sme_reply.reply_scan_results = scanCopy;
160 sme_complete_request(priv, cfm->status);
161 #endif
165 void CsrWifiSmeScanFullCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
167 #ifdef CSR_SUPPORT_WEXT
168 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
169 CsrWifiSmeScanFullCfm* cfm = (CsrWifiSmeScanFullCfm*)msg;
171 if (priv == NULL) {
172 unifi_error(NULL, "CsrWifiSmeScanFullCfmSend: Invalid ospriv.\n");
173 return;
176 sme_complete_request(priv, cfm->status);
177 #endif
181 void CsrWifiSmeScanResultIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
187 void CsrWifiSmeConnectCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
189 #ifdef CSR_SUPPORT_WEXT
190 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
191 CsrWifiSmeConnectCfm* cfm = (CsrWifiSmeConnectCfm*)msg;
193 if (priv == NULL) {
194 unifi_error(NULL, "CsrWifiSmeConnectCfmSend: Invalid ospriv.\n");
195 return;
198 sme_complete_request(priv, cfm->status);
199 #endif
203 void CsrWifiSmeDisconnectCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
205 #ifdef CSR_SUPPORT_WEXT
206 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
207 CsrWifiSmeDisconnectCfm* cfm = (CsrWifiSmeDisconnectCfm*)msg;
209 if (priv == NULL) {
210 unifi_error(NULL, "CsrWifiSmeDisconnectCfmSend: Invalid ospriv.\n");
211 return;
214 sme_complete_request(priv, cfm->status);
215 #endif
219 void CsrWifiSmeKeyCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
221 #ifdef CSR_SUPPORT_WEXT
222 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
223 CsrWifiSmeKeyCfm* cfm = (CsrWifiSmeKeyCfm*)msg;
225 if (priv == NULL) {
226 unifi_error(NULL, "CsrWifiSmeKeyCfmSend: Invalid ospriv.\n");
227 return;
230 sme_complete_request(priv, cfm->status);
231 #endif
235 void CsrWifiSmeMulticastAddressCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
237 #ifdef CSR_SUPPORT_WEXT
238 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
239 CsrWifiSmeMulticastAddressCfm* cfm = (CsrWifiSmeMulticastAddressCfm*)msg;
241 if (priv == NULL) {
242 unifi_error(NULL, "CsrWifiSmeMulticastAddressCfmSend: Invalid ospriv.\n");
243 return;
246 sme_complete_request(priv, cfm->status);
247 #endif
250 void CsrWifiSmeWifiFlightmodeCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
252 #ifdef CSR_SUPPORT_WEXT
253 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
254 CsrWifiSmeWifiFlightmodeCfm* cfm = (CsrWifiSmeWifiFlightmodeCfm*)msg;
256 if (priv == NULL) {
257 unifi_error(NULL, "CsrWifiSmeWifiFlightmodeCfmSend: Invalid ospriv.\n");
258 return;
261 sme_complete_request(priv, cfm->status);
262 #endif
265 void CsrWifiSmeWifiOnCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
267 #ifdef CSR_SUPPORT_WEXT
268 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
269 CsrWifiSmeWifiOnCfm* cfm = (CsrWifiSmeWifiOnCfm*)msg;
271 if (priv == NULL) {
272 unifi_error(NULL, "CsrWifiSmeWifiOnCfmSend: Invalid ospriv.\n");
273 return;
276 unifi_trace(priv, UDBG4,
277 "CsrWifiSmeWifiOnCfmSend: wake up status %d\n", cfm->status);
278 #ifdef CSR_SUPPORT_WEXT_AP
279 sme_complete_request(priv, cfm->status);
280 #endif
282 #endif
285 void CsrWifiSmeWifiOffCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
287 #ifdef CSR_SUPPORT_WEXT
288 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
289 CsrWifiSmeWifiOffCfm* cfm = (CsrWifiSmeWifiOffCfm*)msg;
291 if (priv == NULL) {
292 unifi_error(NULL, "CsrWifiSmeWifiOffCfmSend: Invalid ospriv.\n");
293 return;
296 sme_complete_request(priv, cfm->status);
297 #endif
301 void CsrWifiSmeWifiOffIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
303 #ifdef CSR_SUPPORT_WEXT
304 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
305 CsrWifiSmeWifiOffInd* ind = (CsrWifiSmeWifiOffInd*)msg;
307 if (priv == NULL) {
308 unifi_error(NULL, "CsrWifiRouterCtrlStoppedReqSend: Invalid ospriv.\n");
309 return;
312 if (priv->smepriv == NULL) {
313 unifi_error(priv, "CsrWifiRouterCtrlStoppedReqSend: invalid smepriv\n");
314 return;
318 * If the status indicates an error, the SME is in a stopped state.
319 * We need to start it again in order to reinitialise UniFi.
321 switch (ind->reason) {
322 case CSR_WIFI_SME_CONTROL_INDICATION_ERROR:
323 unifi_trace(priv, UDBG1,
324 "CsrWifiRouterCtrlStoppedReqSend: Restarting SME (ind:%d)\n",
325 ind->reason);
327 /* On error, restart the SME */
328 sme_mgt_wifi_on(priv);
329 break;
330 case CSR_WIFI_SME_CONTROL_INDICATION_EXIT:
331 #ifdef CSR_SUPPORT_WEXT_AP
332 sme_complete_request(priv, 0);
333 #endif
334 break;
335 default:
336 break;
339 #endif
342 void CsrWifiSmeVersionsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
344 #ifdef CSR_SUPPORT_WEXT
345 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
346 CsrWifiSmeVersionsGetCfm* cfm = (CsrWifiSmeVersionsGetCfm*)msg;
348 if (priv == NULL) {
349 unifi_error(NULL, "CsrWifiSmeVersionsGetCfmSend: Invalid ospriv.\n");
350 return;
353 priv->sme_reply.versions = cfm->versions;
354 sme_complete_request(priv, cfm->status);
355 #endif
358 void CsrWifiSmePowerConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
360 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
361 CsrWifiSmePowerConfigGetCfm* cfm = (CsrWifiSmePowerConfigGetCfm*)msg;
363 if (priv == NULL) {
364 unifi_error(NULL, "CsrWifiSmePowerConfigGetCfmSend: Invalid ospriv.\n");
365 return;
368 priv->sme_reply.powerConfig = cfm->powerConfig;
369 sme_complete_request(priv, cfm->status);
372 void CsrWifiSmeHostConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
374 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
375 CsrWifiSmeHostConfigGetCfm* cfm = (CsrWifiSmeHostConfigGetCfm*)msg;
377 if (priv == NULL) {
378 unifi_error(NULL, "CsrWifiSmeHostConfigGetCfmSend: Invalid ospriv.\n");
379 return;
382 priv->sme_reply.hostConfig = cfm->hostConfig;
383 sme_complete_request(priv, cfm->status);
386 void CsrWifiSmeCoexInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
388 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
389 CsrWifiSmeCoexInfoGetCfm* cfm = (CsrWifiSmeCoexInfoGetCfm*)msg;
391 if (priv == NULL) {
392 unifi_error(NULL, "CsrWifiSmeCoexInfoGetCfmSend: Invalid ospriv.\n");
393 return;
396 priv->sme_reply.coexInfo = cfm->coexInfo;
397 sme_complete_request(priv, cfm->status);
400 void CsrWifiSmeCoexConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
402 #ifdef CSR_SUPPORT_WEXT
403 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
404 CsrWifiSmeCoexConfigGetCfm* cfm = (CsrWifiSmeCoexConfigGetCfm*)msg;
406 if (priv == NULL) {
407 unifi_error(NULL, "CsrWifiSmeCoexConfigGetCfmSend: Invalid ospriv.\n");
408 return;
411 priv->sme_reply.coexConfig = cfm->coexConfig;
412 sme_complete_request(priv, cfm->status);
413 #endif
416 void CsrWifiSmeMibConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
418 #ifdef CSR_SUPPORT_WEXT
419 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
420 CsrWifiSmeMibConfigGetCfm* cfm = (CsrWifiSmeMibConfigGetCfm*)msg;
422 if (priv == NULL) {
423 unifi_error(NULL, "CsrWifiSmeMibConfigGetCfmSend: Invalid ospriv.\n");
424 return;
427 priv->sme_reply.mibConfig = cfm->mibConfig;
428 sme_complete_request(priv, cfm->status);
429 #endif
432 void CsrWifiSmeConnectionInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
434 #ifdef CSR_SUPPORT_WEXT
435 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
436 CsrWifiSmeConnectionInfoGetCfm* cfm = (CsrWifiSmeConnectionInfoGetCfm*)msg;
438 if (priv == NULL) {
439 unifi_error(NULL, "CsrWifiSmeConnectionInfoGetCfmSend: Invalid ospriv.\n");
440 return;
443 priv->sme_reply.connectionInfo = cfm->connectionInfo;
444 sme_complete_request(priv, cfm->status);
445 #endif
448 void CsrWifiSmeConnectionConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
450 #ifdef CSR_SUPPORT_WEXT
451 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
452 CsrWifiSmeConnectionConfigGetCfm* cfm = (CsrWifiSmeConnectionConfigGetCfm*)msg;
454 if (priv == NULL) {
455 unifi_error(NULL, "CsrWifiSmeConnectionConfigGetCfmSend: Invalid ospriv.\n");
456 return;
459 priv->sme_reply.connectionConfig = cfm->connectionConfig;
460 sme_complete_request(priv, cfm->status);
461 #endif
464 void CsrWifiSmeConnectionStatsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
466 #ifdef CSR_SUPPORT_WEXT
467 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
468 CsrWifiSmeConnectionStatsGetCfm* cfm = (CsrWifiSmeConnectionStatsGetCfm*)msg;
470 if (priv == NULL) {
471 unifi_error(NULL, "CsrWifiSmeConnectionStatsGetCfmSend: Invalid ospriv.\n");
472 return;
475 priv->sme_reply.connectionStats = cfm->connectionStats;
476 sme_complete_request(priv, cfm->status);
477 #endif
480 void CsrWifiSmeMibSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
482 #ifdef CSR_SUPPORT_WEXT
483 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
484 CsrWifiSmeMibSetCfm* cfm = (CsrWifiSmeMibSetCfm*)msg;
486 if (priv == NULL) {
487 unifi_error(NULL, "CsrWifiSmeMibSetCfmSend: Invalid ospriv.\n");
488 return;
491 sme_complete_request(priv, cfm->status);
492 #endif
495 void CsrWifiSmeMibGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
497 #ifdef CSR_SUPPORT_WEXT
498 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
499 CsrWifiSmeMibGetCfm* cfm = (CsrWifiSmeMibGetCfm*)msg;
501 if (priv == NULL) {
502 unifi_error(NULL, "CsrWifiSmeMibGetCfmSend: Invalid ospriv.\n");
503 return;
506 if (cfm->mibAttribute == NULL) {
507 unifi_error(priv, "CsrWifiSmeMibGetCfmSend: Empty reply.\n");
508 sme_complete_request(priv, cfm->status);
509 return;
512 if ((priv->mib_cfm_buffer != NULL) &&
513 (priv->mib_cfm_buffer_length >= cfm->mibAttributeLength)) {
514 memcpy(priv->mib_cfm_buffer, cfm->mibAttribute, cfm->mibAttributeLength);
515 priv->mib_cfm_buffer_length = cfm->mibAttributeLength;
516 } else {
517 unifi_error(priv,
518 "CsrWifiSmeMibGetCfmSend: No room to store MIB data (have=%d need=%d).\n",
519 priv->mib_cfm_buffer_length, cfm->mibAttributeLength);
522 sme_complete_request(priv, cfm->status);
523 #endif
526 void CsrWifiSmeMibGetNextCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
528 #ifdef CSR_SUPPORT_WEXT
529 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
530 CsrWifiSmeMibGetNextCfm* cfm = (CsrWifiSmeMibGetNextCfm*)msg;
532 if (priv == NULL) {
533 unifi_error(NULL, "CsrWifiSmeMibGetNextCfmSend: Invalid ospriv.\n");
534 return;
537 /* Need to copy MIB data */
538 sme_complete_request(priv, cfm->status);
539 #endif
542 void CsrWifiSmeConnectionQualityIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
544 #ifdef CSR_SUPPORT_WEXT
545 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
546 CsrWifiSmeConnectionQualityInd* ind = (CsrWifiSmeConnectionQualityInd*)msg;
547 int signal, noise, snr;
549 if (priv == NULL) {
550 unifi_error(NULL, "CsrWifiSmeConnectionQualityIndSend: Invalid ospriv.\n");
551 return;
555 * level and noise below are mapped into an unsigned 8 bit number,
556 * ranging from [-192; 63]. The way this is achieved is simply to
557 * add 0x100 onto the number if it is negative,
558 * once clipped to the correct range.
560 signal = ind->linkQuality.unifiRssi;
561 /* Clip range of snr */
562 snr = (ind->linkQuality.unifiSnr > 0) ? ind->linkQuality.unifiSnr : 0; /* In dB relative, from 0 - 255 */
563 snr = (snr < 255) ? snr : 255;
564 noise = signal - snr;
566 /* Clip range of signal */
567 signal = (signal < 63) ? signal : 63;
568 signal = (signal > -192) ? signal : -192;
570 /* Clip range of noise */
571 noise = (noise < 63) ? noise : 63;
572 noise = (noise > -192) ? noise : -192;
574 /* Make u8 */
575 signal = ( signal < 0 ) ? signal + 0x100 : signal;
576 noise = ( noise < 0 ) ? noise + 0x100 : noise;
578 priv->wext_wireless_stats.qual.level = (u8)signal; /* -192 : 63 */
579 priv->wext_wireless_stats.qual.noise = (u8)noise; /* -192 : 63 */
580 priv->wext_wireless_stats.qual.qual = snr; /* 0 : 255 */
581 priv->wext_wireless_stats.qual.updated = 0;
583 #if WIRELESS_EXT > 16
584 priv->wext_wireless_stats.qual.updated |= IW_QUAL_LEVEL_UPDATED |
585 IW_QUAL_NOISE_UPDATED |
586 IW_QUAL_QUAL_UPDATED;
587 #if WIRELESS_EXT > 18
588 priv->wext_wireless_stats.qual.updated |= IW_QUAL_DBM;
589 #endif
590 #endif
591 #endif
594 void CsrWifiSmePacketFilterSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
596 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
598 if (priv == NULL) {
599 unifi_error(NULL, "CsrWifiSmePacketFilterSetCfmSend: Invalid ospriv.\n");
600 return;
603 /* The packet filter set request does not block for a reply */
606 void CsrWifiSmeTspecCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
608 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
609 CsrWifiSmeTspecCfm* cfm = (CsrWifiSmeTspecCfm*)msg;
611 if (priv == NULL) {
612 unifi_error(NULL, "CsrWifiSmeTspecCfmSend: Invalid ospriv.\n");
613 return;
616 sme_complete_request(priv, cfm->status);
619 void CsrWifiSmeTspecIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
623 void CsrWifiSmeBlacklistCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
627 void CsrWifiSmeEventMaskSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
632 void CsrWifiSmeRoamStartIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
636 void CsrWifiSmeRoamCompleteIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
638 /* This is called when the association completes, before any 802.1x authentication */
641 void CsrWifiSmeAssociationStartIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
645 void CsrWifiSmeAssociationCompleteIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
649 void CsrWifiSmeIbssStationIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
653 void CsrWifiSmeWifiOnIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
657 void CsrWifiSmeRestrictedAccessEnableCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
661 void CsrWifiSmeRestrictedAccessDisableCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
666 void CsrWifiSmeAdhocConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
670 void CsrWifiSmeAdhocConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
672 #ifdef CSR_SUPPORT_WEXT
673 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
674 CsrWifiSmeAdhocConfigSetCfm* cfm = (CsrWifiSmeAdhocConfigSetCfm*)msg;
676 if (priv == NULL) {
677 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
678 return;
681 sme_complete_request(priv, cfm->status);
682 #endif
685 void CsrWifiSmeCalibrationDataGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
689 void CsrWifiSmeCalibrationDataSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
691 #ifdef CSR_SUPPORT_WEXT
692 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
693 CsrWifiSmeCalibrationDataSetCfm* cfm = (CsrWifiSmeCalibrationDataSetCfm*)msg;
695 if (priv == NULL) {
696 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
697 return;
700 sme_complete_request(priv, cfm->status);
701 #endif
704 void CsrWifiSmeCcxConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
708 void CsrWifiSmeCcxConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
710 #ifdef CSR_SUPPORT_WEXT
711 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
712 CsrWifiSmeCcxConfigSetCfm* cfm = (CsrWifiSmeCcxConfigSetCfm*)msg;
714 if (priv == NULL) {
715 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
716 return;
719 sme_complete_request(priv, cfm->status);
720 #endif
723 void CsrWifiSmeCloakedSsidsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
727 void CsrWifiSmeCloakedSsidsSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
729 #ifdef CSR_SUPPORT_WEXT
730 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
731 CsrWifiSmeCloakedSsidsSetCfm* cfm = (CsrWifiSmeCloakedSsidsSetCfm*)msg;
733 if (priv == NULL) {
734 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
735 return;
738 sme_complete_request(priv, cfm->status);
739 #endif
743 void CsrWifiSmeCoexConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
745 #ifdef CSR_SUPPORT_WEXT
746 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
747 CsrWifiSmeCoexConfigSetCfm* cfm = (CsrWifiSmeCoexConfigSetCfm*)msg;
749 if (priv == NULL) {
750 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
751 return;
754 sme_complete_request(priv, cfm->status);
755 #endif
758 void CsrWifiSmeHostConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
760 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
761 CsrWifiSmeHostConfigSetCfm* cfm = (CsrWifiSmeHostConfigSetCfm*)msg;
763 if (priv == NULL) {
764 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
765 return;
768 sme_complete_request(priv, cfm->status);
771 void CsrWifiSmeLinkQualityGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
776 void CsrWifiSmeMibConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
778 #ifdef CSR_SUPPORT_WEXT
779 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
780 CsrWifiSmeMibConfigSetCfm* cfm = (CsrWifiSmeMibConfigSetCfm*)msg;
782 if (priv == NULL) {
783 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
784 return;
787 sme_complete_request(priv, cfm->status);
788 #endif
791 void CsrWifiSmePermanentMacAddressGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
795 void CsrWifiSmePowerConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
797 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
798 CsrWifiSmePowerConfigSetCfm* cfm = (CsrWifiSmePowerConfigSetCfm*)msg;
800 if (priv == NULL) {
801 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
802 return;
805 sme_complete_request(priv, cfm->status);
808 void CsrWifiSmeRegulatoryDomainInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
812 void CsrWifiSmeRoamingConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
816 void CsrWifiSmeMediaStatusIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
818 #ifdef CSR_SUPPORT_WEXT
819 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
820 CsrWifiSmeMediaStatusInd* ind = (CsrWifiSmeMediaStatusInd*)msg;
822 if (priv->smepriv == NULL) {
823 unifi_error(priv, "CsrWifiSmeMediaStatusIndSend: invalid smepriv\n");
824 return;
827 if (ind->mediaStatus == CSR_WIFI_SME_MEDIA_STATUS_CONNECTED) {
829 * Send wireless-extension event up to userland to announce
830 * connection.
832 wext_send_assoc_event(priv,
833 (unsigned char *)ind->connectionInfo.bssid.a,
834 (unsigned char *)ind->connectionInfo.assocReqInfoElements,
835 ind->connectionInfo.assocReqInfoElementsLength,
836 (unsigned char *)ind->connectionInfo.assocRspInfoElements,
837 ind->connectionInfo.assocRspInfoElementsLength,
838 (unsigned char *)ind->connectionInfo.assocScanInfoElements,
839 ind->connectionInfo.assocScanInfoElementsLength);
841 unifi_trace(priv, UDBG2, "CsrWifiSmeMediaStatusIndSend: IBSS=%pM\n",
842 ind->connectionInfo.bssid.a);
844 sme_mgt_packet_filter_set(priv);
846 } else {
848 * Send wireless-extension event up to userland to announce
849 * connection lost to a BSS.
851 wext_send_disassoc_event(priv);
853 #endif
856 void CsrWifiSmeRoamingConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
858 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
859 CsrWifiSmeRoamingConfigSetCfm* cfm = (CsrWifiSmeRoamingConfigSetCfm*)msg;
861 if (priv == NULL) {
862 unifi_error(NULL, "CsrWifiSmeRoamingConfigSetCfmSend: Invalid ospriv.\n");
863 return;
866 sme_complete_request(priv, cfm->status);
869 void CsrWifiSmeScanConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
873 void CsrWifiSmeScanConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
875 #ifdef CSR_SUPPORT_WEXT
876 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
877 CsrWifiSmeScanConfigSetCfm* cfm = (CsrWifiSmeScanConfigSetCfm*)msg;
879 if (priv == NULL) {
880 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
881 return;
884 sme_complete_request(priv, cfm->status);
885 #endif
888 void CsrWifiSmeStationMacAddressGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
892 void CsrWifiSmeSmeCommonConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
894 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
895 CsrWifiSmeSmeCommonConfigGetCfm* cfm = (CsrWifiSmeSmeCommonConfigGetCfm*)msg;
897 if (priv == NULL) {
898 unifi_error(NULL, "CsrWifiSmeSmeCommonConfigGetCfmSend: Invalid ospriv.\n");
899 return;
902 priv->sme_reply.deviceConfig = cfm->deviceConfig;
903 sme_complete_request(priv, cfm->status);
906 void CsrWifiSmeSmeStaConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
908 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
909 CsrWifiSmeSmeStaConfigGetCfm* cfm = (CsrWifiSmeSmeStaConfigGetCfm*)msg;
911 if (priv == NULL) {
912 unifi_error(NULL, "CsrWifiSmeSmeStaConfigGetCfmSend: Invalid ospriv.\n");
913 return;
916 priv->sme_reply.staConfig = cfm->smeConfig;
917 sme_complete_request(priv, cfm->status);
920 void CsrWifiSmeSmeCommonConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
922 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
923 CsrWifiSmeSmeCommonConfigSetCfm* cfm = (CsrWifiSmeSmeCommonConfigSetCfm*)msg;
925 if (priv == NULL) {
926 unifi_error(NULL, "CsrWifiSmeSmeCommonConfigGetCfmSend: Invalid ospriv.\n");
927 return;
930 sme_complete_request(priv, cfm->status);
933 void CsrWifiSmeSmeStaConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
935 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
936 CsrWifiSmeSmeStaConfigSetCfm* cfm = (CsrWifiSmeSmeStaConfigSetCfm*)msg;
938 if (priv == NULL) {
939 unifi_error(NULL, "CsrWifiSmeSmeStaConfigGetCfmSend: Invalid ospriv.\n");
940 return;
943 sme_complete_request(priv, cfm->status);
946 void CsrWifiSmeGetInterfaceCapabilityCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
950 void CsrWifiSmeErrorIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
954 void CsrWifiSmeInfoIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
958 void CsrWifiSmeCoreDumpIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
961 void CsrWifiSmeAmpStatusChangeIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
965 void CsrWifiSmeActivateCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
968 void CsrWifiSmeDeactivateCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
972 #ifdef CSR_SUPPORT_WEXT
973 #ifdef CSR_SUPPORT_WEXT_AP
974 void CsrWifiNmeApStartCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
976 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
977 CsrWifiNmeApStartCfm* cfm = (CsrWifiNmeApStartCfm*)msg;
979 if (priv == NULL) {
980 unifi_error(NULL, "CsrWifiNmeApStartCfmSend: Invalid ospriv.\n");
981 return;
984 sme_complete_request(priv, cfm->status);
987 void CsrWifiNmeApStopCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
989 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
990 CsrWifiNmeApStopCfm* cfm = (CsrWifiNmeApStopCfm*)msg;
992 if (priv == NULL) {
993 unifi_error(NULL, "CsrWifiNmeApStopCfmSend: Invalid ospriv.\n");
994 return;
997 sme_complete_request(priv, cfm->status);
1000 void CsrWifiNmeApConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1002 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1003 CsrWifiNmeApConfigSetCfm* cfm = (CsrWifiNmeApConfigSetCfm*)msg;
1005 if (priv == NULL) {
1006 unifi_error(NULL, "CsrWifiNmeApConfigSetCfmSend: Invalid ospriv.\n");
1007 return;
1009 sme_complete_request(priv, cfm->status);
1011 #endif
1012 #endif