staging: rtl8723au: Use struct ieee80211_mcs_info to describe MCS information
authorJes Sorensen <Jes.Sorensen@redhat.com>
Sat, 31 May 2014 16:05:10 +0000 (18:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jun 2014 19:35:40 +0000 (12:35 -0700)
The original RTL code defined the MCS information as a 16 byte array
and blindly applied it's masking over the full array, ignoring the
fact that only the first 10 bytes describe the rx_mask and the rest
are different fields.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/core/rtw_ieee80211.c
drivers/staging/rtl8723au/core/rtw_ioctl_set.c
drivers/staging/rtl8723au/core/rtw_mlme.c
drivers/staging/rtl8723au/core/rtw_mlme_ext.c
drivers/staging/rtl8723au/core/rtw_wlan_util.c
drivers/staging/rtl8723au/include/ieee80211.h
drivers/staging/rtl8723au/include/wifi.h

index 3dc9119c0694896c54141a8bf34e779287ad025b..47ac4e917f2d089e3d0471205219995a42ffa9ef 100644 (file)
@@ -924,69 +924,69 @@ void rtw_get_bcn_info23a(struct wlan_network *pnetwork)
 
 /* show MCS rate, unit: 100Kbps */
 u16 rtw_mcs_rate23a(u8 rf_type, u8 bw_40MHz, u8 short_GI_20, u8 short_GI_40,
-                unsigned char * MCS_rate)
+                   struct ieee80211_mcs_info *mcs)
 {
        u16 max_rate = 0;
 
        if (rf_type == RF_1T1R) {
-               if (MCS_rate[0] & BIT(7))
+               if (mcs->rx_mask[0] & BIT(7))
                        max_rate = (bw_40MHz) ? ((short_GI_40)?1500:1350):
                                ((short_GI_20)?722:650);
-               else if (MCS_rate[0] & BIT(6))
+               else if (mcs->rx_mask[0] & BIT(6))
                        max_rate = (bw_40MHz) ? ((short_GI_40)?1350:1215):
                                ((short_GI_20)?650:585);
-               else if (MCS_rate[0] & BIT(5))
+               else if (mcs->rx_mask[0] & BIT(5))
                        max_rate = (bw_40MHz) ? ((short_GI_40)?1200:1080):
                                ((short_GI_20)?578:520);
-               else if (MCS_rate[0] & BIT(4))
+               else if (mcs->rx_mask[0] & BIT(4))
                        max_rate = (bw_40MHz) ? ((short_GI_40)?900:810):
                                ((short_GI_20)?433:390);
-               else if (MCS_rate[0] & BIT(3))
+               else if (mcs->rx_mask[0] & BIT(3))
                        max_rate = (bw_40MHz) ? ((short_GI_40)?600:540):
                                ((short_GI_20)?289:260);
-               else if (MCS_rate[0] & BIT(2))
+               else if (mcs->rx_mask[0] & BIT(2))
                        max_rate = (bw_40MHz) ? ((short_GI_40)?450:405):
                                ((short_GI_20)?217:195);
-               else if (MCS_rate[0] & BIT(1))
+               else if (mcs->rx_mask[0] & BIT(1))
                        max_rate = (bw_40MHz) ? ((short_GI_40)?300:270):
                                ((short_GI_20)?144:130);
-               else if (MCS_rate[0] & BIT(0))
+               else if (mcs->rx_mask[0] & BIT(0))
                        max_rate = (bw_40MHz) ? ((short_GI_40)?150:135):
                                ((short_GI_20)?72:65);
        } else {
-               if (MCS_rate[1]) {
-                       if (MCS_rate[1] & BIT(7))
+               if (mcs->rx_mask[1]) {
+                       if (mcs->rx_mask[1] & BIT(7))
                                max_rate = (bw_40MHz) ? ((short_GI_40)?3000:2700):((short_GI_20)?1444:1300);
-                       else if (MCS_rate[1] & BIT(6))
+                       else if (mcs->rx_mask[1] & BIT(6))
                                max_rate = (bw_40MHz) ? ((short_GI_40)?2700:2430):((short_GI_20)?1300:1170);
-                       else if (MCS_rate[1] & BIT(5))
+                       else if (mcs->rx_mask[1] & BIT(5))
                                max_rate = (bw_40MHz) ? ((short_GI_40)?2400:2160):((short_GI_20)?1156:1040);
-                       else if (MCS_rate[1] & BIT(4))
+                       else if (mcs->rx_mask[1] & BIT(4))
                                max_rate = (bw_40MHz) ? ((short_GI_40)?1800:1620):((short_GI_20)?867:780);
-                       else if (MCS_rate[1] & BIT(3))
+                       else if (mcs->rx_mask[1] & BIT(3))
                                max_rate = (bw_40MHz) ? ((short_GI_40)?1200:1080):((short_GI_20)?578:520);
-                       else if (MCS_rate[1] & BIT(2))
+                       else if (mcs->rx_mask[1] & BIT(2))
                                max_rate = (bw_40MHz) ? ((short_GI_40)?900:810):((short_GI_20)?433:390);
-                       else if (MCS_rate[1] & BIT(1))
+                       else if (mcs->rx_mask[1] & BIT(1))
                                max_rate = (bw_40MHz) ? ((short_GI_40)?600:540):((short_GI_20)?289:260);
-                       else if (MCS_rate[1] & BIT(0))
+                       else if (mcs->rx_mask[1] & BIT(0))
                                max_rate = (bw_40MHz) ? ((short_GI_40)?300:270):((short_GI_20)?144:130);
                } else {
-                       if (MCS_rate[0] & BIT(7))
+                       if (mcs->rx_mask[0] & BIT(7))
                                max_rate = (bw_40MHz) ? ((short_GI_40)?1500:1350):((short_GI_20)?722:650);
-                       else if (MCS_rate[0] & BIT(6))
+                       else if (mcs->rx_mask[0] & BIT(6))
                                max_rate = (bw_40MHz) ? ((short_GI_40)?1350:1215):((short_GI_20)?650:585);
-                       else if (MCS_rate[0] & BIT(5))
+                       else if (mcs->rx_mask[0] & BIT(5))
                                max_rate = (bw_40MHz) ? ((short_GI_40)?1200:1080):((short_GI_20)?578:520);
-                       else if (MCS_rate[0] & BIT(4))
+                       else if (mcs->rx_mask[0] & BIT(4))
                                max_rate = (bw_40MHz) ? ((short_GI_40)?900:810):((short_GI_20)?433:390);
-                       else if (MCS_rate[0] & BIT(3))
+                       else if (mcs->rx_mask[0] & BIT(3))
                                max_rate = (bw_40MHz) ? ((short_GI_40)?600:540):((short_GI_20)?289:260);
-                       else if (MCS_rate[0] & BIT(2))
+                       else if (mcs->rx_mask[0] & BIT(2))
                                max_rate = (bw_40MHz) ? ((short_GI_40)?450:405):((short_GI_20)?217:195);
-                       else if (MCS_rate[0] & BIT(1))
+                       else if (mcs->rx_mask[0] & BIT(1))
                                max_rate = (bw_40MHz) ? ((short_GI_40)?300:270):((short_GI_20)?144:130);
-                       else if (MCS_rate[0] & BIT(0))
+                       else if (mcs->rx_mask[0] & BIT(0))
                                max_rate = (bw_40MHz) ? ((short_GI_40)?150:135):((short_GI_20)?72:65);
                }
        }
index cf897c723f4a0570322d53ecf6e7454bc414e8b5..30474f513b863a046321faa586e0b740b831129e 100644 (file)
@@ -406,7 +406,7 @@ u16 rtw_get_cur_max_rate23a(struct rtw_adapter *adapter)
                        max_rate = rtw_mcs_rate23a(rf_type, bw_40MHz &
                                                pregistrypriv->cbw40_enable,
                                                short_GI_20, short_GI_40,
-                                               pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate
+                                               &pmlmeinfo->HT_caps.u.HT_cap_element.mcs_info
                        );
                }
        } else {
index 47a1df013d46c860db2d1e7bda670f941d57bddc..ab59ab72d0413b7cc3c9019373fc7b9b20b883ec 100644 (file)
@@ -2328,11 +2328,11 @@ void rtw_update_ht_cap23a(struct rtw_adapter *padapter, u8 *pie, uint ie_len)
                rf_type = rtl8723a_get_rf_type(padapter);
 
                /* update the MCS rates */
-               for (i = 0; i < 16; i++) {
+               for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++) {
                        if (rf_type == RF_1T1R || rf_type == RF_1T2R)
-                               pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_1R23A[i];
+                               pmlmeinfo->HT_caps.u.HT_cap_element.mcs_info.rx_mask[i] &= MCS_rate_1R23A[i];
                        else
-                               pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R23A[i];
+                               pmlmeinfo->HT_caps.u.HT_cap_element.mcs_info.rx_mask[i] &= MCS_rate_2R23A[i];
                }
                /* switch to the 40M Hz mode accoring to the AP */
                pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40;
index 7a117c00e010d42b0fa3f2dd45d85ac105e1ad72..6249ab2cf8f19efcc1993de56858d9dbb7e94c50 100644 (file)
@@ -3498,7 +3498,7 @@ static void issue_assocreq(struct rtw_adapter *padapter)
                                if (pregpriv->rx_stbc)
                                        pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info |= cpu_to_le16(0x0100);
 
-                               memcpy(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_rate_1R23A, 16);
+                               memcpy(&pmlmeinfo->HT_caps.u.HT_cap_element.mcs_info, MCS_rate_1R23A, 16);
                                break;
 
                        case RF_2T2R:
@@ -3519,7 +3519,7 @@ static void issue_assocreq(struct rtw_adapter *padapter)
                                                  "STBC\n");
                                        pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info |= cpu_to_le16(0x0200);/* RX STBC two spatial stream */
                                }
