[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20160824082150.GA26455@alpha.sfu-kras.ru>
Date: Wed, 24 Aug 2016 15:21:50 +0700
From: Ivan Safonov <insafonov@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Arnd Bergmann <arnd@...db.de>,
Binoy Jayan <binoy.jayan@...aro.org>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Cc: Ivan Safonov <insafonov@...il.com>
Subject: [PATCH 23/41] staging: r8188eu: simplify HT_caps_element structure
Now HT_caps_element structure is similar to ieee80211_ht_caps.
Signed-off-by: Ivan Safonov <insafonov@...il.com>
---
drivers/staging/rtl8188eu/core/rtw_ap.c | 6 +++---
drivers/staging/rtl8188eu/core/rtw_ioctl_set.c | 6 +++---
drivers/staging/rtl8188eu/core/rtw_mlme.c | 8 ++++----
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 18 +++++++++---------
drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 24 ++++++++++++------------
drivers/staging/rtl8188eu/include/wifi.h | 16 ++++++----------
6 files changed, 37 insertions(+), 41 deletions(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c
index a148e7d..be4d624 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -709,9 +709,9 @@ static void update_hw_ht_param(struct adapter *padapter)
AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k
AMPDU_para [4:2]:Min MPDU Start Spacing
*/
- max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03;
+ max_AMPDU_len = pmlmeinfo->HT_caps.AMPDU_para & 0x03;
- min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) >> 2;
+ min_MPDU_spacing = (pmlmeinfo->HT_caps.AMPDU_para & 0x1c) >> 2;
rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 *)(&min_MPDU_spacing));
@@ -720,7 +720,7 @@ static void update_hw_ht_param(struct adapter *padapter)
/* */
/* Config SM Power Save setting */
/* */
- pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) & 0x0C) >> 2;
+ pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.HT_caps_info) & 0x0C) >> 2;
if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC)
DBG_88E("%s(): WLAN_HT_CAP_SM_PS_STATIC\n", __func__);
}
diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
index 62b2f71..a830752 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
@@ -588,8 +588,8 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter)
/* cur_bwmod is updated by beacon, pmlmeinfo is updated by association response */
bw_40MHz = (pmlmeext->cur_bwmode && (HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH & pmlmeinfo->HT_info.infos[0])) ? 1 : 0;
- short_GI_20 = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) & IEEE80211_HT_CAP_SGI_20) ? 1 : 0;
- short_GI_40 = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) & IEEE80211_HT_CAP_SGI_40) ? 1 : 0;
+ short_GI_20 = (le16_to_cpu(pmlmeinfo->HT_caps.HT_caps_info) & IEEE80211_HT_CAP_SGI_20) ? 1 : 0;
+ short_GI_40 = (le16_to_cpu(pmlmeinfo->HT_caps.HT_caps_info) & IEEE80211_HT_CAP_SGI_40) ? 1 : 0;
rtw_hal_get_hwreg(adapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
max_rate = rtw_mcs_rate(
@@ -597,7 +597,7 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter)
bw_40MHz & (pregistrypriv->cbw40_enable),
short_GI_20,
short_GI_40,
- pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate
+ pmlmeinfo->HT_caps.MCS_rate
);
}
} else {
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index 4979c61..03baaa1 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -2044,7 +2044,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len)
/* update cur_bwmode & cur_ch_offset */
if ((pregistrypriv->cbw40_enable) &&
- (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) & BIT(1)) &&
+ (le16_to_cpu(pmlmeinfo->HT_caps.HT_caps_info) & BIT(1)) &&
(pmlmeinfo->HT_info.infos[0] & BIT(2))) {
int i;
u8 rf_type;
@@ -2054,9 +2054,9 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len)
/* update the MCS rates */
for (i = 0; i < 16; i++) {
if ((rf_type == RF_1T1R) || (rf_type == RF_1T2R))
- pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i];
+ pmlmeinfo->HT_caps.MCS_rate[i] &= MCS_rate_1R[i];
else
- pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R[i];
+ pmlmeinfo->HT_caps.MCS_rate[i] &= MCS_rate_2R[i];
}
/* switch to the 40M Hz mode according to the AP */
pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40;
@@ -2074,7 +2074,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len)
}
/* Config SM Power Save setting */
- pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) & 0x0C) >> 2;
+ pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.HT_caps_info) & 0x0C) >> 2;
if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC)
DBG_88E("%s(): WLAN_HT_CAP_SM_PS_STATIC\n", __func__);
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index 91e7b36..5b7cb48 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -1136,19 +1136,19 @@ static void issue_assocreq(struct adapter *padapter)
/* to disable 40M Hz support while gd_bw_40MHz_en = 0 */
if (pregpriv->cbw40_enable == 0)
- pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info &= cpu_to_le16(~(BIT(6) | BIT(1)));
+ pmlmeinfo->HT_caps.HT_caps_info &= cpu_to_le16(~(BIT(6) | BIT(1)));
else
- pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info |= cpu_to_le16(BIT(1));
+ pmlmeinfo->HT_caps.HT_caps_info |= cpu_to_le16(BIT(1));
/* todo: disable SM power save mode */
- pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info |= cpu_to_le16(0x000c);
+ pmlmeinfo->HT_caps.HT_caps_info |= cpu_to_le16(0x000c);
rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
switch (rf_type) {
case RF_1T1R:
if (pregpriv->rx_stbc)
- pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info |= cpu_to_le16(0x0100);/* RX STBC One spatial stream */
- memcpy(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_rate_1R, 16);
+ pmlmeinfo->HT_caps.HT_caps_info |= cpu_to_le16(0x0100);/* RX STBC One spatial stream */
+ memcpy(pmlmeinfo->HT_caps.MCS_rate, MCS_rate_1R, 16);
break;
case RF_2T2R:
case RF_1T2R:
@@ -1157,9 +1157,9 @@ static void issue_assocreq(struct adapter *padapter)
((pmlmeext->cur_wireless_mode & WIRELESS_11_24N) && (pregpriv->rx_stbc == 0x1)) || /* enable for 2.4GHz */
(pregpriv->wifi_spec == 1)) {
DBG_88E("declare supporting RX STBC\n");
- pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info |= cpu_to_le16(0x0200);/* RX STBC two spatial stream */
+ pmlmeinfo->HT_caps.HT_caps_info |= cpu_to_le16(0x0200);/* RX STBC two spatial stream */
}
- memcpy(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_rate_2R, 16);
+ memcpy(pmlmeinfo->HT_caps.MCS_rate, MCS_rate_2R, 16);
break;
}
pframe = rtw_set_ie(pframe, _HT_CAPABILITY_IE_, ie_len , (u8 *)(&(pmlmeinfo->HT_caps)), &(pattrib->pktlen));
@@ -2192,7 +2192,7 @@ static u8 collect_bss_info(struct adapter *padapter,
struct HT_caps_element *pHT_caps;
pHT_caps = (struct HT_caps_element *)(p + 2);
- if (le16_to_cpu(pHT_caps->u.HT_cap_element.HT_caps_info)&BIT(14))
+ if (le16_to_cpu(pHT_caps->HT_caps_info) & BIT(14))
pmlmepriv->num_FortyMHzIntolerant++;
} else {
pmlmepriv->num_sta_no_ht++;
@@ -4479,7 +4479,7 @@ void update_sta_info(struct adapter *padapter, struct sta_info *psta)
psta->htpriv.ampdu_enable = pmlmepriv->htpriv.ampdu_enable;
- if (support_short_GI(padapter, &(pmlmeinfo->HT_caps)))
+ if (support_short_GI(padapter, &pmlmeinfo->HT_caps))
psta->htpriv.sgi = true;
psta->qos_option = true;
diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index c07e4cb..8994e45 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -716,7 +716,7 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct ht_priv *phtpriv = &pmlmepriv->htpriv;
- u8 *HT_cap = (u8 *)(&pmlmeinfo->HT_caps.u.HT_cap_element);
+ u8 *HT_cap = (u8 *)(&pmlmeinfo->HT_caps);
if (pIE == NULL)
return;
@@ -732,17 +732,17 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
HT_cap[i] &= (pIE->data[i]);
} else {
/* modify from fw by Thomas 2010/11/17 */
- if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3) > (pIE->data[i] & 0x3))
+ if ((pmlmeinfo->HT_caps.AMPDU_para & 0x3) > (pIE->data[i] & 0x3))
max_AMPDU_len = pIE->data[i] & 0x3;
else
- max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3;
+ max_AMPDU_len = pmlmeinfo->HT_caps.AMPDU_para & 0x3;
- if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) > (pIE->data[i] & 0x1c))
- min_MPDU_spacing = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c;
+ if ((pmlmeinfo->HT_caps.AMPDU_para & 0x1c) > (pIE->data[i] & 0x1c))
+ min_MPDU_spacing = pmlmeinfo->HT_caps.AMPDU_para & 0x1c;
else
min_MPDU_spacing = pIE->data[i] & 0x1c;
- pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para = max_AMPDU_len | min_MPDU_spacing;
+ pmlmeinfo->HT_caps.AMPDU_para = max_AMPDU_len | min_MPDU_spacing;
}
}
@@ -751,9 +751,9 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
/* update the MCS rates */
for (i = 0; i < 16; i++) {
if ((rf_type == RF_1T1R) || (rf_type == RF_1T2R))
- pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i];
+ pmlmeinfo->HT_caps.MCS_rate[i] &= MCS_rate_1R[i];
else
- pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R[i];
+ pmlmeinfo->HT_caps.MCS_rate[i] &= MCS_rate_2R[i];
}
}
@@ -799,9 +799,9 @@ void HTOnAssocRsp(struct adapter *padapter)
AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k
AMPDU_para [4:2]:Min MPDU Start Spacing
*/
- max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03;
+ max_AMPDU_len = pmlmeinfo->HT_caps.AMPDU_para & 0x03;
- min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) >> 2;
+ min_MPDU_spacing = (pmlmeinfo->HT_caps.AMPDU_para & 0x1c) >> 2;
rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 *)(&min_MPDU_spacing));
@@ -1249,7 +1249,7 @@ unsigned int update_MSC_rate(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->MCS_rate[0] << 12) | (pHT_caps->MCS_rate[1] << 20);
return mask;
}
@@ -1268,7 +1268,7 @@ int support_short_GI(struct adapter *padapter, struct HT_caps_element *pHT_caps)
bit_offset = (pmlmeext->cur_bwmode & HT_CHANNEL_WIDTH_40) ? 6 : 5;
- if (__le16_to_cpu(pHT_caps->u.HT_cap_element.HT_caps_info) & (0x1 << bit_offset))
+ if (__le16_to_cpu(pHT_caps->HT_caps_info) & (0x1 << bit_offset))
return _SUCCESS;
else
return _FAIL;
diff --git a/drivers/staging/rtl8188eu/include/wifi.h b/drivers/staging/rtl8188eu/include/wifi.h
index 27276fe..28e1dde 100644
--- a/drivers/staging/rtl8188eu/include/wifi.h
+++ b/drivers/staging/rtl8188eu/include/wifi.h
@@ -523,16 +523,12 @@ struct ieee80211_ht_addt_info {
} __packed;
struct HT_caps_element {
- union {
- struct {
- __le16 HT_caps_info;
- unsigned char AMPDU_para;
- unsigned char MCS_rate[16];
- unsigned short HT_ext_caps;
- unsigned int Beamforming_caps;
- unsigned char ASEL_caps;
- } HT_cap_element;
- } u;
+ __le16 HT_caps_info;
+ unsigned char AMPDU_para;
+ unsigned char MCS_rate[16];
+ unsigned short HT_ext_caps;
+ unsigned int Beamforming_caps;
+ unsigned char ASEL_caps;
} __packed;
struct HT_info_element {
--
2.7.3
Powered by blists - more mailing lists