aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi/core.c
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2013-03-24 23:06:33 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-04-01 16:17:06 -0400
commit26634c4b1868323f49f8cd24c3493b57819867fd (patch)
tree281409ae1cc5c43951ea74761065a427a5a3ea84 /drivers/net/wireless/rtlwifi/core.c
parentcbafb601cad81de612013fad8daf710ca900015a (diff)
rtlwifi Modify existing bits to match vendor version 2013.02.07
These changes add the new variables for P2P and modify the various struct definitions for other new features. This patch updates files base.{c,h} for the changes in the newest vendor driver. This patch updates files ps.{c,h} for the changes in the newest vendor driver. This patch updates files debug.{c,h}, efuse.c, pci.{c,h}, and wifi.h for the changes in the newest vendor driver. This patch updates files core.c, ps.c, rc.c, and wifi.h for the changes in the newest vendor driver. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Cc: jcheung@suse.com Cc: machen@suse.com Cc: mmarek@suse.cz Cc: zhiyuan_yang@realsil.com.cn Cc: page_he@realsil.com.cn Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtlwifi/core.c')
-rw-r--r--drivers/net/wireless/rtlwifi/core.c208
1 files changed, 169 insertions, 39 deletions
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c
index b5a7a260bf63..3338cf311062 100644
--- a/drivers/net/wireless/rtlwifi/core.c
+++ b/drivers/net/wireless/rtlwifi/core.c
@@ -104,9 +104,12 @@ static void rtl_op_stop(struct ieee80211_hw *hw)
104 if (is_hal_stop(rtlhal)) 104 if (is_hal_stop(rtlhal))
105 return; 105 return;
106 106
107 /* here is must, because adhoc do stop and start,
108 * but stop with RFOFF may cause something wrong,
109 * like adhoc TP
110 */
107 if (unlikely(ppsc->rfpwr_state == ERFOFF)) { 111 if (unlikely(ppsc->rfpwr_state == ERFOFF)) {
108 rtl_ips_nic_on(hw); 112 rtl_ips_nic_on(hw);
109 mdelay(1);
110 } 113 }
111 114
112 mutex_lock(&rtlpriv->locks.conf_mutex); 115 mutex_lock(&rtlpriv->locks.conf_mutex);
@@ -167,7 +170,11 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
167 rtl_ips_nic_on(hw); 170 rtl_ips_nic_on(hw);
168 171
169 mutex_lock(&rtlpriv->locks.conf_mutex); 172 mutex_lock(&rtlpriv->locks.conf_mutex);
170 switch (vif->type) { 173
174 switch (ieee80211_vif_type_p2p(vif)) {
175 case NL80211_IFTYPE_P2P_CLIENT:
176 mac->p2p = P2P_ROLE_CLIENT;
177 /*fall through*/
171 case NL80211_IFTYPE_STATION: 178 case NL80211_IFTYPE_STATION:
172 if (mac->beacon_enabled == 1) { 179 if (mac->beacon_enabled == 1) {
173 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 180 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
@@ -192,6 +199,9 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
192 (u8 *) (&mac->basic_rates)); 199 (u8 *) (&mac->basic_rates));
193 200
194 break; 201 break;
202 case NL80211_IFTYPE_P2P_GO:
203 mac->p2p = P2P_ROLE_GO;
204 /*fall through*/
195 case NL80211_IFTYPE_AP: 205 case NL80211_IFTYPE_AP:
196 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 206 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
197 "NL80211_IFTYPE_AP\n"); 207 "NL80211_IFTYPE_AP\n");
@@ -205,6 +215,19 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
205 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE, 215 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE,
206 (u8 *) (&mac->basic_rates)); 216 (u8 *) (&mac->basic_rates));
207 break; 217 break;
218 case NL80211_IFTYPE_MESH_POINT:
219 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
220 "NL80211_IFTYPE_MESH_POINT\n");
221
222 mac->link_state = MAC80211_LINKED;
223 rtlpriv->cfg->ops->set_bcn_reg(hw);
224 if (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G)
225 mac->basic_rates = 0xfff;
226 else
227 mac->basic_rates = 0xff0;
228 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE,
229 (u8 *)(&mac->basic_rates));
230 break;
208 default: 231 default:
209 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 232 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
210 "operation mode %d is not supported!\n", vif->type); 233 "operation mode %d is not supported!\n", vif->type);
@@ -212,6 +235,13 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
212 goto out; 235 goto out;
213 } 236 }
214 237
238 if (mac->p2p) {
239 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
240 "p2p role %x\n", vif->type);
241 mac->basic_rates = 0xff0;/*disable cck rate for p2p*/
242 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE,
243 (u8 *)(&mac->basic_rates));
244 }
215 mac->vif = vif; 245 mac->vif = vif;
216 mac->opmode = vif->type; 246 mac->opmode = vif->type;
217 rtlpriv->cfg->ops->set_network_type(hw, vif->type); 247 rtlpriv->cfg->ops->set_network_type(hw, vif->type);
@@ -232,9 +262,9 @@ static void rtl_op_remove_interface(struct ieee80211_hw *hw,
232 mutex_lock(&rtlpriv->locks.conf_mutex); 262 mutex_lock(&rtlpriv->locks.conf_mutex);
233 263
234 /* Free beacon resources */ 264 /* Free beacon resources */
235 if ((mac->opmode == NL80211_IFTYPE_AP) || 265 if ((vif->type == NL80211_IFTYPE_AP) ||
236 (mac->opmode == NL80211_IFTYPE_ADHOC) || 266 (vif->type == NL80211_IFTYPE_ADHOC) ||
237 (mac->opmode == NL80211_IFTYPE_MESH_POINT)) { 267 (vif->type == NL80211_IFTYPE_MESH_POINT)) {
238 if (mac->beacon_enabled == 1) { 268 if (mac->beacon_enabled == 1) {
239 mac->beacon_enabled = 0; 269 mac->beacon_enabled = 0;
240 rtlpriv->cfg->ops->update_interrupt_mask(hw, 0, 270 rtlpriv->cfg->ops->update_interrupt_mask(hw, 0,
@@ -247,6 +277,7 @@ static void rtl_op_remove_interface(struct ieee80211_hw *hw,
247 *Note: We assume NL80211_IFTYPE_UNSPECIFIED as 277 *Note: We assume NL80211_IFTYPE_UNSPECIFIED as
248 *NO LINK for our hardware. 278 *NO LINK for our hardware.
249 */ 279 */
280 mac->p2p = 0;
250 mac->vif = NULL; 281 mac->vif = NULL;
251 mac->link_state = MAC80211_NOLINK; 282 mac->link_state = MAC80211_NOLINK;
252 memset(mac->bssid, 0, 6); 283 memset(mac->bssid, 0, 6);
@@ -256,6 +287,22 @@ static void rtl_op_remove_interface(struct ieee80211_hw *hw,
256 mutex_unlock(&rtlpriv->locks.conf_mutex); 287 mutex_unlock(&rtlpriv->locks.conf_mutex);
257} 288}
258 289
290static int rtl_op_change_interface(struct ieee80211_hw *hw,
291 struct ieee80211_vif *vif,
292 enum nl80211_iftype new_type, bool p2p)
293{
294 struct rtl_priv *rtlpriv = rtl_priv(hw);
295 int ret;
296 rtl_op_remove_interface(hw, vif);
297
298 vif->type = new_type;
299 vif->p2p = p2p;
300 ret = rtl_op_add_interface(hw, vif);
301 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
302 "p2p %x\n", p2p);
303 return ret;
304}
305
259static int rtl_op_config(struct ieee80211_hw *hw, u32 changed) 306static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
260{ 307{
261 struct rtl_priv *rtlpriv = rtl_priv(hw); 308 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -264,6 +311,9 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
264 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 311 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
265 struct ieee80211_conf *conf = &hw->conf; 312 struct ieee80211_conf *conf = &hw->conf;
266 313
314 if (mac->skip_scan)
315 return 1;
316
267 mutex_lock(&rtlpriv->locks.conf_mutex); 317 mutex_lock(&rtlpriv->locks.conf_mutex);
268 if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { /*BIT(2)*/ 318 if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { /*BIT(2)*/
269 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 319 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
@@ -323,6 +373,16 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
323 struct ieee80211_channel *channel = hw->conf.channel; 373 struct ieee80211_channel *channel = hw->conf.channel;
324 u8 wide_chan = (u8) channel->hw_value; 374 u8 wide_chan = (u8) channel->hw_value;
325 375
376 if (mac->act_scanning)
377 mac->n_channels++;
378
379 if (rtlpriv->dm.supp_phymode_switch &&
380 mac->link_state < MAC80211_LINKED &&
381 !mac->act_scanning) {
382 if (rtlpriv->cfg->ops->chk_switch_dmdp)
383 rtlpriv->cfg->ops->chk_switch_dmdp(hw);
384 }
385
326 /* 386 /*
327 *because we should back channel to 387 *because we should back channel to
328 *current_network.chan in in scanning, 388 *current_network.chan in in scanning,
@@ -373,13 +433,13 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
373 if (wide_chan <= 0) 433 if (wide_chan <= 0)
374 wide_chan = 1; 434 wide_chan = 1;
375 435
376 /* In scanning, before we go offchannel we may send a ps=1 null 436 /* In scanning, before we go offchannel we may send a ps = 1
377 * to AP, and then we may send a ps = 0 null to AP quickly, but 437 * null to AP, and then we may send a ps = 0 null to AP quickly,
378 * first null may have caused AP to put lots of packet to hw tx 438 * but first null may have caused AP to put lots of packet to
379 * buffer. These packets must be tx'd before we go off channel 439 * hw tx buffer. These packets must be tx'd before we go off
380 * so we must delay more time to let AP flush these packets 440 * channel so we must delay more time to let AP flush these
381 * before going offchannel, or dis-association or delete BA will 441 * packets before going offchannel, or dis-association or
382 * happen by AP 442 * delete BA will be caused by AP
383 */ 443 */
384 if (rtlpriv->mac80211.offchan_delay) { 444 if (rtlpriv->mac80211.offchan_delay) {
385 rtlpriv->mac80211.offchan_delay = false; 445 rtlpriv->mac80211.offchan_delay = false;
@@ -441,7 +501,8 @@ static void rtl_op_configure_filter(struct ieee80211_hw *hw,
441 * and nolink check bssid is set in set network_type */ 501 * and nolink check bssid is set in set network_type */
442 if ((changed_flags & FIF_BCN_PRBRESP_PROMISC) && 502 if ((changed_flags & FIF_BCN_PRBRESP_PROMISC) &&
443 (mac->link_state >= MAC80211_LINKED)) { 503 (mac->link_state >= MAC80211_LINKED)) {
444 if (mac->opmode != NL80211_IFTYPE_AP) { 504 if (mac->opmode != NL80211_IFTYPE_AP &&
505 mac->opmode != NL80211_IFTYPE_MESH_POINT) {
445 if (*new_flags & FIF_BCN_PRBRESP_PROMISC) { 506 if (*new_flags & FIF_BCN_PRBRESP_PROMISC) {
446 rtlpriv->cfg->ops->set_chk_bssid(hw, false); 507 rtlpriv->cfg->ops->set_chk_bssid(hw, false);
447 } else { 508 } else {
@@ -481,32 +542,43 @@ static int rtl_op_sta_add(struct ieee80211_hw *hw,
481{ 542{
482 struct rtl_priv *rtlpriv = rtl_priv(hw); 543 struct rtl_priv *rtlpriv = rtl_priv(hw);
483 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 544 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
545 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
484 struct rtl_sta_info *sta_entry; 546 struct rtl_sta_info *sta_entry;
485 547
486 if (sta) { 548 if (sta) {
487 sta_entry = (struct rtl_sta_info *) sta->drv_priv; 549 sta_entry = (struct rtl_sta_info *) sta->drv_priv;
550 spin_lock_bh(&rtlpriv->locks.entry_list_lock);
551 list_add_tail(&sta_entry->list, &rtlpriv->entry_list);
552 spin_unlock_bh(&rtlpriv->locks.entry_list_lock);
488 if (rtlhal->current_bandtype == BAND_ON_2_4G) { 553 if (rtlhal->current_bandtype == BAND_ON_2_4G) {
489 sta_entry->wireless_mode = WIRELESS_MODE_G; 554 sta_entry->wireless_mode = WIRELESS_MODE_G;
490 if (sta->supp_rates[0] <= 0xf) 555 if (sta->supp_rates[0] <= 0xf)
491 sta_entry->wireless_mode = WIRELESS_MODE_B; 556 sta_entry->wireless_mode = WIRELESS_MODE_B;
492 if (sta->ht_cap.ht_supported) 557 if (sta->ht_cap.ht_supported == true)
493 sta_entry->wireless_mode = WIRELESS_MODE_N_24G; 558 sta_entry->wireless_mode = WIRELESS_MODE_N_24G;
559
560 if (vif->type == NL80211_IFTYPE_ADHOC)
561 sta_entry->wireless_mode = WIRELESS_MODE_G;
494 } else if (rtlhal->current_bandtype == BAND_ON_5G) { 562 } else if (rtlhal->current_bandtype == BAND_ON_5G) {
495 sta_entry->wireless_mode = WIRELESS_MODE_A; 563 sta_entry->wireless_mode = WIRELESS_MODE_A;
496 if (sta->ht_cap.ht_supported) 564 if (sta->ht_cap.ht_supported == true)
497 sta_entry->wireless_mode = WIRELESS_MODE_N_24G; 565 sta_entry->wireless_mode = WIRELESS_MODE_N_24G;
498 }
499 566
500 /* I found some times mac80211 give wrong supp_rates for adhoc*/ 567 if (vif->type == NL80211_IFTYPE_ADHOC)
501 if (rtlpriv->mac80211.opmode == NL80211_IFTYPE_ADHOC) 568 sta_entry->wireless_mode = WIRELESS_MODE_A;
502 sta_entry->wireless_mode = WIRELESS_MODE_G; 569 }
570 /*disable cck rate for p2p*/
571 if (mac->p2p)
572 sta->supp_rates[0] &= 0xfffffff0;
503 573
574 memcpy(sta_entry->mac_addr, sta->addr, ETH_ALEN);
504 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, 575 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG,
505 "Add sta addr is %pM\n", sta->addr); 576 "Add sta addr is %pM\n", sta->addr);
506 rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0); 577 rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0);
507 } 578 }
508 return 0; 579 return 0;
509} 580}
581
510static int rtl_op_sta_remove(struct ieee80211_hw *hw, 582static int rtl_op_sta_remove(struct ieee80211_hw *hw,
511 struct ieee80211_vif *vif, 583 struct ieee80211_vif *vif,
512 struct ieee80211_sta *sta) 584 struct ieee80211_sta *sta)
@@ -519,9 +591,14 @@ static int rtl_op_sta_remove(struct ieee80211_hw *hw,
519 sta_entry = (struct rtl_sta_info *) sta->drv_priv; 591 sta_entry = (struct rtl_sta_info *) sta->drv_priv;
520 sta_entry->wireless_mode = 0; 592 sta_entry->wireless_mode = 0;
521 sta_entry->ratr_index = 0; 593 sta_entry->ratr_index = 0;
594
595 spin_lock_bh(&rtlpriv->locks.entry_list_lock);
596 list_del(&sta_entry->list);
597 spin_unlock_bh(&rtlpriv->locks.entry_list_lock);
522 } 598 }
523 return 0; 599 return 0;
524} 600}
601
525static int _rtl_get_hal_qnum(u16 queue) 602static int _rtl_get_hal_qnum(u16 queue)
526{ 603{
527 int qnum; 604 int qnum;
@@ -547,8 +624,8 @@ static int _rtl_get_hal_qnum(u16 queue)
547} 624}
548 625
549/* 626/*
550 *for mac80211 VO=0, VI=1, BE=2, BK=3 627 *for mac80211 VO = 0, VI = 1, BE = 2, BK = 3
551 *for rtl819x BE=0, BK=1, VI=2, VO=3 628 *for rtl819x BE = 0, BK = 1, VI = 2, VO = 3
552 */ 629 */
553static int rtl_op_conf_tx(struct ieee80211_hw *hw, 630static int rtl_op_conf_tx(struct ieee80211_hw *hw,
554 struct ieee80211_vif *vif, u16 queue, 631 struct ieee80211_vif *vif, u16 queue,
@@ -630,6 +707,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
630 /*TODO: reference to enum ieee80211_bss_change */ 707 /*TODO: reference to enum ieee80211_bss_change */
631 if (changed & BSS_CHANGED_ASSOC) { 708 if (changed & BSS_CHANGED_ASSOC) {
632 if (bss_conf->assoc) { 709 if (bss_conf->assoc) {
710 struct ieee80211_sta *sta = NULL;
633 /* we should reset all sec info & cam 711 /* we should reset all sec info & cam
634 * before set cam after linked, we should not 712 * before set cam after linked, we should not
635 * reset in disassoc, that will cause tkip->wep 713 * reset in disassoc, that will cause tkip->wep
@@ -647,23 +725,37 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
647 725
648 if (rtlpriv->cfg->ops->linked_set_reg) 726 if (rtlpriv->cfg->ops->linked_set_reg)
649 rtlpriv->cfg->ops->linked_set_reg(hw); 727 rtlpriv->cfg->ops->linked_set_reg(hw);
650 if (mac->opmode == NL80211_IFTYPE_STATION && sta) 728 rcu_read_lock();
729 sta = ieee80211_find_sta(vif, (u8 *)bss_conf->bssid);
730
731 if (vif->type == NL80211_IFTYPE_STATION && sta)
651 rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0); 732 rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0);
733 RT_TRACE(rtlpriv, COMP_EASY_CONCURRENT, DBG_LOUD,
734 "send PS STATIC frame\n");
735 if (rtlpriv->dm.supp_phymode_switch) {
736 if (sta->ht_cap.ht_supported)
737 rtl_send_smps_action(hw, sta,
738 IEEE80211_SMPS_STATIC);
739 }
740 rcu_read_unlock();
741
652 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, 742 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG,
653 "BSS_CHANGED_ASSOC\n"); 743 "BSS_CHANGED_ASSOC\n");
654 } else { 744 } else {
655 if (mac->link_state == MAC80211_LINKED) 745 if (mac->link_state == MAC80211_LINKED)
656 rtl_lps_leave(hw); 746 schedule_work(&rtlpriv->works.lps_leave_work);
657 747
748 if (ppsc->p2p_ps_info.p2p_ps_mode > P2P_PS_NONE)
749 rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE);
658 mac->link_state = MAC80211_NOLINK; 750 mac->link_state = MAC80211_NOLINK;
659 memset(mac->bssid, 0, 6); 751 memset(mac->bssid, 0, 6);
660
661 /* reset sec info */
662 rtl_cam_reset_sec_info(hw);
663
664 rtl_cam_reset_all_entry(hw);
665 mac->vendor = PEER_UNKNOWN; 752 mac->vendor = PEER_UNKNOWN;
666 753
754 if (rtlpriv->dm.supp_phymode_switch) {
755 if (rtlpriv->cfg->ops->chk_switch_dmdp)
756 rtlpriv->cfg->ops->chk_switch_dmdp(hw);
757 }
758
667 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, 759 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG,
668 "BSS_CHANGED_UN_ASSOC\n"); 760 "BSS_CHANGED_UN_ASSOC\n");
669 } 761 }
@@ -778,7 +870,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
778 } 870 }
779 871
780 if (changed & BSS_CHANGED_BASIC_RATES) { 872 if (changed & BSS_CHANGED_BASIC_RATES) {
781 /* for 5G must << RATE_6M_INDEX=4, 873 /* for 5G must << RATE_6M_INDEX = 4,
782 * because 5G have no cck rate*/ 874 * because 5G have no cck rate*/
783 if (rtlhal->current_bandtype == BAND_ON_5G) 875 if (rtlhal->current_bandtype == BAND_ON_5G)
784 basic_rates = sta->supp_rates[1] << 4; 876 basic_rates = sta->supp_rates[1] << 4;
@@ -815,6 +907,9 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
815 ppsc->report_linked = false; 907 ppsc->report_linked = false;
816 } 908 }
817 } 909 }
910 if (rtlpriv->cfg->ops->bt_wifi_media_status_notify)
911 rtlpriv->cfg->ops->bt_wifi_media_status_notify(hw,
912 ppsc->report_linked);
818 } 913 }
819 914
820out: 915out:
@@ -885,7 +980,6 @@ static int rtl_op_ampdu_action(struct ieee80211_hw *hw,
885 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, 980 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE,
886 "IEEE80211_AMPDU_TX_STOP: TID:%d\n", tid); 981 "IEEE80211_AMPDU_TX_STOP: TID:%d\n", tid);
887 return rtl_tx_agg_stop(hw, sta, tid); 982 return rtl_tx_agg_stop(hw, sta, tid);
888 break;
889 case IEEE80211_AMPDU_TX_OPERATIONAL: 983 case IEEE80211_AMPDU_TX_OPERATIONAL:
890 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, 984 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE,
891 "IEEE80211_AMPDU_TX_OPERATIONAL:TID:%d\n", tid); 985 "IEEE80211_AMPDU_TX_OPERATIONAL:TID:%d\n", tid);
@@ -894,11 +988,11 @@ static int rtl_op_ampdu_action(struct ieee80211_hw *hw,
894 case IEEE80211_AMPDU_RX_START: 988 case IEEE80211_AMPDU_RX_START:
895 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, 989 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE,
896 "IEEE80211_AMPDU_RX_START:TID:%d\n", tid); 990 "IEEE80211_AMPDU_RX_START:TID:%d\n", tid);
897 break; 991 return rtl_rx_agg_start(hw, sta, tid);
898 case IEEE80211_AMPDU_RX_STOP: 992 case IEEE80211_AMPDU_RX_STOP:
899 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, 993 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE,
900 "IEEE80211_AMPDU_RX_STOP:TID:%d\n", tid); 994 "IEEE80211_AMPDU_RX_STOP:TID:%d\n", tid);
901 break; 995 return rtl_rx_agg_stop(hw, sta, tid);
902 default: 996 default:
903 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 997 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
904 "IEEE80211_AMPDU_ERR!!!!:\n"); 998 "IEEE80211_AMPDU_ERR!!!!:\n");
@@ -912,12 +1006,19 @@ static void rtl_op_sw_scan_start(struct ieee80211_hw *hw)
912 struct rtl_priv *rtlpriv = rtl_priv(hw); 1006 struct rtl_priv *rtlpriv = rtl_priv(hw);
913 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 1007 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
914 1008
915 mac->act_scanning = true;
916
917 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "\n"); 1009 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "\n");
1010 mac->act_scanning = true;
1011 if (rtlpriv->link_info.higher_busytraffic) {
1012 mac->skip_scan = true;
1013 return;
1014 }
918 1015
1016 if (rtlpriv->dm.supp_phymode_switch) {
1017 if (rtlpriv->cfg->ops->chk_switch_dmdp)
1018 rtlpriv->cfg->ops->chk_switch_dmdp(hw);
1019 }
919 if (mac->link_state == MAC80211_LINKED) { 1020 if (mac->link_state == MAC80211_LINKED) {
920 rtl_lps_leave(hw); 1021 schedule_work(&rtlpriv->works.lps_leave_work);
921 mac->link_state = MAC80211_LINKED_SCANNING; 1022 mac->link_state = MAC80211_LINKED_SCANNING;
922 } else { 1023 } else {
923 rtl_ips_nic_on(hw); 1024 rtl_ips_nic_on(hw);
@@ -937,6 +1038,16 @@ static void rtl_op_sw_scan_complete(struct ieee80211_hw *hw)
937 1038
938 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "\n"); 1039 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "\n");
939 mac->act_scanning = false; 1040 mac->act_scanning = false;
1041 mac->skip_scan = false;
1042 if (rtlpriv->link_info.higher_busytraffic)
1043 return;
1044
1045 /*p2p will use 1/6/11 to scan */
1046 if (mac->n_channels == 3)
1047 mac->p2p_in_use = true;
1048 else
1049 mac->p2p_in_use = false;
1050 mac->n_channels = 0;
940 /* Dual mac */ 1051 /* Dual mac */
941 rtlpriv->rtlhal.load_imrandiqk_setting_for2g = false; 1052 rtlpriv->rtlhal.load_imrandiqk_setting_for2g = false;
942 1053
@@ -970,6 +1081,11 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
970 "not open hw encryption\n"); 1081 "not open hw encryption\n");
971 return -ENOSPC; /*User disabled HW-crypto */ 1082 return -ENOSPC; /*User disabled HW-crypto */
972 } 1083 }
1084 /* To support IBSS, use sw-crypto for GTK */
1085 if (((vif->type == NL80211_IFTYPE_ADHOC) ||
1086 (vif->type == NL80211_IFTYPE_MESH_POINT)) &&
1087 !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE))
1088 return -ENOSPC;
973 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 1089 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
974 "%s hardware based encryption for keyidx: %d, mac: %pM\n", 1090 "%s hardware based encryption for keyidx: %d, mac: %pM\n",
975 cmd == SET_KEY ? "Using" : "Disabling", key->keyidx, 1091 cmd == SET_KEY ? "Using" : "Disabling", key->keyidx,
@@ -996,6 +1112,14 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
996 key_type = AESCCMP_ENCRYPTION; 1112 key_type = AESCCMP_ENCRYPTION;
997 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "alg:CCMP\n"); 1113 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "alg:CCMP\n");
998 break; 1114 break;
1115 case WLAN_CIPHER_SUITE_AES_CMAC:
1116 /*HW doesn't support CMAC encryption, use software CMAC */
1117 key_type = AESCMAC_ENCRYPTION;
1118 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "alg:CMAC\n");
1119 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
1120 "HW don't support CMAC encryption, use software CMAC\n");
1121 err = -EOPNOTSUPP;
1122 goto out_unlock;
999 default: 1123 default:
1000 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "alg_err:%x!!!!\n", 1124 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "alg_err:%x!!!!\n",
1001 key->cipher); 1125 key->cipher);
@@ -1017,13 +1141,14 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1017 * 1) wep only: is just for wep enc, in this condition 1141 * 1) wep only: is just for wep enc, in this condition
1018 * rtlpriv->sec.pairwise_enc_algorithm == NO_ENCRYPTION 1142 * rtlpriv->sec.pairwise_enc_algorithm == NO_ENCRYPTION
1019 * will be true & enable_hw_sec will be set when wep 1143 * will be true & enable_hw_sec will be set when wep
1020 * ke setting. 1144 * key setting.
1021 * 2) wep(group) + AES(pairwise): some AP like cisco 1145 * 2) wep(group) + AES(pairwise): some AP like cisco
1022 * may use it, in this condition enable_hw_sec will not 1146 * may use it, in this condition enable_hw_sec will not
1023 * be set when wep key setting */ 1147 * be set when wep key setting */
1024 /* we must reset sec_info after lingked before set key, 1148 /* we must reset sec_info after lingked before set key,
1025 * or some flag will be wrong*/ 1149 * or some flag will be wrong*/
1026 if (mac->opmode == NL80211_IFTYPE_AP) { 1150 if (vif->type == NL80211_IFTYPE_AP ||
1151 vif->type == NL80211_IFTYPE_MESH_POINT) {
1027 if (!group_key || key_type == WEP40_ENCRYPTION || 1152 if (!group_key || key_type == WEP40_ENCRYPTION ||
1028 key_type == WEP104_ENCRYPTION) { 1153 key_type == WEP104_ENCRYPTION) {
1029 if (group_key) 1154 if (group_key)
@@ -1098,12 +1223,16 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1098 key->hw_key_idx = key_idx; 1223 key->hw_key_idx = key_idx;
1099 if (key_type == TKIP_ENCRYPTION) 1224 if (key_type == TKIP_ENCRYPTION)
1100 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; 1225 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
1226 /*use software CCMP encryption for management frames (MFP) */
1227 if (key_type == AESCCMP_ENCRYPTION)
1228 key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
1101 break; 1229 break;
1102 case DISABLE_KEY: 1230 case DISABLE_KEY:
1103 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 1231 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
1104 "disable key delete one entry\n"); 1232 "disable key delete one entry\n");
1105 /*set local buf about wep key. */ 1233 /*set local buf about wep key. */
1106 if (mac->opmode == NL80211_IFTYPE_AP) { 1234 if (vif->type == NL80211_IFTYPE_AP ||
1235 vif->type == NL80211_IFTYPE_MESH_POINT) {
1107 if (sta) 1236 if (sta)
1108 rtl_cam_del_entry(hw, sta->addr); 1237 rtl_cam_del_entry(hw, sta->addr);
1109 } 1238 }
@@ -1163,7 +1292,7 @@ static void rtl_op_rfkill_poll(struct ieee80211_hw *hw)
1163} 1292}
1164 1293
1165/* this function is called by mac80211 to flush tx buffer 1294/* this function is called by mac80211 to flush tx buffer
1166 * before switch channle or power save, or tx buffer packet 1295 * before switch channel or power save, or tx buffer packet
1167 * maybe send after offchannel or rf sleep, this may cause 1296 * maybe send after offchannel or rf sleep, this may cause
1168 * dis-association by AP */ 1297 * dis-association by AP */
1169static void rtl_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop) 1298static void rtl_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
@@ -1180,6 +1309,7 @@ const struct ieee80211_ops rtl_ops = {
1180 .tx = rtl_op_tx, 1309 .tx = rtl_op_tx,
1181 .add_interface = rtl_op_add_interface, 1310 .add_interface = rtl_op_add_interface,
1182 .remove_interface = rtl_op_remove_interface, 1311 .remove_interface = rtl_op_remove_interface,
1312 .change_interface = rtl_op_change_interface,
1183 .config = rtl_op_config, 1313 .config = rtl_op_config,
1184 .configure_filter = rtl_op_configure_filter, 1314 .configure_filter = rtl_op_configure_filter,
1185 .sta_add = rtl_op_sta_add, 1315 .sta_add = rtl_op_sta_add,