rtlwifi: rtl8192ce: Convert to use the new rate-mapping routine in rtlwifi
authorLarry Finger <Larry.Finger@lwfinger.net>
Mon, 22 Aug 2011 21:50:15 +0000 (16:50 -0500)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 24 Aug 2011 18:57:19 +0000 (14:57 -0400)
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Chaoming Li <chaoming_li@realsil.com.cn>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
drivers/net/wireless/rtlwifi/rtl8192ce/trx.h

index 373dc78af1dcaef05f5511de4e509a87f06add03..4c34c4c1ae56b96f0a1c248cafe20e13027f0030 100644 (file)
@@ -318,21 +318,21 @@ static struct rtl_hal_cfg rtl92ce_hal_cfg = {
        .maps[RTL_IMR_ROK] = IMR_ROK,
        .maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER),
 
-       .maps[RTL_RC_CCK_RATE1M] = DESC92C_RATE1M,
-       .maps[RTL_RC_CCK_RATE2M] = DESC92C_RATE2M,
-       .maps[RTL_RC_CCK_RATE5_5M] = DESC92C_RATE5_5M,
-       .maps[RTL_RC_CCK_RATE11M] = DESC92C_RATE11M,
-       .maps[RTL_RC_OFDM_RATE6M] = DESC92C_RATE6M,
-       .maps[RTL_RC_OFDM_RATE9M] = DESC92C_RATE9M,
-       .maps[RTL_RC_OFDM_RATE12M] = DESC92C_RATE12M,
-       .maps[RTL_RC_OFDM_RATE18M] = DESC92C_RATE18M,
-       .maps[RTL_RC_OFDM_RATE24M] = DESC92C_RATE24M,
-       .maps[RTL_RC_OFDM_RATE36M] = DESC92C_RATE36M,
-       .maps[RTL_RC_OFDM_RATE48M] = DESC92C_RATE48M,
-       .maps[RTL_RC_OFDM_RATE54M] = DESC92C_RATE54M,
-
-       .maps[RTL_RC_HT_RATEMCS7] = DESC92C_RATEMCS7,
-       .maps[RTL_RC_HT_RATEMCS15] = DESC92C_RATEMCS15,
+       .maps[RTL_RC_CCK_RATE1M] = DESC92_RATE1M,
+       .maps[RTL_RC_CCK_RATE2M] = DESC92_RATE2M,
+       .maps[RTL_RC_CCK_RATE5_5M] = DESC92_RATE5_5M,
+       .maps[RTL_RC_CCK_RATE11M] = DESC92_RATE11M,
+       .maps[RTL_RC_OFDM_RATE6M] = DESC92_RATE6M,
+       .maps[RTL_RC_OFDM_RATE9M] = DESC92_RATE9M,
+       .maps[RTL_RC_OFDM_RATE12M] = DESC92_RATE12M,
+       .maps[RTL_RC_OFDM_RATE18M] = DESC92_RATE18M,
+       .maps[RTL_RC_OFDM_RATE24M] = DESC92_RATE24M,
+       .maps[RTL_RC_OFDM_RATE36M] = DESC92_RATE36M,
+       .maps[RTL_RC_OFDM_RATE48M] = DESC92_RATE48M,
+       .maps[RTL_RC_OFDM_RATE54M] = DESC92_RATE54M,
+
+       .maps[RTL_RC_HT_RATEMCS7] = DESC92_RATEMCS7,
+       .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15,
 };
 
 DEFINE_PCI_DEVICE_TABLE(rtl92ce_pci_ids) = {
index 230bbe900d8d07eacf1975fe85da3956bb8ffb62..4fb5ae24dee07fc08819add09b6e7793298beff8 100644 (file)
@@ -48,104 +48,6 @@ static u8 _rtl92ce_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue)
        return skb->priority;
 }
 
