rtlwifi: rtl8192de: Convert to use the new rate-mapping routine in rtlwifi
[pandora-kernel.git] / drivers / net / wireless / rtlwifi / rtl8192de / trx.c
index dc86fcb..3637c0c 100644 (file)
@@ -48,99 +48,6 @@ static u8 _rtl92de_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue)
        return skb->priority;
 }
 
-static int _rtl92de_rate_mapping(bool isht, u8 desc_rate)
-{
-       int rate_idx;
-
-       if (false == isht) {
-               switch (desc_rate) {
-               case DESC92D_RATE1M:
-                       rate_idx = 0;
-                       break;
-               case DESC92D_RATE2M:
-                       rate_idx = 1;
-                       break;
-               case DESC92D_RATE5_5M:
-                       rate_idx = 2;
-                       break;
-               case DESC92D_RATE11M:
-                       rate_idx = 3;
-                       break;
-               case DESC92D_RATE6M:
-                       rate_idx = 4;
-                       break;
-               case DESC92D_RATE9M:
-                       rate_idx = 5;
-                       break;
-               case DESC92D_RATE12M:
-                       rate_idx = 6;
-                       break;
-               case DESC92D_RATE18M:
-                       rate_idx = 7;
-                       break;
-               case DESC92D_RATE24M:
-                       rate_idx = 8;
-                       break;
-               case DESC92D_RATE36M:
-                       rate_idx = 9;
-                       break;
-               case DESC92D_RATE48M:
-                       rate_idx = 10;
-                       break;
-               case DESC92D_RATE54M:
-                       rate_idx = 11;
-                       break;
-               default:
-                       rate_idx = 0;
-                       break;
-               }
-               return rate_idx;
-       } else {
-               switch (desc_rate) {
-               case DESC92D_RATE1M:
-                       rate_idx = 0;
-                       break;
-               case DESC92D_RATE2M:
-                       rate_idx = 1;
-                       break;
-               case DESC92D_RATE5_5M:
-                       rate_idx = 2;
-                       break;
-               case DESC92D_RATE11M:
-                       rate_idx = 3;
-                       break;
-               case DESC92D_RATE6M:
-                       rate_idx = 4;
-                       break;
-               case DESC92D_RATE9M:
-                       rate_idx = 5;
-                       break;
-               case DESC92D_RATE12M:
-                       rate_idx = 6;
-                       break;
-               case DESC92D_RATE18M:
-                       rate_idx = 7;
-                       break;
-               case DESC92D_RATE24M:
-                       rate_idx = 8;
-                       break;
-               case DESC92D_RATE36M:
-                       rate_idx = 9;
-                       break;
-               case DESC92D_RATE48M:
-                       rate_idx = 10;
-                       break;
-               case DESC92D_RATE54M:
-                       rate_idx = 11;
-                       break;
-               default:
-                       rate_idx = 11;
-                       break;
-               }
-               return rate_idx;
-       }
-}
-
 static u8 _rtl92d_query_rxpwrpercentage(char antpower)
 {
        if ((antpower <= -100) || (antpower >= 20))
@@ -328,8 +235,8 @@ static void _rtl92de_query_rxphystatus(struct ieee80211_hw *hw,
                pstats->rx_pwdb_all = pwdb_all;
                pstats->rxpower = rx_pwr_all;
                pstats->recvsignalpower = rx_pwr_all;
-               if (pdesc->rxht && pdesc->rxmcs >= DESC92D_RATEMCS8 &&
-                   pdesc->rxmcs <= DESC92D_RATEMCS15)
+               if (pdesc->rxht && pdesc->rxmcs >= DESC92_RATEMCS8 &&
+                   pdesc->rxmcs <= DESC92_RATEMCS15)
                        max_spatial_stream = 2;
                else
                        max_spatial_stream = 1;
@@ -609,10 +516,10 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw,       struct rtl_stats *stats,
        rx_status->flag |= RX_FLAG_MACTIME_MPDU;
        if (stats->decrypted)
                rx_status->flag |= RX_FLAG_DECRYPTED;
-       rx_status->rate_idx = _rtl92de_rate_mapping((bool)
-                                                   GET_RX_DESC_RXHT(pdesc),
-                                                   (u8)
-                                                   GET_RX_DESC_RXMCS(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) {
                p_drvinfo = (struct rx_fwinfo_92d *)(skb->data +
@@ -705,14 +612,14 @@ void rtl92de_tx_fill_desc(struct ieee80211_hw *hw,
                }
                /* 5G have no CCK rate */
                if (rtlhal->current_bandtype == BAND_ON_5G)
-                       if (ptcb_desc->hw_rate < DESC92D_RATE6M)
-                               ptcb_desc->hw_rate = DESC92D_RATE6M;
+                       if (ptcb_desc->hw_rate < DESC92_RATE6M)
+                               ptcb_desc->hw_rate = DESC92_RATE6M;
                SET_TX_DESC_TX_RATE(pdesc, ptcb_desc->hw_rate);
                if (ptcb_desc->use_shortgi || ptcb_desc->use_shortpreamble)
                        SET_TX_DESC_DATA_SHORTGI(pdesc, 1);
 
                if (rtlhal->macphymode == DUALMAC_DUALPHY &&
-                       ptcb_desc->hw_rate == DESC92D_RATEMCS7)
+                       ptcb_desc->hw_rate == DESC92_RATEMCS7)
                        SET_TX_DESC_DATA_SHORTGI(pdesc, 1);
 
                if (info->flags & IEEE80211_TX_CTL_AMPDU) {
@@ -728,13 +635,13 @@ void rtl92de_tx_fill_desc(struct ieee80211_hw *hw,
                SET_TX_DESC_RTS_STBC(pdesc, ((ptcb_desc->rts_stbc) ? 1 : 0));
                /* 5G have no CCK rate */
                if (rtlhal->current_bandtype == BAND_ON_5G)
-                       if (ptcb_desc->rts_rate < DESC92D_RATE6M)
-                               ptcb_desc->rts_rate = DESC92D_RATE6M;
+                       if (ptcb_desc->rts_rate < DESC92_RATE6M)
+                               ptcb_desc->rts_rate = DESC92_RATE6M;
                SET_TX_DESC_RTS_RATE(pdesc, ptcb_desc->rts_rate);
                SET_TX_DESC_RTS_BW(pdesc, 0);
                SET_TX_DESC_RTS_SC(pdesc, ptcb_desc->rts_sc);
                SET_TX_DESC_RTS_SHORT(pdesc, ((ptcb_desc->rts_rate <=
-                       DESC92D_RATE54M) ?
+                       DESC92_RATE54M) ?
                        (ptcb_desc->rts_use_shortpreamble ? 1 : 0) :
                        (ptcb_desc->rts_use_shortgi ? 1 : 0)));
                if (bw_40) {
@@ -844,9 +751,9 @@ void rtl92de_tx_fill_cmddesc(struct ieee80211_hw *hw,
         * The braces are needed no matter what checkpatch says
         */
        if (rtlhal->current_bandtype == BAND_ON_5G) {
-               SET_TX_DESC_TX_RATE(pdesc, DESC92D_RATE6M);
+               SET_TX_DESC_TX_RATE(pdesc, DESC92_RATE6M);
        } else {
-               SET_TX_DESC_TX_RATE(pdesc, DESC92D_RATE1M);
+               SET_TX_DESC_TX_RATE(pdesc, DESC92_RATE1M);
        }
        SET_TX_DESC_SEQ(pdesc, 0);
        SET_TX_DESC_LINIP(pdesc, 0);