-
Notifications
You must be signed in to change notification settings - Fork 962
/
rtw_tdls.c
executable file
·3142 lines (2563 loc) · 95.5 KB
/
rtw_tdls.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/******************************************************************************
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
******************************************************************************/
#define _RTW_TDLS_C_
#include <drv_types.h>
#ifdef CONFIG_TDLS
#define ONE_SEC 1000 /* 1000 ms */
extern unsigned char MCS_rate_2R[16];
extern unsigned char MCS_rate_1R[16];
extern void process_wmmps_data(_adapter *padapter, union recv_frame *precv_frame);
void rtw_reset_tdls_info(_adapter* padapter)
{
struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
ptdlsinfo->ap_prohibited = _FALSE;
/* For TDLS channel switch, currently we only allow it to work in wifi logo test mode */
if (padapter->registrypriv.wifi_spec == 1)
{
ptdlsinfo->ch_switch_prohibited = _FALSE;
}
else
{
ptdlsinfo->ch_switch_prohibited = _TRUE;
}
ptdlsinfo->link_established = _FALSE;
ptdlsinfo->sta_cnt = 0;
ptdlsinfo->sta_maximum = _FALSE;
#ifdef CONFIG_TDLS_CH_SW
ptdlsinfo->chsw_info.ch_sw_state = TDLS_STATE_NONE;
ATOMIC_SET(&ptdlsinfo->chsw_info.chsw_on, _FALSE);
ptdlsinfo->chsw_info.off_ch_num = 0;
ptdlsinfo->chsw_info.ch_offset = 0;
ptdlsinfo->chsw_info.cur_time = 0;
ptdlsinfo->chsw_info.delay_switch_back = _FALSE;
ptdlsinfo->chsw_info.dump_stack = _FALSE;
#endif
ptdlsinfo->ch_sensing = 0;
ptdlsinfo->watchdog_count = 0;
ptdlsinfo->dev_discovered = _FALSE;
#ifdef CONFIG_WFD
ptdlsinfo->wfd_info = &padapter->wfd_info;
#endif /* ONFIG_WFD */
}
int rtw_init_tdls_info(_adapter* padapter)
{
int res = _SUCCESS;
struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
rtw_reset_tdls_info(padapter);
ptdlsinfo->tdls_enable = _TRUE;
#ifdef CONFIG_TDLS_DRIVER_SETUP
ptdlsinfo->driver_setup = _TRUE;
#else
ptdlsinfo->driver_setup = _FALSE;
#endif /* CONFIG_TDLS_DRIVER_SETUP */
_rtw_spinlock_init(&ptdlsinfo->cmd_lock);
_rtw_spinlock_init(&ptdlsinfo->hdl_lock);
return res;
}
void rtw_free_tdls_info(struct tdls_info *ptdlsinfo)
{
_rtw_spinlock_free(&ptdlsinfo->cmd_lock);
_rtw_spinlock_free(&ptdlsinfo->hdl_lock);
_rtw_memset(ptdlsinfo, 0, sizeof(struct tdls_info) );
}
int check_ap_tdls_prohibited(u8 *pframe, u8 pkt_len)
{
u8 tdls_prohibited_bit = 0x40; /* bit(38); TDLS_prohibited */
if (pkt_len < 5) {
return _FALSE;
}
pframe += 4;
if ((*pframe) & tdls_prohibited_bit)
return _TRUE;
return _FALSE;
}
int check_ap_tdls_ch_switching_prohibited(u8 *pframe, u8 pkt_len)
{
u8 tdls_ch_swithcing_prohibited_bit = 0x80; /* bit(39); TDLS_channel_switching prohibited */
if (pkt_len < 5) {
return _FALSE;
}
pframe += 4;
if ((*pframe) & tdls_ch_swithcing_prohibited_bit)
return _TRUE;
return _FALSE;
}
int _issue_nulldata_to_TDLS_peer_STA(_adapter *padapter, unsigned char *da, unsigned int power_mode, int wait_ack)
{
int ret = _FAIL;
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
unsigned char *pframe;
struct rtw_ieee80211_hdr *pwlanhdr;
unsigned short *fctrl, *qc;
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
goto exit;
pattrib = &pmgntframe->attrib;
update_mgntframe_attrib(padapter, pattrib);
pattrib->hdrlen +=2;
pattrib->qos_en = _TRUE;
pattrib->eosp = 1;
pattrib->ack_policy = 0;
pattrib->mdata = 0;
pattrib->retry_ctrl = _FALSE;
_rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
fctrl = &(pwlanhdr->frame_ctl);
*(fctrl) = 0;
if (power_mode)
SetPwrMgt(fctrl);
qc = (unsigned short *)(pframe + pattrib->hdrlen - 2);
SetPriority(qc, 7); /* Set priority to VO */
SetEOSP(qc, pattrib->eosp);
SetAckpolicy(qc, pattrib->ack_policy);
_rtw_memcpy(pwlanhdr->addr1, da, ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr2, adapter_mac_addr(padapter), ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
pmlmeext->mgnt_seq++;
SetFrameSubType(pframe, WIFI_QOS_DATA_NULL);
pframe += sizeof(struct rtw_ieee80211_hdr_3addr_qos);
pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr_qos);
pattrib->last_txcmdsz = pattrib->pktlen;
if (wait_ack)
ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe);
else {
dump_mgntframe(padapter, pmgntframe);
ret = _SUCCESS;
}
exit:
return ret;
}
/*
*wait_ms == 0 means that there is no need to wait ack through C2H_CCX_TX_RPT
*wait_ms > 0 means you want to wait ack through C2H_CCX_TX_RPT, and the value of wait_ms means the interval between each TX
*try_cnt means the maximal TX count to try
*/
int issue_nulldata_to_TDLS_peer_STA(_adapter *padapter, unsigned char *da, unsigned int power_mode, int try_cnt, int wait_ms)
{
int ret;
int i = 0;
u32 start = rtw_get_current_time();
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
#if 0
psta = rtw_get_stainfo(&padapter->stapriv, da);
if (psta) {
if (power_mode)
rtw_hal_macid_sleep(padapter, psta->mac_id);
else
rtw_hal_macid_wakeup(padapter, psta->mac_id);
} else {
DBG_871X(FUNC_ADPT_FMT ": Can't find sta info for " MAC_FMT ", skip macid %s!!\n",
FUNC_ADPT_ARG(padapter), MAC_ARG(da), power_mode?"sleep":"wakeup");
rtw_warn_on(1);
}
#endif
do {
ret = _issue_nulldata_to_TDLS_peer_STA(padapter, da, power_mode, wait_ms>0 ? _TRUE : _FALSE);
i++;
if (RTW_CANNOT_RUN(padapter))
break;
if (i < try_cnt && wait_ms > 0 && ret == _FAIL)
rtw_msleep_os(wait_ms);
} while ((i < try_cnt) && (ret==_FAIL || wait_ms==0));
if (ret != _FAIL) {
ret = _SUCCESS;
#ifndef DBG_XMIT_ACK
goto exit;
#endif
}
if (try_cnt && wait_ms) {
if (da)
DBG_871X(FUNC_ADPT_FMT" to "MAC_FMT", ch:%u%s, %d/%d in %u ms\n",
FUNC_ADPT_ARG(padapter), MAC_ARG(da), rtw_get_oper_ch(padapter),
ret==_SUCCESS?", acked":"", i, try_cnt, rtw_get_passing_time_ms(start));
else
DBG_871X(FUNC_ADPT_FMT", ch:%u%s, %d/%d in %u ms\n",
FUNC_ADPT_ARG(padapter), rtw_get_oper_ch(padapter),
ret==_SUCCESS?", acked":"", i, try_cnt, rtw_get_passing_time_ms(start));
}
exit:
return ret;
}
void free_tdls_sta(_adapter *padapter, struct sta_info *ptdls_sta)
{
struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
struct sta_priv *pstapriv = &padapter->stapriv;
_irqL irqL;
/* free peer sta_info */
_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
if (ptdlsinfo->sta_cnt != 0)
ptdlsinfo->sta_cnt--;
_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
/* -2: AP + BC/MC sta, -4: default key */
if (ptdlsinfo->sta_cnt < MAX_ALLOWED_TDLS_STA_NUM) {
ptdlsinfo->sta_maximum = _FALSE;
_rtw_memset( &ptdlsinfo->ss_record, 0x00, sizeof(struct tdls_ss_record) );
}
/* clear cam */
rtw_clearstakey_cmd(padapter, ptdls_sta, _TRUE);
if (ptdlsinfo->sta_cnt == 0) {
rtw_tdls_cmd(padapter, NULL, TDLS_RS_RCR);
ptdlsinfo->link_established = _FALSE;
}
else
DBG_871X("Remain tdls sta:%02x\n", ptdlsinfo->sta_cnt);
rtw_free_stainfo(padapter, ptdls_sta);
}
/* TDLS encryption(if needed) will always be CCMP */
void rtw_tdls_set_key(_adapter *padapter, struct sta_info *ptdls_sta)
{
ptdls_sta->dot118021XPrivacy=_AES_;
rtw_setstakey_cmd(padapter, ptdls_sta, TDLS_KEY, _TRUE);
}
#ifdef CONFIG_80211N_HT
void rtw_tdls_process_ht_cap(_adapter *padapter, struct sta_info *ptdls_sta, u8 *data, u8 Length)
{
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct ht_priv *phtpriv = &pmlmepriv->htpriv;
u8 max_AMPDU_len, min_MPDU_spacing;
u8 cur_ldpc_cap = 0, cur_stbc_cap = 0, cur_beamform_cap = 0;
/* Save HT capabilities in the sta object */
_rtw_memset(&ptdls_sta->htpriv.ht_cap, 0, sizeof(struct rtw_ieee80211_ht_cap));
if (data && Length >= sizeof(struct rtw_ieee80211_ht_cap)) {
ptdls_sta->flags |= WLAN_STA_HT;
ptdls_sta->flags |= WLAN_STA_WME;
_rtw_memcpy(&ptdls_sta->htpriv.ht_cap, data, sizeof(struct rtw_ieee80211_ht_cap));
} else
ptdls_sta->flags &= ~WLAN_STA_HT;
if (ptdls_sta->flags & WLAN_STA_HT) {
if (padapter->registrypriv.ht_enable == _TRUE) {
ptdls_sta->htpriv.ht_option = _TRUE;
ptdls_sta->qos_option = _TRUE;
} else {
ptdls_sta->htpriv.ht_option = _FALSE;
ptdls_sta->qos_option = _FALSE;
}
}
/* HT related cap */
if (ptdls_sta->htpriv.ht_option) {
/* Check if sta supports rx ampdu */
if (padapter->registrypriv.ampdu_enable == 1)
ptdls_sta->htpriv.ampdu_enable = _TRUE;
/* AMPDU Parameters field */
/* Get MIN of MAX AMPDU Length Exp */
if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3) > (data[2] & 0x3))
max_AMPDU_len = (data[2] & 0x3);
else
max_AMPDU_len = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3);
/* Get MAX of MIN MPDU Start Spacing */
if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) > (data[2] & 0x1c))
min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c);
else
min_MPDU_spacing = (data[2] & 0x1c);
ptdls_sta->htpriv.rx_ampdu_min_spacing = max_AMPDU_len | min_MPDU_spacing;
/* Check if sta support s Short GI 20M */
if (ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SGI_20))
ptdls_sta->htpriv.sgi_20m = _TRUE;
/* Check if sta support s Short GI 40M */
if (ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SGI_40))
ptdls_sta->htpriv.sgi_40m = _TRUE;
/* Bwmode would still followed AP's setting */
if (ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH)) {
if (padapter->mlmeextpriv.cur_bwmode >= CHANNEL_WIDTH_40)
ptdls_sta->bw_mode = CHANNEL_WIDTH_40;
ptdls_sta->htpriv.ch_offset = padapter->mlmeextpriv.cur_ch_offset;
}
/* Config LDPC Coding Capability */
if (TEST_FLAG(phtpriv->ldpc_cap, LDPC_HT_ENABLE_TX) && GET_HT_CAP_ELE_LDPC_CAP(data)) {
SET_FLAG(cur_ldpc_cap, (LDPC_HT_ENABLE_TX | LDPC_HT_CAP_TX));
DBG_871X("Enable HT Tx LDPC!\n");
}
ptdls_sta->htpriv.ldpc_cap = cur_ldpc_cap;
/* Config STBC setting */
if (TEST_FLAG(phtpriv->stbc_cap, STBC_HT_ENABLE_TX) && GET_HT_CAP_ELE_RX_STBC(data)) {
SET_FLAG(cur_stbc_cap, (STBC_HT_ENABLE_TX | STBC_HT_CAP_TX));
DBG_871X("Enable HT Tx STBC!\n");
}
ptdls_sta->htpriv.stbc_cap = cur_stbc_cap;
#ifdef CONFIG_BEAMFORMING
/* Config Tx beamforming setting */
if (TEST_FLAG(phtpriv->beamform_cap, BEAMFORMING_HT_BEAMFORMEE_ENABLE) &&
GET_HT_CAP_TXBF_EXPLICIT_COMP_STEERING_CAP(data)) {
SET_FLAG(cur_beamform_cap, BEAMFORMING_HT_BEAMFORMER_ENABLE);
}
if (TEST_FLAG(phtpriv->beamform_cap, BEAMFORMING_HT_BEAMFORMER_ENABLE) &&
GET_HT_CAP_TXBF_EXPLICIT_COMP_FEEDBACK_CAP(data)) {
SET_FLAG(cur_beamform_cap, BEAMFORMING_HT_BEAMFORMEE_ENABLE);
}
ptdls_sta->htpriv.beamform_cap = cur_beamform_cap;
if (cur_beamform_cap)
DBG_871X("Client HT Beamforming Cap = 0x%02X\n", cur_beamform_cap);
#endif /* CONFIG_BEAMFORMING */
}
}
u8 *rtw_tdls_set_ht_cap(_adapter *padapter, u8 *pframe, struct pkt_attrib *pattrib)
{
rtw_ht_use_default_setting(padapter);
rtw_restructure_ht_ie(padapter, NULL, pframe, 0, &(pattrib->pktlen), padapter->mlmeextpriv.cur_channel);
return pframe + pattrib->pktlen;
}
#endif
#ifdef CONFIG_80211AC_VHT
void rtw_tdls_process_vht_cap(_adapter *padapter, struct sta_info *ptdls_sta, u8 *data, u8 Length)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
u8 cur_ldpc_cap = 0, cur_stbc_cap = 0, cur_beamform_cap = 0, rf_type = RF_1T1R;
u8 *pcap_mcs;
u8 vht_mcs[2];
_rtw_memset(&ptdls_sta->vhtpriv, 0, sizeof(struct vht_priv));
if (data && Length == 12) {
ptdls_sta->flags |= WLAN_STA_VHT;
_rtw_memcpy(ptdls_sta->vhtpriv.vht_cap, data, 12);
#if 0
if (elems.vht_op_mode_notify && elems.vht_op_mode_notify_len == 1) {
_rtw_memcpy(&pstat->vhtpriv.vht_op_mode_notify, elems.vht_op_mode_notify, 1);
} else /* for Frame without Operating Mode notify ie; default: 80M */ {
pstat->vhtpriv.vht_op_mode_notify = CHANNEL_WIDTH_80;
}
#else
ptdls_sta->vhtpriv.vht_op_mode_notify = CHANNEL_WIDTH_80;
#endif
} else
ptdls_sta->flags &= ~WLAN_STA_VHT;
if (ptdls_sta->flags & WLAN_STA_VHT) {
if (padapter->registrypriv.vht_enable == _TRUE)
ptdls_sta->vhtpriv.vht_option = _TRUE;
else
ptdls_sta->vhtpriv.vht_option = _FALSE;
}
/* B4 Rx LDPC */
if (TEST_FLAG(pvhtpriv->ldpc_cap, LDPC_VHT_ENABLE_TX) &&
GET_VHT_CAPABILITY_ELE_RX_LDPC(data)) {
SET_FLAG(cur_ldpc_cap, (LDPC_VHT_ENABLE_TX | LDPC_VHT_CAP_TX));
DBG_871X("Current VHT LDPC Setting = %02X\n", cur_ldpc_cap);
}
ptdls_sta->vhtpriv.ldpc_cap = cur_ldpc_cap;
/* B5 Short GI for 80 MHz */
ptdls_sta->vhtpriv.sgi_80m = (GET_VHT_CAPABILITY_ELE_SHORT_GI80M(data) & pvhtpriv->sgi_80m) ? _TRUE : _FALSE;
/* B8 B9 B10 Rx STBC */
if (TEST_FLAG(pvhtpriv->stbc_cap, STBC_VHT_ENABLE_TX) &&
GET_VHT_CAPABILITY_ELE_RX_STBC(data)) {
SET_FLAG(cur_stbc_cap, (STBC_VHT_ENABLE_TX | STBC_VHT_CAP_TX));
DBG_871X("Current VHT STBC Setting = %02X\n", cur_stbc_cap);
}
ptdls_sta->vhtpriv.stbc_cap = cur_stbc_cap;
/* B11 SU Beamformer Capable, the target supports Beamformer and we are Beamformee */
if (TEST_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_BEAMFORMER_ENABLE) &&
GET_VHT_CAPABILITY_ELE_SU_BFEE(data)) {
SET_FLAG(cur_beamform_cap, BEAMFORMING_VHT_BEAMFORMEE_ENABLE);
}
/* B12 SU Beamformee Capable, the target supports Beamformee and we are Beamformer */
if (TEST_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_BEAMFORMEE_ENABLE) &&
GET_VHT_CAPABILITY_ELE_SU_BFER(data)) {
SET_FLAG(cur_beamform_cap, BEAMFORMING_VHT_BEAMFORMER_ENABLE);
}
ptdls_sta->vhtpriv.beamform_cap = cur_beamform_cap;
if (cur_beamform_cap)
DBG_871X("Current VHT Beamforming Setting = %02X\n", cur_beamform_cap);
/* B23 B24 B25 Maximum A-MPDU Length Exponent */
ptdls_sta->vhtpriv.ampdu_len = GET_VHT_CAPABILITY_ELE_MAX_RXAMPDU_FACTOR(data);
pcap_mcs = GET_VHT_CAPABILITY_ELE_RX_MCS(data);
_rtw_memcpy(vht_mcs, pcap_mcs, 2);
rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
if ((rf_type == RF_1T1R) || (rf_type == RF_1T2R))
vht_mcs[0] |= 0xfc;
else if (rf_type == RF_2T2R)
vht_mcs[0] |= 0xf0;
else if (rf_type == RF_3T3R)
vht_mcs[0] |= 0xc0;
_rtw_memcpy(ptdls_sta->vhtpriv.vht_mcs_map, vht_mcs, 2);
ptdls_sta->vhtpriv.vht_highest_rate = rtw_get_vht_highest_rate(ptdls_sta->vhtpriv.vht_mcs_map);
}
u8 *rtw_tdls_set_aid(_adapter *padapter, u8 *pframe, struct pkt_attrib *pattrib)
{
return rtw_set_ie(pframe, EID_AID, 2, (u8 *)&(padapter->mlmepriv.cur_network.aid), &(pattrib->pktlen));
}
u8 *rtw_tdls_set_vht_cap(_adapter *padapter, u8 *pframe, struct pkt_attrib *pattrib)
{
u32 ie_len = 0;
rtw_vht_use_default_setting(padapter);
ie_len = rtw_build_vht_cap_ie(padapter, pframe);
pattrib->pktlen += ie_len;
return pframe + ie_len;
}
u8 *rtw_tdls_set_vht_operation(_adapter *padapter, u8 *pframe, struct pkt_attrib *pattrib, u8 channel)
{
u32 ie_len = 0;
ie_len = rtw_build_vht_operation_ie(padapter, pframe, channel);
pattrib->pktlen += ie_len;
return pframe + ie_len;
}
u8 *rtw_tdls_set_vht_op_mode_notify(_adapter *padapter, u8 *pframe, struct pkt_attrib *pattrib, u8 bw)
{
u32 ie_len = 0;
ie_len = rtw_build_vht_op_mode_notify_ie(padapter, pframe, bw);
pattrib->pktlen += ie_len;
return pframe + ie_len;
}
#endif
u8 *rtw_tdls_set_sup_ch(struct mlme_ext_priv *pmlmeext, u8 *pframe, struct pkt_attrib *pattrib)
{
u8 sup_ch[30 * 2] = {0x00}, ch_set_idx = 0, sup_ch_idx = 2;
do {
if (pmlmeext->channel_set[ch_set_idx].ChannelNum <= 14) {
sup_ch[0] = 1; /* First channel number */
sup_ch[1] = pmlmeext->channel_set[ch_set_idx].ChannelNum; /* Number of channel */
} else {
sup_ch[sup_ch_idx++] = pmlmeext->channel_set[ch_set_idx].ChannelNum;
sup_ch[sup_ch_idx++] = 1;
}
ch_set_idx++;
} while (pmlmeext->channel_set[ch_set_idx].ChannelNum != 0 && ch_set_idx < MAX_CHANNEL_NUM);
return rtw_set_ie(pframe, _SUPPORTED_CH_IE_, sup_ch_idx, sup_ch, &(pattrib->pktlen));
}
u8 *rtw_tdls_set_rsnie(struct tdls_txmgmt *ptxmgmt, u8 *pframe, struct pkt_attrib *pattrib, int init, struct sta_info *ptdls_sta)
{
u8 *p = NULL;
int len = 0;
if (ptxmgmt->len > 0)
p = rtw_get_ie(ptxmgmt->buf, _RSN_IE_2_, &len, ptxmgmt->len);
if (p != NULL)
return rtw_set_ie(pframe, _RSN_IE_2_, len, p+2, &(pattrib->pktlen));
else
if (init == _TRUE)
return rtw_set_ie(pframe, _RSN_IE_2_, sizeof(TDLS_RSNIE), TDLS_RSNIE, &(pattrib->pktlen));
else
return rtw_set_ie(pframe, _RSN_IE_2_, sizeof(ptdls_sta->TDLS_RSNIE), ptdls_sta->TDLS_RSNIE, &(pattrib->pktlen));
}
u8 *rtw_tdls_set_ext_cap(u8 *pframe, struct pkt_attrib *pattrib)
{
return rtw_set_ie(pframe, _EXT_CAP_IE_ , sizeof(TDLS_EXT_CAPIE), TDLS_EXT_CAPIE, &(pattrib->pktlen));
}
u8 *rtw_tdls_set_qos_cap(u8 *pframe, struct pkt_attrib *pattrib)
{
return rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, sizeof(TDLS_WMMIE), TDLS_WMMIE, &(pattrib->pktlen));
}
u8 *rtw_tdls_set_ftie(struct tdls_txmgmt *ptxmgmt, u8 *pframe, struct pkt_attrib *pattrib, u8 *ANonce, u8 *SNonce)
{
struct wpa_tdls_ftie FTIE = {0};
u8 *p = NULL;
int len = 0;
if (ptxmgmt->len > 0)
p = rtw_get_ie(ptxmgmt->buf, _FTIE_, &len, ptxmgmt->len);
if (p != NULL)
return rtw_set_ie(pframe, _FTIE_, len, p+2, &(pattrib->pktlen));
else {
if (ANonce != NULL)
_rtw_memcpy(FTIE.Anonce, ANonce, WPA_NONCE_LEN);
if (SNonce != NULL)
_rtw_memcpy(FTIE.Snonce, SNonce, WPA_NONCE_LEN);
return rtw_set_ie(pframe, _FTIE_ , 82, (u8 *)FTIE.mic_ctrl, &(pattrib->pktlen));
}
}
u8 *rtw_tdls_set_timeout_interval(struct tdls_txmgmt *ptxmgmt, u8 *pframe, struct pkt_attrib *pattrib, int init, struct sta_info *ptdls_sta)
{
u8 timeout_itvl[5]; /* set timeout interval to maximum value */
u32 timeout_interval= TPK_RESEND_COUNT;
u8 *p = NULL;
int len = 0;
if (ptxmgmt->len > 0)
p = rtw_get_ie(ptxmgmt->buf, _TIMEOUT_ITVL_IE_, &len, ptxmgmt->len);
if (p != NULL)
return rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, len, p+2, &(pattrib->pktlen));
else {
/* Timeout interval */
timeout_itvl[0]=0x02;
if (init == _TRUE)
_rtw_memcpy(timeout_itvl+1, &timeout_interval, 4);
else
_rtw_memcpy(timeout_itvl+1, (u8 *)(&ptdls_sta->TDLS_PeerKey_Lifetime), 4);
return rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen));
}
}
u8 *rtw_tdls_set_bss_coexist(_adapter *padapter, u8 *pframe, struct pkt_attrib *pattrib)
{
u8 iedata=0;
if (padapter->mlmepriv.num_FortyMHzIntolerant > 0)
iedata |= BIT(2); /* 20 MHz BSS Width Request */
/* Information Bit should be set by TDLS test plan 5.9 */
iedata |= BIT(0);
return rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen));
}
u8 *rtw_tdls_set_payload_type(u8 *pframe, struct pkt_attrib *pattrib)
{
u8 payload_type = 0x02;
return rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen));
}
u8 *rtw_tdls_set_category(u8 *pframe, struct pkt_attrib *pattrib, u8 category)
{
return rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
}
u8 *rtw_tdls_set_action(u8 *pframe, struct pkt_attrib *pattrib, struct tdls_txmgmt *ptxmgmt)
{
return rtw_set_fixed_ie(pframe, 1, &(ptxmgmt->action_code), &(pattrib->pktlen));
}
u8 *rtw_tdls_set_status_code(u8 *pframe, struct pkt_attrib *pattrib, struct tdls_txmgmt *ptxmgmt)
{
return rtw_set_fixed_ie(pframe, 2, (u8 *)&(ptxmgmt->status_code), &(pattrib->pktlen));
}
u8 *rtw_tdls_set_dialog(u8 *pframe, struct pkt_attrib *pattrib, struct tdls_txmgmt *ptxmgmt)
{
u8 dialogtoken = 1;
if (ptxmgmt->dialog_token)
return rtw_set_fixed_ie(pframe, 1, &(ptxmgmt->dialog_token), &(pattrib->pktlen));
else
return rtw_set_fixed_ie(pframe, 1, &(dialogtoken), &(pattrib->pktlen));
}
u8 *rtw_tdls_set_reg_class(u8 *pframe, struct pkt_attrib *pattrib, struct sta_info *ptdls_sta)
{
u8 reg_class = 1;
return rtw_set_fixed_ie(pframe, 1, &(reg_class), &(pattrib->pktlen));
}
u8 *rtw_tdls_set_capability(_adapter *padapter, u8 *pframe, struct pkt_attrib *pattrib)
{
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
u8 cap_from_ie[2] = {0};
_rtw_memcpy(cap_from_ie, rtw_get_capability_from_ie(pmlmeinfo->network.IEs), 2);
return rtw_set_fixed_ie(pframe, 2, cap_from_ie, &(pattrib->pktlen));
}
u8 *rtw_tdls_set_supported_rate(_adapter *padapter, u8 *pframe, struct pkt_attrib *pattrib)
{
u8 bssrate[NDIS_802_11_LENGTH_RATES_EX];
int bssrate_len = 0;
u8 more_supportedrates = 0;
rtw_set_supported_rate(bssrate, (padapter->registrypriv.wireless_mode == WIRELESS_MODE_MAX) ? padapter->mlmeextpriv.cur_wireless_mode : padapter->registrypriv.wireless_mode);
bssrate_len = rtw_get_rateset_len(bssrate);
if (bssrate_len > 8) {
pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen));
more_supportedrates = 1;
} else {
pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen));
}
/* extended supported rates */
if (more_supportedrates == 1) {
pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
}
return pframe;
}
u8 *rtw_tdls_set_sup_reg_class(u8 *pframe, struct pkt_attrib *pattrib)
{
return rtw_set_ie(pframe, _SRC_IE_ , sizeof(TDLS_SRC), TDLS_SRC, &(pattrib->pktlen));
}
u8 *rtw_tdls_set_linkid(u8 *pframe, struct pkt_attrib *pattrib, u8 init)
{
u8 link_id_addr[18] = {0};
if (init == _TRUE) {
_rtw_memcpy(link_id_addr, pattrib->ra, 6);
_rtw_memcpy((link_id_addr+6), pattrib->src, 6);
_rtw_memcpy((link_id_addr+12), pattrib->dst, 6);
} else {
_rtw_memcpy(link_id_addr, pattrib->ra, 6);
_rtw_memcpy((link_id_addr+6), pattrib->dst, 6);
_rtw_memcpy((link_id_addr+12), pattrib->src, 6);
}
return rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
}
#ifdef CONFIG_TDLS_CH_SW
u8 *rtw_tdls_set_target_ch(_adapter *padapter, u8 *pframe, struct pkt_attrib *pattrib)
{
u8 target_ch = 1;
if (padapter->tdlsinfo.chsw_info.off_ch_num)
return rtw_set_fixed_ie(pframe, 1, &(padapter->tdlsinfo.chsw_info.off_ch_num), &(pattrib->pktlen));
else
return rtw_set_fixed_ie(pframe, 1, &(target_ch), &(pattrib->pktlen));
}
u8 *rtw_tdls_set_ch_sw(u8 *pframe, struct pkt_attrib *pattrib, struct sta_info *ptdls_sta)
{
u8 ch_switch_timing[4] = {0};
u16 switch_time = (ptdls_sta->ch_switch_time >= CH_SWITCH_TIME * 1000) ?
ptdls_sta->ch_switch_time : CH_SWITCH_TIME;
u16 switch_timeout = (ptdls_sta->ch_switch_timeout >= CH_SWITCH_TIMEOUT * 1000) ?
ptdls_sta->ch_switch_timeout : CH_SWITCH_TIMEOUT;
_rtw_memcpy(ch_switch_timing, &switch_time, 2);
_rtw_memcpy(ch_switch_timing + 2, &switch_timeout, 2);
return rtw_set_ie(pframe, _CH_SWITCH_TIMING_, 4, ch_switch_timing, &(pattrib->pktlen));
}
#endif
u8 *rtw_tdls_set_wmm_params(_adapter *padapter, u8 *pframe, struct pkt_attrib *pattrib)
{
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
u8 wmm_param_ele[24] = {0};
if (&pmlmeinfo->WMM_param) {
_rtw_memcpy(wmm_param_ele, WMM_PARA_OUI, 6);
if (_rtw_memcmp(&pmlmeinfo->WMM_param, &wmm_param_ele[6], 18) == _TRUE)
/* Use default WMM Param */
_rtw_memcpy(wmm_param_ele + 6, (u8 *)&TDLS_WMM_PARAM_IE, sizeof(TDLS_WMM_PARAM_IE));
else
_rtw_memcpy(wmm_param_ele + 6, (u8 *)&pmlmeinfo->WMM_param, sizeof(pmlmeinfo->WMM_param));
return rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 24, wmm_param_ele, &(pattrib->pktlen));
}
else
return pframe;
}
#ifdef CONFIG_WFD
void rtw_tdls_process_wfd_ie(struct tdls_info *ptdlsinfo, u8 *ptr, u8 length)
{
u8 wfd_ie[ 128 ] = { 0x00 };
u32 wfd_ielen = 0;
u32 wfd_offset = 0;
/* Try to get the TCP port information when receiving the negotiation response. */
wfd_offset = 0;
wfd_offset = rtw_get_wfd_ie( ptr + wfd_offset, length - wfd_offset, wfd_ie, &wfd_ielen );
while (wfd_offset) {
u8 attr_content[ 10 ] = { 0x00 };
u32 attr_contentlen = 0;
int i;
DBG_871X( "[%s] WFD IE Found!!\n", __FUNCTION__ );
rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, attr_content, &attr_contentlen);
if (attr_contentlen) {
ptdlsinfo->wfd_info->peer_rtsp_ctrlport = RTW_GET_BE16( attr_content + 2 );
DBG_871X( "[%s] Peer PORT NUM = %d\n", __FUNCTION__, ptdlsinfo->wfd_info->peer_rtsp_ctrlport );
}
_rtw_memset( attr_content, 0x00, 10);
attr_contentlen = 0;
rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_LOCAL_IP_ADDR, attr_content, &attr_contentlen);
if (attr_contentlen) {
_rtw_memcpy(ptdlsinfo->wfd_info->peer_ip_address, ( attr_content + 1 ), 4);
DBG_871X( "[%s] Peer IP = %02u.%02u.%02u.%02u \n", __FUNCTION__,
ptdlsinfo->wfd_info->peer_ip_address[0], ptdlsinfo->wfd_info->peer_ip_address[1],
ptdlsinfo->wfd_info->peer_ip_address[2], ptdlsinfo->wfd_info->peer_ip_address[3]);
}
wfd_offset = rtw_get_wfd_ie( ptr + wfd_offset, length - wfd_offset, wfd_ie, &wfd_ielen );
}
}
int issue_tunneled_probe_req(_adapter *padapter)
{
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
u8 baddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
struct tdls_txmgmt txmgmt;
int ret = _FAIL;
DBG_871X("[%s]\n", __FUNCTION__);
_rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
txmgmt.action_code = TUNNELED_PROBE_REQ;
if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
goto exit;
pattrib = &pmgntframe->attrib;
pmgntframe->frame_tag = DATA_FRAMETAG;
pattrib->ether_type = 0x890d;
_rtw_memcpy(pattrib->dst, baddr, ETH_ALEN);
_rtw_memcpy(pattrib->src, adapter_mac_addr(padapter), ETH_ALEN);
_rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
_rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
update_tdls_attrib(padapter, pattrib);
pattrib->qsel = pattrib->priority;
if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, &txmgmt) != _SUCCESS) {
rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
rtw_free_xmitframe(pxmitpriv, pmgntframe);
goto exit;
}
dump_mgntframe(padapter, pmgntframe);
ret = _SUCCESS;
exit:
return ret;
}
int issue_tunneled_probe_rsp(_adapter *padapter, union recv_frame *precv_frame)
{
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
struct tdls_txmgmt txmgmt;
int ret = _FAIL;
DBG_871X("[%s]\n", __FUNCTION__);
_rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
txmgmt.action_code = TUNNELED_PROBE_RSP;
if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
goto exit;
pattrib = &pmgntframe->attrib;
pmgntframe->frame_tag = DATA_FRAMETAG;
pattrib->ether_type = 0x890d;
_rtw_memcpy(pattrib->dst, precv_frame->u.hdr.attrib.src, ETH_ALEN);
_rtw_memcpy(pattrib->src, adapter_mac_addr(padapter), ETH_ALEN);
_rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
_rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
update_tdls_attrib(padapter, pattrib);
pattrib->qsel = pattrib->priority;
if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, &txmgmt) != _SUCCESS) {
rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf);
rtw_free_xmitframe(pxmitpriv, pmgntframe);
goto exit;
}
dump_mgntframe(padapter, pmgntframe);
ret = _SUCCESS;
exit:
return ret;
}
#endif /* CONFIG_WFD */
int issue_tdls_setup_req(_adapter *padapter, struct tdls_txmgmt *ptxmgmt, int wait_ack)
{
struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
struct sta_priv *pstapriv = &padapter->stapriv;
struct sta_info *ptdls_sta= NULL;
_irqL irqL;
int ret = _FAIL;
/* Retry timer should be set at least 301 sec, using TPK_count counting 301 times. */
u32 timeout_interval= TPK_RESEND_COUNT;
DBG_871X("[TDLS] %s\n", __FUNCTION__);
ptxmgmt->action_code = TDLS_SETUP_REQUEST;
if (ptdlsinfo->ap_prohibited == _TRUE)
goto exit;
if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
goto exit;
pattrib = &pmgntframe->attrib;
pmgntframe->frame_tag = DATA_FRAMETAG;
pattrib->ether_type = 0x890d;
_rtw_memcpy(pattrib->dst, ptxmgmt->peer, ETH_ALEN);
_rtw_memcpy(pattrib->src, adapter_mac_addr(padapter), ETH_ALEN);
_rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
_rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
update_tdls_attrib(padapter, pattrib);
/* init peer sta_info */
ptdls_sta = rtw_get_stainfo(pstapriv, ptxmgmt->peer);
if (ptdls_sta == NULL) {
ptdls_sta = rtw_alloc_stainfo(pstapriv, ptxmgmt->peer);
if (ptdls_sta == NULL) {
DBG_871X("[%s] rtw_alloc_stainfo fail\n", __FUNCTION__);
rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf);
rtw_free_xmitframe(pxmitpriv, pmgntframe);
goto exit;
}
}
if(!(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE))
ptdlsinfo->sta_cnt++;
if (ptdlsinfo->sta_cnt == MAX_ALLOWED_TDLS_STA_NUM)
ptdlsinfo->sta_maximum = _TRUE;
ptdls_sta->tdls_sta_state |= TDLS_RESPONDER_STATE;
if (rtw_tdls_is_driver_setup(padapter) == _TRUE) {
ptdls_sta->TDLS_PeerKey_Lifetime = timeout_interval;
_set_timer(&ptdls_sta->handshake_timer, TDLS_HANDSHAKE_TIME);
}
pattrib->qsel = pattrib->priority;
if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, ptxmgmt) !=_SUCCESS) {
rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf);
rtw_free_xmitframe(pxmitpriv, pmgntframe);
goto exit;
}
if (wait_ack) {
ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe);
} else {
dump_mgntframe(padapter, pmgntframe);
ret = _SUCCESS;
}
exit:
return ret;
}
int _issue_tdls_teardown(_adapter *padapter, struct tdls_txmgmt *ptxmgmt, u8 wait_ack)
{
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
struct sta_priv *pstapriv = &padapter->stapriv;
struct sta_info *ptdls_sta=NULL;
_irqL irqL;
int ret = _FAIL;
DBG_871X("[TDLS] %s\n", __FUNCTION__);
ptxmgmt->action_code = TDLS_TEARDOWN;
ptdls_sta = rtw_get_stainfo(pstapriv, ptxmgmt->peer);
if (ptdls_sta == NULL) {
DBG_871X("Np tdls_sta for tearing down\n");
goto exit;
}
if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
goto exit;
rtw_set_scan_deny(padapter, 550);
rtw_scan_abort(padapter);
#ifdef CONFIG_CONCURRENT_MODE
if (rtw_buddy_adapter_up(padapter))
rtw_scan_abort(padapter->pbuddy_adapter);
#endif /* CONFIG_CONCURRENT_MODE */
pattrib = &pmgntframe->attrib;
pmgntframe->frame_tag = DATA_FRAMETAG;
pattrib->ether_type = 0x890d;