aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChaoming_Li <chaoming_li@realsil.com.cn>2011-04-25 13:54:05 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-26 16:14:55 -0400
commit76c34f910a5c99a402de5068444563d4c151e794 (patch)
tree0845a2441841e07e2b0fb0d59ecf815ad72b7520
parente0b5a5078675f58736787982af811244eeb98081 (diff)
rtlwifi: rtl8192ce: Change rtl8192ce routines phy and trx and modify rtl8192cu for addition of rtl8192se and rtl8192de
Change rtl8192ce routines phy and trx for addition of RTL8192SE and RTL8192DE. In addition, make necessary modifications to rtl8192cu. This patch also removes the temporary patches needed to enable intermediate steps to build without error. Signed-off-by: Chaoming_Li <chaoming_li@realsil.com.cn> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c13
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/hw.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/phy.c25
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/sw.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/trx.c174
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/trx.h7
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/hw.c14
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/hw.h5
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/sw.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/trx.c48
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/trx.h5
-rw-r--r--drivers/net/wireless/rtlwifi/wifi.h5
13 files changed, 109 insertions, 197 deletions
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index e496361fa2c6..aeb0901ce711 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -584,9 +584,7 @@ static void _rtl_pci_tx_chk_waitq(struct ieee80211_hw *hw)
584 _rtl_update_earlymode_info(hw, skb, 584 _rtl_update_earlymode_info(hw, skb,
585 &tcb_desc, tid); 585 &tcb_desc, tid);
586 586
587#if 0 /* temporary */
588 rtlpriv->intf_ops->adapter_tx(hw, skb, &tcb_desc); 587 rtlpriv->intf_ops->adapter_tx(hw, skb, &tcb_desc);
589#endif
590 } 588 }
591 } 589 }
592} 590}
@@ -1100,10 +1098,8 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw)
1100 hdr = rtl_get_hdr(pskb); 1098 hdr = rtl_get_hdr(pskb);
1101 info = IEEE80211_SKB_CB(pskb); 1099 info = IEEE80211_SKB_CB(pskb);
1102 pdesc = &ring->desc[0]; 1100 pdesc = &ring->desc[0];
1103#if 0 /* temporary */
1104 rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *) pdesc, 1101 rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *) pdesc,
1105 info, pskb, BEACON_QUEUE, &tcb_desc); 1102 info, pskb, BEACON_QUEUE, &tcb_desc);
1106#endif
1107 1103
1108 __skb_queue_tail(&ring->queue, pskb); 1104 __skb_queue_tail(&ring->queue, pskb);
1109 1105
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
index 3915a1ba59fb..991d865cb38c 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
@@ -82,7 +82,7 @@ void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw,
82} 82}
83EXPORT_SYMBOL(rtl92c_phy_set_bb_reg); 83EXPORT_SYMBOL(rtl92c_phy_set_bb_reg);
84 84
85static u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw, 85u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw,
86 enum radio_path rfpath, u32 offset) 86 enum radio_path rfpath, u32 offset)
87{ 87{
88 RT_ASSERT(false, ("deprecated!\n")); 88 RT_ASSERT(false, ("deprecated!\n"));
@@ -91,7 +91,7 @@ static u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw,
91} 91}
92EXPORT_SYMBOL(_rtl92c_phy_fw_rf_serial_read); 92EXPORT_SYMBOL(_rtl92c_phy_fw_rf_serial_read);
93 93
94static void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, 94void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw,
95 enum radio_path rfpath, u32 offset, 95 enum radio_path rfpath, u32 offset,
96 u32 data) 96 u32 data)
97{ 97{
@@ -99,7 +99,7 @@ static void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw,
99} 99}
100EXPORT_SYMBOL(_rtl92c_phy_fw_rf_serial_write); 100EXPORT_SYMBOL(_rtl92c_phy_fw_rf_serial_write);
101 101
102static u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, 102u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw,
103 enum radio_path rfpath, u32 offset) 103 enum radio_path rfpath, u32 offset)
104{ 104{
105 struct rtl_priv *rtlpriv = rtl_priv(hw); 105 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -150,7 +150,7 @@ static u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw,
150} 150}
151EXPORT_SYMBOL(_rtl92c_phy_rf_serial_read); 151EXPORT_SYMBOL(_rtl92c_phy_rf_serial_read);
152 152
153static void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw, 153void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw,
154 enum radio_path rfpath, u32 offset, 154 enum radio_path rfpath, u32 offset,
155 u32 data) 155 u32 data)
156{ 156{
@@ -208,7 +208,7 @@ bool rtl92c_phy_rf_config(struct ieee80211_hw *hw)
208} 208}
209EXPORT_SYMBOL(rtl92c_phy_rf_config); 209EXPORT_SYMBOL(rtl92c_phy_rf_config);
210 210
211static bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw) 211bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw)
212{ 212{
213 struct rtl_priv *rtlpriv = rtl_priv(hw); 213 struct rtl_priv *rtlpriv = rtl_priv(hw);
214 struct rtl_phy *rtlphy = &(rtlpriv->phy); 214 struct rtl_phy *rtlphy = &(rtlpriv->phy);
@@ -1364,8 +1364,7 @@ static void _rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw,
1364static void _rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, 1364static void _rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw,
1365 char delta, bool is2t) 1365 char delta, bool is2t)
1366{ 1366{
1367 /* This routine is deliberately dummied out for later fixes */ 1367#if 0 /* This routine is deliberately dummied out for later fixes */
1368#if 0
1369 struct rtl_priv *rtlpriv = rtl_priv(hw); 1368 struct rtl_priv *rtlpriv = rtl_priv(hw);
1370 struct rtl_phy *rtlphy = &(rtlpriv->phy); 1369 struct rtl_phy *rtlphy = &(rtlpriv->phy);
1371 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); 1370 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
index bb604b8ee519..794b4b6d09a2 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
@@ -930,10 +930,8 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw)
930 } 930 }
931 931
932 rtlhal->last_hmeboxnum = 0; 932 rtlhal->last_hmeboxnum = 0;
933#if 0 /* temporary */
934 rtl92c_phy_mac_config(hw); 933 rtl92c_phy_mac_config(hw);
935 rtl92c_phy_bb_config(hw); 934 rtl92c_phy_bb_config(hw);
936#endif
937 rtlphy->rf_mode = RF_OP_BY_SW_3WIRE; 935 rtlphy->rf_mode = RF_OP_BY_SW_3WIRE;
938 rtl92c_phy_rf_config(hw); 936 rtl92c_phy_rf_config(hw);
939 rtlphy->rfreg_chnlval[0] = rtl_get_rfreg(hw, (enum radio_path)0, 937 rtlphy->rfreg_chnlval[0] = rtl_get_rfreg(hw, (enum radio_path)0,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c
index bbba6f8a8349..604540160a31 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c
@@ -366,7 +366,7 @@ bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
366 return true; 366 return true;
367} 367}
368 368
369static void rtl92c_phy_set_bw_mode_callback(struct ieee80211_hw *hw) 369void rtl92c_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
370{ 370{
371 struct rtl_priv *rtlpriv = rtl_priv(hw); 371 struct rtl_priv *rtlpriv = rtl_priv(hw);
372 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 372 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
@@ -430,34 +430,11 @@ static void rtl92c_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
430 ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw)); 430 ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw));
431 break; 431 break;
432 } 432 }
433#if 0 /* temporary */
434 rtl92ce_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); 433 rtl92ce_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw);
435#endif
436 rtlphy->set_bwmode_inprogress = false; 434 rtlphy->set_bwmode_inprogress = false;
437 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n")); 435 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n"));
438} 436}
439 437
440void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw,
441 enum nl80211_channel_type ch_type)
442{
443 struct rtl_priv *rtlpriv = rtl_priv(hw);
444 struct rtl_phy *rtlphy = &(rtlpriv->phy);
445 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
446 u8 tmp_bw = rtlphy->current_chan_bw;
447
448 if (rtlphy->set_bwmode_inprogress)
449 return;
450 rtlphy->set_bwmode_inprogress = true;
451 if ((!is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) {
452 rtl92c_phy_set_bw_mode_callback(hw);
453 } else {
454 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
455 ("FALSE driver sleep or unload\n"));
456 rtlphy->set_bwmode_inprogress = false;
457 rtlphy->current_chan_bw = tmp_bw;
458 }
459}
460
461void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t) 438void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t)
462{ 439{
463 u8 tmpreg; 440 u8 tmpreg;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
index 5c920c6270c8..702dd11b9370 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
@@ -214,7 +214,6 @@ struct rtl_hal_ops rtl8192ce_hal_ops = {
214 .switch_channel = rtl92c_phy_sw_chnl, 214 .switch_channel = rtl92c_phy_sw_chnl,
215 .dm_watchdog = rtl92c_dm_watchdog, 215 .dm_watchdog = rtl92c_dm_watchdog,
216 .scan_operation_backup = rtl92c_phy_scan_operation_backup, 216 .scan_operation_backup = rtl92c_phy_scan_operation_backup,
217#if 0 /* temporary */
218 .set_rf_power_state = rtl92c_phy_set_rf_power_state, 217 .set_rf_power_state = rtl92c_phy_set_rf_power_state,
219 .led_control = rtl92ce_led_control, 218 .led_control = rtl92ce_led_control,
220 .set_desc = rtl92ce_set_desc, 219 .set_desc = rtl92ce_set_desc,
@@ -234,7 +233,6 @@ struct rtl_hal_ops rtl8192ce_hal_ops = {
234 .config_bb_with_pgheaderfile = _rtl92ce_phy_config_bb_with_pgheaderfile, 233 .config_bb_with_pgheaderfile = _rtl92ce_phy_config_bb_with_pgheaderfile,
235 .phy_lc_calibrate = _rtl92ce_phy_lc_calibrate, 234 .phy_lc_calibrate = _rtl92ce_phy_lc_calibrate,
236 .dm_dynamic_txpower = rtl92ce_dm_dynamic_txpower, 235 .dm_dynamic_txpower = rtl92ce_dm_dynamic_txpower,
237#endif
238}; 236};
239 237
240struct rtl_mod_params rtl92ce_mod_params = { 238struct rtl_mod_params rtl92ce_mod_params = {
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
index 356b8513b8a6..f76d406535dc 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
@@ -36,42 +36,16 @@
36#include "trx.h" 36#include "trx.h"
37#include "led.h" 37#include "led.h"
38 38
39static enum rtl_desc_qsel _rtl92ce_map_hwqueue_to_fwqueue(__le16 fc, 39u8 _rtl92ce_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue)
40 unsigned int
41 skb_queue)
42{ 40{
43 enum rtl_desc_qsel qsel; 41 u16 fc = rtl_get_fc(skb);
44 42
45 if (unlikely(ieee80211_is_beacon(fc))) { 43 if (unlikely(ieee80211_is_beacon(fc)))
46 qsel = QSLT_BEACON; 44 return QSLT_BEACON;
47 return qsel; 45 if (ieee80211_is_mgmt(fc))
48 } 46 return QSLT_MGNT;
49
50 if (ieee80211_is_mgmt(fc)) {
51 qsel = QSLT_MGNT;
52 return qsel;
53 }
54 47
55 switch (skb_queue) { 48 return skb->priority;
56 case VO_QUEUE:
57 qsel = QSLT_VO;
58 break;
59 case VI_QUEUE:
60 qsel = QSLT_VI;
61 break;
62 case BE_QUEUE:
63 qsel = QSLT_BE;
64 break;
65 case BK_QUEUE:
66 qsel = QSLT_BK;
67 break;
68 default:
69 qsel = QSLT_BE;
70 RT_ASSERT(false, ("BE queue, skb_queue:%d,"
71 " set qsel = 0x%X\n", skb_queue, QSLT_BE));
72 break;
73 }
74 return qsel;
75} 49}
76 50
77static int _rtl92ce_rate_mapping(bool isht, u8 desc_rate, bool first_ampdu) 51static int _rtl92ce_rate_mapping(bool isht, u8 desc_rate, bool first_ampdu)
@@ -255,6 +229,7 @@ static void _rtl92ce_query_rxphystatus(struct ieee80211_hw *hw,
255 u8 evm, pwdb_all, rf_rx_num = 0; 229 u8 evm, pwdb_all, rf_rx_num = 0;
256 u8 i, max_spatial_stream; 230 u8 i, max_spatial_stream;
257 u32 rssi, total_rssi = 0; 231 u32 rssi, total_rssi = 0;
232 bool in_powersavemode = false;
258 bool is_cck_rate; 233 bool is_cck_rate;
259 234
260 is_cck_rate = RX_HAL_IS_CCK_RATE(pdesc); 235 is_cck_rate = RX_HAL_IS_CCK_RATE(pdesc);
@@ -270,9 +245,13 @@ static void _rtl92ce_query_rxphystatus(struct ieee80211_hw *hw,
270 u8 report, cck_highpwr; 245 u8 report, cck_highpwr;
271 cck_buf = (struct phy_sts_cck_8192s_t *)p_drvinfo; 246 cck_buf = (struct phy_sts_cck_8192s_t *)p_drvinfo;
272 247
273 cck_highpwr = (u8) rtl_get_bbreg(hw, 248 if (!in_powersavemode)
274 RFPGA0_XA_HSSIPARAMETER2, 249 cck_highpwr = (u8) rtl_get_bbreg(hw,
275 BIT(9)); 250 RFPGA0_XA_HSSIPARAMETER2,
251 BIT(9));
252 else
253 cck_highpwr = false;
254
276 if (!cck_highpwr) { 255 if (!cck_highpwr) {
277 u8 cck_agc_rpt = cck_buf->cck_agc_rpt; 256 u8 cck_agc_rpt = cck_buf->cck_agc_rpt;
278 report = cck_buf->cck_agc_rpt & 0xc0; 257 report = cck_buf->cck_agc_rpt & 0xc0;
@@ -398,6 +377,7 @@ static void _rtl92ce_process_ui_rssi(struct ieee80211_hw *hw,
398 377
399 if (rtlpriv->stats.ui_rssi.total_num++ >= 378 if (rtlpriv->stats.ui_rssi.total_num++ >=
400 PHY_RSSI_SLID_WIN_MAX) { 379 PHY_RSSI_SLID_WIN_MAX) {
380
401 rtlpriv->stats.ui_rssi.total_num = 381 rtlpriv->stats.ui_rssi.total_num =
402 PHY_RSSI_SLID_WIN_MAX; 382 PHY_RSSI_SLID_WIN_MAX;
403 last_rssi = 383 last_rssi =
@@ -424,10 +404,6 @@ static void _rtl92ce_process_ui_rssi(struct ieee80211_hw *hw,
424 if (!pstats->is_cck && pstats->packet_toself) { 404 if (!pstats->is_cck && pstats->packet_toself) {
425 for (rfpath = RF90_PATH_A; rfpath < rtlphy->num_total_rfpath; 405 for (rfpath = RF90_PATH_A; rfpath < rtlphy->num_total_rfpath;
426 rfpath++) { 406 rfpath++) {
427
428 if (!rtl8192_phy_check_is_legal_rfpath(hw, rfpath))
429 continue;
430
431 if (rtlpriv->stats.rx_rssi_percentage[rfpath] == 0) { 407 if (rtlpriv->stats.rx_rssi_percentage[rfpath] == 0) {
432 rtlpriv->stats.rx_rssi_percentage[rfpath] = 408 rtlpriv->stats.rx_rssi_percentage[rfpath] =
433 pstats->rx_mimo_signalstrength[rfpath]; 409 pstats->rx_mimo_signalstrength[rfpath];
@@ -723,7 +699,7 @@ bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw,
723void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, 699void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
724 struct ieee80211_hdr *hdr, u8 *pdesc_tx, 700 struct ieee80211_hdr *hdr, u8 *pdesc_tx,
725 struct ieee80211_tx_info *info, struct sk_buff *skb, 701 struct ieee80211_tx_info *info, struct sk_buff *skb,
726 unsigned int queue_index) 702 u8 hw_queue, struct rtl_tcb_desc *tcb_desc)
727{ 703{
728 struct rtl_priv *rtlpriv = rtl_priv(hw); 704 struct rtl_priv *rtlpriv = rtl_priv(hw);
729 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 705 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
@@ -732,16 +708,9 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
732 bool defaultadapter = true; 708 bool defaultadapter = true;
733 struct ieee80211_sta *sta; 709 struct ieee80211_sta *sta;
734 u8 *pdesc = (u8 *) pdesc_tx; 710 u8 *pdesc = (u8 *) pdesc_tx;
735 struct rtl_tcb_desc tcb_desc;
736 u8 *qc = ieee80211_get_qos_ctl(hdr);
737 u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
738 u16 seq_number; 711 u16 seq_number;
739 __le16 fc = hdr->frame_control; 712 __le16 fc = hdr->frame_control;
740 u8 rate_flag = info->control.rates[0].flags; 713 u8 fw_qsel = _rtl92ce_map_hwqueue_to_fwqueue(skb, hw_queue);
741
742 enum rtl_desc_qsel fw_qsel =
743 _rtl92ce_map_hwqueue_to_fwqueue(fc, queue_index);
744
745 bool firstseg = ((hdr->seq_ctrl & 714 bool firstseg = ((hdr->seq_ctrl &
746 cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0); 715 cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0);
747 716
@@ -751,56 +720,68 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
751 dma_addr_t mapping = pci_map_single(rtlpci->pdev, 720 dma_addr_t mapping = pci_map_single(rtlpci->pdev,
752 skb->data, skb->len, 721 skb->data, skb->len,
753 PCI_DMA_TODEVICE); 722 PCI_DMA_TODEVICE);
723 u8 bw_40 = 0;
724
725 rcu_read_lock();
726 sta = get_sta(hw, mac->vif, mac->bssid);
727 if (mac->opmode == NL80211_IFTYPE_STATION) {
728 bw_40 = mac->bw_40;
729 } else if (mac->opmode == NL80211_IFTYPE_AP ||
730 mac->opmode == NL80211_IFTYPE_ADHOC) {
731 if (sta)
732 bw_40 = sta->ht_cap.cap &
733 IEEE80211_HT_CAP_SUP_WIDTH_20_40;
734 }
754 735
755 seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4; 736 seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4;
756 737
757 rtl_get_tcb_desc(hw, info, sta, skb, &tcb_desc); 738 rtl_get_tcb_desc(hw, info, sta, skb, tcb_desc);
758 739
759 CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_92c)); 740 CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_92c));
760 741
742 if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) {
743 firstseg = true;
744 lastseg = true;
745 }
761 if (firstseg) { 746 if (firstseg) {
762 SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); 747 SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN);
763 748
764 SET_TX_DESC_TX_RATE(pdesc, tcb_desc.hw_rate); 749 SET_TX_DESC_TX_RATE(pdesc, tcb_desc->hw_rate);
765 750
766 if (tcb_desc.use_shortgi || tcb_desc.use_shortpreamble) 751 if (tcb_desc->use_shortgi || tcb_desc->use_shortpreamble)
767 SET_TX_DESC_DATA_SHORTGI(pdesc, 1); 752 SET_TX_DESC_DATA_SHORTGI(pdesc, 1);
768 753
769 if (mac->tids[tid].agg.agg_state == RTL_AGG_ON && 754 if (info->flags & IEEE80211_TX_CTL_AMPDU) {
770 info->flags & IEEE80211_TX_CTL_AMPDU) {
771 SET_TX_DESC_AGG_BREAK(pdesc, 1); 755 SET_TX_DESC_AGG_BREAK(pdesc, 1);
772 SET_TX_DESC_MAX_AGG_NUM(pdesc, 0x14); 756 SET_TX_DESC_MAX_AGG_NUM(pdesc, 0x14);
773 } 757 }
774 SET_TX_DESC_SEQ(pdesc, seq_number); 758 SET_TX_DESC_SEQ(pdesc, seq_number);
775 759
776 SET_TX_DESC_RTS_ENABLE(pdesc, ((tcb_desc.rts_enable && 760 SET_TX_DESC_RTS_ENABLE(pdesc, ((tcb_desc->rts_enable &&
777 !tcb_desc. 761 !tcb_desc->
778 cts_enable) ? 1 : 0)); 762 cts_enable) ? 1 : 0));
779 SET_TX_DESC_HW_RTS_ENABLE(pdesc, 763 SET_TX_DESC_HW_RTS_ENABLE(pdesc,
780 ((tcb_desc.rts_enable 764 ((tcb_desc->rts_enable
781 || tcb_desc.cts_enable) ? 1 : 0)); 765 || tcb_desc->cts_enable) ? 1 : 0));
782 SET_TX_DESC_CTS2SELF(pdesc, ((tcb_desc.cts_enable) ? 1 : 0)); 766 SET_TX_DESC_CTS2SELF(pdesc, ((tcb_desc->cts_enable) ? 1 : 0));
783 SET_TX_DESC_RTS_STBC(pdesc, ((tcb_desc.rts_stbc) ? 1 : 0)); 767 SET_TX_DESC_RTS_STBC(pdesc, ((tcb_desc->rts_stbc) ? 1 : 0));
784 768
785 SET_TX_DESC_RTS_RATE(pdesc, tcb_desc.rts_rate); 769 SET_TX_DESC_RTS_RATE(pdesc, tcb_desc->rts_rate);
786 SET_TX_DESC_RTS_BW(pdesc, 0); 770 SET_TX_DESC_RTS_BW(pdesc, 0);
787 SET_TX_DESC_RTS_SC(pdesc, tcb_desc.rts_sc); 771 SET_TX_DESC_RTS_SC(pdesc, tcb_desc->rts_sc);
788 SET_TX_DESC_RTS_SHORT(pdesc, 772 SET_TX_DESC_RTS_SHORT(pdesc,
789 ((tcb_desc.rts_rate <= DESC92C_RATE54M) ? 773 ((tcb_desc->rts_rate <= DESC92C_RATE54M) ?
790 (tcb_desc.rts_use_shortpreamble ? 1 : 0) 774 (tcb_desc->rts_use_shortpreamble ? 1 : 0)
791 : (tcb_desc.rts_use_shortgi ? 1 : 0))); 775 : (tcb_desc->rts_use_shortgi ? 1 : 0)));
792 776
793 if (mac->bw_40) { 777 if (bw_40) {
794 if (tcb_desc.packet_bw) { 778 if (tcb_desc->packet_bw) {
795 SET_TX_DESC_DATA_BW(pdesc, 1); 779 SET_TX_DESC_DATA_BW(pdesc, 1);
796 SET_TX_DESC_TX_SUB_CARRIER(pdesc, 3); 780 SET_TX_DESC_TX_SUB_CARRIER(pdesc, 3);
797 } else { 781 } else {
798 SET_TX_DESC_DATA_BW(pdesc, 0); 782 SET_TX_DESC_DATA_BW(pdesc, 0);
799 783 SET_TX_DESC_TX_SUB_CARRIER(pdesc,
800 if (rate_flag & IEEE80211_TX_RC_DUP_DATA) { 784 mac->cur_40_prime_sc);
801 SET_TX_DESC_TX_SUB_CARRIER(pdesc,
802 mac->cur_40_prime_sc);
803 }
804 } 785 }
805 } else { 786 } else {
806 SET_TX_DESC_DATA_BW(pdesc, 0); 787 SET_TX_DESC_DATA_BW(pdesc, 0);
@@ -810,8 +791,6 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
810 SET_TX_DESC_LINIP(pdesc, 0); 791 SET_TX_DESC_LINIP(pdesc, 0);
811 SET_TX_DESC_PKT_SIZE(pdesc, (u16) skb->len); 792 SET_TX_DESC_PKT_SIZE(pdesc, (u16) skb->len);
812 793
813 rcu_read_lock();
814 sta = ieee80211_find_sta(mac->vif, mac->bssid);
815 if (sta) { 794 if (sta) {
816 u8 ampdu_density = sta->ht_cap.ampdu_density; 795 u8 ampdu_density = sta->ht_cap.ampdu_density;
817 SET_TX_DESC_AMPDU_DENSITY(pdesc, ampdu_density); 796 SET_TX_DESC_AMPDU_DENSITY(pdesc, ampdu_density);
@@ -844,7 +823,7 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
844 SET_TX_DESC_DATA_RATE_FB_LIMIT(pdesc, 0x1F); 823 SET_TX_DESC_DATA_RATE_FB_LIMIT(pdesc, 0x1F);
845 SET_TX_DESC_RTS_RATE_FB_LIMIT(pdesc, 0xF); 824 SET_TX_DESC_RTS_RATE_FB_LIMIT(pdesc, 0xF);
846 SET_TX_DESC_DISABLE_FB(pdesc, 0); 825 SET_TX_DESC_DISABLE_FB(pdesc, 0);
847 SET_TX_DESC_USE_RATE(pdesc, tcb_desc.use_driver_rate ? 1 : 0); 826 SET_TX_DESC_USE_RATE(pdesc, tcb_desc->use_driver_rate ? 1 : 0);
848 827
849 if (ieee80211_is_data_qos(fc)) { 828 if (ieee80211_is_data_qos(fc)) {
850 if (mac->rdg_en) { 829 if (mac->rdg_en) {
@@ -864,15 +843,14 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
864 SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, cpu_to_le32(mapping)); 843 SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, cpu_to_le32(mapping));
865 844
866 if (rtlpriv->dm.useramask) { 845 if (rtlpriv->dm.useramask) {
867 SET_TX_DESC_RATE_ID(pdesc, tcb_desc.ratr_index); 846 SET_TX_DESC_RATE_ID(pdesc, tcb_desc->ratr_index);
868 SET_TX_DESC_MACID(pdesc, tcb_desc.mac_id); 847 SET_TX_DESC_MACID(pdesc, tcb_desc->mac_id);
869 } else { 848 } else {
870 SET_TX_DESC_RATE_ID(pdesc, 0xC + tcb_desc.ratr_index); 849 SET_TX_DESC_RATE_ID(pdesc, 0xC + tcb_desc->ratr_index);
871 SET_TX_DESC_MACID(pdesc, tcb_desc.ratr_index); 850 SET_TX_DESC_MACID(pdesc, tcb_desc->ratr_index);
872 } 851 }
873 852
874 if ((!ieee80211_is_data_qos(fc)) && ppsc->leisure_ps && 853 if ((!ieee80211_is_data_qos(fc)) && ppsc->fwctrl_lps) {
875 ppsc->fwctrl_lps) {
876 SET_TX_DESC_HWSEQ_EN(pdesc, 1); 854 SET_TX_DESC_HWSEQ_EN(pdesc, 1);
877 SET_TX_DESC_PKT_ID(pdesc, 8); 855 SET_TX_DESC_PKT_ID(pdesc, 8);
878 856
@@ -1021,7 +999,7 @@ u32 rtl92ce_get_desc(u8 *p_desc, bool istx, u8 desc_name)
1021 return ret; 999 return ret;
1022} 1000}
1023 1001
1024void rtl92ce_tx_polling(struct ieee80211_hw *hw, unsigned int hw_queue) 1002void rtl92ce_tx_polling(struct ieee80211_hw *hw, u8 hw_queue)
1025{ 1003{
1026 struct rtl_priv *rtlpriv = rtl_priv(hw); 1004 struct rtl_priv *rtlpriv = rtl_priv(hw);
1027 if (hw_queue == BEACON_QUEUE) { 1005 if (hw_queue == BEACON_QUEUE) {
@@ -1032,35 +1010,3 @@ void rtl92ce_tx_polling(struct ieee80211_hw *hw, unsigned int hw_queue)
1032 } 1010 }
1033} 1011}
1034 1012
1035bool _rtl92c_cmd_send_packet(struct ieee80211_hw *hw,
1036 struct sk_buff *skb)
1037{
1038 struct rtl_priv *rtlpriv = rtl_priv(hw);
1039 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
1040 struct rtl8192_tx_ring *ring;
1041 struct rtl_tx_desc *pdesc;
1042 u8 own;
1043 unsigned long flags;
1044 struct sk_buff *pskb = NULL;
1045
1046 ring = &rtlpci->tx_ring[BEACON_QUEUE];
1047
1048 spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags);
1049
1050 pskb = __skb_dequeue(&ring->queue);
1051 if (pskb)
1052 kfree_skb(pskb);
1053
1054 pdesc = &ring->desc[0];
1055 own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc, true, HW_DESC_OWN);
1056
1057 rtlpriv->cfg->ops->fill_tx_cmddesc(hw, (u8 *) pdesc, 1, 1, skb);
1058
1059 __skb_queue_tail(&ring->queue, skb);
1060
1061 spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags);
1062
1063 rtlpriv->cfg->ops->tx_polling(hw, BEACON_QUEUE);
1064
1065 return true;
1066}
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.h b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.h
index b0b0b13dd0ae..0f1177137501 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.h
@@ -724,17 +724,16 @@ struct rx_desc_92c {
724void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, 724void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
725 struct ieee80211_hdr *hdr, 725 struct ieee80211_hdr *hdr,
726 u8 *pdesc, struct ieee80211_tx_info *info, 726 u8 *pdesc, struct ieee80211_tx_info *info,
727 struct sk_buff *skb, unsigned int qsel); 727 struct sk_buff *skb, u8 hw_queue,
728 struct rtl_tcb_desc *ptcb_desc);
728bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw, 729bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw,
729 struct rtl_stats *stats, 730 struct rtl_stats *stats,
730 struct ieee80211_rx_status *rx_status, 731 struct ieee80211_rx_status *rx_status,
731 u8 *pdesc, struct sk_buff *skb); 732 u8 *pdesc, struct sk_buff *skb);
732void rtl92ce_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val); 733void rtl92ce_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val);
733u32 rtl92ce_get_desc(u8 *pdesc, bool istx, u8 desc_name); 734u32 rtl92ce_get_desc(u8 *pdesc, bool istx, u8 desc_name);
734void rtl92ce_tx_polling(struct ieee80211_hw *hw, unsigned int hw_queue); 735void rtl92ce_tx_polling(struct ieee80211_hw *hw, u8 hw_queue);
735void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, 736void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
736 bool b_firstseg, bool b_lastseg, 737 bool b_firstseg, bool b_lastseg,
737 struct sk_buff *skb); 738 struct sk_buff *skb);
738bool _rtl92c_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb);
739
740#endif 739#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
index 861f39fad3ec..52e2af58c1ed 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
@@ -39,10 +39,10 @@
39#include "mac.h" 39#include "mac.h"
40#include "dm.h" 40#include "dm.h"
41#include "hw.h" 41#include "hw.h"
42#include "../rtl8192ce/hw.h"
42#include "trx.h" 43#include "trx.h"
43#include "led.h" 44#include "led.h"
44#include "table.h" 45#include "table.h"
45#include "../rtl8192ce/hw.h"
46 46
47static void _rtl92cu_phy_param_tab_init(struct ieee80211_hw *hw) 47static void _rtl92cu_phy_param_tab_init(struct ieee80211_hw *hw)
48{ 48{
@@ -606,12 +606,10 @@ void rtl92cu_read_eeprom_info(struct ieee80211_hw *hw)
606 if (!IS_NORMAL_CHIP(rtlhal->version)) 606 if (!IS_NORMAL_CHIP(rtlhal->version))
607 return; 607 return;
608 tmp_u1b = rtl_read_byte(rtlpriv, REG_9346CR); 608 tmp_u1b = rtl_read_byte(rtlpriv, REG_9346CR);
609#if 0 /* temporary */ 609 rtlefuse->epromtype = (tmp_u1b & BOOT_FROM_EEPROM) ?
610 rtlefuse->epromtype = (tmp_u1b & EEPROMSEL) ?
611 EEPROM_93C46 : EEPROM_BOOT_EFUSE; 610 EEPROM_93C46 : EEPROM_BOOT_EFUSE;
612 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("Boot from %s\n", 611 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("Boot from %s\n",
613 (tmp_u1b & EEPROMSEL) ? "EERROM" : "EFUSE")); 612 (tmp_u1b & BOOT_FROM_EEPROM) ? "EERROM" : "EFUSE"));
614#endif
615 rtlefuse->autoload_failflag = (tmp_u1b & EEPROM_EN) ? false : true; 613 rtlefuse->autoload_failflag = (tmp_u1b & EEPROM_EN) ? false : true;
616 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Autoload %s\n", 614 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Autoload %s\n",
617 (tmp_u1b & EEPROM_EN) ? "OK!!" : "ERR!!")); 615 (tmp_u1b & EEPROM_EN) ? "OK!!" : "ERR!!"));
@@ -980,7 +978,7 @@ static void _rtl92cu_init_wmac_setting(struct ieee80211_hw *hw)
980 struct rtl_priv *rtlpriv = rtl_priv(hw); 978 struct rtl_priv *rtlpriv = rtl_priv(hw);
981 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 979 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
982 980
983 mac->rx_conf = (RCR_APM | RCR_AM | RCR_ADF | RCR_AB | RCR_APP_FCS | 981 mac->rx_conf = (RCR_APM | RCR_AM | RCR_ADF | RCR_AB | RCR_APPFCS |
984 RCR_APP_ICV | RCR_AMF | RCR_HTC_LOC_CTRL | 982 RCR_APP_ICV | RCR_AMF | RCR_HTC_LOC_CTRL |
985 RCR_APP_MIC | RCR_APP_PHYSTS | RCR_ACRC32); 983 RCR_APP_MIC | RCR_APP_PHYSTS | RCR_ACRC32);
986 rtl_write_dword(rtlpriv, REG_RCR, mac->rx_conf); 984 rtl_write_dword(rtlpriv, REG_RCR, mac->rx_conf);
@@ -2185,7 +2183,9 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
2185 } 2183 }
2186} 2184}
2187 2185
2188void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw) 2186void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw,
2187 struct ieee80211_sta *sta,
2188 u8 rssi_level)
2189{ 2189{
2190 struct rtl_priv *rtlpriv = rtl_priv(hw); 2190 struct rtl_priv *rtlpriv = rtl_priv(hw);
2191 struct rtl_phy *rtlphy = &(rtlpriv->phy); 2191 struct rtl_phy *rtlphy = &(rtlpriv->phy);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
index 17dc5a3151cf..32f85cba106a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
@@ -98,13 +98,14 @@ 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); 101void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw,
102 struct ieee80211_sta *sta,
103 u8 rssi_level);
102void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level); 104void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level);
103 105
104void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw); 106void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw);
105bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid); 107bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid);
106void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid); 108void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid);
107static u8 _rtl92c_get_chnl_group(u8 chnl);
108int rtl92c_download_fw(struct ieee80211_hw *hw); 109int rtl92c_download_fw(struct ieee80211_hw *hw);
109void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); 110void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode);
110void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished); 111void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 71244a38d49e..bee7c1480f63 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -94,7 +94,7 @@ static struct rtl_hal_ops rtl8192cu_hal_ops = {
94 .update_interrupt_mask = rtl92cu_update_interrupt_mask, 94 .update_interrupt_mask = rtl92cu_update_interrupt_mask,
95 .get_hw_reg = rtl92cu_get_hw_reg, 95 .get_hw_reg = rtl92cu_get_hw_reg,
96 .set_hw_reg = rtl92cu_set_hw_reg, 96 .set_hw_reg = rtl92cu_set_hw_reg,
97 .update_rate_table = rtl92cu_update_hal_rate_table, 97 .update_rate_tbl = rtl92cu_update_hal_rate_table,
98 .update_rate_mask = rtl92cu_update_hal_rate_mask, 98 .update_rate_mask = rtl92cu_update_hal_rate_mask,
99 .fill_tx_desc = rtl92cu_tx_fill_desc, 99 .fill_tx_desc = rtl92cu_tx_fill_desc,
100 .fill_fake_txdesc = rtl92cu_fill_fake_txdesc, 100 .fill_fake_txdesc = rtl92cu_fill_fake_txdesc,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
index cc5de0726938..79c98f62175f 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
@@ -498,14 +498,14 @@ static void _rtl_tx_desc_checksum(u8 *txdesc)
498void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw, 498void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw,
499 struct ieee80211_hdr *hdr, u8 *pdesc_tx, 499 struct ieee80211_hdr *hdr, u8 *pdesc_tx,
500 struct ieee80211_tx_info *info, struct sk_buff *skb, 500 struct ieee80211_tx_info *info, struct sk_buff *skb,
501 unsigned int queue_index) 501 u8 queue_index,
502 struct rtl_tcb_desc *tcb_desc)
502{ 503{
503 struct rtl_priv *rtlpriv = rtl_priv(hw); 504 struct rtl_priv *rtlpriv = rtl_priv(hw);
504 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 505 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
505 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 506 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
506 bool defaultadapter = true; 507 bool defaultadapter = true;
507 struct ieee80211_sta *sta = info->control.sta; 508 struct ieee80211_sta *sta = info->control.sta = info->control.sta;
508 struct rtl_tcb_desc tcb_desc;
509 u8 *qc = ieee80211_get_qos_ctl(hdr); 509 u8 *qc = ieee80211_get_qos_ctl(hdr);
510 u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; 510 u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
511 u16 seq_number; 511 u16 seq_number;
@@ -517,15 +517,15 @@ void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw,
517 u8 *txdesc; 517 u8 *txdesc;
518 518
519 seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4; 519 seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4;
520 rtl_get_tcb_desc(hw, info, sta, skb, &tcb_desc); 520 rtl_get_tcb_desc(hw, info, sta, skb, tcb_desc);
521 txdesc = (u8 *)skb_push(skb, RTL_TX_HEADER_SIZE); 521 txdesc = (u8 *)skb_push(skb, RTL_TX_HEADER_SIZE);
522 memset(txdesc, 0, RTL_TX_HEADER_SIZE); 522 memset(txdesc, 0, RTL_TX_HEADER_SIZE);
523 SET_TX_DESC_PKT_SIZE(txdesc, pktlen); 523 SET_TX_DESC_PKT_SIZE(txdesc, pktlen);
524 SET_TX_DESC_LINIP(txdesc, 0); 524 SET_TX_DESC_LINIP(txdesc, 0);
525 SET_TX_DESC_PKT_OFFSET(txdesc, RTL_DUMMY_OFFSET); 525 SET_TX_DESC_PKT_OFFSET(txdesc, RTL_DUMMY_OFFSET);
526 SET_TX_DESC_OFFSET(txdesc, RTL_TX_HEADER_SIZE); 526 SET_TX_DESC_OFFSET(txdesc, RTL_TX_HEADER_SIZE);
527 SET_TX_DESC_TX_RATE(txdesc, tcb_desc.hw_rate); 527 SET_TX_DESC_TX_RATE(txdesc, tcb_desc->hw_rate);
528 if (tcb_desc.use_shortgi || tcb_desc.use_shortpreamble) 528 if (tcb_desc->use_shortgi || tcb_desc->use_shortpreamble)
529 SET_TX_DESC_DATA_SHORTGI(txdesc, 1); 529 SET_TX_DESC_DATA_SHORTGI(txdesc, 1);
530 if (mac->tids[tid].agg.agg_state == RTL_AGG_ON && 530 if (mac->tids[tid].agg.agg_state == RTL_AGG_ON &&
531 info->flags & IEEE80211_TX_CTL_AMPDU) { 531 info->flags & IEEE80211_TX_CTL_AMPDU) {
@@ -535,21 +535,21 @@ void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw,
535 SET_TX_DESC_AGG_BREAK(txdesc, 1); 535 SET_TX_DESC_AGG_BREAK(txdesc, 1);
536 } 536 }
537 SET_TX_DESC_SEQ(txdesc, seq_number); 537 SET_TX_DESC_SEQ(txdesc, seq_number);
538 SET_TX_DESC_RTS_ENABLE(txdesc, ((tcb_desc.rts_enable && 538 SET_TX_DESC_RTS_ENABLE(txdesc, ((tcb_desc->rts_enable &&
539 !tcb_desc.cts_enable) ? 1 : 0)); 539 !tcb_desc->cts_enable) ? 1 : 0));
540 SET_TX_DESC_HW_RTS_ENABLE(txdesc, ((tcb_desc.rts_enable || 540 SET_TX_DESC_HW_RTS_ENABLE(txdesc, ((tcb_desc->rts_enable ||
541 tcb_desc.cts_enable) ? 1 : 0)); 541 tcb_desc->cts_enable) ? 1 : 0));
542 SET_TX_DESC_CTS2SELF(txdesc, ((tcb_desc.cts_enable) ? 1 : 0)); 542 SET_TX_DESC_CTS2SELF(txdesc, ((tcb_desc->cts_enable) ? 1 : 0));
543 SET_TX_DESC_RTS_STBC(txdesc, ((tcb_desc.rts_stbc) ? 1 : 0)); 543 SET_TX_DESC_RTS_STBC(txdesc, ((tcb_desc->rts_stbc) ? 1 : 0));
544 SET_TX_DESC_RTS_RATE(txdesc, tcb_desc.rts_rate); 544 SET_TX_DESC_RTS_RATE(txdesc, tcb_desc->rts_rate);
545 SET_TX_DESC_RTS_BW(txdesc, 0); 545 SET_TX_DESC_RTS_BW(txdesc, 0);
546 SET_TX_DESC_RTS_SC(txdesc, tcb_desc.rts_sc); 546 SET_TX_DESC_RTS_SC(txdesc, tcb_desc->rts_sc);
547 SET_TX_DESC_RTS_SHORT(txdesc, 547 SET_TX_DESC_RTS_SHORT(txdesc,
548 ((tcb_desc.rts_rate <= DESC92C_RATE54M) ? 548 ((tcb_desc->rts_rate <= DESC92C_RATE54M) ?
549 (tcb_desc.rts_use_shortpreamble ? 1 : 0) 549 (tcb_desc->rts_use_shortpreamble ? 1 : 0)
550 : (tcb_desc.rts_use_shortgi ? 1 : 0))); 550 : (tcb_desc->rts_use_shortgi ? 1 : 0)));
551 if (mac->bw_40) { 551 if (mac->bw_40) {
552 if (tcb_desc.packet_bw) { 552 if (tcb_desc->packet_bw) {
553 SET_TX_DESC_DATA_BW(txdesc, 1); 553 SET_TX_DESC_DATA_BW(txdesc, 1);
554 SET_TX_DESC_DATA_SC(txdesc, 3); 554 SET_TX_DESC_DATA_SC(txdesc, 3);
555 } else { 555 } else {
@@ -590,7 +590,7 @@ void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw,
590 SET_TX_DESC_DATA_RATE_FB_LIMIT(txdesc, 0x1F); 590 SET_TX_DESC_DATA_RATE_FB_LIMIT(txdesc, 0x1F);
591 SET_TX_DESC_RTS_RATE_FB_LIMIT(txdesc, 0xF); 591 SET_TX_DESC_RTS_RATE_FB_LIMIT(txdesc, 0xF);
592 SET_TX_DESC_DISABLE_FB(txdesc, 0); 592 SET_TX_DESC_DISABLE_FB(txdesc, 0);
593 SET_TX_DESC_USE_RATE(txdesc, tcb_desc.use_driver_rate ? 1 : 0); 593 SET_TX_DESC_USE_RATE(txdesc, tcb_desc->use_driver_rate ? 1 : 0);
594 if (ieee80211_is_data_qos(fc)) { 594 if (ieee80211_is_data_qos(fc)) {
595 if (mac->rdg_en) { 595 if (mac->rdg_en) {
596 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, 596 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
@@ -600,11 +600,11 @@ void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw,
600 } 600 }
601 } 601 }
602 if (rtlpriv->dm.useramask) { 602 if (rtlpriv->dm.useramask) {
603 SET_TX_DESC_RATE_ID(txdesc, tcb_desc.ratr_index); 603 SET_TX_DESC_RATE_ID(txdesc, tcb_desc->ratr_index);
604 SET_TX_DESC_MACID(txdesc, tcb_desc.mac_id); 604 SET_TX_DESC_MACID(txdesc, tcb_desc->mac_id);
605 } else { 605 } else {
606 SET_TX_DESC_RATE_ID(txdesc, 0xC + tcb_desc.ratr_index); 606 SET_TX_DESC_RATE_ID(txdesc, 0xC + tcb_desc->ratr_index);
607 SET_TX_DESC_MACID(txdesc, tcb_desc.ratr_index); 607 SET_TX_DESC_MACID(txdesc, tcb_desc->ratr_index);
608 } 608 }
609 if ((!ieee80211_is_data_qos(fc)) && ppsc->leisure_ps && 609 if ((!ieee80211_is_data_qos(fc)) && ppsc->leisure_ps &&
610 ppsc->fwctrl_lps) { 610 ppsc->fwctrl_lps) {
@@ -656,7 +656,7 @@ void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw,
656 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); 656 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data);
657 __le16 fc = hdr->frame_control; 657 __le16 fc = hdr->frame_control;
658 658
659 memset(pdesc, 0, RTL_TX_HEADER_SIZE); 659 memset((void *)pdesc, 0, RTL_TX_HEADER_SIZE);
660 if (firstseg) 660 if (firstseg)
661 SET_TX_DESC_OFFSET(pdesc, RTL_TX_HEADER_SIZE); 661 SET_TX_DESC_OFFSET(pdesc, RTL_TX_HEADER_SIZE);
662 SET_TX_DESC_TX_RATE(pdesc, DESC92C_RATE1M); 662 SET_TX_DESC_TX_RATE(pdesc, DESC92C_RATE1M);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h
index b396d46edbb7..53de5f66e242 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h
@@ -37,6 +37,8 @@
37#define RTL92C_SIZE_MAX_RX_BUFFER 15360 /* 8192 */ 37#define RTL92C_SIZE_MAX_RX_BUFFER 15360 /* 8192 */
38#define RX_DRV_INFO_SIZE_UNIT 8 38#define RX_DRV_INFO_SIZE_UNIT 8
39 39
40#define RTL_AGG_ON 1
41
40enum usb_rx_agg_mode { 42enum usb_rx_agg_mode {
41 USB_RX_AGG_DISABLE, 43 USB_RX_AGG_DISABLE,
42 USB_RX_AGG_DMA, 44 USB_RX_AGG_DMA,
@@ -419,7 +421,8 @@ struct sk_buff *rtl8192c_tx_aggregate_hdl(struct ieee80211_hw *,
419void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw, 421void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw,
420 struct ieee80211_hdr *hdr, u8 *pdesc_tx, 422 struct ieee80211_hdr *hdr, u8 *pdesc_tx,
421 struct ieee80211_tx_info *info, struct sk_buff *skb, 423 struct ieee80211_tx_info *info, struct sk_buff *skb,
422 unsigned int queue_index); 424 u8 queue_index,
425 struct rtl_tcb_desc *tcb_desc);
423void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 * pDesc, 426void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 * pDesc,
424 u32 buffer_len, bool bIsPsPoll); 427 u32 buffer_len, bool bIsPsPoll);
425void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw, 428void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index 683f7f71b6cd..690508feafcc 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -1370,13 +1370,8 @@ struct rtl_hal_ops {
1370 u32 add_msr, u32 rm_msr); 1370 u32 add_msr, u32 rm_msr);
1371 void (*get_hw_reg) (struct ieee80211_hw *hw, u8 variable, u8 *val); 1371 void (*get_hw_reg) (struct ieee80211_hw *hw, u8 variable, u8 *val);
1372 void (*set_hw_reg) (struct ieee80211_hw *hw, u8 variable, u8 *val); 1372 void (*set_hw_reg) (struct ieee80211_hw *hw, u8 variable, u8 *val);
1373#if 1 /* temporary */
1374 void (*update_rate_tbl) (struct ieee80211_hw *hw, 1373 void (*update_rate_tbl) (struct ieee80211_hw *hw,
1375 struct ieee80211_sta *sta, u8 rssi_level); 1374 struct ieee80211_sta *sta, u8 rssi_level);
1376#endif
1377#if 1 /* temporary */
1378 void (*update_rate_table) (struct ieee80211_hw *hw);
1379#endif
1380 void (*update_rate_mask) (struct ieee80211_hw *hw, u8 rssi_level); 1375 void (*update_rate_mask) (struct ieee80211_hw *hw, u8 rssi_level);
1381 void (*fill_tx_desc) (struct ieee80211_hw *hw, 1376 void (*fill_tx_desc) (struct ieee80211_hw *hw,
1382 struct ieee80211_hdr *hdr, u8 *pdesc_tx, 1377 struct ieee80211_hdr *hdr, u8 *pdesc_tx,