* N rate:
  * (rx_status->flag & RX_FLAG_HT) = 1,
  * DESC_RATEMCS0-->DESC_RATEMCS15 ==> idx is 0-->15
+ *
+ * VHT rates:
+ * DESC_RATEVHT1SS_MCS0-->DESC_RATEVHT1SS_MCS9 ==> idx is 0-->9
+ * DESC_RATEVHT2SS_MCS0-->DESC_RATEVHT2SS_MCS9 ==> idx is 0-->9
  */
-int rtlwifi_rate_mapping(struct ieee80211_hw *hw,
-                        bool isht, u8 desc_rate)
+int rtlwifi_rate_mapping(struct ieee80211_hw *hw, bool isht, bool isvht,
+                        u8 desc_rate)
 {
        int rate_idx;
 
+       if (isvht) {
+               switch (desc_rate) {
+               case DESC_RATEVHT1SS_MCS0:
+                       rate_idx = 0;
+                       break;
+               case DESC_RATEVHT1SS_MCS1:
+                       rate_idx = 1;
+                       break;
+               case DESC_RATEVHT1SS_MCS2:
+                       rate_idx = 2;
+                       break;
+               case DESC_RATEVHT1SS_MCS3:
+                       rate_idx = 3;
+                       break;
+               case DESC_RATEVHT1SS_MCS4:
+                       rate_idx = 4;
+                       break;
+               case DESC_RATEVHT1SS_MCS5:
+                       rate_idx = 5;
+                       break;
+               case DESC_RATEVHT1SS_MCS6:
+                       rate_idx = 6;
+                       break;
+               case DESC_RATEVHT1SS_MCS7:
+                       rate_idx = 7;
+                       break;
+               case DESC_RATEVHT1SS_MCS8:
+                       rate_idx = 8;
+                       break;
+               case DESC_RATEVHT1SS_MCS9:
+                       rate_idx = 9;
+                       break;
+               case DESC_RATEVHT2SS_MCS0:
+                       rate_idx = 0;
+                       break;
+               case DESC_RATEVHT2SS_MCS1:
+                       rate_idx = 1;
+                       break;
+               case DESC_RATEVHT2SS_MCS2:
+                       rate_idx = 2;
+                       break;
+               case DESC_RATEVHT2SS_MCS3:
+                       rate_idx = 3;
+                       break;
+               case DESC_RATEVHT2SS_MCS4:
+                       rate_idx = 4;
+                       break;
+               case DESC_RATEVHT2SS_MCS5:
+                       rate_idx = 5;
+                       break;
+               case DESC_RATEVHT2SS_MCS6:
+                       rate_idx = 6;
+                       break;
+               case DESC_RATEVHT2SS_MCS7:
+                       rate_idx = 7;
+                       break;
+               case DESC_RATEVHT2SS_MCS8:
+                       rate_idx = 8;
+                       break;
+               case DESC_RATEVHT2SS_MCS9:
+                       rate_idx = 9;
+                       break;
+               default:
+                       rate_idx = 0;
+                       break;
+               }
+               return rate_idx;
+       }
        if (false == isht) {
                if (IEEE80211_BAND_2GHZ == hw->conf.chandef.chan->band) {
                        switch (desc_rate) {
 
 void rtl_deinit_deferred_work(struct ieee80211_hw *hw);
 
 bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx);
-int rtlwifi_rate_mapping(struct ieee80211_hw *hw,
-                        bool isht, u8 desc_rate);
+int rtlwifi_rate_mapping(struct ieee80211_hw *hw, bool isht,
+                        bool isvht, u8 desc_rate);
 bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb);
 u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx);
 
 
         * Notice: this is diff with windows define
         */
        rx_status->rate_idx = rtlwifi_rate_mapping(hw, status->is_ht,
-                                                  status->rate);
+                                                  false, status->rate);
 
        rx_status->mactime = status->timestamp_low;
        if (phystatus == true) {
 
         * Notice: this is diff with windows define
         */
        rx_status->rate_idx = rtlwifi_rate_mapping(hw, stats->is_ht,
-                                                  stats->rate);
+                                                  false, stats->rate);
 
        rx_status->mactime = stats->timestamp_low;
        if (phystatus) {
 
        if (stats->decrypted)
                rx_status->flag |= RX_FLAG_DECRYPTED;
        rx_status->rate_idx = rtlwifi_rate_mapping(hw, stats->is_ht,
-                                                  stats->rate);
+                                                  false, stats->rate);
        rx_status->mactime = GET_RX_DESC_TSFL(pdesc);
        if (phystatus) {
                p_drvinfo = (struct rx_fwinfo_92c *)(skb->data +
                rx_status->flag |= RX_FLAG_HT;
        /* Data rate */
        rx_status->rate_idx = rtlwifi_rate_mapping(hw, stats.is_ht,
-                                                  stats.rate);
+                                                  false, 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);
 
        if (stats->decrypted)
                rx_status->flag |= RX_FLAG_DECRYPTED;
        rx_status->rate_idx = rtlwifi_rate_mapping(hw, stats->is_ht,
-                                                  stats->rate);
+                                                  false, stats->rate);
        rx_status->mactime = GET_RX_DESC_TSFL(pdesc);
        if (phystatus) {
                p_drvinfo = (struct rx_fwinfo_92d *)(skb->data +
 
         * Notice: this is diff with windows define
         */
        rx_status->rate_idx = rtlwifi_rate_mapping(hw, status->is_ht,
-                                                  status->rate);
+                                                  false, status->rate);
 
        rx_status->mactime = status->timestamp_low;
        if (phystatus) {
 
        }
 
        rx_status->rate_idx = rtlwifi_rate_mapping(hw, stats->is_ht,
-                                                  stats->rate);
+                                                  false, stats->rate);
 
        rx_status->mactime = stats->timestamp_low;
        if (phystatus) {
 
         * Notice: this is diff with windows define
         */
        rx_status->rate_idx = rtlwifi_rate_mapping(hw, status->is_ht,
-                                                  status->rate);
+                                                  false, status->rate);
 
        rx_status->mactime = status->timestamp_low;
        if (phystatus == true) {
 
         * are use (RX_FLAG_HT)
         */
        rx_status->rate_idx = rtlwifi_rate_mapping(hw, status->is_ht,
-                                                     status->rate);
+                                                  false, status->rate);
 
        rx_status->mactime = status->timestamp_low;
        if (phystatus) {
 
        return skb->priority;
 }
 
