net: wireless: rockchip_wlan: add rtl8723cs support
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8723cs / core / rtw_sta_mgt.c
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  *
19  ******************************************************************************/
20 #define _RTW_STA_MGT_C_
21
22 #include <drv_types.h>
23
24 #if defined(PLATFORM_LINUX) && defined (PLATFORM_WINDOWS)
25
26         #error "Shall be Linux or Windows, but not both!\n"
27
28 #endif
29
30
31 bool test_st_match_rule(_adapter *adapter, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port)
32 {
33         if (ntohs(*((u16 *)local_port)) == 5001 || ntohs(*((u16 *)remote_port)) == 5001)
34                 return _TRUE;
35         return _FALSE;
36 }
37
38 struct st_register test_st_reg = {
39         .s_proto = 0x06,
40         .rule = test_st_match_rule,
41 };
42
43 inline void rtw_st_ctl_init(struct st_ctl_t *st_ctl)
44 {
45         _rtw_memset(st_ctl->reg, 0 , sizeof(struct st_register) * SESSION_TRACKER_REG_ID_NUM);
46         _rtw_init_queue(&st_ctl->tracker_q);
47 }
48
49 inline void rtw_st_ctl_clear_tracker_q(struct st_ctl_t *st_ctl)
50 {
51         _irqL irqL;
52         _list *plist, *phead;
53         struct session_tracker *st;
54
55         _enter_critical_bh(&st_ctl->tracker_q.lock, &irqL);
56         phead = &st_ctl->tracker_q.queue;
57         plist = get_next(phead);
58         while (rtw_end_of_queue_search(phead, plist) == _FALSE) {
59                 st = LIST_CONTAINOR(plist, struct session_tracker, list);
60                 plist = get_next(plist);
61                 rtw_list_delete(&st->list);
62                 rtw_mfree((u8 *)st, sizeof(struct session_tracker));
63         }
64         _exit_critical_bh(&st_ctl->tracker_q.lock, &irqL);
65 }
66
67 inline void rtw_st_ctl_deinit(struct st_ctl_t *st_ctl)
68 {
69         rtw_st_ctl_clear_tracker_q(st_ctl);
70         _rtw_deinit_queue(&st_ctl->tracker_q);
71 }
72
73 inline void rtw_st_ctl_register(struct st_ctl_t *st_ctl, u8 st_reg_id, struct st_register *reg)
74 {
75         if (st_reg_id >= SESSION_TRACKER_REG_ID_NUM) {
76                 rtw_warn_on(1);
77                 return;
78         }
79
80         st_ctl->reg[st_reg_id].s_proto = reg->s_proto;
81         st_ctl->reg[st_reg_id].rule = reg->rule;
82 }
83
84 inline void rtw_st_ctl_unregister(struct st_ctl_t *st_ctl, u8 st_reg_id)
85 {
86         int i;
87
88         if (st_reg_id >= SESSION_TRACKER_REG_ID_NUM) {
89                 rtw_warn_on(1);
90                 return;
91         }
92
93         st_ctl->reg[st_reg_id].s_proto = 0;
94         st_ctl->reg[st_reg_id].rule = NULL;
95
96         /* clear tracker queue if no session trecker registered */
97         for (i = 0; i < SESSION_TRACKER_REG_ID_NUM; i++)
98                 if (st_ctl->reg[i].s_proto != 0)
99                         break;
100         if (i >= SESSION_TRACKER_REG_ID_NUM)
101                 rtw_st_ctl_clear_tracker_q(st_ctl);
102 }
103
104 inline bool rtw_st_ctl_chk_reg_s_proto(struct st_ctl_t *st_ctl, u8 s_proto)
105 {
106         bool ret = _FALSE;
107         int i;
108
109         for (i = 0; i < SESSION_TRACKER_REG_ID_NUM; i++) {
110                 if (st_ctl->reg[i].s_proto == s_proto) {
111                         ret = _TRUE;
112                         break;
113                 }
114         }
115
116         return ret;
117 }
118
119 inline bool rtw_st_ctl_chk_reg_rule(struct st_ctl_t *st_ctl, _adapter *adapter, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port)
120 {
121         bool ret = _FALSE;
122         int i;
123         st_match_rule rule;
124
125         for (i = 0; i < SESSION_TRACKER_REG_ID_NUM; i++) {
126                 rule = st_ctl->reg[i].rule;
127                 if (rule && rule(adapter, local_naddr, local_port, remote_naddr, remote_port) == _TRUE) {
128                         ret = _TRUE;
129                         break;
130                 }
131         }
132
133         return ret;
134 }
135
136 #define SESSION_TRACKER_FMT IP_FMT":"PORT_FMT" "IP_FMT":"PORT_FMT" %u %d"
137 #define SESSION_TRACKER_ARG(st) IP_ARG(&(st)->local_naddr), PORT_ARG(&(st)->local_port), IP_ARG(&(st)->remote_naddr), PORT_ARG(&(st)->remote_port), (st)->status, rtw_get_passing_time_ms((st)->set_time)
138
139 void dump_st_ctl(void *sel, struct st_ctl_t *st_ctl)
140 {
141         int i;
142         _irqL irqL;
143         _list *plist, *phead;
144         struct session_tracker *st;
145
146         if (!DBG_SESSION_TRACKER)
147                 return;
148
149         for (i = 0; i < SESSION_TRACKER_REG_ID_NUM; i++)
150                 RTW_PRINT_SEL(sel, "reg%d: %u %p\n", i, st_ctl->reg[i].s_proto, st_ctl->reg[i].rule);
151
152         _enter_critical_bh(&st_ctl->tracker_q.lock, &irqL);
153         phead = &st_ctl->tracker_q.queue;
154         plist = get_next(phead);
155         while (rtw_end_of_queue_search(phead, plist) == _FALSE) {
156                 st = LIST_CONTAINOR(plist, struct session_tracker, list);
157                 plist = get_next(plist);
158
159                 RTW_PRINT_SEL(sel, SESSION_TRACKER_FMT"\n", SESSION_TRACKER_ARG(st));
160         }
161         _exit_critical_bh(&st_ctl->tracker_q.lock, &irqL);
162
163 }
164
165 void _rtw_init_stainfo(struct sta_info *psta);
166 void _rtw_init_stainfo(struct sta_info *psta)
167 {
168
169
170         _rtw_memset((u8 *)psta, 0, sizeof(struct sta_info));
171
172         _rtw_spinlock_init(&psta->lock);
173         _rtw_init_listhead(&psta->list);
174         _rtw_init_listhead(&psta->hash_list);
175         /* _rtw_init_listhead(&psta->asoc_list); */
176         /* _rtw_init_listhead(&psta->sleep_list); */
177         /* _rtw_init_listhead(&psta->wakeup_list);       */
178
179         _rtw_init_queue(&psta->sleep_q);
180         psta->sleepq_len = 0;
181
182         _rtw_init_sta_xmit_priv(&psta->sta_xmitpriv);
183         _rtw_init_sta_recv_priv(&psta->sta_recvpriv);
184
185 #ifdef CONFIG_AP_MODE
186
187         _rtw_init_listhead(&psta->asoc_list);
188
189         _rtw_init_listhead(&psta->auth_list);
190
191         psta->expire_to = 0;
192
193         psta->flags = 0;
194
195         psta->capability = 0;
196
197         psta->bpairwise_key_installed = _FALSE;
198
199 #ifdef CONFIG_RTW_80211R
200         psta->ft_pairwise_key_installed = _FALSE;
201 #endif
202
203 #ifdef CONFIG_NATIVEAP_MLME
204         psta->nonerp_set = 0;
205         psta->no_short_slot_time_set = 0;
206         psta->no_short_preamble_set = 0;
207         psta->no_ht_gf_set = 0;
208         psta->no_ht_set = 0;
209         psta->ht_20mhz_set = 0;
210         psta->ht_40mhz_intolerant = 0;
211 #endif
212
213 #ifdef CONFIG_TX_MCAST2UNI
214         psta->under_exist_checking = 0;
215 #endif /* CONFIG_TX_MCAST2UNI */
216
217         psta->keep_alive_trycnt = 0;
218
219 #endif /* CONFIG_AP_MODE         */
220
221         rtw_st_ctl_init(&psta->st_ctl);
222
223
224 }
225
226 u32     _rtw_init_sta_priv(struct       sta_priv *pstapriv)
227 {
228         struct sta_info *psta;
229         s32 i;
230
231
232         pstapriv->pallocated_stainfo_buf = rtw_zvmalloc(sizeof(struct sta_info) * NUM_STA + 4);
233
234         if (!pstapriv->pallocated_stainfo_buf)
235                 return _FAIL;
236
237         pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 -
238                          ((SIZE_PTR)(pstapriv->pallocated_stainfo_buf) & 3);
239
240         _rtw_init_queue(&pstapriv->free_sta_queue);
241
242         _rtw_spinlock_init(&pstapriv->sta_hash_lock);
243
244         /* _rtw_init_queue(&pstapriv->asoc_q); */
245         pstapriv->asoc_sta_count = 0;
246         _rtw_init_queue(&pstapriv->sleep_q);
247         _rtw_init_queue(&pstapriv->wakeup_q);
248
249         psta = (struct sta_info *)(pstapriv->pstainfo_buf);
250
251
252         for (i = 0; i < NUM_STA; i++) {
253                 _rtw_init_stainfo(psta);
254
255                 _rtw_init_listhead(&(pstapriv->sta_hash[i]));
256
257                 rtw_list_insert_tail(&psta->list, get_list_head(&pstapriv->free_sta_queue));
258
259                 psta++;
260         }
261
262         pstapriv->adhoc_expire_to = 4; /* 4 * 2 = 8 sec */
263
264 #ifdef CONFIG_AP_MODE
265
266         pstapriv->sta_dz_bitmap = 0;
267         pstapriv->tim_bitmap = 0;
268
269         _rtw_init_listhead(&pstapriv->asoc_list);
270         _rtw_init_listhead(&pstapriv->auth_list);
271         _rtw_spinlock_init(&pstapriv->asoc_list_lock);
272         _rtw_spinlock_init(&pstapriv->auth_list_lock);
273         pstapriv->asoc_list_cnt = 0;
274         pstapriv->auth_list_cnt = 0;
275
276         pstapriv->auth_to = 3; /* 3*2 = 6 sec */
277         pstapriv->assoc_to = 3;
278         /* pstapriv->expire_to = 900; */ /* 900*2 = 1800 sec = 30 min, expire after no any traffic. */
279         /* pstapriv->expire_to = 30; */ /* 30*2 = 60 sec = 1 min, expire after no any traffic. */
280 #ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
281         pstapriv->expire_to = 3; /* 3*2 = 6 sec */
282 #else
283         pstapriv->expire_to = 60;/* 60*2 = 120 sec = 2 min, expire after no any traffic. */
284 #endif
285 #ifdef CONFIG_ATMEL_RC_PATCH
286         _rtw_memset(pstapriv->atmel_rc_pattern, 0, ETH_ALEN);
287 #endif
288         pstapriv->max_num_sta = NUM_STA;
289
290 #endif
291
292 #if CONFIG_RTW_MACADDR_ACL
293         _rtw_init_queue(&(pstapriv->acl_list.acl_node_q));
294 #endif
295
296 #if CONFIG_RTW_PRE_LINK_STA
297         rtw_pre_link_sta_ctl_init(pstapriv);
298 #endif
299
300         return _SUCCESS;
301
302 }
303
304 inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta)
305 {
306         int offset = (((u8 *)sta) - stapriv->pstainfo_buf) / sizeof(struct sta_info);
307
308         if (!stainfo_offset_valid(offset))
309                 RTW_INFO("%s invalid offset(%d), out of range!!!", __func__, offset);
310
311         return offset;
312 }
313
314 inline struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int offset)
315 {
316         if (!stainfo_offset_valid(offset))
317                 RTW_INFO("%s invalid offset(%d), out of range!!!", __func__, offset);
318
319         return (struct sta_info *)(stapriv->pstainfo_buf + offset * sizeof(struct sta_info));
320 }
321
322 void    _rtw_free_sta_xmit_priv_lock(struct sta_xmit_priv *psta_xmitpriv);
323 void    _rtw_free_sta_xmit_priv_lock(struct sta_xmit_priv *psta_xmitpriv)
324 {
325
326         _rtw_spinlock_free(&psta_xmitpriv->lock);
327
328         _rtw_spinlock_free(&(psta_xmitpriv->be_q.sta_pending.lock));
329         _rtw_spinlock_free(&(psta_xmitpriv->bk_q.sta_pending.lock));
330         _rtw_spinlock_free(&(psta_xmitpriv->vi_q.sta_pending.lock));
331         _rtw_spinlock_free(&(psta_xmitpriv->vo_q.sta_pending.lock));
332 }
333
334 static void     _rtw_free_sta_recv_priv_lock(struct sta_recv_priv *psta_recvpriv)
335 {
336
337         _rtw_spinlock_free(&psta_recvpriv->lock);
338
339         _rtw_spinlock_free(&(psta_recvpriv->defrag_q.lock));
340
341
342 }
343
344 void rtw_mfree_stainfo(struct sta_info *psta);
345 void rtw_mfree_stainfo(struct sta_info *psta)
346 {
347
348         if (&psta->lock != NULL)
349                 _rtw_spinlock_free(&psta->lock);
350
351         _rtw_free_sta_xmit_priv_lock(&psta->sta_xmitpriv);
352         _rtw_free_sta_recv_priv_lock(&psta->sta_recvpriv);
353
354 }
355
356
357 /* this function is used to free the memory of lock || sema for all stainfos */
358 void rtw_mfree_all_stainfo(struct sta_priv *pstapriv);
359 void rtw_mfree_all_stainfo(struct sta_priv *pstapriv)
360 {
361         _irqL    irqL;
362         _list   *plist, *phead;
363         struct sta_info *psta = NULL;
364
365
366         _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
367
368         phead = get_list_head(&pstapriv->free_sta_queue);
369         plist = get_next(phead);
370
371         while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
372                 psta = LIST_CONTAINOR(plist, struct sta_info , list);
373                 plist = get_next(plist);
374
375                 rtw_mfree_stainfo(psta);
376         }
377
378         _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
379
380
381 }
382
383 void rtw_mfree_sta_priv_lock(struct     sta_priv *pstapriv);
384 void rtw_mfree_sta_priv_lock(struct     sta_priv *pstapriv)
385 {
386         rtw_mfree_all_stainfo(pstapriv); /* be done before free sta_hash_lock */
387
388         _rtw_spinlock_free(&pstapriv->free_sta_queue.lock);
389
390         _rtw_spinlock_free(&pstapriv->sta_hash_lock);
391         _rtw_spinlock_free(&pstapriv->wakeup_q.lock);
392         _rtw_spinlock_free(&pstapriv->sleep_q.lock);
393
394 #ifdef CONFIG_AP_MODE
395         _rtw_spinlock_free(&pstapriv->asoc_list_lock);
396         _rtw_spinlock_free(&pstapriv->auth_list_lock);
397 #endif
398
399 }
400
401 u32     _rtw_free_sta_priv(struct       sta_priv *pstapriv)
402 {
403         _irqL   irqL;
404         _list   *phead, *plist;
405         struct sta_info *psta = NULL;
406         struct recv_reorder_ctrl *preorder_ctrl;
407         int     index;
408
409         if (pstapriv) {
410
411                 /*      delete all reordering_ctrl_timer                */
412                 _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
413                 for (index = 0; index < NUM_STA; index++) {
414                         phead = &(pstapriv->sta_hash[index]);
415                         plist = get_next(phead);
416
417                         while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
418                                 int i;
419                                 psta = LIST_CONTAINOR(plist, struct sta_info , hash_list);
420                                 plist = get_next(plist);
421
422                                 for (i = 0; i < 16 ; i++) {
423                                         preorder_ctrl = &psta->recvreorder_ctrl[i];
424                                         _cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer);
425                                 }
426                         }
427                 }
428                 _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
429                 /*===============================*/
430
431                 rtw_mfree_sta_priv_lock(pstapriv);
432
433 #if CONFIG_RTW_MACADDR_ACL
434                 _rtw_deinit_queue(&(pstapriv->acl_list.acl_node_q));
435 #endif
436
437 #if CONFIG_RTW_PRE_LINK_STA
438                 rtw_pre_link_sta_ctl_deinit(pstapriv);
439 #endif
440
441                 if (pstapriv->pallocated_stainfo_buf)
442                         rtw_vmfree(pstapriv->pallocated_stainfo_buf, sizeof(struct sta_info) * NUM_STA + 4);
443         }
444
445         return _SUCCESS;
446 }
447
448
449 /* struct       sta_info *rtw_alloc_stainfo(_queue *pfree_sta_queue, unsigned char *hwaddr) */
450 struct  sta_info *rtw_alloc_stainfo(struct      sta_priv *pstapriv, u8 *hwaddr)
451 {
452         _irqL irqL, irqL2;
453         uint tmp_aid;
454         s32     index;
455         _list   *phash_list;
456         struct sta_info *psta;
457         _queue *pfree_sta_queue;
458         struct recv_reorder_ctrl *preorder_ctrl;
459         int i = 0;
460         u16  wRxSeqInitialValue = 0xffff;
461
462
463         pfree_sta_queue = &pstapriv->free_sta_queue;
464
465         /* _enter_critical_bh(&(pfree_sta_queue->lock), &irqL); */
466         _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL2);
467         if (_rtw_queue_empty(pfree_sta_queue) == _TRUE) {
468                 /* _exit_critical_bh(&(pfree_sta_queue->lock), &irqL); */
469                 _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2);
470                 psta = NULL;
471         } else {
472                 psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list);
473
474                 rtw_list_delete(&(psta->list));
475
476                 /* _exit_critical_bh(&(pfree_sta_queue->lock), &irqL); */
477
478                 tmp_aid = psta->aid;
479
480                 _rtw_init_stainfo(psta);
481
482                 psta->padapter = pstapriv->padapter;
483
484                 _rtw_memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
485
486                 index = wifi_mac_hash(hwaddr);
487
488
489                 if (index >= NUM_STA) {
490                         psta = NULL;
491                         goto exit;
492                 }
493                 phash_list = &(pstapriv->sta_hash[index]);
494
495                 /* _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); */
496
497                 rtw_list_insert_tail(&psta->hash_list, phash_list);
498
499                 pstapriv->asoc_sta_count++;
500
501                 /* _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); */
502
503                 /* Commented by Albert 2009/08/13
504                  * For the SMC router, the sequence number of first packet of WPS handshake will be 0.
505                  * In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable.
506                  * So, we initialize the tid_rxseq variable as the 0xffff. */
507
508                 for (i = 0; i < 16; i++)
509                         _rtw_memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i], &wRxSeqInitialValue, 2);
510
511
512                 init_addba_retry_timer(pstapriv->padapter, psta);
513 #ifdef CONFIG_IEEE80211W
514                 init_dot11w_expire_timer(pstapriv->padapter, psta);
515 #endif /* CONFIG_IEEE80211W */
516 #ifdef CONFIG_TDLS
517                 rtw_init_tdls_timer(pstapriv->padapter, psta);
518 #endif /* CONFIG_TDLS */
519
520                 /* for A-MPDU Rx reordering buffer control */
521                 for (i = 0; i < 16 ; i++) {
522                         preorder_ctrl = &psta->recvreorder_ctrl[i];
523
524                         preorder_ctrl->padapter = pstapriv->padapter;
525
526                         preorder_ctrl->enable = _FALSE;
527
528                         preorder_ctrl->indicate_seq = 0xffff;
529 #ifdef DBG_RX_SEQ
530                         RTW_INFO("DBG_RX_SEQ %s:%d IndicateSeq: %d\n", __FUNCTION__, __LINE__,
531                                  preorder_ctrl->indicate_seq);
532 #endif
533                         preorder_ctrl->wend_b = 0xffff;
534                         /* preorder_ctrl->wsize_b = (NR_RECVBUFF-2); */
535                         preorder_ctrl->wsize_b = 64;/* 64; */
536                         preorder_ctrl->ampdu_size = RX_AMPDU_SIZE_INVALID;
537
538                         _rtw_init_queue(&preorder_ctrl->pending_recvframe_queue);
539
540                         rtw_init_recv_timer(preorder_ctrl);
541                 }
542
543
544                 /* init for DM */
545                 psta->rssi_stat.undecorated_smoothed_pwdb = (-1);
546                 psta->rssi_stat.undecorated_smoothed_cck = (-1);
547 #ifdef CONFIG_ATMEL_RC_PATCH
548                 psta->flag_atmel_rc = 0;
549 #endif
550                 /* init for the sequence number of received management frame */
551                 psta->RxMgmtFrameSeqNum = 0xffff;
552                 psta->ra_rpt_linked = _FALSE;
553
554                 rtw_alloc_macid(pstapriv->padapter, psta);
555
556         }
557
558 exit:
559
560         _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2);
561
562
563         if (psta)
564                 rtw_mi_update_iface_status(&(pstapriv->padapter->mlmepriv), 0);
565
566         return psta;
567 }
568
569
570 /* using pstapriv->sta_hash_lock to protect */
571 u32     rtw_free_stainfo(_adapter *padapter , struct sta_info *psta)
572 {
573         int i;
574         _irqL irqL0;
575         _queue *pfree_sta_queue;
576         struct recv_reorder_ctrl *preorder_ctrl;
577         struct  sta_xmit_priv   *pstaxmitpriv;
578         struct  xmit_priv       *pxmitpriv = &padapter->xmitpriv;
579         struct  sta_priv *pstapriv = &padapter->stapriv;
580         struct hw_xmit *phwxmit;
581         int pending_qcnt[4];
582         u8 is_pre_link_sta = _FALSE;
583
584         if (psta == NULL)
585                 goto exit;
586
587         is_pre_link_sta = rtw_is_pre_link_sta(pstapriv, psta->hwaddr);
588
589         if (is_pre_link_sta == _FALSE) {
590                 _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL0);
591                 rtw_list_delete(&psta->hash_list);
592                 pstapriv->asoc_sta_count--;
593                 _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL0);
594                 rtw_mi_update_iface_status(&(padapter->mlmepriv), 0);
595         } else {
596                 _enter_critical_bh(&psta->lock, &irqL0);
597                 psta->state = WIFI_FW_PRE_LINK;
598                 _exit_critical_bh(&psta->lock, &irqL0);
599         }
600
601         _enter_critical_bh(&psta->lock, &irqL0);
602         psta->state &= ~_FW_LINKED;
603         _exit_critical_bh(&psta->lock, &irqL0);
604
605         pfree_sta_queue = &pstapriv->free_sta_queue;
606
607
608         pstaxmitpriv = &psta->sta_xmitpriv;
609
610         /* rtw_list_delete(&psta->sleep_list); */
611
612         /* rtw_list_delete(&psta->wakeup_list); */
613
614         _enter_critical_bh(&pxmitpriv->lock, &irqL0);
615
616         rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q);
617         psta->sleepq_len = 0;
618
619         /* vo */
620         /* _enter_critical_bh(&(pxmitpriv->vo_pending.lock), &irqL0); */
621         rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vo_q.sta_pending);
622         rtw_list_delete(&(pstaxmitpriv->vo_q.tx_pending));
623         phwxmit = pxmitpriv->hwxmits;
624         phwxmit->accnt -= pstaxmitpriv->vo_q.qcnt;
625         pending_qcnt[0] = pstaxmitpriv->vo_q.qcnt;
626         pstaxmitpriv->vo_q.qcnt = 0;
627         /* _exit_critical_bh(&(pxmitpriv->vo_pending.lock), &irqL0); */
628
629         /* vi */
630         /* _enter_critical_bh(&(pxmitpriv->vi_pending.lock), &irqL0); */
631         rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vi_q.sta_pending);
632         rtw_list_delete(&(pstaxmitpriv->vi_q.tx_pending));
633         phwxmit = pxmitpriv->hwxmits + 1;
634         phwxmit->accnt -= pstaxmitpriv->vi_q.qcnt;
635         pending_qcnt[1] = pstaxmitpriv->vi_q.qcnt;
636         pstaxmitpriv->vi_q.qcnt = 0;
637         /* _exit_critical_bh(&(pxmitpriv->vi_pending.lock), &irqL0); */
638
639         /* be */
640         /* _enter_critical_bh(&(pxmitpriv->be_pending.lock), &irqL0); */
641         rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->be_q.sta_pending);
642         rtw_list_delete(&(pstaxmitpriv->be_q.tx_pending));
643         phwxmit = pxmitpriv->hwxmits + 2;
644         phwxmit->accnt -= pstaxmitpriv->be_q.qcnt;
645         pending_qcnt[2] = pstaxmitpriv->be_q.qcnt;
646         pstaxmitpriv->be_q.qcnt = 0;
647         /* _exit_critical_bh(&(pxmitpriv->be_pending.lock), &irqL0); */
648
649         /* bk */
650         /* _enter_critical_bh(&(pxmitpriv->bk_pending.lock), &irqL0); */
651         rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->bk_q.sta_pending);
652         rtw_list_delete(&(pstaxmitpriv->bk_q.tx_pending));
653         phwxmit = pxmitpriv->hwxmits + 3;
654         phwxmit->accnt -= pstaxmitpriv->bk_q.qcnt;
655         pending_qcnt[3] = pstaxmitpriv->bk_q.qcnt;
656         pstaxmitpriv->bk_q.qcnt = 0;
657         /* _exit_critical_bh(&(pxmitpriv->bk_pending.lock), &irqL0); */
658
659         rtw_os_wake_queue_at_free_stainfo(padapter, pending_qcnt);
660
661         _exit_critical_bh(&pxmitpriv->lock, &irqL0);
662
663
664         /* re-init sta_info; 20061114 */ /* will be init in alloc_stainfo */
665         /* _rtw_init_sta_xmit_priv(&psta->sta_xmitpriv); */
666         /* _rtw_init_sta_recv_priv(&psta->sta_recvpriv); */
667 #ifdef CONFIG_IEEE80211W
668         _cancel_timer_ex(&psta->dot11w_expire_timer);
669 #endif /* CONFIG_IEEE80211W */
670         _cancel_timer_ex(&psta->addba_retry_timer);
671
672 #ifdef CONFIG_TDLS
673         psta->tdls_sta_state = TDLS_STATE_NONE;
674         rtw_free_tdls_timer(psta);
675 #endif /* CONFIG_TDLS */
676
677         /* for A-MPDU Rx reordering buffer control, cancel reordering_ctrl_timer */
678         for (i = 0; i < 16 ; i++) {
679                 _irqL irqL;
680                 _list   *phead, *plist;
681                 union recv_frame *prframe;
682                 _queue *ppending_recvframe_queue;
683                 _queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue;
684
685                 preorder_ctrl = &psta->recvreorder_ctrl[i];
686
687                 _cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer);
688
689
690                 ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
691
692                 _enter_critical_bh(&ppending_recvframe_queue->lock, &irqL);
693
694                 phead = get_list_head(ppending_recvframe_queue);
695                 plist = get_next(phead);
696
697                 while (!rtw_is_list_empty(phead)) {
698                         prframe = LIST_CONTAINOR(plist, union recv_frame, u);
699
700                         plist = get_next(plist);
701
702                         rtw_list_delete(&(prframe->u.hdr.list));
703
704                         rtw_free_recvframe(prframe, pfree_recv_queue);
705                 }
706
707                 _exit_critical_bh(&ppending_recvframe_queue->lock, &irqL);
708
709         }
710
711         if (!((psta->state & WIFI_AP_STATE) || MacAddr_isBcst(psta->hwaddr)) && is_pre_link_sta == _FALSE)
712                 rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, _FALSE);
713
714
715         /* release mac id for non-bc/mc station, */
716         if (is_pre_link_sta == _FALSE)
717                 rtw_release_macid(pstapriv->padapter, psta);
718
719 #ifdef CONFIG_AP_MODE
720
721         /*
722                 _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL0);
723                 rtw_list_delete(&psta->asoc_list);
724                 _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL0);
725         */
726         _enter_critical_bh(&pstapriv->auth_list_lock, &irqL0);
727         if (!rtw_is_list_empty(&psta->auth_list)) {
728                 rtw_list_delete(&psta->auth_list);
729                 pstapriv->auth_list_cnt--;
730         }
731         _exit_critical_bh(&pstapriv->auth_list_lock, &irqL0);
732
733         psta->expire_to = 0;
734 #ifdef CONFIG_ATMEL_RC_PATCH
735         psta->flag_atmel_rc = 0;
736 #endif
737         psta->sleepq_ac_len = 0;
738         psta->qos_info = 0;
739
740         psta->max_sp_len = 0;
741         psta->uapsd_bk = 0;
742         psta->uapsd_be = 0;
743         psta->uapsd_vi = 0;
744         psta->uapsd_vo = 0;
745
746         psta->has_legacy_ac = 0;
747
748 #ifdef CONFIG_NATIVEAP_MLME
749
750         pstapriv->sta_dz_bitmap &= ~BIT(psta->aid);
751         pstapriv->tim_bitmap &= ~BIT(psta->aid);
752
753         /* rtw_indicate_sta_disassoc_event(padapter, psta); */
754
755         if ((psta->aid > 0) && (pstapriv->sta_aid[psta->aid - 1] == psta)) {
756                 pstapriv->sta_aid[psta->aid - 1] = NULL;
757                 psta->aid = 0;
758         }
759
760 #endif /* CONFIG_NATIVEAP_MLME   */
761
762 #ifdef CONFIG_TX_MCAST2UNI
763         psta->under_exist_checking = 0;
764 #endif /* CONFIG_TX_MCAST2UNI */
765
766 #endif /* CONFIG_AP_MODE         */
767
768         rtw_st_ctl_deinit(&psta->st_ctl);
769
770         if (is_pre_link_sta == _FALSE) {
771                 _rtw_spinlock_free(&psta->lock);
772
773                 /* _enter_critical_bh(&(pfree_sta_queue->lock), &irqL0); */
774                 _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL0);
775                 rtw_list_insert_tail(&psta->list, get_list_head(pfree_sta_queue));
776                 _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL0);
777                 /* _exit_critical_bh(&(pfree_sta_queue->lock), &irqL0); */
778         }
779
780 exit:
781         return _SUCCESS;
782 }
783
784 /* free all stainfo which in sta_hash[all] */
785 void rtw_free_all_stainfo(_adapter *padapter)
786 {
787         _irqL    irqL;
788         _list   *plist, *phead;
789         s32     index;
790         struct sta_info *psta = NULL;
791         struct  sta_priv *pstapriv = &padapter->stapriv;
792         struct sta_info *pbcmc_stainfo = rtw_get_bcmc_stainfo(padapter);
793         u8 free_sta_num = 0;
794         char free_sta_list[NUM_STA];
795         int stainfo_offset;
796
797
798         if (pstapriv->asoc_sta_count == 1)
799                 goto exit;
800
801         _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
802
803         for (index = 0; index < NUM_STA; index++) {
804                 phead = &(pstapriv->sta_hash[index]);
805                 plist = get_next(phead);
806
807                 while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
808                         psta = LIST_CONTAINOR(plist, struct sta_info , hash_list);
809
810                         plist = get_next(plist);
811
812                         if (pbcmc_stainfo != psta) {
813                                 if (rtw_is_pre_link_sta(pstapriv, psta->hwaddr) == _FALSE)
814                                         rtw_list_delete(&psta->hash_list);
815
816                                 stainfo_offset = rtw_stainfo_offset(pstapriv, psta);
817                                 if (stainfo_offset_valid(stainfo_offset))
818                                         free_sta_list[free_sta_num++] = stainfo_offset;
819                         }
820
821                 }
822         }
823
824         _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
825
826
827         for (index = 0; index < free_sta_num; index++) {
828                 psta = rtw_get_stainfo_by_offset(pstapriv, free_sta_list[index]);
829                 rtw_free_stainfo(padapter , psta);
830         }
831
832 exit:
833         return;
834 }
835
836 /* any station allocated can be searched by hash list */
837 struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
838 {
839
840         _irqL    irqL;
841
842         _list   *plist, *phead;
843
844         struct sta_info *psta = NULL;
845
846         u32     index;
847
848         u8 *addr;
849
850         u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
851
852
853         if (hwaddr == NULL)
854                 return NULL;
855
856         if (IS_MCAST(hwaddr))
857                 addr = bc_addr;
858         else
859                 addr = hwaddr;
860
861         index = wifi_mac_hash(addr);
862
863         _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
864
865         phead = &(pstapriv->sta_hash[index]);
866         plist = get_next(phead);
867
868
869         while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
870
871                 psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
872
873                 if ((_rtw_memcmp(psta->hwaddr, addr, ETH_ALEN)) == _TRUE) {
874                         /* if found the matched address */
875                         break;
876                 }
877                 psta = NULL;
878                 plist = get_next(plist);
879         }
880
881         _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
882         return psta;
883
884 }
885
886 u32 rtw_init_bcmc_stainfo(_adapter *padapter)
887 {
888
889         struct sta_info *psta;
890         struct tx_servq *ptxservq;
891         u32 res = _SUCCESS;
892         NDIS_802_11_MAC_ADDRESS bcast_addr = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
893
894         struct  sta_priv *pstapriv = &padapter->stapriv;
895         /* _queue       *pstapending = &padapter->xmitpriv.bm_pending; */
896
897
898         psta = rtw_alloc_stainfo(pstapriv, bcast_addr);
899
900         if (psta == NULL) {
901                 res = _FAIL;
902                 goto exit;
903         }
904 #ifdef CONFIG_BEAMFORMING
905         psta->txbf_gid = 63;
906         psta->txbf_paid = 0;
907 #endif
908         ptxservq = &(psta->sta_xmitpriv.be_q);
909
910         /*
911                 _enter_critical(&pstapending->lock, &irqL0);
912
913                 if (rtw_is_list_empty(&ptxservq->tx_pending))
914                         rtw_list_insert_tail(&ptxservq->tx_pending, get_list_head(pstapending));
915
916                 _exit_critical(&pstapending->lock, &irqL0);
917         */
918
919 exit:
920         return _SUCCESS;
921
922 }
923
924
925 struct sta_info *rtw_get_bcmc_stainfo(_adapter *padapter)
926 {
927         struct sta_info *psta;
928         struct sta_priv *pstapriv = &padapter->stapriv;
929         u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
930         psta = rtw_get_stainfo(pstapriv, bc_addr);
931         return psta;
932
933 }
934
935 #if CONFIG_RTW_MACADDR_ACL
936 const char *const _acl_mode_str[] = {
937         "DISABLED",
938         "ACCEPT_UNLESS_LISTED",
939         "DENY_UNLESS_LISTED",
940 };
941
942 u8 rtw_access_ctrl(_adapter *adapter, u8 *mac_addr)
943 {
944         u8 res = _TRUE;
945         _irqL irqL;
946         _list *list, *head;
947         struct rtw_wlan_acl_node *acl_node;
948         u8 match = _FALSE;
949         struct sta_priv *stapriv = &adapter->stapriv;
950         struct wlan_acl_pool *acl = &stapriv->acl_list;
951         _queue  *acl_node_q = &acl->acl_node_q;
952
953         _enter_critical_bh(&(acl_node_q->lock), &irqL);
954         head = get_list_head(acl_node_q);
955         list = get_next(head);
956         while (rtw_end_of_queue_search(head, list) == _FALSE) {
957                 acl_node = LIST_CONTAINOR(list, struct rtw_wlan_acl_node, list);
958                 list = get_next(list);
959
960                 if (_rtw_memcmp(acl_node->addr, mac_addr, ETH_ALEN)) {
961                         if (acl_node->valid == _TRUE) {
962                                 match = _TRUE;
963                                 break;
964                         }
965                 }
966         }
967         _exit_critical_bh(&(acl_node_q->lock), &irqL);
968
969         if (acl->mode == RTW_ACL_MODE_ACCEPT_UNLESS_LISTED)
970                 res = (match == _TRUE) ?  _FALSE : _TRUE;
971         else if (acl->mode == RTW_ACL_MODE_DENY_UNLESS_LISTED)
972                 res = (match == _TRUE) ?  _TRUE : _FALSE;
973         else
974                 res = _TRUE;
975
976         return res;
977 }
978
979 void dump_macaddr_acl(void *sel, _adapter *adapter)
980 {
981         struct sta_priv *stapriv = &adapter->stapriv;
982         struct wlan_acl_pool *acl = &stapriv->acl_list;
983         int i;
984
985         RTW_PRINT_SEL(sel, "mode:%s(%d)\n", acl_mode_str(acl->mode), acl->mode);
986         RTW_PRINT_SEL(sel, "num:%d/%d\n", acl->num, NUM_ACL);
987         for (i = 0; i < NUM_ACL; i++) {
988                 if (acl->aclnode[i].valid == _FALSE)
989                         continue;
990                 RTW_PRINT_SEL(sel, MAC_FMT"\n", MAC_ARG(acl->aclnode[i].addr));
991         }
992 }
993 #endif /* CONFIG_RTW_MACADDR_ACL */
994
995 bool rtw_is_pre_link_sta(struct sta_priv *stapriv, u8 *addr)
996 {
997 #if CONFIG_RTW_PRE_LINK_STA
998         struct pre_link_sta_ctl_t *pre_link_sta_ctl = &stapriv->pre_link_sta_ctl;
999         struct sta_info *sta = NULL;
1000         u8 exist = _FALSE;
1001         int i;
1002         _irqL irqL;
1003
1004         _enter_critical_bh(&(pre_link_sta_ctl->lock), &irqL);
1005         for (i = 0; i < RTW_PRE_LINK_STA_NUM; i++) {
1006                 if (pre_link_sta_ctl->node[i].valid == _TRUE
1007                         && _rtw_memcmp(pre_link_sta_ctl->node[i].addr, addr, ETH_ALEN) == _TRUE
1008                 ) {
1009                         exist = _TRUE;
1010                         break;
1011                 }
1012         }
1013         _exit_critical_bh(&(pre_link_sta_ctl->lock), &irqL);
1014
1015         return exist;
1016 #else
1017         return _FALSE;
1018 #endif
1019 }
1020
1021 #if CONFIG_RTW_PRE_LINK_STA
1022 struct sta_info *rtw_pre_link_sta_add(struct sta_priv *stapriv, u8 *hwaddr)
1023 {
1024         struct pre_link_sta_ctl_t *pre_link_sta_ctl = &stapriv->pre_link_sta_ctl;
1025         struct pre_link_sta_node_t *node = NULL;
1026         struct sta_info *sta = NULL;
1027         u8 exist = _FALSE;
1028         int i;
1029         _irqL irqL;
1030
1031         if (rtw_check_invalid_mac_address(hwaddr, _FALSE) == _TRUE)
1032                 goto exit;
1033
1034         _enter_critical_bh(&(pre_link_sta_ctl->lock), &irqL);
1035         for (i = 0; i < RTW_PRE_LINK_STA_NUM; i++) {
1036                 if (pre_link_sta_ctl->node[i].valid == _TRUE
1037                         && _rtw_memcmp(pre_link_sta_ctl->node[i].addr, hwaddr, ETH_ALEN) == _TRUE
1038                 ) {
1039                         node = &pre_link_sta_ctl->node[i];
1040                         exist = _TRUE;
1041                         break;
1042                 }
1043
1044                 if (node == NULL && pre_link_sta_ctl->node[i].valid == _FALSE)
1045                         node = &pre_link_sta_ctl->node[i];
1046         }
1047
1048         if (exist == _FALSE && node) {
1049                 _rtw_memcpy(node->addr, hwaddr, ETH_ALEN);
1050                 node->valid = _TRUE;
1051                 pre_link_sta_ctl->num++;
1052         }
1053         _exit_critical_bh(&(pre_link_sta_ctl->lock), &irqL);
1054
1055         if (node == NULL)
1056                 goto exit;
1057
1058         sta = rtw_get_stainfo(stapriv, hwaddr);
1059         if (sta)
1060                 goto odm_hook;
1061
1062         sta = rtw_alloc_stainfo(stapriv, hwaddr);
1063         if (!sta)
1064                 goto exit;
1065
1066         sta->state = WIFI_FW_PRE_LINK;
1067
1068 odm_hook:
1069         rtw_hal_set_odm_var(stapriv->padapter, HAL_ODM_STA_INFO, sta, _TRUE);
1070
1071 exit:
1072         return sta;
1073 }
1074
1075 void rtw_pre_link_sta_del(struct sta_priv *stapriv, u8 *hwaddr)
1076 {
1077         struct pre_link_sta_ctl_t *pre_link_sta_ctl = &stapriv->pre_link_sta_ctl;
1078         struct pre_link_sta_node_t *node = NULL;
1079         struct sta_info *sta = NULL;
1080         u8 exist = _FALSE;
1081         int i;
1082         _irqL irqL;
1083
1084         if (rtw_check_invalid_mac_address(hwaddr, _FALSE) == _TRUE)
1085                 goto exit;
1086
1087         _enter_critical_bh(&(pre_link_sta_ctl->lock), &irqL);
1088         for (i = 0; i < RTW_PRE_LINK_STA_NUM; i++) {
1089                 if (pre_link_sta_ctl->node[i].valid == _TRUE
1090                         && _rtw_memcmp(pre_link_sta_ctl->node[i].addr, hwaddr, ETH_ALEN) == _TRUE
1091                 ) {
1092                         node = &pre_link_sta_ctl->node[i];
1093                         exist = _TRUE;
1094                         break;
1095                 }
1096         }
1097
1098         if (exist == _TRUE && node) {
1099                 node->valid = _FALSE;
1100                 pre_link_sta_ctl->num--;
1101         }
1102         _exit_critical_bh(&(pre_link_sta_ctl->lock), &irqL);
1103
1104         if (exist == _FALSE)
1105                 goto exit;
1106
1107         sta = rtw_get_stainfo(stapriv, hwaddr);
1108         if (!sta)
1109                 goto exit;
1110
1111         if (sta->state == WIFI_FW_PRE_LINK)
1112                 rtw_free_stainfo(stapriv->padapter, sta);
1113
1114 exit:
1115         return;
1116 }
1117
1118 void rtw_pre_link_sta_ctl_reset(struct sta_priv *stapriv)
1119 {
1120         struct pre_link_sta_ctl_t *pre_link_sta_ctl = &stapriv->pre_link_sta_ctl;
1121         struct pre_link_sta_node_t *node = NULL;
1122         struct sta_info *sta = NULL;
1123         int i, j = 0;
1124         _irqL irqL;
1125
1126         u8 addrs[RTW_PRE_LINK_STA_NUM][ETH_ALEN];
1127
1128         _rtw_memset(addrs, 0, RTW_PRE_LINK_STA_NUM * ETH_ALEN);
1129
1130         _enter_critical_bh(&(pre_link_sta_ctl->lock), &irqL);
1131         for (i = 0; i < RTW_PRE_LINK_STA_NUM; i++) {
1132                 if (pre_link_sta_ctl->node[i].valid == _FALSE)
1133                         continue;
1134                 _rtw_memcpy(&(addrs[j][0]), pre_link_sta_ctl->node[i].addr, ETH_ALEN);
1135                 pre_link_sta_ctl->node[i].valid = _FALSE;
1136                 pre_link_sta_ctl->num--;
1137                 j++;
1138         }
1139         _exit_critical_bh(&(pre_link_sta_ctl->lock), &irqL);
1140
1141         for (i = 0; i < j; i++) {
1142                 sta = rtw_get_stainfo(stapriv, &(addrs[i][0]));
1143                 if (!sta)
1144                         continue;
1145
1146                 if (sta->state == WIFI_FW_PRE_LINK)
1147                         rtw_free_stainfo(stapriv->padapter, sta);
1148         }
1149 }
1150
1151 void rtw_pre_link_sta_ctl_init(struct sta_priv *stapriv)
1152 {
1153         struct pre_link_sta_ctl_t *pre_link_sta_ctl = &stapriv->pre_link_sta_ctl;
1154         int i;
1155
1156         _rtw_spinlock_init(&pre_link_sta_ctl->lock);
1157         pre_link_sta_ctl->num = 0;
1158         for (i = 0; i < RTW_PRE_LINK_STA_NUM; i++)
1159                 pre_link_sta_ctl->node[i].valid = _FALSE;
1160 }
1161
1162 void rtw_pre_link_sta_ctl_deinit(struct sta_priv *stapriv)
1163 {
1164         struct pre_link_sta_ctl_t *pre_link_sta_ctl = &stapriv->pre_link_sta_ctl;
1165         int i;
1166
1167         rtw_pre_link_sta_ctl_reset(stapriv);
1168
1169         _rtw_spinlock_free(&pre_link_sta_ctl->lock);
1170 }
1171
1172 void dump_pre_link_sta_ctl(void *sel, struct sta_priv *stapriv)
1173 {
1174         struct pre_link_sta_ctl_t *pre_link_sta_ctl = &stapriv->pre_link_sta_ctl;
1175         int i;
1176
1177         RTW_PRINT_SEL(sel, "num:%d/%d\n", pre_link_sta_ctl->num, RTW_PRE_LINK_STA_NUM);
1178
1179         for (i = 0; i < RTW_PRE_LINK_STA_NUM; i++) {
1180                 if (pre_link_sta_ctl->node[i].valid == _FALSE)
1181                         continue;
1182                 RTW_PRINT_SEL(sel, MAC_FMT"\n", MAC_ARG(pre_link_sta_ctl->node[i].addr));
1183         }
1184 }
1185 #endif /* CONFIG_RTW_PRE_LINK_STA */
1186