blob: 0038a7b3009ebc1aac6184c8c09c21ce6344bbdd [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05302 * Copyright (c) 2014, 2016 The Linux Foundation. All rights reserved.
Kiet Lam1ed83fc2014-02-19 01:15:45 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam1ed83fc2014-02-19 01:15:45 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Jeff Johnson295189b2012-06-20 16:38:30 -070028/*===========================================================================
29
30 W L A N _ Q C T _ W D I _ S T A . C
31
32 OVERVIEW:
33
34 This software unit holds the implementation of the WLAN Device Abstraction
35 Layer Station Table Management Entity.
36
37 The functions externalized by this module are internal APIs for DAL Core
38 and can only be called by it.
39
40 DEPENDENCIES:
41
42 Are listed for each API below.
43
44
Jeff Johnson295189b2012-06-20 16:38:30 -070045===========================================================================*/
46
47/*===========================================================================
48
49 EDIT HISTORY FOR FILE
50
51
52 This section contains comments describing changes made to the module.
53 Notice that changes are listed in reverse chronological order.
54
55
56 $Header$$DateTime$$Author$
57
58
59 when who what, where, why
60---------- --- --------------------------------------------------------
612010-08-09 lti Created module
62
63===========================================================================*/
64
65/*----------------------------------------------------------------------------
66 * Include Files
67 * -------------------------------------------------------------------------*/
68#include "wlan_qct_wdi.h"
69#include "wlan_qct_wdi_i.h"
70#include "wlan_qct_wdi_sta.h"
71#include "wlan_qct_pal_api.h"
72#include "wlan_qct_pal_trace.h"
73
74
75/*----------------------------------------------------------------------------
76 * Function definition
77 * -------------------------------------------------------------------------*/
78/**
79 @brief WDI_STATableInit - Initializes the STA tables.
80 Allocates the necesary memory.
81
82
83 @param pWDICtx: pointer to the WLAN DAL context
84
85 @see
86 @return Result of the function call
87*/
88WDI_Status WDI_STATableInit
89(
90 WDI_ControlBlockType* pWDICtx
91)
92{
93 wpt_uint8 ucMaxStations;
94 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
95
96 ucMaxStations = (wpt_uint8) pWDICtx->ucMaxStations;
97
98 /*----------------------------------------------------------------------
99 Allocate the memory for sta table
100 ------------------------------------------------------------------------*/
101 pWDICtx->staTable = wpalMemoryAllocate(ucMaxStations * sizeof(WDI_StaStruct));
102
103 if (NULL == pWDICtx->staTable)
104 {
105
106 WDI_STATableClose(pWDICtx);
107
108 WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
109 "Error allocating memory on WDI_STATableInit");
110 return WDI_STATUS_E_FAILURE;
111 }
112
113 wpalMemoryZero( pWDICtx->staTable, ucMaxStations * sizeof( WDI_StaStruct ));
114
115#ifndef HAL_SELF_STA_PER_BSS
116 // Initialize the Self STAID to an invalid value
117 pWDICtx->ucSelfStaId = WDI_STA_INVALID_IDX;
118#endif
119
120 return WDI_STATUS_SUCCESS;
121}/*WDI_STATableInit*/
122
123/**
124 @brief WDI_STATableStart - resets the max and number values of
125 STAtions
126
127
128 @param pWDICtx: pointer to the WLAN DAL context
129
130 @see
131 @return Result of the function call
132*/
133WDI_Status
134WDI_STATableStart
135(
136 WDI_ControlBlockType* pWDICtx
137)
138{
139 wpt_uint8 ucMaxStations;
140 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
141
142 ucMaxStations = (wpt_uint8) pWDICtx->ucMaxStations;
143
144 return WDI_STATUS_SUCCESS;
145}/*WDI_STATableStart*/
146
147/**
148 @brief WDI_STATableStop - clears the sta table
149
150
151 @param pWDICtx: pointer to the WLAN DAL context
152
153 @see
154 @return Result of the function call
155*/
156WDI_Status
157WDI_STATableStop
158(
159 WDI_ControlBlockType* pWDICtx
160)
161{
162 wpt_uint8 ucMaxStations;
163 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
164
165#ifndef HAL_SELF_STA_PER_BSS
166 /* Clean up the Self STAID */
167 pWDICtx->ucSelfStaId = WDI_STA_INVALID_IDX;
168#endif
169
170 ucMaxStations = pWDICtx->ucMaxStations;
171
172 wpalMemoryZero( (void *) pWDICtx->staTable,
173 ucMaxStations * sizeof( WDI_StaStruct ));
174
175 return WDI_STATUS_SUCCESS;
176}/*WDI_STATableStop*/
177
178/**
179 @brief WDI_STATableClose - frees the resources used by the STA
180 table.
181
182
183 @param pWDICtx: pointer to the WLAN DAL context
184
185 @see
186 @return Result of the function call
187*/
188WDI_Status
189WDI_STATableClose
190(
191 WDI_ControlBlockType* pWDICtx
192)
193{
194 WDI_Status status = WDI_STATUS_SUCCESS;
195
196 // Free memory
197 if (pWDICtx->staTable != NULL)
198 wpalMemoryFree( pWDICtx->staTable);
199
200 pWDICtx->staTable = NULL;
201 return status;
202}/*WDI_STATableClose*/
203
204
205/**
206 @brief WDI_STATableAddSta - Function to Add Station
207
208
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530209 @param pWDICtx: pointer to the WLAN DAL context
Jeff Johnson295189b2012-06-20 16:38:30 -0700210 pwdiParam: station parameters
211
212 @see
213 @return Result of the function call
214*/
215WDI_Status
216WDI_STATableAddSta
217(
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530218 void* ctx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700219 WDI_AddStaParams* pwdiParam
220)
221{
222 wpt_uint8 ucSTAIdx = 0;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530223 WDI_ControlBlockType* pWDICtx = ctx;
Jeff Johnson295189b2012-06-20 16:38:30 -0700224 WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
225 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
226
227 /*-----------------------------------------------------------------------
228 Sanity check
229 - station ids are allocated by the HAL located on RIVA SS - they must
230 always be valid
231 -----------------------------------------------------------------------*/
232 if (( pwdiParam->ucSTAIdx == WDI_STA_INVALID_IDX) ||
233 ( pwdiParam->ucSTAIdx >= pWDICtx->ucMaxStations ))
234 {
235 WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
236 "Station id sent by HAL is invalid - not OK");
237 WDI_ASSERT(0);
238 return WDI_STATUS_E_FAILURE;
239 }
240
241 ucSTAIdx = pwdiParam->ucSTAIdx;
242
243 /*Since we are not the allocator of STA Ids but HAL is - just set flag to
244 valid*/
245 pSTATable[ucSTAIdx].valid = 1;
246
247
248 // Save the STA type - this is used for lookup
249 WDI_STATableSetStaType(pWDICtx, ucSTAIdx, pwdiParam->ucStaType);
250 WDI_STATableSetStaQosEnabled(pWDICtx, ucSTAIdx,
251 (wpt_uint8)(pwdiParam->ucWmmEnabled | pwdiParam->ucHTCapable) );
252
253#ifdef WLAN_PERF
254 pWDICtx->uBdSigSerialNum ++;
255#endif
256
257 wpalMemoryCopy(pSTATable[ucSTAIdx].macBSSID,
258 pwdiParam->macBSSID, WDI_MAC_ADDR_LEN);
259
260 /*------------------------------------------------------------------------
261 Set DPU Related Information
262 ------------------------------------------------------------------------*/
263 pSTATable[ucSTAIdx].dpuIndex = pwdiParam->dpuIndex;
264 pSTATable[ucSTAIdx].dpuSig = pwdiParam->dpuSig;
265
266 pSTATable[ucSTAIdx].bcastDpuIndex = pwdiParam->bcastDpuIndex;
267 pSTATable[ucSTAIdx].bcastDpuSignature = pwdiParam->bcastDpuSignature;
268
269 pSTATable[ucSTAIdx].bcastMgmtDpuIndex = pwdiParam->bcastMgmtDpuIndex;
270 pSTATable[ucSTAIdx].bcastMgmtDpuSignature = pwdiParam->bcastMgmtDpuSignature;
271
272 /*Robust Mgmt Frame enabled */
273 pSTATable[ucSTAIdx].rmfEnabled = pwdiParam->ucRmfEnabled;
274
275 pSTATable[ucSTAIdx].bssIdx = pwdiParam->ucBSSIdx;
276
277 /* Now update the STA entry with the new MAC address */
278 if(WDI_STATUS_SUCCESS != WDI_STATableSetStaAddr( pWDICtx,
279 ucSTAIdx,
280 pwdiParam->staMacAddr))
281 {
282 WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
283 "Failed to update station entry - internal failure");
284 WDI_ASSERT(0);
285 return WDI_STATUS_E_FAILURE;
286 }
287
288 /* Now update the STA entry with the new BSSID address */
289 if(WDI_STATUS_SUCCESS != WDI_STATableSetBSSID( pWDICtx,
290 ucSTAIdx,
291 pwdiParam->macBSSID))
292 {
293 WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
294 "Failed to update station entry - internal failure");
295 WDI_ASSERT(0);
296 return WDI_STATUS_E_FAILURE;
297 }
298
299 return WDI_STATUS_SUCCESS;
300}/*WDI_AddSta*/
301
302/**
303 @brief WDI_STATableDelSta - Function to Delete a Station
304
305
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530306 @param void: pointer to the WLAN DAL context
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 ucSTAIdx: station to be deleted
308
309 @see
310 @return Result of the function call
311*/
312WDI_Status
313WDI_STATableDelSta
314(
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530315 void* ctx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700316 wpt_uint8 ucSTAIdx
317)
318{
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530319 WDI_ControlBlockType* pWDICtx = ctx;
Jeff Johnson295189b2012-06-20 16:38:30 -0700320 WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
321 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
322
323 /*-----------------------------------------------------------------------
324 Sanity check
325 - station ids are allocated by the HAL located on RIVA SS - they must
326 always be valid
327 -----------------------------------------------------------------------*/
328 if(( ucSTAIdx == WDI_STA_INVALID_IDX )||
329 ( ucSTAIdx >= pWDICtx->ucMaxStations ))
330 {
331 WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
332 "STA Id invalid on Del STA - internal failure");
333 WDI_ASSERT(0);
334 return WDI_STATUS_E_FAILURE;
335 }
336
337 wpalMemoryZero(&pSTATable[ucSTAIdx], sizeof(pSTATable[ucSTAIdx]));
338 pSTATable->valid = 0;
339 return WDI_STATUS_SUCCESS;
340}/*WDI_STATableDelSta*/
341
342/**
343 @brief WDI_STATableBSSDelSta - Function to Delete Stations in this BSS
344
345
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530346 @param pWDICtx: pointer to the WLAN DAL context
Jeff Johnson295189b2012-06-20 16:38:30 -0700347 ucBSSIdx: BSS index
348
349 @see
350 @return Result of the function call
351*/
352WDI_Status
353WDI_STATableBSSDelSta
354(
355 WDI_ControlBlockType* pWDICtx,
356 wpt_uint8 ucBSSIdx
357)
358{
359 WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
360 wpt_uint8 ucSTAIdx;
361 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
362
363 for (ucSTAIdx = 0; (ucSTAIdx < pWDICtx->ucMaxStations); ucSTAIdx++)
364 {
365 if( (pSTATable[ucSTAIdx].ucStaType == WDI_STA_ENTRY_PEER) &&
366 (pSTATable[ucSTAIdx].bssIdx == ucBSSIdx))
367 {
368 WDI_STATableDelSta(pWDICtx, ucSTAIdx);
369 }
370 }
371
372 return WDI_STATUS_SUCCESS;
373}/*WDI_STATableBSSDelSta*/
374
375
376/**
377 @brief WDI_STATableGetStaBSSIDAddr - Gets the BSSID associated
378 with this station
379
380
381 @param pWDICtx: pointer to the WLAN DAL context
382 ucSTAIdx: station index
383 pmacBSSID: out BSSID for this STA
384
385 @see
386 @return Result of the function call
387*/
388WDI_Status
389WDI_STATableGetStaBSSIDAddr
390(
391 WDI_ControlBlockType* pWDICtx,
392 wpt_uint8 ucSTAIdx,
393 wpt_macAddr* pmacBSSID
394)
395{
396 WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
397 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
398
399 if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
400 {
401 wpalMemoryCopy(*pmacBSSID, pSTATable[ucSTAIdx].macBSSID, WDI_MAC_ADDR_LEN);
402 return WDI_STATUS_SUCCESS;
403 }
404 else
405 return WDI_STATUS_E_FAILURE;
406}/*WDI_STATableGetStaQosEnabled*/
407
408
409/**
410 @brief WDI_STATableGetStaQosEnabled - Gets is qos is enabled
411 for a sta
412
413
414 @param pWDICtx: pointer to the WLAN DAL context
415 ucSTAIdx: station index
416 qosEnabled: out qos enabled
417
418 @see
419 @return Result of the function call
420*/
421WDI_Status
422WDI_STATableGetStaQosEnabled
423(
424 WDI_ControlBlockType* pWDICtx,
425 wpt_uint8 ucSTAIdx,
426 wpt_uint8* qosEnabled
427)
428{
429 WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
430 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
431
432 if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid) && qosEnabled)
433 {
434 *qosEnabled = pSTATable[ucSTAIdx].qosEnabled;
435 return WDI_STATUS_SUCCESS;
436 }
437 else
438 return WDI_STATUS_E_FAILURE;
439}/*WDI_STATableGetStaQosEnabled*/
440
441/**
442 @brief WDI_STATableSetStaQosEnabled - set qos mode for STA
443
444
445 @param pWDICtx: pointer to the WLAN DAL context
446 ucSTAIdx: station index
447 qosEnabled: qos enabled
448
449 @see
450 @return Result of the function call
451*/
452WDI_Status
453WDI_STATableSetStaQosEnabled
454(
455 WDI_ControlBlockType* pWDICtx,
456 wpt_uint8 ucSTAIdx,
457 wpt_uint8 qosEnabled
458)
459{
460 WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
461 if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
462 {
463 pSTATable[ucSTAIdx].qosEnabled = qosEnabled;
464 return WDI_STATUS_SUCCESS;
465 }
466 else
467 return WDI_STATUS_E_FAILURE;
468}/*WDI_STATableSetStaQosEnabled*/
469
470/**
471 @brief WDI_STATableGetStaType - get sta type for STA
472
473
474 @param pWDICtx: pointer to the WLAN DAL context
475 ucSTAIdx: station index
476 pStaType: qos enabled
477
478 @see
479 @return Result of the function call
480*/
481WDI_Status
482WDI_STATableGetStaType
483(
484 WDI_ControlBlockType* pWDICtx,
485 wpt_uint8 ucSTAIdx,
486 wpt_uint8* pStaType
487)
488{
489 WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
490 if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
491 {
492 *pStaType = pSTATable[ucSTAIdx].ucStaType;
493 return WDI_STATUS_SUCCESS;
494 }
495 else
496 return WDI_STATUS_E_FAILURE;
497}/*WDI_STATableGetStaType*/
498
499/**
500 @brief WDI_STATableSetStaType - sets sta type for STA
501
502
503 @param pWDICtx: pointer to the WLAN DAL context
504 ucSTAIdx: station index
505 staType: sta type
506
507 @see
508 @return Result of the function call
509*/
510WDI_Status
511WDI_STATableSetStaType
512(
513 WDI_ControlBlockType* pWDICtx,
514 wpt_uint8 ucSTAIdx,
515 wpt_uint8 staType
516)
517{
518 WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
519 if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
520 {
521 pSTATable[ucSTAIdx].ucStaType = staType;
522 return WDI_STATUS_SUCCESS;
523 }
524 else
525 return WDI_STATUS_E_FAILURE;
526}/*WDI_STATableSetStaType*/
527
528
529/**
530 @brief WDI_CompareMacAddr - compare the MAC address
531
532
533 @param addr1: address 1
534 addr2: address 2
535
536 @see
537 @return Result of the function call
538*/
539WPT_STATIC WPT_INLINE wpt_uint8
540WDI_CompareMacAddr
541(
542 wpt_uint8 addr1[],
543 wpt_uint8 addr2[]
544)
545{
546#if defined( _X86_ )
547 wpt_uint32 align = (0x3 & ((wpt_uint32) addr1 | (wpt_uint32) addr2 ));
548
549 if( align ==0){
550 return ((*((wpt_uint16 *) &(addr1[4])) == *((wpt_uint16 *) &(addr2[4])))&&
551 (*((wpt_uint32 *) addr1) == *((wpt_uint32 *) addr2)));
552 }else if(align == 2){
553 return ((*((wpt_uint16 *) &addr1[4]) == *((wpt_uint16 *) &addr2[4])) &&
554 (*((wpt_uint16 *) &addr1[2]) == *((wpt_uint16 *) &addr2[2])) &&
555 (*((wpt_uint16 *) &addr1[0]) == *((wpt_uint16 *) &addr2[0])));
556 }else{
557 return ( (addr1[5]==addr2[5])&&
558 (addr1[4]==addr2[4])&&
559 (addr1[3]==addr2[3])&&
560 (addr1[2]==addr2[2])&&
561 (addr1[1]==addr2[1])&&
562 (addr1[0]==addr2[0]));
563 }
564#else
565 return ( (addr1[0]==addr2[0])&&
566 (addr1[1]==addr2[1])&&
567 (addr1[2]==addr2[2])&&
568 (addr1[3]==addr2[3])&&
569 (addr1[4]==addr2[4])&&
570 (addr1[5]==addr2[5]));
571#endif
572}/*WDI_CompareMacAddr*/
573
574
575/**
576 @brief WDI_STATableFindStaidByAddr - Given a station mac address, search
577 for the corresponding station index from the Station Table.
578
579 @param pWDICtx: WDI Context pointer
580 staAddr: station address
581 pucStaId: output station id
582
583 @see
584 @return Result of the function call
585*/
586WDI_Status
587WDI_STATableFindStaidByAddr
588(
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530589 void * context,
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 wpt_macAddr staAddr,
591 wpt_uint8* pucStaId
592)
593{
594 WDI_Status wdiStatus = WDI_STATUS_E_FAILURE;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530595 WDI_ControlBlockType* pWDICtx = context;
Jeff Johnson295189b2012-06-20 16:38:30 -0700596 wpt_uint8 i;
597 WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
598
599 for (i=0; i < pWDICtx->ucMaxStations; i++, pSTATable++)
600 {
601 if ( (pSTATable->valid == 1) && (WDI_CompareMacAddr(pSTATable->staAddr, staAddr)) )
602 {
603 *pucStaId = i;
604 wdiStatus = WDI_STATUS_SUCCESS;
605 break;
606 }
607 }
608 return wdiStatus;
609}/*WDI_STATableFindStaidByAddr*/
610
611/**
612 @brief WDI_STATableGetStaAddr - get station address
613
614 @param pWDICtx: WDI Context pointer
615 ucSTAIdx: station index
616 pStaAddr: output station address
617
618 @see
619 @return Result of the function call
620*/
621WDI_Status
622WDI_STATableGetStaAddr
623(
624 WDI_ControlBlockType* pWDICtx,
625 wpt_uint8 ucSTAIdx,
626 wpt_uint8** pStaAddr
627)
628{
629 WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
630 if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
631 {
632 *pStaAddr = pSTATable[ucSTAIdx].staAddr;
633 return WDI_STATUS_SUCCESS;
634 }
635 else
636 return WDI_STATUS_E_FAILURE;
637}/*WDI_STATableGetStaAddr*/
638
639/**
Dino Mycled3d50022014-07-07 12:58:25 +0530640 @brief WDI_STATableGetStaMacAddr - get station MAC address
641
642 @param pWDICtx: WDI Context pointer
643 ucSTAIdx: station index
644 pStaAddr: output station MAC address
645
646 @see
647 @return Result of the function call
648*/
649WDI_Status
650WDI_STATableGetStaMacAddr
651(
652 WDI_ControlBlockType* pWDICtx,
653 wpt_uint8 ucSTAIdx,
654 wpt_macAddr* staMacAddr
655)
656{
657 WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
658 if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
659 {
660 wpalMemoryCopy(staMacAddr, pSTATable[ucSTAIdx].staAddr,
661 WDI_MAC_ADDR_LEN);
662 return WDI_STATUS_SUCCESS;
663 }
664 else
665 return WDI_STATUS_E_FAILURE;
666}/*WDI_STATableGetStaMacAddr*/
667
668/**
Jeff Johnson295189b2012-06-20 16:38:30 -0700669 @brief WDI_STATableSetStaAddr - set station address
670
671 @param pWDICtx: WDI Context pointer
672 ucSTAIdx: station index
673 pStaAddr: output station address
674
675 @see
676 @return Result of the function call
677*/
678WDI_Status
679WDI_STATableSetStaAddr
680(
681 WDI_ControlBlockType* pWDICtx,
682 wpt_uint8 ucSTAIdx,
683 wpt_macAddr staAddr
684)
685{
686 WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
687 if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
688 {
689 wpalMemoryCopy (pSTATable[ucSTAIdx].staAddr, staAddr, 6);
690 return WDI_STATUS_SUCCESS;
691 }
692 else
693 return WDI_STATUS_E_FAILURE;
694}/*WDI_STATableSetStaAddr*/
695
696/**
697 @brief WDI_STATableSetBSSID - set station corresponding BSSID
698
699 @param pWDICtx: WDI Context pointer
700 ucSTAIdx: station index
701 pStaAddr: output station address
702
703 @see
704 @return Result of the function call
705*/
706WDI_Status
707WDI_STATableSetBSSID
708(
709 WDI_ControlBlockType* pWDICtx,
710 wpt_uint8 ucSTAIdx,
711 wpt_macAddr macBSSID
712)
713{
714 WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
715 if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
716 {
717 wpalMemoryCopy (pSTATable[ucSTAIdx].macBSSID, macBSSID, 6);
718 return WDI_STATUS_SUCCESS;
719 }
720 else
721 return WDI_STATUS_E_FAILURE;
722}/*WDI_STATableSetBSSID*/
723
724/**
725 @brief WDI_STATableSetBSSIdx - set station corresponding BSS index
726
727 @param pWDICtx: WDI Context pointer
728 ucSTAIdx: station index
729 ucBSSIdx: BSS index
730
731 @see
732 @return Result of the function call
733*/
734WDI_Status
735WDI_STATableSetBSSIdx
736(
737 WDI_ControlBlockType* pWDICtx,
738 wpt_uint8 ucSTAIdx,
739 wpt_uint8 ucBSSIdx
740)
741{
742 WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
743 if ((ucSTAIdx < pWDICtx->ucMaxStations) && (pSTATable[ucSTAIdx].valid))
744 {
745 pSTATable[ucSTAIdx].bssIdx = ucBSSIdx;
746 return WDI_STATUS_SUCCESS;
747 }
748 else
749 return WDI_STATUS_E_FAILURE;
750}/*WDI_STATableSetBSSIdx*/
751