-                               memcpy(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_rate_2R23A, 16);
+                               memcpy(&pmlmeinfo->HT_caps.u.HT_cap_element.mcs_info, MCS_rate_2R23A, 16);
                                break;
                        }
                        pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info =
index 579a4a8c8276523d7f49829d912b1a3d46e5fca5..b63248bd7f8d468189ec444d1e5419f096a23652 100644 (file)
@@ -762,13 +762,11 @@ void HT_caps_handler23a(struct rtw_adapter *padapter, u8 *p)
        rf_type = rtl8723a_get_rf_type(padapter);
 
        /* update the MCS rates */
-       for (i = 0; i < 16; i++) {
+       for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++) {
                if (rf_type == RF_1T1R || rf_type == RF_1T2R)
-                       pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &=
-                               MCS_rate_1R23A[i];
+                       pmlmeinfo->HT_caps.u.HT_cap_element.mcs_info.rx_mask[i] &= MCS_rate_1R23A[i];
                else
-                       pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &=
-                               MCS_rate_2R23A[i];
+                       pmlmeinfo->HT_caps.u.HT_cap_element.mcs_info.rx_mask[i] &= MCS_rate_2R23A[i];
        }
        return;
 }
@@ -1344,8 +1342,8 @@ unsigned int update_MSC_rate23a(struct HT_caps_element *pHT_caps)
 {
        unsigned int mask = 0;
 
-       mask = pHT_caps->u.HT_cap_element.MCS_rate[0] << 12 |
-               pHT_caps->u.HT_cap_element.MCS_rate[1] << 20;
+       mask = pHT_caps->u.HT_cap_element.mcs_info.rx_mask[0] << 12 |
+               pHT_caps->u.HT_cap_element.mcs_info.rx_mask[1] << 20;
 
        return mask;
 }
