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

staging: rtl8723au: rtw_wlan_util.c: Clean up the code

Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7ae25994
......@@ -34,27 +34,33 @@ static unsigned char EPIGRAM_OUI[] = {0x00, 0x90, 0x4c};
unsigned char REALTEK_96B_IE23A[] = {0x00, 0xe0, 0x4c, 0x02, 0x01, 0x20};
#define R2T_PHY_DELAY (0)
#define R2T_PHY_DELAY 0
/* define WAIT_FOR_BCN_TO_MIN (3000) */
#define WAIT_FOR_BCN_TO_MIN (6000)
#define WAIT_FOR_BCN_TO_MAX (20000)
/* define WAIT_FOR_BCN_TO_MIN 3000 */
#define WAIT_FOR_BCN_TO_MIN 6000
#define WAIT_FOR_BCN_TO_MAX 20000
static u8 rtw_basic_rate_cck[4] = {
IEEE80211_CCK_RATE_1MB|IEEE80211_BASIC_RATE_MASK, IEEE80211_CCK_RATE_2MB|IEEE80211_BASIC_RATE_MASK,
IEEE80211_CCK_RATE_5MB|IEEE80211_BASIC_RATE_MASK, IEEE80211_CCK_RATE_11MB|IEEE80211_BASIC_RATE_MASK
IEEE80211_CCK_RATE_1MB | IEEE80211_BASIC_RATE_MASK,
IEEE80211_CCK_RATE_2MB | IEEE80211_BASIC_RATE_MASK,
IEEE80211_CCK_RATE_5MB | IEEE80211_BASIC_RATE_MASK,
IEEE80211_CCK_RATE_11MB | IEEE80211_BASIC_RATE_MASK
};
static u8 rtw_basic_rate_ofdm[3] = {
IEEE80211_OFDM_RATE_6MB|IEEE80211_BASIC_RATE_MASK, IEEE80211_OFDM_RATE_12MB|IEEE80211_BASIC_RATE_MASK,
IEEE80211_OFDM_RATE_24MB|IEEE80211_BASIC_RATE_MASK
IEEE80211_OFDM_RATE_6MB | IEEE80211_BASIC_RATE_MASK,
IEEE80211_OFDM_RATE_12MB | IEEE80211_BASIC_RATE_MASK,
IEEE80211_OFDM_RATE_24MB | IEEE80211_BASIC_RATE_MASK
};
static u8 rtw_basic_rate_mix[7] = {
IEEE80211_CCK_RATE_1MB|IEEE80211_BASIC_RATE_MASK, IEEE80211_CCK_RATE_2MB|IEEE80211_BASIC_RATE_MASK,
IEEE80211_CCK_RATE_5MB|IEEE80211_BASIC_RATE_MASK, IEEE80211_CCK_RATE_11MB|IEEE80211_BASIC_RATE_MASK,
IEEE80211_OFDM_RATE_6MB|IEEE80211_BASIC_RATE_MASK, IEEE80211_OFDM_RATE_12MB|IEEE80211_BASIC_RATE_MASK,
IEEE80211_OFDM_RATE_24MB|IEEE80211_BASIC_RATE_MASK
IEEE80211_CCK_RATE_1MB | IEEE80211_BASIC_RATE_MASK,
IEEE80211_CCK_RATE_2MB | IEEE80211_BASIC_RATE_MASK,
IEEE80211_CCK_RATE_5MB | IEEE80211_BASIC_RATE_MASK,
IEEE80211_CCK_RATE_11MB | IEEE80211_BASIC_RATE_MASK,
IEEE80211_OFDM_RATE_6MB | IEEE80211_BASIC_RATE_MASK,
IEEE80211_OFDM_RATE_12MB | IEEE80211_BASIC_RATE_MASK,
IEEE80211_OFDM_RATE_24MB | IEEE80211_BASIC_RATE_MASK
};
int cckrates_included23a(unsigned char *rate, int ratelen)
......@@ -62,8 +68,8 @@ int cckrates_included23a(unsigned char *rate, int ratelen)
int i;
for (i = 0; i < ratelen; i++) {
if ((((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) ||
(((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22))
if (((rate[i]) & 0x7f) == 2 || ((rate[i]) & 0x7f) == 4 ||
((rate[i]) & 0x7f) == 11 || ((rate[i]) & 0x7f) == 22)
return true;
}
......@@ -75,8 +81,8 @@ int cckratesonly_included23a(unsigned char *rate, int ratelen)
int i;
for (i = 0; i < ratelen; i++) {
if ((((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) &&
(((rate[i]) & 0x7f) != 11) && (((rate[i]) & 0x7f) != 22))
if (((rate[i]) & 0x7f) != 2 && ((rate[i]) & 0x7f) != 4 &&
((rate[i]) & 0x7f) != 11 && ((rate[i]) & 0x7f) != 22)
return false;
}
......@@ -116,7 +122,8 @@ unsigned char networktype_to_raid23a(unsigned char network_type)
return raid;
}
u8 judge_network_type23a(struct rtw_adapter *padapter, unsigned char *rate, int ratelen)
u8 judge_network_type23a(struct rtw_adapter *padapter,
unsigned char *rate, int ratelen)
{
u8 network_type = 0;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
......@@ -194,7 +201,7 @@ static int is_basicrate(struct rtw_adapter *padapter, unsigned char rate)
for (i = 0; i < NumRates; i++) {
val = pmlmeext->basicrate[i];
if ((val != 0xff) && (val != 0xfe)) {
if (val != 0xff && val != 0xfe) {
if (rate == ratetbl_val_2wifirate(val))
return true;
}
......@@ -233,7 +240,8 @@ static unsigned int ratetbl2rateset(struct rtw_adapter *padapter,
return len;
}
void get_rate_set23a(struct rtw_adapter *padapter, unsigned char *pbssrate, int *bssrate_len)
void get_rate_set23a(struct rtw_adapter *padapter,
unsigned char *pbssrate, int *bssrate_len)
{
unsigned char supportedrates[NumRates];
......@@ -351,10 +359,11 @@ void set_channel_bwmode23a(struct rtw_adapter *padapter, unsigned char channel,
u8 center_ch;
if (padapter->bNotifyChannelChange)
DBG_8723A("[%s] ch = %d, offset = %d, bwmode = %d\n", __func__, channel, channel_offset, bwmode);
DBG_8723A("[%s] ch = %d, offset = %d, bwmode = %d\n",
__func__, channel, channel_offset, bwmode);
if ((bwmode == HT_CHANNEL_WIDTH_20) ||
(channel_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE)) {
if (bwmode == HT_CHANNEL_WIDTH_20 ||
channel_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE) {
/* SelectChannel23a(padapter, channel); */
center_ch = channel;
} else {
......@@ -400,7 +409,7 @@ inline u8 *get_my_bssid23a(struct wlan_bssid_ex *pnetwork)
u16 get_beacon_interval23a(struct wlan_bssid_ex *bss)
{
unsigned short val;
memcpy((unsigned char *)&val, rtw_get_beacon_interval23a_from_ie(bss->IEs), 2);
memcpy(&val, rtw_get_beacon_interval23a_from_ie(bss->IEs), 2);
return le16_to_cpu(val);
}
......@@ -416,7 +425,8 @@ int is_client_associated_to_ap23a(struct rtw_adapter *padapter)
pmlmeext = &padapter->mlmeextpriv;
pmlmeinfo = &pmlmeext->mlmext_info;
if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE))
if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS &&
(pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE)
return true;
else
return _FAIL;
......@@ -427,8 +437,8 @@ int is_client_associated_to_ibss23a(struct rtw_adapter *padapter)
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) &&
((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE))
if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS &&
(pmlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE)
return true;
else
return _FAIL;
......@@ -467,7 +477,9 @@ void clear_cam_entry23a(struct rtw_adapter *padapter, u8 entry)
{
unsigned char null_sta[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
unsigned char null_key[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
unsigned char null_key[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00};
rtl8723a_cam_write(padapter, entry, 0, null_sta, null_key);
}
......@@ -496,10 +508,11 @@ void flush_all_cam_entry23a(struct rtw_adapter *padapter)
rtl8723a_cam_invalid_all(padapter);
memset((u8 *)(pmlmeinfo->FW_sta_info), 0, sizeof(pmlmeinfo->FW_sta_info));
memset(pmlmeinfo->FW_sta_info, 0, sizeof(pmlmeinfo->FW_sta_info));
}
int WMM_param_handler23a(struct rtw_adapter *padapter, struct ndis_802_11_var_ies * pIE)
int WMM_param_handler23a(struct rtw_adapter *padapter,
struct ndis_802_11_var_ies *pIE)
{
/* struct registry_priv *pregpriv = &padapter->registrypriv; */
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
......@@ -546,9 +559,10 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter)
ACM = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 4) & 0x01;
/* AIFS = AIFSN * slot time + SIFS - r2t phy delay */
AIFS = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN & 0x0f) * pmlmeinfo->slotTime + aSifsTime;
AIFS = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN & 0x0f) *
pmlmeinfo->slotTime + aSifsTime;
ECWMin = (pmlmeinfo->WMM_param.ac_param[i].CW & 0x0f);
ECWMin = pmlmeinfo->WMM_param.ac_param[i].CW & 0x0f;
ECWMax = (pmlmeinfo->WMM_param.ac_param[i].CW & 0xf0) >> 4;
TXOP = le16_to_cpu(pmlmeinfo->WMM_param.ac_param[i].TXOP_limit);
......@@ -596,7 +610,8 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter)
/* compare CW and AIFS */
if ((edca[j] & 0xFFFF) < (edca[i] & 0xFFFF)) {
change_inx = true;
} else if ((edca[j] & 0xFFFF) == (edca[i] & 0xFFFF)) {
} else if ((edca[j] & 0xFFFF) ==
(edca[i] & 0xFFFF)) {
/* compare TXOP */
if ((edca[j] >> 16) > (edca[i] >> 16))
change_inx = true;
......@@ -619,13 +634,15 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter)
for (i = 0; i<4; i++) {
pxmitpriv->wmm_para_seq[i] = inx[i];
DBG_8723A("wmm_para_seq(%d): %d\n", i, pxmitpriv->wmm_para_seq[i]);
DBG_8723A("wmm_para_seq(%d): %d\n", i,
pxmitpriv->wmm_para_seq[i]);
}
return;
}
static void bwmode_update_check(struct rtw_adapter *padapter, struct ndis_802_11_var_ies * pIE)
static void bwmode_update_check(struct rtw_adapter *padapter,
struct ndis_802_11_var_ies *pIE)
{
struct HT_info_element *pHT_info;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
......@@ -664,8 +681,8 @@ static void bwmode_update_check(struct rtw_adapter *padapter, struct ndis_802_11
new_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
}
if ((new_bwmode!= pmlmeext->cur_bwmode) ||
(new_ch_offset!= pmlmeext->cur_ch_offset)) {
if (new_bwmode != pmlmeext->cur_bwmode ||
new_ch_offset != pmlmeext->cur_ch_offset) {
pmlmeinfo->bwmode_updated = true;
pmlmeext->cur_bwmode = new_bwmode;
......@@ -673,16 +690,16 @@ static void bwmode_update_check(struct rtw_adapter *padapter, struct ndis_802_11
/* update HT info also */
HT_info_handler23a(padapter, pIE);
} else {
} else
pmlmeinfo->bwmode_updated = false;
}
if (pmlmeinfo->bwmode_updated) {
struct sta_info *psta;
struct wlan_bssid_ex *cur_network = &pmlmeinfo->network;
struct sta_priv *pstapriv = &padapter->stapriv;
/* set_channel_bwmode23a(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); */
/* set_channel_bwmode23a(padapter, pmlmeext->cur_channel,
pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); */
/* update ap's stainfo */
psta = rtw_get_stainfo23a(pstapriv, cur_network->MacAddress);
......@@ -692,17 +709,19 @@ static void bwmode_update_check(struct rtw_adapter *padapter, struct ndis_802_11
if (phtpriv_sta->ht_option) {
/* bwmode */
phtpriv_sta->bwmode = pmlmeext->cur_bwmode;
phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset;
phtpriv_sta->ch_offset =
pmlmeext->cur_ch_offset;
} else {
phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_20;
phtpriv_sta->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
phtpriv_sta->ch_offset =
HAL_PRIME_CHNL_OFFSET_DONT_CARE;
}
}
}
}
void HT_caps_handler23a(struct rtw_adapter *padapter, struct ndis_802_11_var_ies * pIE)
void HT_caps_handler23a(struct rtw_adapter *padapter,
struct ndis_802_11_var_ies * pIE)
{
unsigned int i;
u8 rf_type;
......@@ -712,13 +731,15 @@ void HT_caps_handler23a(struct rtw_adapter *padapter, struct ndis_802_11_var_ies
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct ht_priv *phtpriv = &pmlmepriv->htpriv;
if (pIE == NULL) return;
if (!pIE)
return;
if (phtpriv->ht_option == false) return;
if (phtpriv->ht_option == false)
return;
pmlmeinfo->HT_caps_enable = 1;
for (i = 0; i < (pIE->Length); i++) {
for (i = 0; i < pIE->Length; i++) {
if (i != 2) {
/* Commented by Albert 2010/07/12 */
/* Got the endian issue here. */
......@@ -726,12 +747,12 @@ void HT_caps_handler23a(struct rtw_adapter *padapter, struct ndis_802_11_var_ies
} else {
/* modify from fw by Thomas 2010/11/17 */
if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3) > (pIE->data[i] & 0x3))
max_AMPDU_len = (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.u.HT_cap_element.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);
min_MPDU_spacing = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c;
else
min_MPDU_spacing = (pIE->data[i] & 0x1c);
......@@ -742,31 +763,38 @@ void HT_caps_handler23a(struct rtw_adapter *padapter, struct ndis_802_11_var_ies
/* Commented by Albert 2010/07/12 */
/* Have to handle the endian issue after copying. */
/* HT_ext_caps didn't be used yet. */
pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info = le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info);
pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps = le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps);
pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info =
le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info);
pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps =
le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps);
rf_type = rtl8723a_get_rf_type(padapter);
/* 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_1R23A[i];
if (rf_type == RF_1T1R || rf_type == RF_1T2R)
pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[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_rate[i] &=
MCS_rate_2R23A[i];
}
return;
}
void HT_info_handler23a(struct rtw_adapter *padapter, struct ndis_802_11_var_ies * pIE)
void HT_info_handler23a(struct rtw_adapter *padapter,
struct ndis_802_11_var_ies *pIE)
{
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct ht_priv *phtpriv = &pmlmepriv->htpriv;
if (pIE == NULL) return;
if (!pIE)
return;
if (phtpriv->ht_option == false) return;
if (phtpriv->ht_option == false)
return;
if (pIE->Length > sizeof(struct HT_info_element))
return;
......@@ -786,11 +814,12 @@ void HTOnAssocRsp23a(struct rtw_adapter *padapter)
DBG_8723A("%s\n", __func__);
if ((pmlmeinfo->HT_info_enable) && (pmlmeinfo->HT_caps_enable)) {
if (pmlmeinfo->HT_info_enable && pmlmeinfo->HT_caps_enable)
pmlmeinfo->HT_enable = 1;
} else {
else {
pmlmeinfo->HT_enable = 0;
/* set_channel_bwmode23a(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); */
/* set_channel_bwmode23a(padapter, pmlmeext->cur_channel,
pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); */
return;
}
......@@ -801,18 +830,20 @@ void HTOnAssocRsp23a(struct rtw_adapter *padapter)
*/
max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03;
min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) >> 2;
min_MPDU_spacing =
(pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) >> 2;
rtl8723a_set_ampdu_min_space(padapter, min_MPDU_spacing);
rtl8723a_set_ampdu_factor(padapter, max_AMPDU_len);
}
void ERP_IE_handler23a(struct rtw_adapter *padapter, struct ndis_802_11_var_ies * pIE)
void ERP_IE_handler23a(struct rtw_adapter *padapter,
struct ndis_802_11_var_ies *pIE)
{
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
if (pIE->Length>1)
if (pIE->Length > 1)
return;
pmlmeinfo->ERP_enable = 1;
......@@ -841,7 +872,7 @@ void VCS_update23a(struct rtw_adapter *padapter, struct sta_info *psta)
break;
case 2: /* auto */
default:
if ((pmlmeinfo->ERP_enable) && (pmlmeinfo->ERP_IE & BIT(1))) {
if (pmlmeinfo->ERP_enable && pmlmeinfo->ERP_IE & BIT(1)) {
if (pregpriv->vcs_type == 1) {
psta->rtsen = 1;
psta->cts2self = 0;
......@@ -1137,22 +1168,27 @@ void update_beacon23a_info(struct rtw_adapter *padapter, u8 *pframe, uint pkt_le
unsigned int is_ap_in_tkip23a(struct rtw_adapter *padapter)
{
u32 i;
struct ndis_802_11_var_ies * pIE;
struct ndis_802_11_var_ies *pIE;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct wlan_bssid_ex *cur_network = &pmlmeinfo->network;
if (rtw_get_capability23a(cur_network) & WLAN_CAPABILITY_PRIVACY) {
for (i = sizeof(struct ndis_802_11_fixed_ies); i < pmlmeinfo->network.IELength;) {
pIE = (struct ndis_802_11_var_ies *)(pmlmeinfo->network.IEs + i);
for (i = sizeof(struct ndis_802_11_fixed_ies);
i < pmlmeinfo->network.IELength;) {
pIE = (struct ndis_802_11_var_ies *)
(pmlmeinfo->network.IEs + i);
switch (pIE->ElementID) {
case WLAN_EID_VENDOR_SPECIFIC:
if ((!memcmp(pIE->data, RTW_WPA_OUI23A_TYPE, 4)) && (!memcmp((pIE->data + 12), WPA_TKIP_CIPHER23A, 4)))
if (!memcmp(pIE->data, RTW_WPA_OUI23A_TYPE, 4)&&
!memcmp((pIE->data + 12),
WPA_TKIP_CIPHER23A, 4))
return true;
break;
case WLAN_EID_RSN:
if (!memcmp((pIE->data + 8), RSN_TKIP_CIPHER23A, 4))
if (!memcmp(pIE->data + 8, RSN_TKIP_CIPHER23A,
4))
return true;
break;
default:
......@@ -1161,32 +1197,37 @@ unsigned int is_ap_in_tkip23a(struct rtw_adapter *padapter)
i += (pIE->Length + 2);
}
return false;
} else {
} else
return false;
}
}
unsigned int should_forbid_n_rate23a(struct rtw_adapter * padapter)
{
u32 i;
struct ndis_802_11_var_ies * pIE;
struct ndis_802_11_var_ies *pIE;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_bssid_ex *cur_network = &pmlmepriv->cur_network.network;
if (rtw_get_capability23a(cur_network) & WLAN_CAPABILITY_PRIVACY) {
for (i = sizeof(struct ndis_802_11_fixed_ies); i < cur_network->IELength;) {
pIE = (struct ndis_802_11_var_ies *)(cur_network->IEs + i);
for (i = sizeof(struct ndis_802_11_fixed_ies);
i < cur_network->IELength;) {
pIE = (struct ndis_802_11_var_ies *)
(cur_network->IEs + i);
switch (pIE->ElementID) {
case WLAN_EID_VENDOR_SPECIFIC:
if (!memcmp(pIE->data, RTW_WPA_OUI23A_TYPE, 4) &&
((!memcmp((pIE->data + 12), WPA_CIPHER_SUITE_CCMP23A, 4)) ||
(!memcmp((pIE->data + 16), WPA_CIPHER_SUITE_CCMP23A, 4))))
if (!memcmp(pIE->data, RTW_WPA_OUI23A_TYPE, 4)&&
(!memcmp(pIE->data + 12,
WPA_CIPHER_SUITE_CCMP23A, 4) ||
!memcmp(pIE->data + 16,
WPA_CIPHER_SUITE_CCMP23A, 4)))
return false;
break;
case WLAN_EID_RSN:
if ((!memcmp((pIE->data + 8), RSN_CIPHER_SUITE_CCMP23A, 4)) ||
(!memcmp((pIE->data + 12), RSN_CIPHER_SUITE_CCMP23A, 4)))
if (!memcmp(pIE->data + 8,
RSN_CIPHER_SUITE_CCMP23A, 4) ||
!memcmp(pIE->data + 12,
RSN_CIPHER_SUITE_CCMP23A, 4))
return false;
default:
break;
......@@ -1203,14 +1244,16 @@ unsigned int should_forbid_n_rate23a(struct rtw_adapter * padapter)
unsigned int is_ap_in_wep23a(struct rtw_adapter *padapter)
{
u32 i;
struct ndis_802_11_var_ies * pIE;
struct ndis_802_11_var_ies *pIE;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct wlan_bssid_ex *cur_network = &pmlmeinfo->network;
if (rtw_get_capability23a(cur_network) & WLAN_CAPABILITY_PRIVACY) {
for (i = sizeof(struct ndis_802_11_fixed_ies); i < pmlmeinfo->network.IELength;) {
pIE = (struct ndis_802_11_var_ies *)(pmlmeinfo->network.IEs + i);
for (i = sizeof(struct ndis_802_11_fixed_ies);
i < pmlmeinfo->network.IELength;) {
pIE = (struct ndis_802_11_var_ies *)
(pmlmeinfo->network.IEs + i);
switch (pIE->ElementID) {
case WLAN_EID_VENDOR_SPECIFIC:
......@@ -1228,9 +1271,8 @@ unsigned int is_ap_in_wep23a(struct rtw_adapter *padapter)
}
return true;
} else {
} else
return false;
}
}
static int wifirate2_ratetbl_inx23a(unsigned char rate)
......@@ -1298,7 +1340,7 @@ unsigned int update_supported_rate23a(unsigned char *ptn, unsigned int ptn_sz)
unsigned int i, num_of_rate;
unsigned int mask = 0;
num_of_rate = (ptn_sz > NumRates)? NumRates: ptn_sz;
num_of_rate = (ptn_sz > NumRates) ? NumRates : ptn_sz;
for (i = 0; i < num_of_rate; i++)
mask |= 0x1 << wifirate2_ratetbl_inx23a(*(ptn + i));
......@@ -1309,7 +1351,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_rate[0] << 12 |
pHT_caps->u.HT_cap_element.MCS_rate[1] << 20;
return mask;
}
......@@ -1321,9 +1364,9 @@ int support_short_GI23a(struct rtw_adapter *padapter,
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
unsigned char bit_offset;
if (!(pmlmeinfo->HT_enable))
if (!pmlmeinfo->HT_enable)
return _FAIL;
if ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_RALINK))
if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_RALINK)
return _FAIL;
bit_offset = (pmlmeext->cur_bwmode & HT_CHANNEL_WIDTH_40)? 6: 5;
......@@ -1390,7 +1433,7 @@ void update_tx_basic_rate23a(struct rtw_adapter *padapter, u8 wirelessmode)
unsigned char check_assoc_AP23a(u8 *pframe, uint len)
{
unsigned int i;
struct ndis_802_11_var_ies * pIE;
struct ndis_802_11_var_ies *pIE;
u8 epigram_vendor_flag;
u8 ralink_vendor_flag;
epigram_vendor_flag = 0;
......@@ -1401,11 +1444,11 @@ unsigned char check_assoc_AP23a(u8 *pframe, uint len)
switch (pIE->ElementID) {
case WLAN_EID_VENDOR_SPECIFIC:
if ((!memcmp(pIE->data, ARTHEROS_OUI1, 3)) ||
(!memcmp(pIE->data, ARTHEROS_OUI2, 3))) {
if (!memcmp(pIE->data, ARTHEROS_OUI1, 3) ||
!memcmp(pIE->data, ARTHEROS_OUI2, 3)) {
DBG_8723A("link to Artheros AP\n");
return HT_IOT_PEER_ATHEROS;
} else if ((!memcmp(pIE->data, BROADCOM_OUI1, 3)) ||
} else if (!memcmp(pIE->data, BROADCOM_OUI1, 3) ||
!memcmp(pIE->data, BROADCOM_OUI2, 3) ||
!memcmp(pIE->data, BROADCOM_OUI2, 3)) {
DBG_8723A("link to Broadcom AP\n");
......@@ -1414,9 +1457,9 @@ unsigned char check_assoc_AP23a(u8 *pframe, uint len)
DBG_8723A("link to Marvell AP\n");
return HT_IOT_PEER_MARVELL;
} else if (!memcmp(pIE->data, RALINK_OUI, 3)) {
if (!ralink_vendor_flag) {
if (!ralink_vendor_flag)
ralink_vendor_flag = 1;
} else {
else {
DBG_8723A("link to Ralink AP\n");
return HT_IOT_PEER_RALINK;
}
......@@ -1434,12 +1477,10 @@ unsigned char check_assoc_AP23a(u8 *pframe, uint len)
if (ralink_vendor_flag) {
DBG_8723A("link to Tenda W311R AP\n");
return HT_IOT_PEER_TENDA;
} else {
} else
DBG_8723A("Capture EPIGRAM_OUI\n");
}
} else {
} else
break;
}
default:
break;
}
......@@ -1514,15 +1555,18 @@ void update_capinfo23a(struct rtw_adapter *Adapter, u16 updateCap)
pmlmeinfo->slotTime = NON_SHORT_SLOT_TIME;
} else {
/* Filen: See 802.11-2007 p.90 */
if (pmlmeext->cur_wireless_mode & (WIRELESS_11G | WIRELESS_11_24N)) {
if (pmlmeext->cur_wireless_mode &
(WIRELESS_11G | WIRELESS_11_24N)) {
if (updateCap & cShortSlotTime) { /* Short Slot Time */
if (pmlmeinfo->slotTime != SHORT_SLOT_TIME)
pmlmeinfo->slotTime = SHORT_SLOT_TIME;
} else { /* Long Slot Time */
if (pmlmeinfo->slotTime != NON_SHORT_SLOT_TIME)
pmlmeinfo->slotTime = NON_SHORT_SLOT_TIME;
pmlmeinfo->slotTime =
NON_SHORT_SLOT_TIME;
}
} else if (pmlmeext->cur_wireless_mode & (WIRELESS_11A | WIRELESS_11_5N)) {
} else if (pmlmeext->cur_wireless_mode &
(WIRELESS_11A | WIRELESS_11_5N)) {
pmlmeinfo->slotTime = SHORT_SLOT_TIME;
} else {
/* B Mode */
......@@ -1553,15 +1597,16 @@ void update_wireless_mode23a(struct rtw_adapter *padapter)
if (pmlmeinfo->HT_enable)
network_type = WIRELESS_11_24N;
if ((cckratesonly_included23a(rate, ratelen)) == true)
if (cckratesonly_included23a(rate, ratelen) == true)
network_type |= WIRELESS_11B;
else if ((cckrates_included23a(rate, ratelen)) == true)
else if (cckrates_included23a(rate, ratelen) == true)
network_type |= WIRELESS_11BG;
else
network_type |= WIRELESS_11G;
}
pmlmeext->cur_wireless_mode = network_type & padapter->registrypriv.wireless_mode;
pmlmeext->cur_wireless_mode =
network_type & padapter->registrypriv.wireless_mode;
/* 0x0808 -> for CCK, 0x0a0a -> for OFDM */
/* change this value if having IOT issues. */
......@@ -1583,7 +1628,7 @@ void update_bmc_sta_support_rate23a(struct rtw_adapter *padapter, u32 mac_id)
memcpy((pmlmeinfo->FW_sta_info[mac_id].SupportedRates),
rtw_basic_rate_cck, 4);
} else {
memcpy((pmlmeinfo->FW_sta_info[mac_id].SupportedRates),
memcpy(pmlmeinfo->FW_sta_info[mac_id].SupportedRates,
rtw_basic_rate_ofdm, 3);
}
}
......@@ -1610,7 +1655,8 @@ int update_sta_support_rate23a(struct rtw_adapter *padapter, u8 *pvar_ie,
return _SUCCESS;
}
void process_addba_req23a(struct rtw_adapter *padapter, u8 *paddba_req, u8 *addr)
void process_addba_req23a(struct rtw_adapter *padapter,
u8 *paddba_req, u8 *addr)
{
struct sta_info *psta;
u16 tid, start_seq, param;
......@@ -1626,13 +1672,14 @@ void process_addba_req23a(struct rtw_adapter *padapter, u8 *paddba_req, u8 *addr
start_seq = le16_to_cpu(preq->BA_starting_seqctrl) >> 4;
param = le16_to_cpu(preq->BA_para_set);
tid = (param>>2)&0x0f;
tid = (param >> 2) & 0x0f;
preorder_ctrl = &psta->recvreorder_ctrl[tid];
preorder_ctrl->indicate_seq = 0xffff;
preorder_ctrl->enable = (pmlmeinfo->bAcceptAddbaReq == true)? true :false;
preorder_ctrl->enable = (pmlmeinfo->bAcceptAddbaReq == true) ?
true : false;
}
}
......@@ -1650,16 +1697,18 @@ int rtw_handle_dualmac23a(struct rtw_adapter *adapter, bool init)
if (init) {
if (pbuddy_padapter == NULL) {
pbuddy_padapter = adapter;
DBG_8723A("%s(): pbuddy_padapter == NULL, Set pbuddy_padapter\n", __func__);
DBG_8723A("%s(): pbuddy_padapter == NULL, "
"Set pbuddy_padapter\n", __func__);
} else {
adapter->pbuddy_adapter = pbuddy_padapter;
pbuddy_padapter->pbuddy_adapter = adapter;
/* clear global value */
pbuddy_padapter = NULL;
DBG_8723A("%s(): pbuddy_padapter exist, Exchange Information\n", __func__);
DBG_8723A("%s(): pbuddy_padapter exist, "
"Exchange Information\n", __func__);
}
} else {
} else
pbuddy_padapter = NULL;
}
return status;
}
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