Commit 198e95d5 authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman

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: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8b3d9cde
......@@ -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);
}
}
......
......@@ -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 {
......
......@@ -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;
......
......@@ -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 =
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment