rtlwifi: rtl8192cu: Rework calls to rate-control routine
authorLarry Finger <Larry.Finger@lwfinger.net>
Thu, 18 Dec 2014 09:05:38 +0000 (03:05 -0600)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 24 Dec 2014 16:33:33 +0000 (18:33 +0200)
The code uses macros to determine the parameters that are passed to the
rate setting routine. A simpler method is implemented.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/rtlwifi/rtl8192cu/trx.c

index fe298766ea889bc62fc28b7d3b4f70b320f81378..5eccaba79d42d7bfdbd190f407c3e4eea6aab0d2 100644 (file)
@@ -325,6 +325,7 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw,
                                   && (GET_RX_DESC_FAGGR(pdesc) == 1));
        stats->timestamp_low = GET_RX_DESC_TSFL(pdesc);
        stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc);
+       stats->is_ht = (bool)GET_RX_DESC_RX_HT(pdesc);
        rx_status->freq = hw->conf.chandef.chan->center_freq;
        rx_status->band = hw->conf.chandef.chan->band;
        if (GET_RX_DESC_CRC32(pdesc))
@@ -338,9 +339,8 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw,
        rx_status->flag |= RX_FLAG_MACTIME_START;
        if (stats->decrypted)
                rx_status->flag |= RX_FLAG_DECRYPTED;
-       rx_status->rate_idx = rtlwifi_rate_mapping(hw,
-                                       (bool)GET_RX_DESC_RX_HT(pdesc),
-                                       (u8)GET_RX_DESC_RX_MCS(pdesc));
+       rx_status->rate_idx = rtlwifi_rate_mapping(hw, stats->is_ht,
+                                                  stats->rate);
        rx_status->mactime = GET_RX_DESC_TSFL(pdesc);
        if (phystatus) {
                p_drvinfo = (struct rx_fwinfo_92c *)(skb->data +
@@ -392,6 +392,7 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb)
                                   && (GET_RX_DESC_FAGGR(rxdesc) == 1));
        stats.timestamp_low = GET_RX_DESC_TSFL(rxdesc);
        stats.rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(rxdesc);
+       stats.is_ht = (bool)GET_RX_DESC_RX_HT(rxdesc);
        /* TODO: is center_freq changed when doing scan? */
        /* TODO: Shall we add protection or just skip those two step? */
        rx_status->freq = hw->conf.chandef.chan->center_freq;
@@ -405,9 +406,8 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb)
        if (GET_RX_DESC_RX_HT(rxdesc))
                rx_status->flag |= RX_FLAG_HT;
        /* Data rate */
-       rx_status->rate_idx = rtlwifi_rate_mapping(hw,
-                                       (bool)GET_RX_DESC_RX_HT(rxdesc),
-                                       (u8)GET_RX_DESC_RX_MCS(rxdesc));
+       rx_status->rate_idx = rtlwifi_rate_mapping(hw, stats.is_ht,
+                                                  stats.rate);
        /*  There is a phy status after this rx descriptor. */
        if (GET_RX_DESC_PHY_STATUS(rxdesc)) {
                p_drvinfo = (struct rx_fwinfo_92c *)(rxdesc + RTL_RX_DESC_SIZE);