index bb645cfa5a392963e9082197a78a318d32405b50..6f42d2db9ea1bb33adeacf1a39c99277dbd1ae39 100644 (file)
@@ -447,7 +447,8 @@ int rtw_check_network_type23a(unsigned char *rate, int ratelen, int channel);
 
 void rtw_get_bcn_info23a(struct wlan_network *pnetwork);
 
-u16 rtw_mcs_rate23a(u8 rf_type, u8 bw_40MHz, u8 short_GI_20, u8 short_GI_40, unsigned char * MCS_rate);
+u16 rtw_mcs_rate23a(u8 rf_type, u8 bw_40MHz, u8 short_GI_20, u8 short_GI_40,
+                   struct ieee80211_mcs_info *mcs);
 
 const char *action_public_str23a(u8 action);
 
index cccea6a50b3a3d2cfefddd9cbd7c2e10798d147e..f731833566ba2271e6d3a0b7164371b74ec6d35b 100644 (file)
@@ -81,7 +81,7 @@ struct HT_caps_element {
                struct {
                        unsigned short  HT_caps_info;
                        unsigned char   AMPDU_para;
-                       unsigned char   MCS_rate[16];
+                       struct ieee80211_mcs_info mcs_info;
                        unsigned short  HT_ext_caps;
                        unsigned int    Beamforming_caps;
                        unsigned char   ASEL_caps;