Root/drivers/staging/csr/sme_mgt.c

1/*
2 * ---------------------------------------------------------------------------
3 * FILE: sme_mgt.c
4 *
5 * PURPOSE:
6 * This file contains the driver specific implementation of
7 * the SME MGT SAP.
8 * It is part of the porting exercise.
9 *
10 * Copyright (C) 2008-2009 by Cambridge Silicon Radio Ltd.
11 *
12 * Refer to LICENSE.txt included with this source code for details on
13 * the license terms.
14 *
15 * ---------------------------------------------------------------------------
16 */
17
18#include "csr_wifi_hip_unifiversion.h"
19#include "unifi_priv.h"
20#include "csr_wifi_hip_conversions.h"
21/*
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()
55 */
56
57
58void CsrWifiSmeMicFailureIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
59{
60#ifdef CSR_SUPPORT_WEXT
61    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
62    CsrWifiSmeMicFailureInd* ind = (CsrWifiSmeMicFailureInd*)msg;
63
64    if (priv == NULL) {
65        unifi_error(NULL, "CsrWifiSmeMicFailureIndSend: invalid priv\n");
66        return;
67    }
68
69    unifi_trace(priv, UDBG1,
70                "CsrWifiSmeMicFailureIndSend: count=%d, KeyType=%d\n",
71                ind->count, ind->keyType);
72
73    wext_send_michaelmicfailure_event(priv, ind->count, ind->address, ind->keyType, ind->interfaceTag);
74#endif
75}
76
77
78void CsrWifiSmePmkidCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
79{
80#ifdef CSR_SUPPORT_WEXT
81    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
82    CsrWifiSmePmkidCfm* cfm = (CsrWifiSmePmkidCfm*)msg;
83
84    if (priv == NULL) {
85        unifi_error(NULL, "CsrWifiSmePmkidCfmSend: Invalid ospriv.\n");
86        return;
87    }
88
89    /*
90     * WEXT never does a GET operation the PMKIDs, so we don't need
91     * handle data returned in pmkids.
92     */
93
94    sme_complete_request(priv, cfm->status);
95#endif
96}
97
98
99void CsrWifiSmePmkidCandidateListIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
100{
101#ifdef CSR_SUPPORT_WEXT
102    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
103    CsrWifiSmePmkidCandidateListInd* ind = (CsrWifiSmePmkidCandidateListInd*)msg;
104    int i;
105
106    if (priv->smepriv == NULL) {
107        unifi_error(priv, "CsrWifiSmePmkidCandidateListIndSend: invalid smepriv\n");
108        return;
109    }
110
111    for (i = 0; i < ind->pmkidCandidatesCount; i++)
112    {
113        wext_send_pmkid_candidate_event(priv, ind->pmkidCandidates[i].bssid, ind->pmkidCandidates[i].preAuthAllowed, ind->interfaceTag);
114    }
115#endif
116}
117
118void CsrWifiSmeScanResultsFlushCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
119{
120}
121
122void CsrWifiSmeScanResultsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
123{
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;
131
132    if (priv == NULL) {
133        unifi_error(NULL, "CsrWifiSmeScanResultsGetCfmSend: Invalid ospriv.\n");
134        return;
135    }
136
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;
141    }
142
143    /* Take a Copy of the scan Results :-) */
144    scanCopy = kmalloc(bytesRequired, GFP_KERNEL);
145    memcpy(scanCopy, cfm->scanResults, sizeof(CsrWifiSmeScanResult) * cfm->scanResultsCount);
146
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)
150    {
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;
155    }
156
157    priv->sme_reply.reply_scan_results_count = cfm->scanResultsCount;
158    priv->sme_reply.reply_scan_results = scanCopy;
159
160    sme_complete_request(priv, cfm->status);
161#endif
162}
163
164
165void CsrWifiSmeScanFullCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
166{
167#ifdef CSR_SUPPORT_WEXT
168    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
169    CsrWifiSmeScanFullCfm* cfm = (CsrWifiSmeScanFullCfm*)msg;
170
171    if (priv == NULL) {
172        unifi_error(NULL, "CsrWifiSmeScanFullCfmSend: Invalid ospriv.\n");
173        return;
174    }
175
176    sme_complete_request(priv, cfm->status);
177#endif
178}
179
180
181void CsrWifiSmeScanResultIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
182{
183
184}
185
186
187void CsrWifiSmeConnectCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
188{
189#ifdef CSR_SUPPORT_WEXT
190    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
191    CsrWifiSmeConnectCfm* cfm = (CsrWifiSmeConnectCfm*)msg;
192
193    if (priv == NULL) {
194        unifi_error(NULL, "CsrWifiSmeConnectCfmSend: Invalid ospriv.\n");
195        return;
196    }
197
198    sme_complete_request(priv, cfm->status);
199#endif
200}
201
202
203void CsrWifiSmeDisconnectCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
204{
205#ifdef CSR_SUPPORT_WEXT
206    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
207    CsrWifiSmeDisconnectCfm* cfm = (CsrWifiSmeDisconnectCfm*)msg;
208
209    if (priv == NULL) {
210        unifi_error(NULL, "CsrWifiSmeDisconnectCfmSend: Invalid ospriv.\n");
211        return;
212    }
213
214    sme_complete_request(priv, cfm->status);
215#endif
216}
217
218
219void CsrWifiSmeKeyCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
220{
221#ifdef CSR_SUPPORT_WEXT
222    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
223    CsrWifiSmeKeyCfm* cfm = (CsrWifiSmeKeyCfm*)msg;
224
225    if (priv == NULL) {
226        unifi_error(NULL, "CsrWifiSmeKeyCfmSend: Invalid ospriv.\n");
227        return;
228    }
229
230    sme_complete_request(priv, cfm->status);
231#endif
232}
233
234
235void CsrWifiSmeMulticastAddressCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
236{
237#ifdef CSR_SUPPORT_WEXT
238    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
239    CsrWifiSmeMulticastAddressCfm* cfm = (CsrWifiSmeMulticastAddressCfm*)msg;
240
241    if (priv == NULL) {
242        unifi_error(NULL, "CsrWifiSmeMulticastAddressCfmSend: Invalid ospriv.\n");
243        return;
244    }
245
246    sme_complete_request(priv, cfm->status);
247#endif
248}
249
250void CsrWifiSmeWifiFlightmodeCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
251{
252#ifdef CSR_SUPPORT_WEXT
253    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
254    CsrWifiSmeWifiFlightmodeCfm* cfm = (CsrWifiSmeWifiFlightmodeCfm*)msg;
255
256    if (priv == NULL) {
257        unifi_error(NULL, "CsrWifiSmeWifiFlightmodeCfmSend: Invalid ospriv.\n");
258        return;
259    }
260
261    sme_complete_request(priv, cfm->status);
262#endif
263}
264
265void CsrWifiSmeWifiOnCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
266{
267#ifdef CSR_SUPPORT_WEXT
268    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
269    CsrWifiSmeWifiOnCfm* cfm = (CsrWifiSmeWifiOnCfm*)msg;
270
271    if (priv == NULL) {
272        unifi_error(NULL, "CsrWifiSmeWifiOnCfmSend: Invalid ospriv.\n");
273        return;
274    }
275
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
281
282#endif
283}
284
285void CsrWifiSmeWifiOffCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
286{
287#ifdef CSR_SUPPORT_WEXT
288    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
289    CsrWifiSmeWifiOffCfm* cfm = (CsrWifiSmeWifiOffCfm*)msg;
290
291    if (priv == NULL) {
292        unifi_error(NULL, "CsrWifiSmeWifiOffCfmSend: Invalid ospriv.\n");
293        return;
294    }
295
296    sme_complete_request(priv, cfm->status);
297#endif
298}
299
300
301void CsrWifiSmeWifiOffIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
302{
303#ifdef CSR_SUPPORT_WEXT
304    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
305    CsrWifiSmeWifiOffInd* ind = (CsrWifiSmeWifiOffInd*)msg;
306
307    if (priv == NULL) {
308        unifi_error(NULL, "CsrWifiRouterCtrlStoppedReqSend: Invalid ospriv.\n");
309        return;
310    }
311
312    if (priv->smepriv == NULL) {
313        unifi_error(priv, "CsrWifiRouterCtrlStoppedReqSend: invalid smepriv\n");
314        return;
315    }
316
317    /*
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.
320     */
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);
326
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;
337    }
338
339#endif
340}
341
342void CsrWifiSmeVersionsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
343{
344#ifdef CSR_SUPPORT_WEXT
345    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
346    CsrWifiSmeVersionsGetCfm* cfm = (CsrWifiSmeVersionsGetCfm*)msg;
347
348    if (priv == NULL) {
349        unifi_error(NULL, "CsrWifiSmeVersionsGetCfmSend: Invalid ospriv.\n");
350        return;
351    }
352
353    priv->sme_reply.versions = cfm->versions;
354    sme_complete_request(priv, cfm->status);
355#endif
356}
357
358void CsrWifiSmePowerConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
359{
360    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
361    CsrWifiSmePowerConfigGetCfm* cfm = (CsrWifiSmePowerConfigGetCfm*)msg;
362
363    if (priv == NULL) {
364        unifi_error(NULL, "CsrWifiSmePowerConfigGetCfmSend: Invalid ospriv.\n");
365        return;
366    }
367
368    priv->sme_reply.powerConfig = cfm->powerConfig;
369    sme_complete_request(priv, cfm->status);
370}
371
372void CsrWifiSmeHostConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
373{
374    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
375    CsrWifiSmeHostConfigGetCfm* cfm = (CsrWifiSmeHostConfigGetCfm*)msg;
376
377    if (priv == NULL) {
378        unifi_error(NULL, "CsrWifiSmeHostConfigGetCfmSend: Invalid ospriv.\n");
379        return;
380    }
381
382    priv->sme_reply.hostConfig = cfm->hostConfig;
383    sme_complete_request(priv, cfm->status);
384}
385
386void CsrWifiSmeCoexInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
387{
388    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
389    CsrWifiSmeCoexInfoGetCfm* cfm = (CsrWifiSmeCoexInfoGetCfm*)msg;
390
391    if (priv == NULL) {
392        unifi_error(NULL, "CsrWifiSmeCoexInfoGetCfmSend: Invalid ospriv.\n");
393        return;
394    }
395
396    priv->sme_reply.coexInfo = cfm->coexInfo;
397    sme_complete_request(priv, cfm->status);
398}
399
400void CsrWifiSmeCoexConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
401{
402#ifdef CSR_SUPPORT_WEXT
403    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
404    CsrWifiSmeCoexConfigGetCfm* cfm = (CsrWifiSmeCoexConfigGetCfm*)msg;
405
406    if (priv == NULL) {
407        unifi_error(NULL, "CsrWifiSmeCoexConfigGetCfmSend: Invalid ospriv.\n");
408        return;
409    }
410
411    priv->sme_reply.coexConfig = cfm->coexConfig;
412    sme_complete_request(priv, cfm->status);
413#endif
414}
415
416void CsrWifiSmeMibConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
417{
418#ifdef CSR_SUPPORT_WEXT
419    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
420    CsrWifiSmeMibConfigGetCfm* cfm = (CsrWifiSmeMibConfigGetCfm*)msg;
421
422    if (priv == NULL) {
423        unifi_error(NULL, "CsrWifiSmeMibConfigGetCfmSend: Invalid ospriv.\n");
424        return;
425    }
426
427    priv->sme_reply.mibConfig = cfm->mibConfig;
428    sme_complete_request(priv, cfm->status);
429#endif
430}
431
432void CsrWifiSmeConnectionInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
433{
434#ifdef CSR_SUPPORT_WEXT
435    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
436    CsrWifiSmeConnectionInfoGetCfm* cfm = (CsrWifiSmeConnectionInfoGetCfm*)msg;
437
438    if (priv == NULL) {
439        unifi_error(NULL, "CsrWifiSmeConnectionInfoGetCfmSend: Invalid ospriv.\n");
440        return;
441    }
442
443    priv->sme_reply.connectionInfo = cfm->connectionInfo;
444    sme_complete_request(priv, cfm->status);
445#endif
446}
447
448void CsrWifiSmeConnectionConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
449{
450#ifdef CSR_SUPPORT_WEXT
451    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
452    CsrWifiSmeConnectionConfigGetCfm* cfm = (CsrWifiSmeConnectionConfigGetCfm*)msg;
453
454    if (priv == NULL) {
455        unifi_error(NULL, "CsrWifiSmeConnectionConfigGetCfmSend: Invalid ospriv.\n");
456        return;
457    }
458
459    priv->sme_reply.connectionConfig = cfm->connectionConfig;
460    sme_complete_request(priv, cfm->status);
461#endif
462}
463
464void CsrWifiSmeConnectionStatsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
465{
466#ifdef CSR_SUPPORT_WEXT
467    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
468    CsrWifiSmeConnectionStatsGetCfm* cfm = (CsrWifiSmeConnectionStatsGetCfm*)msg;
469
470    if (priv == NULL) {
471        unifi_error(NULL, "CsrWifiSmeConnectionStatsGetCfmSend: Invalid ospriv.\n");
472        return;
473    }
474
475    priv->sme_reply.connectionStats = cfm->connectionStats;
476    sme_complete_request(priv, cfm->status);
477#endif
478}
479
480void CsrWifiSmeMibSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
481{
482#ifdef CSR_SUPPORT_WEXT
483    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
484    CsrWifiSmeMibSetCfm* cfm = (CsrWifiSmeMibSetCfm*)msg;
485
486    if (priv == NULL) {
487        unifi_error(NULL, "CsrWifiSmeMibSetCfmSend: Invalid ospriv.\n");
488        return;
489    }
490
491    sme_complete_request(priv, cfm->status);
492#endif
493}
494
495void CsrWifiSmeMibGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
496{
497#ifdef CSR_SUPPORT_WEXT
498    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
499    CsrWifiSmeMibGetCfm* cfm = (CsrWifiSmeMibGetCfm*)msg;
500
501    if (priv == NULL) {
502        unifi_error(NULL, "CsrWifiSmeMibGetCfmSend: Invalid ospriv.\n");
503        return;
504    }
505
506    if (cfm->mibAttribute == NULL) {
507        unifi_error(priv, "CsrWifiSmeMibGetCfmSend: Empty reply.\n");
508        sme_complete_request(priv, cfm->status);
509        return;
510    }
511
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);
520    }
521
522    sme_complete_request(priv, cfm->status);
523#endif
524}
525
526void CsrWifiSmeMibGetNextCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
527{
528#ifdef CSR_SUPPORT_WEXT
529    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
530    CsrWifiSmeMibGetNextCfm* cfm = (CsrWifiSmeMibGetNextCfm*)msg;
531
532    if (priv == NULL) {
533        unifi_error(NULL, "CsrWifiSmeMibGetNextCfmSend: Invalid ospriv.\n");
534        return;
535    }
536
537    /* Need to copy MIB data */
538    sme_complete_request(priv, cfm->status);
539#endif
540}
541
542void CsrWifiSmeConnectionQualityIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
543{
544#ifdef CSR_SUPPORT_WEXT
545    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
546    CsrWifiSmeConnectionQualityInd* ind = (CsrWifiSmeConnectionQualityInd*)msg;
547    int signal, noise, snr;
548
549    if (priv == NULL) {
550        unifi_error(NULL, "CsrWifiSmeConnectionQualityIndSend: Invalid ospriv.\n");
551        return;
552    }
553
554    /*
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.
559     */
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;
565
566    /* Clip range of signal */
567    signal = (signal < 63) ? signal : 63;
568    signal = (signal > -192) ? signal : -192;
569
570    /* Clip range of noise */
571    noise = (noise < 63) ? noise : 63;
572    noise = (noise > -192) ? noise : -192;
573
574    /* Make u8 */
575    signal = ( signal < 0 ) ? signal + 0x100 : signal;
576    noise = ( noise < 0 ) ? noise + 0x100 : noise;
577
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;
582
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
592}
593
594void CsrWifiSmePacketFilterSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
595{
596    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
597
598    if (priv == NULL) {
599        unifi_error(NULL, "CsrWifiSmePacketFilterSetCfmSend: Invalid ospriv.\n");
600        return;
601    }
602
603    /* The packet filter set request does not block for a reply */
604}
605
606void CsrWifiSmeTspecCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
607{
608    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
609    CsrWifiSmeTspecCfm* cfm = (CsrWifiSmeTspecCfm*)msg;
610
611    if (priv == NULL) {
612        unifi_error(NULL, "CsrWifiSmeTspecCfmSend: Invalid ospriv.\n");
613        return;
614    }
615
616    sme_complete_request(priv, cfm->status);
617}
618
619void CsrWifiSmeTspecIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
620{
621}
622
623void CsrWifiSmeBlacklistCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
624{
625}
626
627void CsrWifiSmeEventMaskSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
628{
629}
630
631
632void CsrWifiSmeRoamStartIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
633{
634}
635
636void CsrWifiSmeRoamCompleteIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
637{
638    /* This is called when the association completes, before any 802.1x authentication */
639}
640
641void CsrWifiSmeAssociationStartIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
642{
643}
644
645void CsrWifiSmeAssociationCompleteIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
646{
647}
648
649void CsrWifiSmeIbssStationIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
650{
651}
652
653void CsrWifiSmeWifiOnIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
654{
655}
656
657void CsrWifiSmeRestrictedAccessEnableCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
658{
659}
660
661void CsrWifiSmeRestrictedAccessDisableCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
662{
663}
664
665
666void CsrWifiSmeAdhocConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
667{
668}
669
670void CsrWifiSmeAdhocConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
671{
672#ifdef CSR_SUPPORT_WEXT
673    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
674    CsrWifiSmeAdhocConfigSetCfm* cfm = (CsrWifiSmeAdhocConfigSetCfm*)msg;
675
676    if (priv == NULL) {
677        unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
678        return;
679    }
680
681    sme_complete_request(priv, cfm->status);
682#endif
683}
684
685void CsrWifiSmeCalibrationDataGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
686{
687}
688
689void CsrWifiSmeCalibrationDataSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
690{
691#ifdef CSR_SUPPORT_WEXT
692    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
693    CsrWifiSmeCalibrationDataSetCfm* cfm = (CsrWifiSmeCalibrationDataSetCfm*)msg;
694
695    if (priv == NULL) {
696        unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
697        return;
698    }
699
700    sme_complete_request(priv, cfm->status);
701#endif
702}
703
704void CsrWifiSmeCcxConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
705{
706}
707
708void CsrWifiSmeCcxConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
709{
710#ifdef CSR_SUPPORT_WEXT
711    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
712    CsrWifiSmeCcxConfigSetCfm* cfm = (CsrWifiSmeCcxConfigSetCfm*)msg;
713
714    if (priv == NULL) {
715        unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
716        return;
717    }
718
719    sme_complete_request(priv, cfm->status);
720#endif
721}
722
723void CsrWifiSmeCloakedSsidsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
724{
725}
726
727void CsrWifiSmeCloakedSsidsSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
728{
729#ifdef CSR_SUPPORT_WEXT
730    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
731    CsrWifiSmeCloakedSsidsSetCfm* cfm = (CsrWifiSmeCloakedSsidsSetCfm*)msg;
732
733    if (priv == NULL) {
734        unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
735        return;
736    }
737
738    sme_complete_request(priv, cfm->status);
739#endif
740}
741
742
743void CsrWifiSmeCoexConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
744{
745#ifdef CSR_SUPPORT_WEXT
746    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
747    CsrWifiSmeCoexConfigSetCfm* cfm = (CsrWifiSmeCoexConfigSetCfm*)msg;
748
749    if (priv == NULL) {
750        unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
751        return;
752    }
753
754    sme_complete_request(priv, cfm->status);
755#endif
756}
757
758void CsrWifiSmeHostConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
759{
760    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
761    CsrWifiSmeHostConfigSetCfm* cfm = (CsrWifiSmeHostConfigSetCfm*)msg;
762
763    if (priv == NULL) {
764        unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
765        return;
766    }
767
768    sme_complete_request(priv, cfm->status);
769}
770
771void CsrWifiSmeLinkQualityGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
772{
773}
774
775
776void CsrWifiSmeMibConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
777{
778#ifdef CSR_SUPPORT_WEXT
779    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
780    CsrWifiSmeMibConfigSetCfm* cfm = (CsrWifiSmeMibConfigSetCfm*)msg;
781
782    if (priv == NULL) {
783        unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
784        return;
785    }
786
787    sme_complete_request(priv, cfm->status);
788#endif
789}
790
791void CsrWifiSmePermanentMacAddressGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
792{
793}
794
795void CsrWifiSmePowerConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
796{
797    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
798    CsrWifiSmePowerConfigSetCfm* cfm = (CsrWifiSmePowerConfigSetCfm*)msg;
799
800    if (priv == NULL) {
801        unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
802        return;
803    }
804
805    sme_complete_request(priv, cfm->status);
806}
807
808void CsrWifiSmeRegulatoryDomainInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
809{
810}
811
812void CsrWifiSmeRoamingConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
813{
814}
815
816void CsrWifiSmeMediaStatusIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
817{
818#ifdef CSR_SUPPORT_WEXT
819    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
820    CsrWifiSmeMediaStatusInd* ind = (CsrWifiSmeMediaStatusInd*)msg;
821
822    if (priv->smepriv == NULL) {
823        unifi_error(priv, "CsrWifiSmeMediaStatusIndSend: invalid smepriv\n");
824        return;
825    }
826
827    if (ind->mediaStatus == CSR_WIFI_SME_MEDIA_STATUS_CONNECTED) {
828        /*
829         * Send wireless-extension event up to userland to announce
830         * connection.
831         */
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);
840
841    unifi_trace(priv, UDBG2, "CsrWifiSmeMediaStatusIndSend: IBSS=%pM\n",
842                 ind->connectionInfo.bssid.a);
843
844        sme_mgt_packet_filter_set(priv);
845
846    } else {
847        /*
848         * Send wireless-extension event up to userland to announce
849         * connection lost to a BSS.
850         */
851        wext_send_disassoc_event(priv);
852    }
853#endif
854}
855
856void CsrWifiSmeRoamingConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
857{
858    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
859    CsrWifiSmeRoamingConfigSetCfm* cfm = (CsrWifiSmeRoamingConfigSetCfm*)msg;
860
861    if (priv == NULL) {
862        unifi_error(NULL, "CsrWifiSmeRoamingConfigSetCfmSend: Invalid ospriv.\n");
863        return;
864    }
865
866    sme_complete_request(priv, cfm->status);
867}
868
869void CsrWifiSmeScanConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
870{
871}
872
873void CsrWifiSmeScanConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
874{
875#ifdef CSR_SUPPORT_WEXT
876    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
877    CsrWifiSmeScanConfigSetCfm* cfm = (CsrWifiSmeScanConfigSetCfm*)msg;
878
879    if (priv == NULL) {
880        unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
881        return;
882    }
883
884    sme_complete_request(priv, cfm->status);
885#endif
886}
887
888void CsrWifiSmeStationMacAddressGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
889{
890}
891
892void CsrWifiSmeSmeCommonConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
893{
894    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
895    CsrWifiSmeSmeCommonConfigGetCfm* cfm = (CsrWifiSmeSmeCommonConfigGetCfm*)msg;
896
897    if (priv == NULL) {
898        unifi_error(NULL, "CsrWifiSmeSmeCommonConfigGetCfmSend: Invalid ospriv.\n");
899        return;
900    }
901
902    priv->sme_reply.deviceConfig = cfm->deviceConfig;
903    sme_complete_request(priv, cfm->status);
904}
905
906void CsrWifiSmeSmeStaConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
907{
908    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
909    CsrWifiSmeSmeStaConfigGetCfm* cfm = (CsrWifiSmeSmeStaConfigGetCfm*)msg;
910
911    if (priv == NULL) {
912        unifi_error(NULL, "CsrWifiSmeSmeStaConfigGetCfmSend: Invalid ospriv.\n");
913        return;
914    }
915
916    priv->sme_reply.staConfig = cfm->smeConfig;
917    sme_complete_request(priv, cfm->status);
918}
919
920void CsrWifiSmeSmeCommonConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
921{
922    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
923    CsrWifiSmeSmeCommonConfigSetCfm* cfm = (CsrWifiSmeSmeCommonConfigSetCfm*)msg;
924
925    if (priv == NULL) {
926        unifi_error(NULL, "CsrWifiSmeSmeCommonConfigGetCfmSend: Invalid ospriv.\n");
927        return;
928    }
929
930    sme_complete_request(priv, cfm->status);
931}
932
933void CsrWifiSmeSmeStaConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
934{
935    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
936    CsrWifiSmeSmeStaConfigSetCfm* cfm = (CsrWifiSmeSmeStaConfigSetCfm*)msg;
937
938    if (priv == NULL) {
939        unifi_error(NULL, "CsrWifiSmeSmeStaConfigGetCfmSend: Invalid ospriv.\n");
940        return;
941    }
942
943    sme_complete_request(priv, cfm->status);
944}
945
946void CsrWifiSmeGetInterfaceCapabilityCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
947{
948}
949
950void CsrWifiSmeErrorIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
951{
952}
953
954void CsrWifiSmeInfoIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
955{
956}
957
958void CsrWifiSmeCoreDumpIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
959{
960}
961void CsrWifiSmeAmpStatusChangeIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
962{
963}
964
965void CsrWifiSmeActivateCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
966{
967}
968void CsrWifiSmeDeactivateCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
969{
970}
971
972#ifdef CSR_SUPPORT_WEXT
973#ifdef CSR_SUPPORT_WEXT_AP
974void CsrWifiNmeApStartCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
975{
976    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
977    CsrWifiNmeApStartCfm* cfm = (CsrWifiNmeApStartCfm*)msg;
978
979    if (priv == NULL) {
980        unifi_error(NULL, "CsrWifiNmeApStartCfmSend: Invalid ospriv.\n");
981        return;
982    }
983
984    sme_complete_request(priv, cfm->status);
985}
986
987void CsrWifiNmeApStopCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
988{
989    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
990    CsrWifiNmeApStopCfm* cfm = (CsrWifiNmeApStopCfm*)msg;
991
992    if (priv == NULL) {
993        unifi_error(NULL, "CsrWifiNmeApStopCfmSend: Invalid ospriv.\n");
994        return;
995    }
996
997    sme_complete_request(priv, cfm->status);
998}
999
1000void CsrWifiNmeApConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1001{
1002    unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1003    CsrWifiNmeApConfigSetCfm* cfm = (CsrWifiNmeApConfigSetCfm*)msg;
1004
1005    if (priv == NULL) {
1006        unifi_error(NULL, "CsrWifiNmeApConfigSetCfmSend: Invalid ospriv.\n");
1007        return;
1008    }
1009    sme_complete_request(priv, cfm->status);
1010}
1011#endif
1012#endif
1013

Archive Download this file



interactive