From: Jes Sorensen Date: Sat, 31 May 2014 16:05:10 +0000 (+0200) Subject: staging: rtl8723au: Use struct ieee80211_mcs_info to describe MCS information X-Git-Tag: firefly_0821_release~176^2~3491^2~2105 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=198e95d548ac741e91521f1e638aa8221bb0f468;p=firefly-linux-kernel-4.4.55.git staging: rtl8723au: Use struct ieee80211_mcs_info to describe MCS information 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c b/drivers/staging/rtl8723au/core/rtw_ieee80211.c index 3dc9119c0694..47ac4e917f2d 100644 --- a/drivers/staging/rtl8723au/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8723au/core/rtw_ieee80211.c @@ -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); } } diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c index cf897c723f4a..30474f513b86 100644 --- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c +++ b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c @@ -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 { diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c index 47a1df013d46..ab59ab72d041 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme.c @@ -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; diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c index 7a117c00e010..6249ab2cf8f1 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c @@ -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 = diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c b/drivers/staging/rtl8723au/core/rtw_wlan_util.c index 579a4a8c8276..b63248bd7f8d 100644 --- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c @@ -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; } diff --git a/drivers/staging/rtl8723au/include/ieee80211.h b/drivers/staging/rtl8723au/include/ieee80211.h index bb645cfa5a39..6f42d2db9ea1 100644 --- a/drivers/staging/rtl8723au/include/ieee80211.h +++ b/drivers/staging/rtl8723au/include/ieee80211.h @@ -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); diff --git a/drivers/staging/rtl8723au/include/wifi.h b/drivers/staging/rtl8723au/include/wifi.h index cccea6a50b3a..f731833566ba 100644 --- a/drivers/staging/rtl8723au/include/wifi.h +++ b/drivers/staging/rtl8723au/include/wifi.h @@ -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;