-static int _rtl92ce_rate_mapping(bool isht, u8 desc_rate, bool first_ampdu)
-{
-       int rate_idx;
-
-       if (first_ampdu) {
-               if (false == isht) {
-                       switch (desc_rate) {
-                       case DESC92C_RATE1M:
-                               rate_idx = 0;
-                               break;
-                       case DESC92C_RATE2M:
-                               rate_idx = 1;
-                               break;
-                       case DESC92C_RATE5_5M:
-                               rate_idx = 2;
-                               break;
-                       case DESC92C_RATE11M:
-                               rate_idx = 3;
-                               break;
-                       case DESC92C_RATE6M:
-                               rate_idx = 4;
-                               break;
-                       case DESC92C_RATE9M:
-                               rate_idx = 5;
-                               break;
-                       case DESC92C_RATE12M:
-                               rate_idx = 6;
-                               break;
-                       case DESC92C_RATE18M:
-                               rate_idx = 7;
-                               break;
-                       case DESC92C_RATE24M:
-                               rate_idx = 8;
-                               break;
-                       case DESC92C_RATE36M:
-                               rate_idx = 9;
-                               break;
-                       case DESC92C_RATE48M:
-                               rate_idx = 10;
-                               break;
-                       case DESC92C_RATE54M:
-                               rate_idx = 11;
-                               break;
-                       default:
-                               rate_idx = 0;
-                               break;
-                       }
-               } else {
-                       rate_idx = 11;
-               }
-
-               return rate_idx;
-       }
-
-       switch (desc_rate) {
-       case DESC92C_RATE1M:
-               rate_idx = 0;
-               break;
-       case DESC92C_RATE2M:
-               rate_idx = 1;
-               break;
-       case DESC92C_RATE5_5M:
-               rate_idx = 2;
-               break;
-       case DESC92C_RATE11M:
-               rate_idx = 3;
-               break;
-       case DESC92C_RATE6M:
-               rate_idx = 4;
-               break;
-       case DESC92C_RATE9M:
-               rate_idx = 5;
-               break;
-       case DESC92C_RATE12M:
-               rate_idx = 6;
-               break;
-       case DESC92C_RATE18M:
-               rate_idx = 7;
-               break;
-       case DESC92C_RATE24M:
-               rate_idx = 8;
-               break;
-       case DESC92C_RATE36M:
-               rate_idx = 9;
-               break;
-       case DESC92C_RATE48M:
-               rate_idx = 10;
-               break;
-       case DESC92C_RATE54M:
-               rate_idx = 11;
-               break;
-       default:
-               rate_idx = 11;
-               break;
-       }
-       return rate_idx;
-}
-
 static u8 _rtl92c_query_rxpwrpercentage(char antpower)
 {
        if ((antpower <= -100) || (antpower >= 20))
@@ -336,8 +238,8 @@ static void _rtl92ce_query_rxphystatus(struct ieee80211_hw *hw,
                pstats->rxpower = rx_pwr_all;
                pstats->recvsignalpower = rx_pwr_all;
 
-               if (pdesc->rxht && pdesc->rxmcs >= DESC92C_RATEMCS8 &&
-                   pdesc->rxmcs <= DESC92C_RATEMCS15)
+               if (pdesc->rxht && pdesc->rxmcs >= DESC92_RATEMCS8 &&
+                   pdesc->rxmcs <= DESC92_RATEMCS15)
                        max_spatial_stream = 2;
                else
                        max_spatial_stream = 1;
@@ -670,12 +572,10 @@ bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw,
        if (stats->decrypted)
                rx_status->flag |= RX_FLAG_DECRYPTED;
 
-       rx_status->rate_idx = _rtl92ce_rate_mapping((bool)
-                                                   GET_RX_DESC_RXHT(pdesc),
-                                                   (u8)
-                                                   GET_RX_DESC_RXMCS(pdesc),
-                                                   (bool)
-                                                   GET_RX_DESC_PAGGR(pdesc));
+       rx_status->rate_idx = rtlwifi_rate_mapping(hw,
+                               (bool)GET_RX_DESC_RXHT(pdesc),
+                               (u8)GET_RX_DESC_RXMCS(pdesc),
+                               (bool)GET_RX_DESC_PAGGR(pdesc));
 
        rx_status->mactime = GET_RX_DESC_TSFL(pdesc);
        if (phystatus) {
@@ -768,7 +668,7 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
                SET_TX_DESC_RTS_BW(pdesc, 0);
                SET_TX_DESC_RTS_SC(pdesc, tcb_desc->rts_sc);
                SET_TX_DESC_RTS_SHORT(pdesc,
-                                     ((tcb_desc->rts_rate <= DESC92C_RATE54M) ?
+                                     ((tcb_desc->rts_rate <= DESC92_RATE54M) ?
                                       (tcb_desc->rts_use_shortpreamble ? 1 : 0)
                                       : (tcb_desc->rts_use_shortgi ? 1 : 0)));
 
@@ -886,7 +786,7 @@ void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw,
        if (firstseg)
                SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN);
 
-       SET_TX_DESC_TX_RATE(pdesc, DESC92C_RATE1M);
+       SET_TX_DESC_TX_RATE(pdesc, DESC92_RATE1M);
 
        SET_TX_DESC_SEQ(pdesc, 0);
 
index 0f117713750126acd76f00353ba2e44fba2691f5..81ae64234f80a102a317b78cb3e3a79a263d49a7 100644 (file)
@@ -538,10 +538,10 @@ do {                                                      \
 } while (0);
 
 #define RX_HAL_IS_CCK_RATE(_pdesc)\
-       (_pdesc->rxmcs == DESC92C_RATE1M ||             \
-        _pdesc->rxmcs == DESC92C_RATE2M ||             \
-        _pdesc->rxmcs == DESC92C_RATE5_5M ||           \
-        _pdesc->rxmcs == DESC92C_RATE11M)
+       (_pdesc->rxmcs == DESC92_RATE1M ||              \
+        _pdesc->rxmcs == DESC92_RATE2M ||              \
+        _pdesc->rxmcs == DESC92_RATE5_5M ||            \
+        _pdesc->rxmcs == DESC92_RATE11M)
 
 struct rx_fwinfo_92c {
        u8 gain_trsw[4];