237 lines
10 KiB
Diff
237 lines
10 KiB
Diff
|
From: Jes Sorensen <Jes.Sorensen@redhat.com>
|
||
|
Date: Sat, 31 May 2014 18:05:10 +0200
|
||
|
Subject: [011/249] staging: rtl8723au: Use struct ieee80211_mcs_info to
|
||
|
describe MCS information
|
||
|
Origin: https://git.kernel.org/linus/198e95d548ac741e91521f1e638aa8221bb0f468
|
||
|
|
||
|
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 | 52 +++++++++++++-------------
|
||
|
drivers/staging/rtl8723au/core/rtw_ioctl_set.c | 2 +-
|
||
|
drivers/staging/rtl8723au/core/rtw_mlme.c | 6 +--
|
||
|
drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 4 +-
|
||
|
drivers/staging/rtl8723au/core/rtw_wlan_util.c | 12 +++---
|
||
|
drivers/staging/rtl8723au/include/ieee80211.h | 3 +-
|
||
|
drivers/staging/rtl8723au/include/wifi.h | 2 +-
|
||
|
7 files changed, 40 insertions(+), 41 deletions(-)
|
||
|
|
||
|
diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
|
||
|
index 3dc9119..47ac4e9 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 cf897c7..30474f5 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 47a1df0..ab59ab7 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 7a117c0..6249ab2 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 579a4a8..b63248b 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 bb645cf..6f42d2d 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 cccea6a..f731833 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;
|