-/* mac80211's rate_idx is like this:
- *
- * 2.4G band:rx_status->band == IEEE80211_BAND_2GHZ
- *
- * B/G rate:
- * (rx_status->flag & RX_FLAG_HT) = 0,
- * DESC_RATE1M-->DESC_RATE54M ==> idx is 0-->11,
- *
- * N rate:
- * (rx_status->flag & RX_FLAG_HT) = 1,
- * DESC_RATEMCS0-->DESC_RATEMCS15 ==> idx is 0-->15
- *
- * 5G band:rx_status->band == IEEE80211_BAND_5GHZ
- * A rate:
- * (rx_status->flag & RX_FLAG_HT) = 0,
- * DESC_RATE6M-->DESC_RATE54M ==> idx is 0-->7,
- *
- * N rate:
- * (rx_status->flag & RX_FLAG_HT) = 1,
- * DESC_RATEMCS0-->DESC_RATEMCS15 ==> idx is 0-->15
- */
-static int _rtl8821ae_rate_mapping(struct ieee80211_hw *hw,
-                                  bool isht, bool isvht, u8 desc_rate)
-{
-       int rate_idx;
-
-       if (!isht) {
-               if (IEEE80211_BAND_2GHZ == hw->conf.chandef.chan->band) {
-                       switch (desc_rate) {
-                       case DESC_RATE1M:
-                               rate_idx = 0;
-                               break;
-                       case DESC_RATE2M:
-                               rate_idx = 1;
-                               break;
-                       case DESC_RATE5_5M:
-                               rate_idx = 2;
-                               break;
-                       case DESC_RATE11M:
-                               rate_idx = 3;
-                               break;
-                       case DESC_RATE6M:
-                               rate_idx = 4;
-                               break;
-                       case DESC_RATE9M:
-                               rate_idx = 5;
-                               break;
-                       case DESC_RATE12M:
-                               rate_idx = 6;
-                               break;
-                       case DESC_RATE18M:
-                               rate_idx = 7;
-                               break;
-                       case DESC_RATE24M:
-                               rate_idx = 8;
-                               break;
-                       case DESC_RATE36M:
-                               rate_idx = 9;
-                               break;
-                       case DESC_RATE48M:
-                               rate_idx = 10;
-                               break;
-                       case DESC_RATE54M:
-                               rate_idx = 11;
-                               break;
-                       default:
-                               rate_idx = 0;
-                               break;
-                       }
-               } else {
-                       switch (desc_rate) {
-                       case DESC_RATE6M:
-                               rate_idx = 0;
-                               break;
-                       case DESC_RATE9M:
-                               rate_idx = 1;
-                               break;
-                       case DESC_RATE12M:
-                               rate_idx = 2;
-                               break;
-                       case DESC_RATE18M:
-                               rate_idx = 3;
-                               break;
-                       case DESC_RATE24M:
-                               rate_idx = 4;
-                               break;
-                       case DESC_RATE36M:
-                               rate_idx = 5;
-                               break;
-                       case DESC_RATE48M:
-                               rate_idx = 6;
-                               break;
-                       case DESC_RATE54M:
-                               rate_idx = 7;
-                               break;
-                       default:
-                               rate_idx = 0;
-                               break;
-                       }
-               }
-       } else {
-               switch (desc_rate) {
-               case DESC_RATEMCS0:
-                       rate_idx = 0;
-                       break;
-               case DESC_RATEMCS1:
-                       rate_idx = 1;
-                       break;
-               case DESC_RATEMCS2:
-                       rate_idx = 2;
-                       break;
-               case DESC_RATEMCS3:
-                       rate_idx = 3;
-                       break;
-               case DESC_RATEMCS4:
-                       rate_idx = 4;
-                       break;
-               case DESC_RATEMCS5:
-                       rate_idx = 5;
-                       break;
-               case DESC_RATEMCS6:
-                       rate_idx = 6;
-                       break;
-               case DESC_RATEMCS7:
-                       rate_idx = 7;
-                       break;
-               case DESC_RATEMCS8:
-                       rate_idx = 8;
-                       break;
-               case DESC_RATEMCS9:
-                       rate_idx = 9;
-                       break;
-               case DESC_RATEMCS10:
-                       rate_idx = 10;
-                       break;
-               case DESC_RATEMCS11:
-                       rate_idx = 11;
-                       break;
-               case DESC_RATEMCS12:
-                       rate_idx = 12;
-                       break;
-               case DESC_RATEMCS13:
-                       rate_idx = 13;
-                       break;
-               case DESC_RATEMCS14:
-                       rate_idx = 14;
-                       break;
-               case DESC_RATEMCS15:
-                       rate_idx = 15;
-                       break;
-               default:
-                       rate_idx = 0;
-                       break;
-               }
-       }
-
-       if (isvht) {
-               switch (desc_rate) {
-               case DESC_RATEVHT1SS_MCS0:
-                       rate_idx = 0;
-                       break;
-               case DESC_RATEVHT1SS_MCS1:
-                       rate_idx = 1;
-                       break;
-               case DESC_RATEVHT1SS_MCS2:
-                       rate_idx = 2;
-                       break;
-               case DESC_RATEVHT1SS_MCS3:
-                       rate_idx = 3;
-                       break;
-               case DESC_RATEVHT1SS_MCS4:
-                       rate_idx = 4;
-                       break;
-               case DESC_RATEVHT1SS_MCS5:
-                       rate_idx = 5;
-                       break;
-               case DESC_RATEVHT1SS_MCS6:
-                       rate_idx = 6;
-                       break;
-               case DESC_RATEVHT1SS_MCS7:
-                       rate_idx = 7;
-                       break;
-               case DESC_RATEVHT1SS_MCS8:
-                       rate_idx = 8;
-                       break;
-               case DESC_RATEVHT1SS_MCS9:
-                       rate_idx = 9;
-                       break;
-               case DESC_RATEVHT2SS_MCS0:
-                       rate_idx = 0;
-                       break;
-               case DESC_RATEVHT2SS_MCS1:
-                       rate_idx = 1;
-                       break;
-               case DESC_RATEVHT2SS_MCS2:
-                       rate_idx = 2;
-                       break;
-               case DESC_RATEVHT2SS_MCS3:
-                       rate_idx = 3;
-                       break;
-               case DESC_RATEVHT2SS_MCS4:
-                       rate_idx = 4;
-                       break;
-               case DESC_RATEVHT2SS_MCS5:
-                       rate_idx = 5;
-                       break;
-               case DESC_RATEVHT2SS_MCS6:
-                       rate_idx = 6;
-                       break;
-               case DESC_RATEVHT2SS_MCS7:
-                       rate_idx = 7;
-                       break;
-               case DESC_RATEVHT2SS_MCS8:
-                       rate_idx = 8;
-                       break;
-               case DESC_RATEVHT2SS_MCS9:
-                       rate_idx = 9;
-                       break;
-               default:
-                       rate_idx = 0;
-                       break;
-               }
-       }
-       return rate_idx;
-}
-
 static u16 odm_cfo(char value)
 {
        int ret_val;
         * supported rates or MCS index if HT rates
         * are use (RX_FLAG_HT)
         */
-       rx_status->rate_idx =
-         _rtl8821ae_rate_mapping(hw, status->is_ht,
-                                 status->is_vht, status->rate);
+       rx_status->rate_idx = rtlwifi_rate_mapping(hw, status->is_ht,
+                                                  status->is_vht,
+                                                  status->rate);
 
        rx_status->mactime = status->timestamp_low;
        if (phystatus) {