255
243
ieee->seq_ctrl[0]++;
257
245
/* avoid watchdog triggers */
258
// ieee->dev->trans_start = jiffies;
259
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
260
//dev_kfree_skb_any(skb);//edit by thomas
246
ieee->softmac_data_hard_start_xmit(skb, ieee, ieee->basic_rate);
263
249
spin_unlock_irqrestore(&ieee->lock, flags);
265
251
spin_unlock_irqrestore(&ieee->lock, flags);
266
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
252
spin_lock(&ieee->mgmt_tx_lock);
268
254
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4);
273
259
ieee->seq_ctrl[0]++;
275
261
/* check wether the managed packet queued greater than 5 */
276
if(!ieee->check_nic_enough_desc(ieee->dev,tcb_desc->queue_index)||\
277
(skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) != 0)||\
262
if(!ieee->check_nic_enough_desc(ieee, tcb_desc->queue_index)||
263
(skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) != 0)||
278
264
(ieee->queue_stop) ) {
279
265
/* insert the skb packet to the management queue */
280
266
/* as for the completion function, it does not need
281
267
* to check it any more.
283
//printk("%s():insert to waitqueue!\n",__FUNCTION__);
284
269
skb_queue_tail(&ieee->skb_waitQ[tcb_desc->queue_index], skb);
286
//printk("TX packet!\n");
287
ieee->softmac_hard_start_xmit(skb,ieee->dev);
288
//dev_kfree_skb_any(skb);//edit by thomas
271
ieee->softmac_hard_start_xmit(skb, ieee);
290
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
273
spin_unlock(&ieee->mgmt_tx_lock);
377
357
struct sk_buff *skb;
378
358
if(!ieee->ieee_up)
380
//unsigned long flags;
381
361
skb = ieee80211_get_beacon_(ieee);
384
364
softmac_mgmt_xmit(skb, ieee);
385
365
ieee->softmac_stats.tx_beacons++;
386
//dev_kfree_skb_any(skb);//edit by thomas
388
// ieee->beacon_timer.expires = jiffies +
389
// (MSECS( ieee->current_network.beacon_interval -5));
391
//spin_lock_irqsave(&ieee->beacon_lock,flags);
392
368
if(ieee->beacon_txing && ieee->ieee_up){
393
// if(!timer_pending(&ieee->beacon_timer))
394
// add_timer(&ieee->beacon_timer);
395
369
mod_timer(&ieee->beacon_timer,jiffies+(MSECS(ieee->current_network.beacon_interval-5)));
397
//spin_unlock_irqrestore(&ieee->beacon_lock,flags);
709
675
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
710
676
memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
712
//auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
713
678
if(ieee->auth_mode == 0)
714
679
auth->algorithm = WLAN_AUTH_OPEN;
715
680
else if(ieee->auth_mode == 1)
798
750
tmp_generic_ie_len = sizeof(ieee->pHTInfo->szRT2RTAggBuffer);
799
751
HTConstructRT2RTAggElement(ieee, tmp_generic_ie_buf, &tmp_generic_ie_len);
801
// printk("===============>tmp_ht_cap_len is %d,tmp_ht_info_len is %d, tmp_generic_ie_len is %d\n",tmp_ht_cap_len,tmp_ht_info_len,tmp_generic_ie_len);
803
754
beacon_size = sizeof(struct ieee80211_probe_response)+2+
877
819
*(tag++) = erpinfo_content;
880
//Include High Throuput capability
882
*(tag++) = MFIE_TYPE_HT_CAP;
883
*(tag++) = tmp_ht_cap_len - 2;
884
memcpy(tag, tmp_ht_cap_buf, tmp_ht_cap_len - 2);
885
tag += tmp_ht_cap_len - 2;
888
822
*(tag++) = MFIE_TYPE_RATES_EX;
889
823
*(tag++) = rate_ex_len-2;
909
835
tag += wpa_ie_len;
914
// Construct Realtek Proprietary Aggregation mode (Set AMPDU Factor to 2, 32k)
916
if(pHTInfo->bRegRT2RTAggregation)
919
(*tag++) = tmp_generic_ie_len - 2;
920
memcpy(tag,tmp_generic_ie_buf,tmp_generic_ie_len -2);
921
tag += tmp_generic_ie_len -2;
926
if(ieee->qos_support)
930
memcpy(tag,QosOui,wmm_len);
934
//skb->dev = ieee->dev;
1344
1239
memcpy(tag, realtek_ie_buf,realtek_ie_len -2 );
1347
// printk("<=====%s(), %p, %p\n", __FUNCTION__, ieee->dev, ieee->dev->dev_addr);
1348
// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len);
1400
1293
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
1401
1294
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
1402
//printk(KERN_WARNING "Sending authentication request\n");
1403
1295
softmac_mgmt_xmit(skb, ieee);
1404
1296
//BUGON when you try to add_timer twice, using mod_timer may be better, john0709
1405
1297
if(!timer_pending(&ieee->associate_timer)){
1406
1298
ieee->associate_timer.expires = jiffies + (HZ / 2);
1407
1299
add_timer(&ieee->associate_timer);
1409
//dev_kfree_skb_any(skb);//edit by thomas
1461
1346
softmac_mgmt_xmit(skb, ieee);
1462
1347
mod_timer(&ieee->associate_timer, jiffies + (HZ/2));
1464
ieee->associate_timer.expires = jiffies + (HZ / 2);
1465
add_timer(&ieee->associate_timer);
1467
//dev_kfree_skb_any(skb);//edit by thomas
1470
1350
void ieee80211_associate_complete_wq(struct work_struct *work)
1491
1371
printk("Successfully associated, ht not enabled(%d, %d)\n", ieee->pHTInfo->bCurrentHTSupport, ieee->pHTInfo->bEnableHT);
1492
1372
memset(ieee->dot11HTOperationalRateSet, 0, 16);
1493
//HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
1495
1374
ieee->LinkDetectInfo.SlotNum = 2 * (1 + ieee->current_network.beacon_interval/500);
1496
1375
// To prevent the immediately calling watch_dog after association.
1513
1392
if (ieee->data_hard_resume)
1514
ieee->data_hard_resume(ieee->dev);
1393
ieee->data_hard_resume(ieee);
1515
1394
netif_carrier_on(ieee->dev);
1518
1397
void ieee80211_associate_complete(struct ieee80211_device *ieee)
1521
// struct net_device* dev = ieee->dev;
1522
1399
del_timer_sync(&ieee->associate_timer);
1525
for(i = 0; i < 6; i++) {
1526
ieee->seq_ctrl[i] = 0;
1529
1401
ieee->state = IEEE80211_LINKED;
1531
if (ieee->pHTInfo->bCurrentHTSupport)
1533
printk("Successfully associated, ht enabled\n");
1534
queue_work(ieee->wq, &ieee->ht_onAssRsp);
1538
printk("Successfully associated, ht not enabled\n");
1539
memset(ieee->dot11HTOperationalRateSet, 0, 16);
1540
HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
1543
//ieee->UpdateHalRATRTableHandler(dev, ieee->dot11HTOperationalRateSet);
1544
1402
queue_work(ieee->wq, &ieee->associate_complete_wq);
1550
1408
ieee->sync_scan_hurryup = 1;
1551
1409
#ifdef ENABLE_IPS
1552
1410
if(ieee->ieee80211_ips_leave != NULL)
1553
ieee->ieee80211_ips_leave(ieee->dev);
1411
ieee->ieee80211_ips_leave(ieee);
1556
1414
down(&ieee->wx_sem);
1558
1416
if (ieee->data_hard_stop)
1559
ieee->data_hard_stop(ieee->dev);
1417
ieee->data_hard_stop(ieee);
1561
1419
ieee80211_stop_scan(ieee);
1562
1420
printk("===>%s(), chan:%d\n", __FUNCTION__, ieee->current_network.channel);
1563
//ieee->set_chan(ieee->dev, ieee->current_network.channel);
1564
1421
HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
1567
if(ieee->eRFPowerState == eRfOff)
1569
if(ieee->ieee80211_ips_leave_wq != NULL)
1570
ieee->ieee80211_ips_leave_wq(ieee->dev);
1577
1423
ieee->associate_seq = 1;
1578
1424
ieee80211_associate_step1(ieee);
1605
1451
* This could be obtained by beacons or, if the network does not
1606
1452
* broadcast it, it can be put manually.
1608
apset = ieee->wap_set;//(memcmp(ieee->current_network.bssid, zero,ETH_ALEN)!=0 );
1609
ssidset = ieee->ssid_set;//ieee->current_network.ssid[0] != '\0';
1454
apset = ieee->wap_set;
1455
ssidset = ieee->ssid_set;
1610
1456
ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0');
1611
1457
apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
1612
1458
ssidmatch = (ieee->current_network.ssid_len == net->ssid_len)&&\
1641
1487
printk(KERN_INFO"Linking with %s,channel:%d, qos:%d, myHT:%d, networkHT:%d\n",ieee->current_network.ssid,ieee->current_network.channel, ieee->current_network.qos_data.supported, ieee->pHTInfo->bEnableHT, ieee->current_network.bssht.bdSupportHT);
1643
//ieee->pHTInfo->IOTAction = 0;
1644
1489
HTResetIOTSetting(ieee->pHTInfo);
1645
1490
if (ieee->iw_mode == IW_MODE_INFRA){
1646
1491
/* Join the network for the first time */
1647
1492
ieee->AsocRetryCount = 0;
1648
1493
//for HT by amy 080514
1649
1494
if((ieee->current_network.qos_data.supported == 1) &&
1650
// (ieee->pHTInfo->bEnableHT && ieee->current_network.bssht.bdSupportHT))
1651
1495
ieee->current_network.bssht.bdSupportHT)
1652
1496
/*WB, 2008.09.09:bCurrentHTSupport and bEnableHT two flags are going to put together to check whether we are in HT now, so needn't to check bEnableHT flags here. That's is to say we will set to HT support whenever joined AP has the ability to support HT. And whether we are in HT or not, please check bCurrentHTSupport&&bEnableHT now please.*/
1654
// ieee->pHTInfo->bCurrentHTSupport = true;
1655
1498
HTResetSelfAndSavePeerSetting(ieee, &(ieee->current_network));
1665
1508
if(ieee80211_is_54g(ieee->current_network) &&
1666
1509
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
1667
1510
ieee->rate = 108;
1668
ieee->SetWirelessMode(ieee->dev, IEEE_G);
1511
ieee->SetWirelessMode(ieee, IEEE_G);
1669
1512
printk(KERN_INFO"Using G rates\n");
1671
1514
ieee->rate = 22;
1672
ieee->SetWirelessMode(ieee->dev, IEEE_B);
1515
ieee->SetWirelessMode(ieee, IEEE_B);
1673
1516
printk(KERN_INFO"Using B rates\n");
1675
1518
memset(ieee->dot11HTOperationalRateSet, 0, 16);
1676
//HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
1677
1519
ieee->state = IEEE80211_LINKED;
1839
1681
u8 dest[ETH_ALEN];
1841
//IEEE80211DMESG("Rx probe");
1842
1683
ieee->softmac_stats.rx_probe_rq++;
1843
//DMESG("Dest is "MACSTR, MAC2STR(dest));
1844
1684
if (probe_rq_parse(ieee, skb, dest)){
1845
//IEEE80211DMESG("Was for me!");
1846
1685
ieee->softmac_stats.tx_probe_rs++;
1847
1686
ieee80211_resp_to_probe(ieee, dest);
1854
1693
u8 dest[ETH_ALEN];
1856
//IEEE80211DMESG("Rx probe");
1857
1695
ieee->softmac_stats.rx_auth_rq++;
1859
1697
status = auth_rq_parse(skb, dest);
1860
1698
if (status != -1) {
1861
1699
ieee80211_resp_to_auth(ieee, status, dest);
1863
//DMESG("Dest is "MACSTR, MAC2STR(dest));
1867
1703
static inline void
1868
1704
ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
1871
1706
u8 dest[ETH_ALEN];
1872
//unsigned long flags;
1874
1708
ieee->softmac_stats.rx_ass_rq++;
1875
1709
if (assoc_rq_parse(skb,dest) != -1){
1912
1740
int timeout = ieee->ps_timeout;
1914
PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(ieee->PowerSaveControl));
1916
1743
if(ieee->LPSDelayCnt)
1918
//printk("===============>Delay enter LPS for DHCP and ARP packets...\n");
1919
1745
ieee->LPSDelayCnt --;
1923
1749
dtim = ieee->current_network.dtim_data;
1924
// printk("%s():DTIM:%d\n",__FUNCTION__,dtim);
1925
1750
if(!(dtim & IEEE80211_DTIM_VALID))
1927
1752
timeout = ieee->current_network.beacon_interval; //should we use ps_timeout value or beacon_interval
1928
//printk("VALID\n");
1929
1753
ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
1930
1754
/* there's no need to nofity AP that I find you buffered with broadcast packet */
1931
1755
if(dtim & (IEEE80211_DTIM_UCAST & ieee->ps))
1934
1758
if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout))){
1935
// printk("%s():111Oh Oh ,it is not time out return 0\n",__FUNCTION__);
1938
1761
if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout))){
1939
// printk("%s():222Oh Oh ,it is not time out return 0\n",__FUNCTION__);
1942
1764
if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
1947
1769
if(ieee->bAwakePktSent == true) {
1948
pPSC->LPSAwakeIntvl = 1;//tx wake one beacon
1770
ieee->LPSAwakeIntvl = 1;//tx wake one beacon
1950
1772
u8 MaxPeriod = 1;
1952
if(pPSC->LPSAwakeIntvl == 0)
1953
pPSC->LPSAwakeIntvl = 1;
1954
//pNdisCommon->RegLPSMaxIntvl /// 0x0 - eFastPs, 0xFF -DTIM, 0xNN - 0xNN * BeaconIntvl
1955
if(pPSC->RegMaxLPSAwakeIntvl == 0) // Default (0x0 - eFastPs, 0xFF -DTIM, 0xNN - 0xNN * BeaconIntvl)
1774
if(ieee->LPSAwakeIntvl == 0)
1775
ieee->LPSAwakeIntvl = 1;
1776
if(ieee->RegMaxLPSAwakeIntvl == 0) // Default (0x0 - eFastPs, 0xFF -DTIM, 0xNN - 0xNN * BeaconIntvl)
1956
1777
MaxPeriod = 1; // 1 Beacon interval
1957
else if(pPSC->RegMaxLPSAwakeIntvl == 0xFF) // DTIM
1778
else if(ieee->RegMaxLPSAwakeIntvl == 0xFF) // DTIM
1958
1779
MaxPeriod = ieee->current_network.dtim_period;
1960
MaxPeriod = pPSC->RegMaxLPSAwakeIntvl;
1961
pPSC->LPSAwakeIntvl = (pPSC->LPSAwakeIntvl >= MaxPeriod) ? MaxPeriod : (pPSC->LPSAwakeIntvl + 1);
1781
MaxPeriod = ieee->RegMaxLPSAwakeIntvl;
1782
ieee->LPSAwakeIntvl = (ieee->LPSAwakeIntvl >= MaxPeriod) ? MaxPeriod : (ieee->LPSAwakeIntvl + 1);
1964
1785
u8 LPSAwakeIntvl_tmp = 0;
1965
1786
u8 period = ieee->current_network.dtim_period;
1966
1787
u8 count = ieee->current_network.tim.tim_count;
1967
1788
if(count == 0 ) {
1968
if(pPSC->LPSAwakeIntvl > period)
1969
LPSAwakeIntvl_tmp = period + (pPSC->LPSAwakeIntvl - period) -((pPSC->LPSAwakeIntvl-period)%period);
1789
if(ieee->LPSAwakeIntvl > period)
1790
LPSAwakeIntvl_tmp = period + (ieee->LPSAwakeIntvl - period) -((ieee->LPSAwakeIntvl-period)%period);
1971
LPSAwakeIntvl_tmp = pPSC->LPSAwakeIntvl;
1792
LPSAwakeIntvl_tmp = ieee->LPSAwakeIntvl;
1974
if(pPSC->LPSAwakeIntvl > ieee->current_network.tim.tim_count)
1975
LPSAwakeIntvl_tmp = count + (pPSC->LPSAwakeIntvl - count) -((pPSC->LPSAwakeIntvl-count)%period);
1795
if(ieee->LPSAwakeIntvl > ieee->current_network.tim.tim_count)
1796
LPSAwakeIntvl_tmp = count + (ieee->LPSAwakeIntvl - count) -((ieee->LPSAwakeIntvl-count)%period);
1977
LPSAwakeIntvl_tmp = pPSC->LPSAwakeIntvl;//ieee->current_network.tim.tim_count;//pPSC->LPSAwakeIntvl;
1798
LPSAwakeIntvl_tmp = ieee->LPSAwakeIntvl;
1979
//printk("=========>%s()assoc_id:%d(%#x),bAwakePktSent:%d,DTIM:%d, sleep interval:%d, LPSAwakeIntvl_tmp:%d, count:%d\n",__func__,ieee->assoc_id,cpu_to_le16(ieee->assoc_id),ieee->bAwakePktSent,ieee->current_network.dtim_period,pPSC->LPSAwakeIntvl,LPSAwakeIntvl_tmp,count);
1981
1801
*time_l = ieee->current_network.last_dtim_sta_time[0]
1982
1802
+ MSECS(ieee->current_network.beacon_interval * LPSAwakeIntvl_tmp);
1983
// * ieee->current_network.dtim_period) * 1000;
2012
1830
// #warning CHECK_LOCK_HERE
2013
1831
printk("=====>%s(): no need to ps,wake up!! ieee->ps is %d,ieee->iw_mode is %d,ieee->state is %d\n",
2014
1832
__FUNCTION__,ieee->ps,ieee->iw_mode,ieee->state);
2015
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
1833
spin_lock(&ieee->mgmt_tx_lock);
2017
1835
ieee80211_sta_wakeup(ieee, 1);
2019
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
1837
spin_unlock(&ieee->mgmt_tx_lock);
2022
1840
sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
2023
1841
/* 2 wake, 1 sleep, 0 do nothing */
2024
1842
if(sleep == 0)//it is not time out or dtim is not valid
2026
//printk("===========>sleep is 0,do nothing\n");
2029
1846
if(sleep == 1){
2030
//printk("===========>sleep is 1,to sleep\n");
2031
1847
if(ieee->sta_sleep == 1){
2032
//printk("%s(1): sta_sleep = 1, sleep again ++++++++++ \n", __func__);
2033
ieee->enter_sleep_state(ieee->dev,th,tl);
1848
ieee->enter_sleep_state(ieee, th, tl);
2036
1851
else if(ieee->sta_sleep == 0){
2037
// printk("send null 1\n");
2038
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
1852
spin_lock(&ieee->mgmt_tx_lock);
2040
if(ieee->ps_is_queue_empty(ieee->dev)){
1854
if (ieee->ps_is_queue_empty(ieee)) {
2041
1855
ieee->sta_sleep = 2;
2042
1856
ieee->ack_tx_to_ieee = 1;
2043
//printk("%s(2): sta_sleep = 0, notify AP we will sleeped ++++++++++ SendNullFunctionData\n", __func__);
2044
1857
ieee80211_sta_ps_send_null_frame(ieee,1);
2045
1858
ieee->ps_th = th;
2046
1859
ieee->ps_tl = tl;
2048
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
1861
spin_unlock(&ieee->mgmt_tx_lock);
2052
1865
ieee->bAwakePktSent = false;//after null to power save we set it to false. not listen every beacon.
2054
1867
}else if(sleep == 2){
2055
//printk("==========>sleep is 2,to wakeup\n");
2056
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
1868
spin_lock(&ieee->mgmt_tx_lock);
2058
//printk("%s(3): pkt buffered in ap will awake ++++++++++ ieee80211_sta_wakeup\n", __func__);
2059
1870
ieee80211_sta_wakeup(ieee,1);
2061
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
1872
spin_unlock(&ieee->mgmt_tx_lock);
2073
1884
if(ieee->pHTInfo->IOTAction & HT_IOT_ACT_NULL_DATA_POWER_SAVING)
2075
//printk("%s(1): notify AP we are awaked ++++++++++ SendNullFunctionData\n", __func__);
2076
//printk("Warning: driver is probably failing to report TX ps error\n");
2077
1886
ieee->ack_tx_to_ieee = 1;
2078
1887
ieee80211_sta_ps_send_null_frame(ieee, 0);
2082
1891
ieee->ack_tx_to_ieee = 1;
2083
//printk("%s(2): notify AP we are awaked ++++++++++ Send PS-Poll\n", __func__);
2084
1892
ieee80211_sta_ps_send_pspoll_frame(ieee);
2091
1899
if(ieee->sta_sleep == 1)
2092
ieee->sta_wake_up(ieee->dev);
1900
ieee->sta_wake_up(ieee);
2095
1903
if(ieee->pHTInfo->IOTAction & HT_IOT_ACT_NULL_DATA_POWER_SAVING)
2097
//printk("%s(3): notify AP we are awaked ++++++++++ SendNullFunctionData\n", __func__);
2098
//printk("Warning: driver is probably failing to report TX ps error\n");
2099
1905
ieee->ack_tx_to_ieee = 1;
2100
1906
ieee80211_sta_ps_send_null_frame(ieee, 0);
2124
1929
/* Null frame with PS bit set */
2126
1931
ieee->sta_sleep = 1;
2127
//printk("notify AP we will sleep and send null ok, so sleep now++++++++++ enter_sleep_state\n");
2128
ieee->enter_sleep_state(ieee->dev,ieee->ps_th,ieee->ps_tl);
1932
ieee->enter_sleep_state(ieee, ieee->ps_th, ieee->ps_tl);
2130
1934
} else {/* 21112005 - tx again null without PS bit if lost */
2132
1936
if((ieee->sta_sleep == 0) && !success){
2133
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
1937
spin_lock(&ieee->mgmt_tx_lock);
2134
1938
//ieee80211_sta_ps_send_null_frame(ieee, 0);
2135
1939
if(ieee->pHTInfo->IOTAction & HT_IOT_ACT_NULL_DATA_POWER_SAVING)
2137
//printk("notify AP we will sleep but send bull failed, so resend++++++++++ SendNullFunctionData\n");
2138
1941
ieee80211_sta_ps_send_null_frame(ieee, 0);
2142
//printk("notify AP we are awaked but send pspoll failed, so resend++++++++++ Send PS-Poll\n");
2143
1945
ieee80211_sta_ps_send_pspoll_frame(ieee);
2145
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
1947
spin_unlock(&ieee->mgmt_tx_lock);
2148
1950
spin_unlock_irqrestore(&ieee->lock, flags);
2192
1992
struct ieee80211_assoc_response_frame *assoc_resp;
2193
// struct ieee80211_info_element *info_element;
2194
1993
bool bSupportNmode = true, bHalfSupportNmode = false; //default support N mode, disable halfNmode
2196
1995
if(!ieee->proto_started)
2199
printk("%d, %d, %d, %d\n", ieee->sta_sleep, ieee->ps, ieee->iw_mode, ieee->state);
2200
if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
2201
ieee->iw_mode == IW_MODE_INFRA &&
2202
ieee->state == IEEE80211_LINKED))
2204
tasklet_schedule(&ieee->ps_task);
2206
if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
2207
WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
2208
ieee->last_rx_ps_time = jiffies;
2211
1998
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
2239
{ //filling the PeerHTCap. //maybe not neccesary as we can get its info from current_network.
2026
{ //filling the PeerHTCap. //maybe not necessary as we can get its info from current_network.
2240
2027
memcpy(ieee->pHTInfo->PeerHTCapBuf, network->bssht.bdHTCapBuf, network->bssht.bdHTCapLen);
2241
2028
memcpy(ieee->pHTInfo->PeerHTInfoBuf, network->bssht.bdHTInfoBuf, network->bssht.bdHTInfoLen);
2243
2030
if (ieee->handle_assoc_response != NULL)
2244
ieee->handle_assoc_response(ieee->dev, (struct ieee80211_assoc_response_frame*)header, network);
2031
ieee->handle_assoc_response(ieee, (struct ieee80211_assoc_response_frame*)header, network);
2246
2033
ieee80211_associate_complete(ieee);
2304
2091
/* Dummy wirless mode setting to avoid encryption issue */
2305
2092
if(bSupportNmode) {
2306
2093
//N mode setting
2307
ieee->SetWirelessMode(ieee->dev, \
2094
ieee->SetWirelessMode(ieee,
2308
2095
ieee->current_network.mode);
2310
2097
//b/g mode setting
2312
ieee->SetWirelessMode(ieee->dev, IEEE_G);
2099
ieee->SetWirelessMode(ieee, IEEE_G);
2315
2102
if (ieee->current_network.mode == IEEE_N_24G && bHalfSupportNmode == true)
2361
2148
ieee->softmac_stats.reassoc++;
2362
2149
ieee->is_roaming = true;
2363
2150
ieee80211_disassociate(ieee);
2364
// notify_wx_assoc_event(ieee);
2365
//HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
2366
2151
RemovePeerTS(ieee, header->addr2);
2367
2152
queue_work(ieee->wq, &ieee->associate_procedure_wq);
2411
2195
ieee80211_sta_wakeup(ieee,0);
2413
2197
/* update the tx status */
2414
// ieee->stats.tx_bytes += txb->payload_size;
2415
// ieee->stats.tx_packets++;
2416
2198
tcb_desc = (cb_desc *)(txb->fragments[0]->cb + MAX_DEV_ADDR_SIZE);
2417
2199
if(tcb_desc->bMulticast) {
2418
2200
ieee->stats.multicast++;
2421
2203
/* if xmit available, just xmit it immediately, else just insert it to the wait queue */
2422
2204
for(i = 0; i < txb->nr_frags; i++) {
2423
2205
#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
2426
2208
if ((skb_queue_len(&ieee->skb_waitQ[queue_index]) != 0) ||
2428
(!ieee->check_nic_enough_desc(ieee->dev,queue_index))||\
2210
(!ieee->check_nic_enough_desc(ieee, queue_index))||
2429
2211
(ieee->queue_stop)) {
2430
2212
/* insert the skb packet to the wait queue */
2431
2213
/* as for the completion function, it does not need
2432
2214
* to check it any more.
2434
//printk("error:no descriptor left@queue_index %d\n", queue_index);
2435
//ieee80211_rtl_stop_queue(ieee);
2436
2216
#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
2437
2217
skb_queue_tail(&ieee->skb_drv_aggQ[queue_index], txb->fragments[i]);
2540
2313
void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee)
2542
//unsigned long flags;
2543
//spin_lock_irqsave(&ieee->lock,flags);
2545
2315
if (! netif_queue_stopped(ieee->dev)){
2546
2316
netif_stop_queue(ieee->dev);
2547
2317
ieee->softmac_stats.swtxstop++;
2549
2319
ieee->queue_stop = 1;
2550
//spin_unlock_irqrestore(&ieee->lock,flags);
2581
2349
memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
2583
ieee->set_chan(ieee->dev, ieee->current_network.channel);
2351
ieee->set_chan(ieee, ieee->current_network.channel);
2584
2352
ieee->state = IEEE80211_LINKED;
2585
ieee->link_change(ieee->dev);
2353
ieee->link_change(ieee);
2586
2354
notify_wx_assoc_event(ieee);
2588
2356
if (ieee->data_hard_resume)
2589
ieee->data_hard_resume(ieee->dev);
2357
ieee->data_hard_resume(ieee);
2591
2359
netif_carrier_on(ieee->dev);
2691
2458
// By default, WMM function will be disabled in IBSS mode
2692
2459
ieee->current_network.QoS_Enable = 0;
2693
ieee->SetWirelessMode(ieee->dev, IEEE_G);
2460
ieee->SetWirelessMode(ieee, IEEE_G);
2694
2461
ieee->current_network.atim_window = 0;
2695
2462
ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
2696
2463
if(ieee->short_slot)
2701
2468
ieee->state = IEEE80211_LINKED;
2703
ieee->set_chan(ieee->dev, ieee->current_network.channel);
2704
ieee->link_change(ieee->dev);
2470
ieee->set_chan(ieee, ieee->current_network.channel);
2471
ieee->link_change(ieee);
2706
2473
notify_wx_assoc_event(ieee);
2708
2475
ieee80211_start_send_beacons(ieee);
2710
2477
if (ieee->data_hard_resume)
2711
ieee->data_hard_resume(ieee->dev);
2478
ieee->data_hard_resume(ieee);
2712
2479
netif_carrier_on(ieee->dev);
2714
2481
up(&ieee->wx_sem);
2773
2540
ieee80211_reset_queue(ieee);
2775
2542
if (ieee->data_hard_stop)
2776
ieee->data_hard_stop(ieee->dev);
2543
ieee->data_hard_stop(ieee);
2777
2544
#ifdef ENABLE_DOT11D
2778
2545
if(IS_DOT11D_ENABLE(ieee))
2779
2546
Dot11d_Reset(ieee);
2781
2548
ieee->is_set_key = false;
2782
ieee->link_change(ieee->dev);
2783
//HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
2549
ieee->link_change(ieee);
2784
2550
if (ieee->state == IEEE80211_LINKED ||
2785
2551
ieee->state == IEEE80211_ASSOCIATING) {
2786
2552
ieee->state = IEEE80211_NOLINK;
2938
2704
if (ieee->current_network.beacon_interval == 0)
2939
2705
ieee->current_network.beacon_interval = 100;
2940
// printk("===>%s(), chan:%d\n", __FUNCTION__, ieee->current_network.channel);
2941
// ieee->set_chan(ieee->dev,ieee->current_network.channel);
2943
2707
for(i = 0; i < 17; i++) {
2944
2708
ieee->last_rxseq_num[i] = -1;
3027
2791
ieee->beacon_timer.data = (unsigned long) ieee;
3028
2792
ieee->beacon_timer.function = ieee80211_send_beacon_cb;
3030
#ifdef PF_SYNCTHREAD
3031
ieee->wq = create_workqueue(DRV_NAME,0);
3033
2794
ieee->wq = create_workqueue(DRV_NAME);
3036
2796
INIT_DELAYED_WORK(&ieee->start_ibss_wq,ieee80211_start_ibss_wq);
3037
2797
INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq);