aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rtlwifi')
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8188ee/trx.h4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/hw.c134
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/hw.h4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/mac.c18
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/sw.c5
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/sw.h3
-rw-r--r--drivers/net/wireless/rtlwifi/usb.c13
-rw-r--r--drivers/net/wireless/rtlwifi/wifi.h4
9 files changed, 143 insertions, 43 deletions
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index 999ffc12578b..c97e9d327331 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -764,6 +764,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
764 "can't alloc skb for rx\n"); 764 "can't alloc skb for rx\n");
765 goto done; 765 goto done;
766 } 766 }
767 kmemleak_not_leak(new_skb);
767 768
768 pci_unmap_single(rtlpci->pdev, 769 pci_unmap_single(rtlpci->pdev,
769 *((dma_addr_t *) skb->cb), 770 *((dma_addr_t *) skb->cb),
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h
index d3a02e73f53a..21ca33a7c770 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h
@@ -550,7 +550,7 @@ do { \
550 rxmcs == DESC92C_RATE11M) 550 rxmcs == DESC92C_RATE11M)
551 551
552struct phy_rx_agc_info_t { 552struct phy_rx_agc_info_t {
553 #if __LITTLE_ENDIAN 553 #ifdef __LITTLE_ENDIAN
554 u8 gain:7, trsw:1; 554 u8 gain:7, trsw:1;
555 #else 555 #else
556 u8 trsw:1, gain:7; 556 u8 trsw:1, gain:7;
@@ -574,7 +574,7 @@ struct phy_status_rpt {
574 u8 stream_target_csi[2]; 574 u8 stream_target_csi[2];
575 u8 sig_evm; 575 u8 sig_evm;
576 u8 rsvd_3; 576 u8 rsvd_3;
577#if __LITTLE_ENDIAN 577#ifdef __LITTLE_ENDIAN
578 u8 antsel_rx_keep_2:1; /*ex_intf_flg:1;*/ 578 u8 antsel_rx_keep_2:1; /*ex_intf_flg:1;*/
579 u8 sgi_en:1; 579 u8 sgi_en:1;
580 u8 rxsc:2; 580 u8 rxsc:2;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
index 3d0498e69c8c..189ba124a8c6 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
@@ -1973,26 +1973,35 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
1973 } 1973 }
1974} 1974}
1975 1975
1976void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, 1976static void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw,
1977 struct ieee80211_sta *sta, 1977 struct ieee80211_sta *sta)
1978 u8 rssi_level)
1979{ 1978{
1980 struct rtl_priv *rtlpriv = rtl_priv(hw); 1979 struct rtl_priv *rtlpriv = rtl_priv(hw);
1981 struct rtl_phy *rtlphy = &(rtlpriv->phy); 1980 struct rtl_phy *rtlphy = &(rtlpriv->phy);
1982 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 1981 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
1983 u32 ratr_value = (u32) mac->basic_rates; 1982 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1984 u8 *mcsrate = mac->mcs; 1983 u32 ratr_value;
1985 u8 ratr_index = 0; 1984 u8 ratr_index = 0;
1986 u8 nmode = mac->ht_enable; 1985 u8 nmode = mac->ht_enable;
1987 u8 mimo_ps = 1; 1986 u8 mimo_ps = IEEE80211_SMPS_OFF;
1988 u16 shortgi_rate = 0; 1987 u16 shortgi_rate;
1989 u32 tmp_ratr_value = 0; 1988 u32 tmp_ratr_value;
1990 u8 curtxbw_40mhz = mac->bw_40; 1989 u8 curtxbw_40mhz = mac->bw_40;
1991 u8 curshortgi_40mhz = mac->sgi_40; 1990 u8 curshortgi_40mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ?
1992 u8 curshortgi_20mhz = mac->sgi_20; 1991 1 : 0;
1992 u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ?
1993 1 : 0;
1993 enum wireless_mode wirelessmode = mac->mode; 1994 enum wireless_mode wirelessmode = mac->mode;
1994 1995
1995 ratr_value |= ((*(u16 *) (mcsrate))) << 12; 1996 if (rtlhal->current_bandtype == BAND_ON_5G)
1997 ratr_value = sta->supp_rates[1] << 4;
1998 else
1999 ratr_value = sta->supp_rates[0];
2000 if (mac->opmode == NL80211_IFTYPE_ADHOC)
2001 ratr_value = 0xfff;
2002
2003 ratr_value |= (sta->ht_cap.mcs.rx_mask[1] << 20 |
2004 sta->ht_cap.mcs.rx_mask[0] << 12);
1996 switch (wirelessmode) { 2005 switch (wirelessmode) {
1997 case WIRELESS_MODE_B: 2006 case WIRELESS_MODE_B:
1998 if (ratr_value & 0x0000000c) 2007 if (ratr_value & 0x0000000c)
@@ -2006,7 +2015,7 @@ void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw,
2006 case WIRELESS_MODE_N_24G: 2015 case WIRELESS_MODE_N_24G:
2007 case WIRELESS_MODE_N_5G: 2016 case WIRELESS_MODE_N_5G:
2008 nmode = 1; 2017 nmode = 1;
2009 if (mimo_ps == 0) { 2018 if (mimo_ps == IEEE80211_SMPS_STATIC) {
2010 ratr_value &= 0x0007F005; 2019 ratr_value &= 0x0007F005;
2011 } else { 2020 } else {
2012 u32 ratr_mask; 2021 u32 ratr_mask;
@@ -2016,8 +2025,7 @@ void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw,
2016 ratr_mask = 0x000ff005; 2025 ratr_mask = 0x000ff005;
2017 else 2026 else
2018 ratr_mask = 0x0f0ff005; 2027 ratr_mask = 0x0f0ff005;
2019 if (curtxbw_40mhz) 2028
2020 ratr_mask |= 0x00000010;
2021 ratr_value &= ratr_mask; 2029 ratr_value &= ratr_mask;
2022 } 2030 }
2023 break; 2031 break;
@@ -2026,41 +2034,74 @@ void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw,
2026 ratr_value &= 0x000ff0ff; 2034 ratr_value &= 0x000ff0ff;
2027 else 2035 else
2028 ratr_value &= 0x0f0ff0ff; 2036 ratr_value &= 0x0f0ff0ff;
2037
2029 break; 2038 break;
2030 } 2039 }
2040
2031 ratr_value &= 0x0FFFFFFF; 2041 ratr_value &= 0x0FFFFFFF;
2032 if (nmode && ((curtxbw_40mhz && curshortgi_40mhz) || 2042
2033 (!curtxbw_40mhz && curshortgi_20mhz))) { 2043 if (nmode && ((curtxbw_40mhz &&
2044 curshortgi_40mhz) || (!curtxbw_40mhz &&
2045 curshortgi_20mhz))) {
2046
2034 ratr_value |= 0x10000000; 2047 ratr_value |= 0x10000000;
2035 tmp_ratr_value = (ratr_value >> 12); 2048 tmp_ratr_value = (ratr_value >> 12);
2049
2036 for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) { 2050 for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) {
2037 if ((1 << shortgi_rate) & tmp_ratr_value) 2051 if ((1 << shortgi_rate) & tmp_ratr_value)
2038 break; 2052 break;
2039 } 2053 }
2054
2040 shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) | 2055 shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) |
2041 (shortgi_rate << 4) | (shortgi_rate); 2056 (shortgi_rate << 4) | (shortgi_rate);
2042 } 2057 }
2058
2043 rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); 2059 rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value);
2060
2061 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n",
2062 rtl_read_dword(rtlpriv, REG_ARFR0));
2044} 2063}
2045 2064
2046void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) 2065static void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw,
2066 struct ieee80211_sta *sta,
2067 u8 rssi_level)
2047{ 2068{
2048 struct rtl_priv *rtlpriv = rtl_priv(hw); 2069 struct rtl_priv *rtlpriv = rtl_priv(hw);
2049 struct rtl_phy *rtlphy = &(rtlpriv->phy); 2070 struct rtl_phy *rtlphy = &(rtlpriv->phy);
2050 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 2071 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
2051 u32 ratr_bitmap = (u32) mac->basic_rates; 2072 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
2052 u8 *p_mcsrate = mac->mcs; 2073 struct rtl_sta_info *sta_entry = NULL;
2053 u8 ratr_index = 0; 2074 u32 ratr_bitmap;
2054 u8 curtxbw_40mhz = mac->bw_40; 2075 u8 ratr_index;
2055 u8 curshortgi_40mhz = mac->sgi_40; 2076 u8 curtxbw_40mhz = (sta->bandwidth >= IEEE80211_STA_RX_BW_40) ? 1 : 0;
2056 u8 curshortgi_20mhz = mac->sgi_20; 2077 u8 curshortgi_40mhz = curtxbw_40mhz &&
2057 enum wireless_mode wirelessmode = mac->mode; 2078 (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ?
2079 1 : 0;
2080 u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ?
2081 1 : 0;
2082 enum wireless_mode wirelessmode = 0;
2058 bool shortgi = false; 2083 bool shortgi = false;
2059 u8 rate_mask[5]; 2084 u8 rate_mask[5];
2060 u8 macid = 0; 2085 u8 macid = 0;
2061 u8 mimops = 1; 2086 u8 mimo_ps = IEEE80211_SMPS_OFF;
2062 2087
2063 ratr_bitmap |= (p_mcsrate[1] << 20) | (p_mcsrate[0] << 12); 2088 sta_entry = (struct rtl_sta_info *) sta->drv_priv;
2089 wirelessmode = sta_entry->wireless_mode;
2090 if (mac->opmode == NL80211_IFTYPE_STATION ||
2091 mac->opmode == NL80211_IFTYPE_MESH_POINT)
2092 curtxbw_40mhz = mac->bw_40;
2093 else if (mac->opmode == NL80211_IFTYPE_AP ||
2094 mac->opmode == NL80211_IFTYPE_ADHOC)
2095 macid = sta->aid + 1;
2096
2097 if (rtlhal->current_bandtype == BAND_ON_5G)
2098 ratr_bitmap = sta->supp_rates[1] << 4;
2099 else
2100 ratr_bitmap = sta->supp_rates[0];
2101 if (mac->opmode == NL80211_IFTYPE_ADHOC)
2102 ratr_bitmap = 0xfff;
2103 ratr_bitmap |= (sta->ht_cap.mcs.rx_mask[1] << 20 |
2104 sta->ht_cap.mcs.rx_mask[0] << 12);
2064 switch (wirelessmode) { 2105 switch (wirelessmode) {
2065 case WIRELESS_MODE_B: 2106 case WIRELESS_MODE_B:
2066 ratr_index = RATR_INX_WIRELESS_B; 2107 ratr_index = RATR_INX_WIRELESS_B;
@@ -2071,6 +2112,7 @@ void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level)
2071 break; 2112 break;
2072 case WIRELESS_MODE_G: 2113 case WIRELESS_MODE_G:
2073 ratr_index = RATR_INX_WIRELESS_GB; 2114 ratr_index = RATR_INX_WIRELESS_GB;
2115
2074 if (rssi_level == 1) 2116 if (rssi_level == 1)
2075 ratr_bitmap &= 0x00000f00; 2117 ratr_bitmap &= 0x00000f00;
2076 else if (rssi_level == 2) 2118 else if (rssi_level == 2)
@@ -2085,7 +2127,8 @@ void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level)
2085 case WIRELESS_MODE_N_24G: 2127 case WIRELESS_MODE_N_24G:
2086 case WIRELESS_MODE_N_5G: 2128 case WIRELESS_MODE_N_5G:
2087 ratr_index = RATR_INX_WIRELESS_NGB; 2129 ratr_index = RATR_INX_WIRELESS_NGB;
2088 if (mimops == 0) { 2130
2131 if (mimo_ps == IEEE80211_SMPS_STATIC) {
2089 if (rssi_level == 1) 2132 if (rssi_level == 1)
2090 ratr_bitmap &= 0x00070000; 2133 ratr_bitmap &= 0x00070000;
2091 else if (rssi_level == 2) 2134 else if (rssi_level == 2)
@@ -2128,8 +2171,10 @@ void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level)
2128 } 2171 }
2129 } 2172 }
2130 } 2173 }
2174
2131 if ((curtxbw_40mhz && curshortgi_40mhz) || 2175 if ((curtxbw_40mhz && curshortgi_40mhz) ||
2132 (!curtxbw_40mhz && curshortgi_20mhz)) { 2176 (!curtxbw_40mhz && curshortgi_20mhz)) {
2177
2133 if (macid == 0) 2178 if (macid == 0)
2134 shortgi = true; 2179 shortgi = true;
2135 else if (macid == 1) 2180 else if (macid == 1)
@@ -2138,21 +2183,42 @@ void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level)
2138 break; 2183 break;
2139 default: 2184 default:
2140 ratr_index = RATR_INX_WIRELESS_NGB; 2185 ratr_index = RATR_INX_WIRELESS_NGB;
2186
2141 if (rtlphy->rf_type == RF_1T2R) 2187 if (rtlphy->rf_type == RF_1T2R)
2142 ratr_bitmap &= 0x000ff0ff; 2188 ratr_bitmap &= 0x000ff0ff;
2143 else 2189 else
2144 ratr_bitmap &= 0x0f0ff0ff; 2190 ratr_bitmap &= 0x0f0ff0ff;
2145 break; 2191 break;
2146 } 2192 }
2147 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "ratr_bitmap :%x\n", 2193 sta_entry->ratr_index = ratr_index;
2148 ratr_bitmap); 2194
2149 *(u32 *)&rate_mask = ((ratr_bitmap & 0x0fffffff) | 2195 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG,
2150 ratr_index << 28); 2196 "ratr_bitmap :%x\n", ratr_bitmap);
2197 *(u32 *)&rate_mask = (ratr_bitmap & 0x0fffffff) |
2198 (ratr_index << 28);
2151 rate_mask[4] = macid | (shortgi ? 0x20 : 0x00) | 0x80; 2199 rate_mask[4] = macid | (shortgi ? 0x20 : 0x00) | 0x80;
2152 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, 2200 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG,
2153 "Rate_index:%x, ratr_val:%x, %5phC\n", 2201 "Rate_index:%x, ratr_val:%x, %5phC\n",
2154 ratr_index, ratr_bitmap, rate_mask); 2202 ratr_index, ratr_bitmap, rate_mask);
2155 rtl92c_fill_h2c_cmd(hw, H2C_RA_MASK, 5, rate_mask); 2203 memcpy(rtlpriv->rate_mask, rate_mask, 5);
2204 /* rtl92c_fill_h2c_cmd() does USB I/O and will result in a
2205 * "scheduled while atomic" if called directly */
2206 schedule_work(&rtlpriv->works.fill_h2c_cmd);
2207
2208 if (macid != 0)
2209 sta_entry->ratr_index = ratr_index;
2210}
2211
2212void rtl92cu_update_hal_rate_tbl(struct ieee80211_hw *hw,
2213 struct ieee80211_sta *sta,
2214 u8 rssi_level)
2215{
2216 struct rtl_priv *rtlpriv = rtl_priv(hw);
2217
2218 if (rtlpriv->dm.useramask)
2219 rtl92cu_update_hal_rate_mask(hw, sta, rssi_level);
2220 else
2221 rtl92cu_update_hal_rate_table(hw, sta);
2156} 2222}
2157 2223
2158void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw) 2224void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw)
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
index f41a3aa4a26f..8e3ec1e25644 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
@@ -98,10 +98,6 @@ void rtl92cu_update_interrupt_mask(struct ieee80211_hw *hw,
98 u32 add_msr, u32 rm_msr); 98 u32 add_msr, u32 rm_msr);
99void rtl92cu_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); 99void rtl92cu_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val);
100void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); 100void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val);
101void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw,
102 struct ieee80211_sta *sta,
103 u8 rssi_level);
104void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level);
105 101
106void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw); 102void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw);
107bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid); 103bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
index 85b6bdb163c0..da4f587199ee 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
@@ -289,14 +289,30 @@ void rtl92c_set_key(struct ieee80211_hw *hw, u32 key_index,
289 macaddr = cam_const_broad; 289 macaddr = cam_const_broad;
290 entry_id = key_index; 290 entry_id = key_index;
291 } else { 291 } else {
292 if (mac->opmode == NL80211_IFTYPE_AP ||
293 mac->opmode == NL80211_IFTYPE_MESH_POINT) {
294 entry_id = rtl_cam_get_free_entry(hw,
295 p_macaddr);
296 if (entry_id >= TOTAL_CAM_ENTRY) {
297 RT_TRACE(rtlpriv, COMP_SEC,
298 DBG_EMERG,
299 "Can not find free hw security cam entry\n");
300 return;
301 }
302 } else {
303 entry_id = CAM_PAIRWISE_KEY_POSITION;
304 }
305
292 key_index = PAIRWISE_KEYIDX; 306 key_index = PAIRWISE_KEYIDX;
293 entry_id = CAM_PAIRWISE_KEY_POSITION;
294 is_pairwise = true; 307 is_pairwise = true;
295 } 308 }
296 } 309 }
297 if (rtlpriv->sec.key_len[key_index] == 0) { 310 if (rtlpriv->sec.key_len[key_index] == 0) {
298 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 311 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
299 "delete one entry\n"); 312 "delete one entry\n");
313 if (mac->opmode == NL80211_IFTYPE_AP ||
314 mac->opmode == NL80211_IFTYPE_MESH_POINT)
315 rtl_cam_del_entry(hw, p_macaddr);
300 rtl_cam_delete_one_entry(hw, p_macaddr, entry_id); 316 rtl_cam_delete_one_entry(hw, p_macaddr, entry_id);
301 } else { 317 } else {
302 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 318 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 23d640a4debd..826f085c29dd 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -106,8 +106,7 @@ static struct rtl_hal_ops rtl8192cu_hal_ops = {
106 .update_interrupt_mask = rtl92cu_update_interrupt_mask, 106 .update_interrupt_mask = rtl92cu_update_interrupt_mask,
107 .get_hw_reg = rtl92cu_get_hw_reg, 107 .get_hw_reg = rtl92cu_get_hw_reg,
108 .set_hw_reg = rtl92cu_set_hw_reg, 108 .set_hw_reg = rtl92cu_set_hw_reg,
109 .update_rate_tbl = rtl92cu_update_hal_rate_table, 109 .update_rate_tbl = rtl92cu_update_hal_rate_tbl,
110 .update_rate_mask = rtl92cu_update_hal_rate_mask,
111 .fill_tx_desc = rtl92cu_tx_fill_desc, 110 .fill_tx_desc = rtl92cu_tx_fill_desc,
112 .fill_fake_txdesc = rtl92cu_fill_fake_txdesc, 111 .fill_fake_txdesc = rtl92cu_fill_fake_txdesc,
113 .fill_tx_cmddesc = rtl92cu_tx_fill_cmddesc, 112 .fill_tx_cmddesc = rtl92cu_tx_fill_cmddesc,
@@ -137,6 +136,7 @@ static struct rtl_hal_ops rtl8192cu_hal_ops = {
137 .phy_lc_calibrate = _rtl92cu_phy_lc_calibrate, 136 .phy_lc_calibrate = _rtl92cu_phy_lc_calibrate,
138 .phy_set_bw_mode_callback = rtl92cu_phy_set_bw_mode_callback, 137 .phy_set_bw_mode_callback = rtl92cu_phy_set_bw_mode_callback,
139 .dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower, 138 .dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower,
139 .fill_h2c_cmd = rtl92c_fill_h2c_cmd,
140}; 140};
141 141
142static struct rtl_mod_params rtl92cu_mod_params = { 142static struct rtl_mod_params rtl92cu_mod_params = {
@@ -349,6 +349,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
349 {RTL_USB_DEVICE(0x07aa, 0x0056, rtl92cu_hal_cfg)}, /*ATKK-Gemtek*/ 349 {RTL_USB_DEVICE(0x07aa, 0x0056, rtl92cu_hal_cfg)}, /*ATKK-Gemtek*/
350 {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/ 350 {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/
351 {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/ 351 {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/
352 {RTL_USB_DEVICE(0x0846, 0xf001, rtl92cu_hal_cfg)}, /*On Netwrks N300MA*/
352 {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ 353 {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
353 {RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/ 354 {RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/
354 {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/ 355 {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h
index a1310abd0d54..262e1e4c6e5b 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h
@@ -49,5 +49,8 @@ bool rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw,
49u32 rtl92cu_phy_query_rf_reg(struct ieee80211_hw *hw, 49u32 rtl92cu_phy_query_rf_reg(struct ieee80211_hw *hw,
50 enum radio_path rfpath, u32 regaddr, u32 bitmask); 50 enum radio_path rfpath, u32 regaddr, u32 bitmask);
51void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw); 51void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw);
52void rtl92cu_update_hal_rate_tbl(struct ieee80211_hw *hw,
53 struct ieee80211_sta *sta,
54 u8 rssi_level);
52 55
53#endif 56#endif
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index 76732b0cd221..a3532e077871 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -824,6 +824,7 @@ static void rtl_usb_stop(struct ieee80211_hw *hw)
824 824
825 /* should after adapter start and interrupt enable. */ 825 /* should after adapter start and interrupt enable. */
826 set_hal_stop(rtlhal); 826 set_hal_stop(rtlhal);
827 cancel_work_sync(&rtlpriv->works.fill_h2c_cmd);
827 /* Enable software */ 828 /* Enable software */
828 SET_USB_STOP(rtlusb); 829 SET_USB_STOP(rtlusb);
829 rtl_usb_deinit(hw); 830 rtl_usb_deinit(hw);
@@ -1026,6 +1027,16 @@ static bool rtl_usb_tx_chk_waitq_insert(struct ieee80211_hw *hw,
1026 return false; 1027 return false;
1027} 1028}
1028 1029
1030static void rtl_fill_h2c_cmd_work_callback(struct work_struct *work)
1031{
1032 struct rtl_works *rtlworks =
1033 container_of(work, struct rtl_works, fill_h2c_cmd);
1034 struct ieee80211_hw *hw = rtlworks->hw;
1035 struct rtl_priv *rtlpriv = rtl_priv(hw);
1036
1037 rtlpriv->cfg->ops->fill_h2c_cmd(hw, H2C_RA_MASK, 5, rtlpriv->rate_mask);
1038}
1039
1029static struct rtl_intf_ops rtl_usb_ops = { 1040static struct rtl_intf_ops rtl_usb_ops = {
1030 .adapter_start = rtl_usb_start, 1041 .adapter_start = rtl_usb_start,
1031 .adapter_stop = rtl_usb_stop, 1042 .adapter_stop = rtl_usb_stop,
@@ -1057,6 +1068,8 @@ int rtl_usb_probe(struct usb_interface *intf,
1057 1068
1058 /* this spin lock must be initialized early */ 1069 /* this spin lock must be initialized early */
1059 spin_lock_init(&rtlpriv->locks.usb_lock); 1070 spin_lock_init(&rtlpriv->locks.usb_lock);
1071 INIT_WORK(&rtlpriv->works.fill_h2c_cmd,
1072 rtl_fill_h2c_cmd_work_callback);
1060 1073
1061 rtlpriv->usb_data_index = 0; 1074 rtlpriv->usb_data_index = 0;
1062 init_completion(&rtlpriv->firmware_loading_complete); 1075 init_completion(&rtlpriv->firmware_loading_complete);
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index 44328baa6389..cc03e7c87cbe 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -1736,6 +1736,8 @@ struct rtl_hal_ops {
1736 void (*bt_wifi_media_status_notify) (struct ieee80211_hw *hw, 1736 void (*bt_wifi_media_status_notify) (struct ieee80211_hw *hw,
1737 bool mstate); 1737 bool mstate);
1738 void (*bt_coex_off_before_lps) (struct ieee80211_hw *hw); 1738 void (*bt_coex_off_before_lps) (struct ieee80211_hw *hw);
1739 void (*fill_h2c_cmd) (struct ieee80211_hw *hw, u8 element_id,
1740 u32 cmd_len, u8 *p_cmdbuffer);
1739}; 1741};
1740 1742
1741struct rtl_intf_ops { 1743struct rtl_intf_ops {
@@ -1869,6 +1871,7 @@ struct rtl_works {
1869 struct delayed_work fwevt_wq; 1871 struct delayed_work fwevt_wq;
1870 1872
1871 struct work_struct lps_change_work; 1873 struct work_struct lps_change_work;
1874 struct work_struct fill_h2c_cmd;
1872}; 1875};
1873 1876
1874struct rtl_debug { 1877struct rtl_debug {
@@ -2048,6 +2051,7 @@ struct rtl_priv {
2048 }; 2051 };
2049 }; 2052 };
2050 bool enter_ps; /* true when entering PS */ 2053 bool enter_ps; /* true when entering PS */
2054 u8 rate_mask[5];
2051 2055
2052 /*This must be the last item so 2056 /*This must be the last item so
2053 that it points to the data allocated 2057 that it points to the data allocated