aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi/base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rtlwifi/base.c')
-rw-r--r--drivers/net/wireless/rtlwifi/base.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index cf0b73e51fc2..3f40dc2b129c 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -144,7 +144,7 @@ static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw,
144 ht_cap->mcs.rx_mask[1] = 0xFF; 144 ht_cap->mcs.rx_mask[1] = 0xFF;
145 ht_cap->mcs.rx_mask[4] = 0x01; 145 ht_cap->mcs.rx_mask[4] = 0x01;
146 146
147 ht_cap->mcs.rx_highest = MAX_BIT_RATE_40MHZ_MCS15; 147 ht_cap->mcs.rx_highest = cpu_to_le16(MAX_BIT_RATE_40MHZ_MCS15);
148 } else if (get_rf_type(rtlphy) == RF_1T1R) { 148 } else if (get_rf_type(rtlphy) == RF_1T1R) {
149 149
150 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("1T1R\n")); 150 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("1T1R\n"));
@@ -153,7 +153,7 @@ static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw,
153 ht_cap->mcs.rx_mask[1] = 0x00; 153 ht_cap->mcs.rx_mask[1] = 0x00;
154 ht_cap->mcs.rx_mask[4] = 0x01; 154 ht_cap->mcs.rx_mask[4] = 0x01;
155 155
156 ht_cap->mcs.rx_highest = MAX_BIT_RATE_40MHZ_MCS7; 156 ht_cap->mcs.rx_highest = cpu_to_le16(MAX_BIT_RATE_40MHZ_MCS7);
157 } 157 }
158} 158}
159 159
@@ -399,21 +399,21 @@ static void _rtl_query_protection_mode(struct ieee80211_hw *hw,
399 u8 rate_flag = info->control.rates[0].flags; 399 u8 rate_flag = info->control.rates[0].flags;
400 400
401 /* Common Settings */ 401 /* Common Settings */
402 tcb_desc->b_rts_stbc = false; 402 tcb_desc->rts_stbc = false;
403 tcb_desc->b_cts_enable = false; 403 tcb_desc->cts_enable = false;
404 tcb_desc->rts_sc = 0; 404 tcb_desc->rts_sc = 0;
405 tcb_desc->b_rts_bw = false; 405 tcb_desc->rts_bw = false;
406 tcb_desc->b_rts_use_shortpreamble = false; 406 tcb_desc->rts_use_shortpreamble = false;
407 tcb_desc->b_rts_use_shortgi = false; 407 tcb_desc->rts_use_shortgi = false;
408 408
409 if (rate_flag & IEEE80211_TX_RC_USE_CTS_PROTECT) { 409 if (rate_flag & IEEE80211_TX_RC_USE_CTS_PROTECT) {
410 /* Use CTS-to-SELF in protection mode. */ 410 /* Use CTS-to-SELF in protection mode. */
411 tcb_desc->b_rts_enable = true; 411 tcb_desc->rts_enable = true;
412 tcb_desc->b_cts_enable = true; 412 tcb_desc->cts_enable = true;
413 tcb_desc->rts_rate = rtlpriv->cfg->maps[RTL_RC_OFDM_RATE24M]; 413 tcb_desc->rts_rate = rtlpriv->cfg->maps[RTL_RC_OFDM_RATE24M];
414 } else if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) { 414 } else if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) {
415 /* Use RTS-CTS in protection mode. */ 415 /* Use RTS-CTS in protection mode. */
416 tcb_desc->b_rts_enable = true; 416 tcb_desc->rts_enable = true;
417 tcb_desc->rts_rate = rtlpriv->cfg->maps[RTL_RC_OFDM_RATE24M]; 417 tcb_desc->rts_rate = rtlpriv->cfg->maps[RTL_RC_OFDM_RATE24M];
418 } 418 }
419 419
@@ -429,7 +429,7 @@ static void _rtl_txrate_selectmode(struct ieee80211_hw *hw,
429 if (mac->opmode == NL80211_IFTYPE_STATION) 429 if (mac->opmode == NL80211_IFTYPE_STATION)
430 tcb_desc->ratr_index = 0; 430 tcb_desc->ratr_index = 0;
431 else if (mac->opmode == NL80211_IFTYPE_ADHOC) { 431 else if (mac->opmode == NL80211_IFTYPE_ADHOC) {
432 if (tcb_desc->b_multicast || tcb_desc->b_broadcast) { 432 if (tcb_desc->multicast || tcb_desc->broadcast) {
433 tcb_desc->hw_rate = 433 tcb_desc->hw_rate =
434 rtlpriv->cfg->maps[RTL_RC_CCK_RATE2M]; 434 rtlpriv->cfg->maps[RTL_RC_CCK_RATE2M];
435 tcb_desc->use_driver_rate = 1; 435 tcb_desc->use_driver_rate = 1;
@@ -439,7 +439,7 @@ static void _rtl_txrate_selectmode(struct ieee80211_hw *hw,
439 } 439 }
440 } 440 }
441 441
442 if (rtlpriv->dm.b_useramask) { 442 if (rtlpriv->dm.useramask) {
443 /* TODO we will differentiate adhoc and station futrue */ 443 /* TODO we will differentiate adhoc and station futrue */
444 tcb_desc->mac_id = 0; 444 tcb_desc->mac_id = 0;
445 445
@@ -461,19 +461,19 @@ static void _rtl_query_bandwidth_mode(struct ieee80211_hw *hw,
461 struct rtl_priv *rtlpriv = rtl_priv(hw); 461 struct rtl_priv *rtlpriv = rtl_priv(hw);
462 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 462 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
463 463
464 tcb_desc->b_packet_bw = false; 464 tcb_desc->packet_bw = false;
465 465
466 if (!mac->bw_40 || !mac->ht_enable) 466 if (!mac->bw_40 || !mac->ht_enable)
467 return; 467 return;
468 468
469 if (tcb_desc->b_multicast || tcb_desc->b_broadcast) 469 if (tcb_desc->multicast || tcb_desc->broadcast)
470 return; 470 return;
471 471
472 /*use legency rate, shall use 20MHz */ 472 /*use legency rate, shall use 20MHz */
473 if (tcb_desc->hw_rate <= rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M]) 473 if (tcb_desc->hw_rate <= rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M])
474 return; 474 return;
475 475
476 tcb_desc->b_packet_bw = true; 476 tcb_desc->packet_bw = true;
477} 477}
478 478
479static u8 _rtl_get_highest_n_rate(struct ieee80211_hw *hw) 479static u8 _rtl_get_highest_n_rate(struct ieee80211_hw *hw)
@@ -498,7 +498,7 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,
498 struct rtl_mac *rtlmac = rtl_mac(rtl_priv(hw)); 498 struct rtl_mac *rtlmac = rtl_mac(rtl_priv(hw));
499 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); 499 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data);
500 struct ieee80211_rate *txrate; 500 struct ieee80211_rate *txrate;
501 u16 fc = le16_to_cpu(hdr->frame_control); 501 __le16 fc = hdr->frame_control;
502 502
503 memset(tcb_desc, 0, sizeof(struct rtl_tcb_desc)); 503 memset(tcb_desc, 0, sizeof(struct rtl_tcb_desc));
504 504
@@ -545,9 +545,9 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,
545 } 545 }
546 546
547 if (is_multicast_ether_addr(ieee80211_get_DA(hdr))) 547 if (is_multicast_ether_addr(ieee80211_get_DA(hdr)))
548 tcb_desc->b_multicast = 1; 548 tcb_desc->multicast = 1;
549 else if (is_broadcast_ether_addr(ieee80211_get_DA(hdr))) 549 else if (is_broadcast_ether_addr(ieee80211_get_DA(hdr)))
550 tcb_desc->b_broadcast = 1; 550 tcb_desc->broadcast = 1;
551 551
552 _rtl_txrate_selectmode(hw, tcb_desc); 552 _rtl_txrate_selectmode(hw, tcb_desc);
553 _rtl_query_bandwidth_mode(hw, tcb_desc); 553 _rtl_query_bandwidth_mode(hw, tcb_desc);
@@ -570,7 +570,7 @@ bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb)
570 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 570 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
571 struct rtl_priv *rtlpriv = rtl_priv(hw); 571 struct rtl_priv *rtlpriv = rtl_priv(hw);
572 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); 572 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data);
573 u16 fc = le16_to_cpu(hdr->frame_control); 573 __le16 fc = hdr->frame_control;
574 574
575 if (ieee80211_is_auth(fc)) { 575 if (ieee80211_is_auth(fc)) {
576 RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, ("MAC80211_LINKING\n")); 576 RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, ("MAC80211_LINKING\n"));
@@ -587,7 +587,7 @@ bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
587 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 587 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
588 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); 588 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data);
589 struct rtl_priv *rtlpriv = rtl_priv(hw); 589 struct rtl_priv *rtlpriv = rtl_priv(hw);
590 u16 fc = le16_to_cpu(hdr->frame_control); 590 __le16 fc = hdr->frame_control;
591 u8 *act = (u8 *) (((u8 *) skb->data + MAC80211_3ADDR_LEN)); 591 u8 *act = (u8 *) (((u8 *) skb->data + MAC80211_3ADDR_LEN));
592 u8 category; 592 u8 category;
593 593
@@ -632,7 +632,7 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
632 struct rtl_priv *rtlpriv = rtl_priv(hw); 632 struct rtl_priv *rtlpriv = rtl_priv(hw);
633 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); 633 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data);
634 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 634 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
635 u16 fc = le16_to_cpu(hdr->frame_control); 635 __le16 fc = hdr->frame_control;
636 u16 ether_type; 636 u16 ether_type;
637 u8 mac_hdr_len = ieee80211_get_hdrlen_from_skb(skb); 637 u8 mac_hdr_len = ieee80211_get_hdrlen_from_skb(skb);
638 const struct iphdr *ip; 638 const struct iphdr *ip;
@@ -646,7 +646,6 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
646 ip = (struct iphdr *)((u8 *) skb->data + mac_hdr_len + 646 ip = (struct iphdr *)((u8 *) skb->data + mac_hdr_len +
647 SNAP_SIZE + PROTOC_TYPE_SIZE); 647 SNAP_SIZE + PROTOC_TYPE_SIZE);
648 ether_type = *(u16 *) ((u8 *) skb->data + mac_hdr_len + SNAP_SIZE); 648 ether_type = *(u16 *) ((u8 *) skb->data + mac_hdr_len + SNAP_SIZE);
649 ether_type = ntohs(ether_type);
650 649
651 if (ETH_P_IP == ether_type) { 650 if (ETH_P_IP == ether_type) {
652 if (IPPROTO_UDP == ip->protocol) { 651 if (IPPROTO_UDP == ip->protocol) {
@@ -690,7 +689,8 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
690 } 689 }
691 690
692 return true; 691 return true;
693 } else if (0x86DD == ether_type) { 692 } else if (ETH_P_IPV6 == ether_type) {
693 /* IPv6 */
694 return true; 694 return true;
695 } 695 }
696 696
@@ -777,10 +777,10 @@ void rtl_watchdog_wq_callback(void *data)
777 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 777 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
778 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 778 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
779 779
780 bool b_busytraffic = false; 780 bool busytraffic = false;
781 bool b_higher_busytraffic = false; 781 bool higher_busytraffic = false;
782 bool b_higher_busyrxtraffic = false; 782 bool higher_busyrxtraffic = false;
783 bool b_higher_busytxtraffic = false; 783 bool higher_busytxtraffic = false;
784 784
785 u8 idx = 0; 785 u8 idx = 0;
786 u32 rx_cnt_inp4eriod = 0; 786 u32 rx_cnt_inp4eriod = 0;
@@ -788,7 +788,7 @@ void rtl_watchdog_wq_callback(void *data)
788 u32 aver_rx_cnt_inperiod = 0; 788 u32 aver_rx_cnt_inperiod = 0;
789 u32 aver_tx_cnt_inperiod = 0; 789 u32 aver_tx_cnt_inperiod = 0;
790 790
791 bool benter_ps = false; 791 bool enter_ps = false;
792 792
793 if (is_hal_stop(rtlhal)) 793 if (is_hal_stop(rtlhal))
794 return; 794 return;
@@ -832,29 +832,29 @@ void rtl_watchdog_wq_callback(void *data)
832 832
833 /* (2) check traffic busy */ 833 /* (2) check traffic busy */
834 if (aver_rx_cnt_inperiod > 100 || aver_tx_cnt_inperiod > 100) 834 if (aver_rx_cnt_inperiod > 100 || aver_tx_cnt_inperiod > 100)
835 b_busytraffic = true; 835 busytraffic = true;
836 836
837 /* Higher Tx/Rx data. */ 837 /* Higher Tx/Rx data. */
838 if (aver_rx_cnt_inperiod > 4000 || 838 if (aver_rx_cnt_inperiod > 4000 ||
839 aver_tx_cnt_inperiod > 4000) { 839 aver_tx_cnt_inperiod > 4000) {
840 b_higher_busytraffic = true; 840 higher_busytraffic = true;
841 841
842 /* Extremely high Rx data. */ 842 /* Extremely high Rx data. */
843 if (aver_rx_cnt_inperiod > 5000) 843 if (aver_rx_cnt_inperiod > 5000)
844 b_higher_busyrxtraffic = true; 844 higher_busyrxtraffic = true;
845 else 845 else
846 b_higher_busytxtraffic = false; 846 higher_busytxtraffic = false;
847 } 847 }
848 848
849 if (((rtlpriv->link_info.num_rx_inperiod + 849 if (((rtlpriv->link_info.num_rx_inperiod +
850 rtlpriv->link_info.num_tx_inperiod) > 8) || 850 rtlpriv->link_info.num_tx_inperiod) > 8) ||
851 (rtlpriv->link_info.num_rx_inperiod > 2)) 851 (rtlpriv->link_info.num_rx_inperiod > 2))
852 benter_ps = false; 852 enter_ps = false;
853 else 853 else
854 benter_ps = true; 854 enter_ps = true;
855 855
856 /* LeisurePS only work in infra mode. */ 856 /* LeisurePS only work in infra mode. */
857 if (benter_ps) 857 if (enter_ps)
858 rtl_lps_enter(hw); 858 rtl_lps_enter(hw);
859 else 859 else
860 rtl_lps_leave(hw); 860 rtl_lps_leave(hw);
@@ -863,9 +863,9 @@ void rtl_watchdog_wq_callback(void *data)
863 rtlpriv->link_info.num_rx_inperiod = 0; 863 rtlpriv->link_info.num_rx_inperiod = 0;
864 rtlpriv->link_info.num_tx_inperiod = 0; 864 rtlpriv->link_info.num_tx_inperiod = 0;
865 865
866 rtlpriv->link_info.b_busytraffic = b_busytraffic; 866 rtlpriv->link_info.busytraffic = busytraffic;
867 rtlpriv->link_info.b_higher_busytraffic = b_higher_busytraffic; 867 rtlpriv->link_info.higher_busytraffic = higher_busytraffic;
868 rtlpriv->link_info.b_higher_busyrxtraffic = b_higher_busyrxtraffic; 868 rtlpriv->link_info.higher_busyrxtraffic = higher_busyrxtraffic;
869 869
870} 870}
871 871