-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrt_profile.c
663 lines (539 loc) · 18.4 KB
/
rt_profile.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
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2010, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* 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., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************/
#include "rt_config.h"
#if defined (CONFIG_RA_HW_NAT) || defined (CONFIG_RA_HW_NAT_MODULE)
#include "../../../../../../net/nat/hw_nat/ra_nat.h"
#include "../../../../../../net/nat/hw_nat/frame_engine.h"
#endif
#ifdef SYSTEM_LOG_SUPPORT
/* for wireless system event message */
char const *pWirelessSysEventText[IW_SYS_EVENT_TYPE_NUM] = {
/* system status event */
"had associated successfully", /* IW_ASSOC_EVENT_FLAG */
"had disassociated", /* IW_DISASSOC_EVENT_FLAG */
"had deauthenticated", /* IW_DEAUTH_EVENT_FLAG */
"had been aged-out and disassociated", /* IW_AGEOUT_EVENT_FLAG */
"occurred CounterMeasures attack", /* IW_COUNTER_MEASURES_EVENT_FLAG */
"occurred replay counter different in Key Handshaking", /* IW_REPLAY_COUNTER_DIFF_EVENT_FLAG */
"occurred RSNIE different in Key Handshaking", /* IW_RSNIE_DIFF_EVENT_FLAG */
"occurred MIC different in Key Handshaking", /* IW_MIC_DIFF_EVENT_FLAG */
"occurred ICV error in RX", /* IW_ICV_ERROR_EVENT_FLAG */
"occurred MIC error in RX", /* IW_MIC_ERROR_EVENT_FLAG */
"Group Key Handshaking timeout", /* IW_GROUP_HS_TIMEOUT_EVENT_FLAG */
"Pairwise Key Handshaking timeout", /* IW_PAIRWISE_HS_TIMEOUT_EVENT_FLAG */
"RSN IE sanity check failure", /* IW_RSNIE_SANITY_FAIL_EVENT_FLAG */
"set key done in WPA/WPAPSK", /* IW_SET_KEY_DONE_WPA1_EVENT_FLAG */
"set key done in WPA2/WPA2PSK", /* IW_SET_KEY_DONE_WPA2_EVENT_FLAG */
"connects with our wireless client", /* IW_STA_LINKUP_EVENT_FLAG */
"disconnects with our wireless client", /* IW_STA_LINKDOWN_EVENT_FLAG */
"scan completed", /* IW_SCAN_COMPLETED_EVENT_FLAG */
"scan terminate!! Busy!! Enqueue fail!!", /* IW_SCAN_ENQUEUE_FAIL_EVENT_FLAG */
"channel switch to ", /* IW_CHANNEL_CHANGE_EVENT_FLAG */
"wireless mode is not support", /* IW_STA_MODE_EVENT_FLAG */
"blacklisted in MAC filter list", /* IW_MAC_FILTER_LIST_EVENT_FLAG */
"Authentication rejected because of challenge failure", /* IW_AUTH_REJECT_CHALLENGE_FAILURE */
"Scanning", /* IW_SCANNING_EVENT_FLAG */
"Start a new IBSS", /* IW_START_IBSS_FLAG */
"Join the IBSS", /* IW_JOIN_IBSS_FLAG */
"Shared WEP fail", /* IW_SHARED_WEP_FAIL*/
};
#ifdef IDS_SUPPORT
/* for wireless IDS_spoof_attack event message */
char const *pWirelessSpoofEventText[IW_SPOOF_EVENT_TYPE_NUM] = {
"detected conflict SSID", /* IW_CONFLICT_SSID_EVENT_FLAG */
"detected spoofed association response", /* IW_SPOOF_ASSOC_RESP_EVENT_FLAG */
"detected spoofed reassociation responses", /* IW_SPOOF_REASSOC_RESP_EVENT_FLAG */
"detected spoofed probe response", /* IW_SPOOF_PROBE_RESP_EVENT_FLAG */
"detected spoofed beacon", /* IW_SPOOF_BEACON_EVENT_FLAG */
"detected spoofed disassociation", /* IW_SPOOF_DISASSOC_EVENT_FLAG */
"detected spoofed authentication", /* IW_SPOOF_AUTH_EVENT_FLAG */
"detected spoofed deauthentication", /* IW_SPOOF_DEAUTH_EVENT_FLAG */
"detected spoofed unknown management frame", /* IW_SPOOF_UNKNOWN_MGMT_EVENT_FLAG */
"detected replay attack" /* IW_REPLAY_ATTACK_EVENT_FLAG */
};
/* for wireless IDS_flooding_attack event message */
char const *pWirelessFloodEventText[IW_FLOOD_EVENT_TYPE_NUM] = {
"detected authentication flooding", /* IW_FLOOD_AUTH_EVENT_FLAG */
"detected association request flooding", /* IW_FLOOD_ASSOC_REQ_EVENT_FLAG */
"detected reassociation request flooding", /* IW_FLOOD_REASSOC_REQ_EVENT_FLAG */
"detected probe request flooding", /* IW_FLOOD_PROBE_REQ_EVENT_FLAG */
"detected disassociation flooding", /* IW_FLOOD_DISASSOC_EVENT_FLAG */
"detected deauthentication flooding", /* IW_FLOOD_DEAUTH_EVENT_FLAG */
"detected 802.1x eap-request flooding" /* IW_FLOOD_EAP_REQ_EVENT_FLAG */
};
#endif /* IDS_SUPPORT */
#ifdef CONFIG_STA_SUPPORT
#endif /* CONFIG_STA_SUPPORT */
#endif /* SYSTEM_LOG_SUPPORT */
NDIS_STATUS RTMPReadParametersHook(
IN PRTMP_ADAPTER pAd)
{
PSTRING src = NULL;
RTMP_OS_FD srcf;
RTMP_OS_FS_INFO osFSInfo;
INT retval = NDIS_STATUS_FAILURE;
PSTRING buffer;
#ifdef HOSTAPD_SUPPORT
int i;
#endif /*HOSTAPD_SUPPORT */
/* buffer = kmalloc(MAX_INI_BUFFER_SIZE, MEM_ALLOC_FLAG); */
os_alloc_mem(pAd, (UCHAR **)&buffer, MAX_INI_BUFFER_SIZE);
if(buffer == NULL)
return NDIS_STATUS_FAILURE;
memset(buffer, 0x00, MAX_INI_BUFFER_SIZE);
{
#ifdef CONFIG_STA_SUPPORT
IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
{
src = STA_PROFILE_PATH;
}
#endif /* CONFIG_STA_SUPPORT */
#ifdef MULTIPLE_CARD_SUPPORT
src = (PSTRING)pAd->MC_FileName;
#endif /* MULTIPLE_CARD_SUPPORT */
}
if (src && *src)
{
RtmpOSFSInfoChange(&osFSInfo, TRUE);
srcf = RtmpOSFileOpen(src, O_RDONLY, 0);
if (IS_FILE_OPEN_ERR(srcf))
{
DBGPRINT(RT_DEBUG_ERROR, ("Open file \"%s\" failed!\n", src));
}
else
{
retval =RtmpOSFileRead(srcf, buffer, MAX_INI_BUFFER_SIZE);
if (retval > 0)
{
RTMPSetProfileParameters(pAd, buffer);
retval = NDIS_STATUS_SUCCESS;
}
else
DBGPRINT(RT_DEBUG_ERROR, ("Read file \"%s\" failed(errCode=%d)!\n", src, retval));
retval = RtmpOSFileClose(srcf);
if ( retval != 0)
{
retval = NDIS_STATUS_FAILURE;
DBGPRINT(RT_DEBUG_ERROR, ("Close file \"%s\" failed(errCode=%d)!\n", src, retval));
}
}
RtmpOSFSInfoChange(&osFSInfo, FALSE);
}
#ifdef HOSTAPD_SUPPORT
for (i = 0; i < pAd->ApCfg.BssidNum; i++)
{
pAd->ApCfg.MBSSID[i].Hostapd=FALSE;
DBGPRINT(RT_DEBUG_TRACE, ("Reset ra%d hostapd support=FLASE", i));
}
#endif /*HOSTAPD_SUPPORT */
#ifdef SINGLE_SKU_V2
RTMPSetSingleSKUParameters(pAd);
#endif /* SINGLE_SKU_V2 */
/* kfree(buffer); */
os_free_mem(NULL, buffer);
return (retval);
}
#ifdef SYSTEM_LOG_SUPPORT
/*
========================================================================
Routine Description:
Send log message through wireless event
Support standard iw_event with IWEVCUSTOM. It is used below.
iwreq_data.data.flags is used to store event_flag that is defined by user.
iwreq_data.data.length is the length of the event log.
The format of the event log is composed of the entry's MAC address and
the desired log message (refer to pWirelessEventText).
ex: 11:22:33:44:55:66 has associated successfully
p.s. The requirement of Wireless Extension is v15 or newer.
========================================================================
*/
VOID RtmpDrvSendWirelessEvent(
IN VOID *pAdSrc,
IN USHORT Event_flag,
IN PUCHAR pAddr,
IN UCHAR BssIdx,
IN CHAR Rssi)
{
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdSrc;
PSTRING pBuf = NULL, pBufPtr = NULL;
USHORT event, type, BufLen;
UCHAR event_table_len = 0;
if (pAd->CommonCfg.bWirelessEvent == FALSE)
return;
type = Event_flag & 0xFF00;
event = Event_flag & 0x00FF;
switch (type)
{
case IW_SYS_EVENT_FLAG_START:
event_table_len = IW_SYS_EVENT_TYPE_NUM;
break;
#ifdef IDS_SUPPORT
case IW_SPOOF_EVENT_FLAG_START:
event_table_len = IW_SPOOF_EVENT_TYPE_NUM;
break;
case IW_FLOOD_EVENT_FLAG_START:
event_table_len = IW_FLOOD_EVENT_TYPE_NUM;
break;
#endif /* IDS_SUPPORT */
#ifdef CONFIG_STA_SUPPORT
#endif /* CONFIG_STA_SUPPORT */
}
if (event_table_len == 0)
{
DBGPRINT(RT_DEBUG_ERROR, ("%s : The type(%0x02x) is not valid.\n", __FUNCTION__, type));
return;
}
if (event >= event_table_len)
{
DBGPRINT(RT_DEBUG_ERROR, ("%s : The event(%0x02x) is not valid.\n", __FUNCTION__, event));
return;
}
/*Allocate memory and copy the msg. */
/* if((pBuf = kmalloc(IW_CUSTOM_MAX_LEN, GFP_ATOMIC)) != NULL) */
os_alloc_mem(NULL, (UCHAR **)&pBuf, IW_CUSTOM_MAX_LEN);
if(pBuf != NULL)
{
/*Prepare the payload */
memset(pBuf, 0, IW_CUSTOM_MAX_LEN);
pBufPtr = pBuf;
if (pAddr)
pBufPtr += sprintf(pBufPtr, "(RT2860) STA(%02x:%02x:%02x:%02x:%02x:%02x) ", PRINT_MAC(pAddr));
else if (BssIdx < MAX_MBSSID_NUM(pAd))
pBufPtr += sprintf(pBufPtr, "(RT2860) BSS(ra%d) ", BssIdx);
else
pBufPtr += sprintf(pBufPtr, "(RT2860) ");
if (type == IW_SYS_EVENT_FLAG_START)
{
pBufPtr += sprintf(pBufPtr, "%s", pWirelessSysEventText[event]);
if (Event_flag == IW_CHANNEL_CHANGE_EVENT_FLAG)
{
pBufPtr += sprintf(pBufPtr, "%3d", Rssi);
}
}
#ifdef IDS_SUPPORT
else if (type == IW_SPOOF_EVENT_FLAG_START)
pBufPtr += sprintf(pBufPtr, "%s (RSSI=%d)", pWirelessSpoofEventText[event], Rssi);
else if (type == IW_FLOOD_EVENT_FLAG_START)
pBufPtr += sprintf(pBufPtr, "%s", pWirelessFloodEventText[event]);
#endif /* IDS_SUPPORT */
#ifdef CONFIG_STA_SUPPORT
#endif /* CONFIG_STA_SUPPORT */
else
pBufPtr += sprintf(pBufPtr, "%s", "unknown event");
pBufPtr[pBufPtr - pBuf] = '\0';
BufLen = pBufPtr - pBuf;
RtmpOSWrielessEventSend(pAd->net_dev, RT_WLAN_EVENT_CUSTOM, Event_flag, NULL, (PUCHAR)pBuf, BufLen);
/*DBGPRINT(RT_DEBUG_TRACE, ("%s : %s\n", __FUNCTION__, pBuf)); */
/* kfree(pBuf); */
os_free_mem(NULL, pBuf);
}
else
DBGPRINT(RT_DEBUG_ERROR, ("%s : Can't allocate memory for wireless event.\n", __FUNCTION__));
}
#endif /* SYSTEM_LOG_SUPPORT */
void RTMP_IndicateMediaState(
IN PRTMP_ADAPTER pAd,
IN NDIS_MEDIA_STATE media_state)
{
pAd->IndicateMediaState = media_state;
#ifdef SYSTEM_LOG_SUPPORT
if (pAd->IndicateMediaState == NdisMediaStateConnected)
{
RTMPSendWirelessEvent(pAd, IW_STA_LINKUP_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0);
}
else
{
RTMPSendWirelessEvent(pAd, IW_STA_LINKDOWN_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0);
}
#endif /* SYSTEM_LOG_SUPPORT */
}
void tbtt_tasklet(unsigned long data)
{
}
void announce_802_3_packet(
IN VOID *pAdSrc,
IN PNDIS_PACKET pPacket,
IN UCHAR OpMode)
{
PNDIS_PACKET pRxPkt = pPacket;
ASSERT(pPacket);
MEM_DBG_PKT_FREE_INC(pPacket);
#ifdef CONFIG_STA_SUPPORT
#endif /* CONFIG_STA_SUPPORT */
/* Push up the protocol stack */
#ifdef IKANOS_VX_1X0
{
IKANOS_DataFrameRx(pAd, pRxPkt);
return;
}
#endif /* IKANOS_VX_1X0 */
#ifdef INF_PPA_SUPPORT
if (ppa_hook_directpath_send_fn && pAd->PPAEnable==TRUE )
{
RtmpOsPktInfPpaSend(pRxPkt);
pRxPkt=NULL;
return;
}
#endif /* INF_PPA_SUPPORT */
{
#ifdef CONFIG_RT2880_BRIDGING_ONLY
PACKET_CB_ASSIGN(pRxPkt, 22) = 0xa8;
#endif
#if defined(CONFIG_RA_CLASSIFIER)||defined(CONFIG_RA_CLASSIFIER_MODULE)
if(ra_classifier_hook_rx!= NULL)
{
unsigned int flags;
RTMP_IRQ_LOCK(&pAd->page_lock, flags);
ra_classifier_hook_rx(pRxPkt, classifier_cur_cycle);
RTMP_IRQ_UNLOCK(&pAd->page_lock, flags);
}
#endif /* CONFIG_RA_CLASSIFIER */
#if !defined(CONFIG_RA_NAT_NONE)
#if defined (CONFIG_RA_HW_NAT) || defined (CONFIG_RA_HW_NAT_MODULE)
RtmpOsPktNatMagicTag(pRxPkt);
#endif
#ifdef RA_NAT_SUPPORT
/* bruce+
* ra_sw_nat_hook_rx return 1 --> continue
* ra_sw_nat_hook_rx return 0 --> FWD & without netif_rx
*/
if (ra_sw_nat_hook_rx!= NULL)
{
unsigned int flags;
RtmpOsPktProtocolAssign(pRxPkt);
RTMP_IRQ_LOCK(&pAd->page_lock, flags);
if(ra_sw_nat_hook_rx(pRxPkt))
{
RtmpOsPktRcvHandle(pRxPkt);
}
RTMP_IRQ_UNLOCK(&pAd->page_lock, flags);
}
#endif /* RA_NAT_SUPPORT */
#else
{
#if defined (CONFIG_RA_HW_NAT) || defined (CONFIG_RA_HW_NAT_MODULE)
RtmpOsPktNatNone(pRxPkt);
#endif /* CONFIG_RA_HW_NAT */
}
#endif /* CONFIG_RA_NAT_NONE */
}
RtmpOsPktProtocolAssign(pRxPkt);
RtmpOsPktRcvHandle(pRxPkt);
}
#ifdef CONFIG_STA_SUPPORT
void STA_MonPktSend(
IN RTMP_ADAPTER *pAd,
IN RX_BLK *pRxBlk)
{
PNET_DEV pNetDev;
PNDIS_PACKET pRxPacket;
PHEADER_802_11 pHeader;
USHORT DataSize;
UINT32 MaxRssi;
UCHAR L2PAD, PHYMODE, BW, ShortGI, MCS, AMPDU, STBC, RSSI1;
UCHAR BssMonitorFlag11n, Channel, CentralChannel;
UCHAR *pData, *pDevName;
/* sanity check */
ASSERT(pRxBlk->pRxPacket);
if (pRxBlk->DataSize < 10)
{
DBGPRINT(RT_DEBUG_ERROR, ("%s : Size is too small! (%d)\n", __FUNCTION__, pRxBlk->DataSize));
goto err_free_sk_buff;
}
if (pRxBlk->DataSize + sizeof(wlan_ng_prism2_header) > RX_BUFFER_AGGRESIZE)
{
DBGPRINT(RT_DEBUG_ERROR, ("%s : Size is too large! (%lu)\n", __FUNCTION__, pRxBlk->DataSize + sizeof(wlan_ng_prism2_header)));
goto err_free_sk_buff;
}
/* init */
MaxRssi = RTMPMaxRssi(pAd,
ConvertToRssi(pAd, pRxBlk->pRxWI->RxWIRSSI0, RSSI_0),
ConvertToRssi(pAd, pRxBlk->pRxWI->RxWIRSSI1, RSSI_1),
ConvertToRssi(pAd, pRxBlk->pRxWI->RxWIRSSI2, RSSI_2));
pNetDev = get_netdev_from_bssid(pAd, BSS0);
pRxPacket = pRxBlk->pRxPacket;
pHeader = pRxBlk->pHeader;
pData = pRxBlk->pData;
DataSize = pRxBlk->DataSize;
L2PAD = pRxBlk->pRxInfo->L2PAD;
PHYMODE = pRxBlk->pRxWI->RxWIPhyMode;
BW = pRxBlk->pRxWI->RxWIBW;
ShortGI = pRxBlk->pRxWI->RxWISGI;
MCS = pRxBlk->pRxWI->RxWIMCS;
AMPDU = pRxBlk->pRxInfo->AMPDU;
STBC = pRxBlk->pRxWI->RxWISTBC;
RSSI1 = pRxBlk->pRxWI->RxWIRSSI1;
BssMonitorFlag11n = 0;
#ifdef MONITOR_FLAG_11N_SNIFFER_SUPPORT
BssMonitorFlag11n = (pAd->StaCfg.BssMonitorFlag & MONITOR_FLAG_11N_SNIFFER);
#endif /* MONITOR_FLAG_11N_SNIFFER_SUPPORT */
pDevName = (UCHAR *)RtmpOsGetNetDevName(pAd->net_dev);
Channel = pAd->CommonCfg.Channel;
CentralChannel = pAd->CommonCfg.CentralChannel;
/* pass the packet */
send_monitor_packets(pNetDev, pRxPacket, pHeader, pData, DataSize,
L2PAD, PHYMODE, BW, ShortGI, MCS, AMPDU, STBC, RSSI1,
BssMonitorFlag11n, pDevName, Channel, CentralChannel,
MaxRssi);
return;
err_free_sk_buff:
RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE);
return;
}
#endif /* CONFIG_STA_SUPPORT */
extern NDIS_SPIN_LOCK TimerSemLock;
VOID RTMPFreeAdapter(
IN VOID *pAdSrc)
{
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdSrc;
POS_COOKIE os_cookie;
int index;
os_cookie=(POS_COOKIE)pAd->OS_Cookie;
if (pAd->BeaconBuf)
os_free_mem(NULL, pAd->BeaconBuf);
NdisFreeSpinLock(&pAd->MgmtRingLock);
#if defined(RT3290) || defined(RT65xx)
#endif /* defined(RT3290) || defined(RT65xx) */
for (index =0 ; index < NUM_OF_TX_RING; index++)
{
NdisFreeSpinLock(&pAd->TxSwQueueLock[index]);
NdisFreeSpinLock(&pAd->DeQueueLock[index]);
pAd->DeQueueRunning[index] = FALSE;
}
NdisFreeSpinLock(&pAd->irq_lock);
#ifdef UAPSD_SUPPORT
NdisFreeSpinLock(&pAd->UAPSDEOSPLock); /* OS_ABL_SUPPORT */
#endif /* UAPSD_SUPPORT */
#ifdef DOT11_N_SUPPORT
NdisFreeSpinLock(&pAd->mpdu_blk_pool.lock);
#endif /* DOT11_N_SUPPORT */
if (pAd->iw_stats)
{
os_free_mem(NULL, pAd->iw_stats);
pAd->iw_stats = NULL;
}
if (pAd->stats)
{
os_free_mem(NULL, pAd->stats);
pAd->stats = NULL;
}
NdisFreeSpinLock(&TimerSemLock);
#ifdef RALINK_ATE
#ifdef RTMP_MAC_USB
RTMP_OS_ATMOIC_DESTROY(&pAd->BulkOutRemained);
RTMP_OS_ATMOIC_DESTROY(&pAd->BulkInRemained);
#endif /* RTMP_MAC_USB */
#endif /* RALINK_ATE */
RTMP_OS_FREE_TIMER(pAd);
RTMP_OS_FREE_LOCK(pAd);
RTMP_OS_FREE_TASKLET(pAd);
RTMP_OS_FREE_TASK(pAd);
RTMP_OS_FREE_SEM(pAd);
RTMP_OS_FREE_ATOMIC(pAd);
RtmpOsVfree(pAd); /* pci_free_consistent(os_cookie->pci_dev,sizeof(RTMP_ADAPTER),pAd,os_cookie->pAd_pa); */
if (os_cookie)
os_free_mem(NULL, os_cookie);
}
int RTMPSendPackets(
IN NDIS_HANDLE dev_hnd,
IN PPNDIS_PACKET ppPacketArray,
IN UINT NumberOfPackets,
IN UINT32 PktTotalLen,
IN RTMP_NET_ETH_CONVERT_DEV_SEARCH Func)
{
RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)dev_hnd;
PNDIS_PACKET pPacket = ppPacketArray[0];
INC_COUNTER64(pAd->WlanCounters.TransmitCountFrmOs);
if (pPacket == NULL)
goto done;
/* RT2870STA does this in RTMPSendPackets() */
#ifdef RALINK_ATE
if (ATE_ON(pAd))
{
RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_RESOURCES);
return 0;
}
#endif /* RALINK_ATE */
#ifdef CONFIG_STA_SUPPORT
IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
{
/* Drop send request since we are in monitor mode */
if (MONITOR_ON(pAd))
{
RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE);
return 0;
}
}
#endif /* CONFIG_STA_SUPPORT */
/* EapolStart size is 18 */
if (PktTotalLen < 14)
{
/*printk("bad packet size: %d\n", pkt->len); */
hex_dump("bad packet", GET_OS_PKT_DATAPTR(pPacket), PktTotalLen);
RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE);
return 0;
}
RTMP_SET_PACKET_5VT(pPacket, 0);
/* MiniportMMRequest(pAd, pkt->data, pkt->len); */
#ifdef CONFIG_5VT_ENHANCE
if (*(int*)(GET_OS_PKT_CB(pPacket)) == BRIDGE_TAG) {
RTMP_SET_PACKET_5VT(pPacket, 1);
}
#endif
#ifdef CONFIG_STA_SUPPORT
IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
{
STASendPackets((NDIS_HANDLE)pAd, (PPNDIS_PACKET) &pPacket, 1);
}
#endif /* CONFIG_STA_SUPPORT */
done:
return 0;
}
PNET_DEV get_netdev_from_bssid(
IN PRTMP_ADAPTER pAd,
IN UCHAR FromWhichBSSID)
{
PNET_DEV dev_p = NULL;
do
{
#ifdef CONFIG_STA_SUPPORT
#endif /* CONFIG_STA_SUPPORT */
{
dev_p = pAd->net_dev;
}
} while (FALSE);
ASSERT(dev_p);
return dev_p; /* return one of MBSS */
}
#ifdef WDS_SUPPORT
VOID AP_WDS_KeyNameMakeUp(
IN STRING *pKey,
IN UINT32 KeyMaxSize,
IN INT KeyId)
{
snprintf(pKey, KeyMaxSize, "Wds%dKey", KeyId);
}
#endif /* WDS_SUPPORT */