rtl8188eu: Fix some instances where open bracket should be moved to previous line

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2015-08-15 16:21:55 -05:00
parent 11ab93f073
commit e6a0d110e4
3 changed files with 241 additions and 574 deletions

View file

@ -89,8 +89,7 @@ static void update_BCNTIM(struct adapter *padapter)
/* update TIM IE */
/* if (pstapriv->tim_bitmap) */
if (true)
{
if (true) {
u8 *p, *dst_ie, *premainder_ie = NULL, *pbackup_remainder_ie = NULL;
__le16 tim_bitmap_le;
uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen;
@ -98,8 +97,7 @@ static void update_BCNTIM(struct adapter *padapter)
tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap);
p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_);
if (p != NULL && tim_ielen>0)
{
if (p != NULL && tim_ielen>0) {
tim_ielen += 2;
premainder_ie = p+tim_ielen;
@ -110,9 +108,7 @@ static void update_BCNTIM(struct adapter *padapter)
/* append TIM IE from dst_ie offset */
dst_ie = p;
}
else
{
} else {
tim_ielen = 0;
/* calucate head_len */
@ -126,9 +122,7 @@ static void update_BCNTIM(struct adapter *padapter)
/* get supported rates len */
p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &tmp_len, (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_));
if (p != NULL)
{
offset += tmp_len+2;
}
/* DS Parameter Set IE, len =3 */
offset += 3;
@ -142,8 +136,7 @@ static void update_BCNTIM(struct adapter *padapter)
}
if (remainder_ielen>0)
{
if (remainder_ielen>0) {
pbackup_remainder_ie = rtw_malloc(remainder_ielen);
if (pbackup_remainder_ie && premainder_ie)
memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
@ -166,19 +159,15 @@ static void update_BCNTIM(struct adapter *padapter)
else
*dst_ie++ = 0;
if (tim_ielen ==4)
{
if (tim_ielen ==4) {
*dst_ie++ = *(u8*)&tim_bitmap_le;
}
else if (tim_ielen ==5)
{
} else if (tim_ielen ==5) {
memcpy(dst_ie, &tim_bitmap_le, 2);
dst_ie+=2;
}
/* copy remainder IE */
if (pbackup_remainder_ie)
{
if (pbackup_remainder_ie) {
memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen);
rtw_mfree(pbackup_remainder_ie, remainder_ielen);
@ -200,16 +189,12 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork, u8
u8 *p, *dst_ie, *premainder_ie = NULL, *pbackup_remainder_ie = NULL;
u32 i, offset, ielen, ie_offset, remainder_ielen = 0;
for (i = sizeof(struct ndis_802_11_fixed_ies); i < pnetwork->IELength;)
{
for (i = sizeof(struct ndis_802_11_fixed_ies); i < pnetwork->IELength;) {
pIE = (struct ndis_802_11_variable_ies *)(pnetwork->IEs + i);
if (pIE->ElementID > index)
{
if (pIE->ElementID > index) {
break;
}
else if (pIE->ElementID == index) /* already exist the same IE */
{
} else if (pIE->ElementID == index) { /* already exist the same IE */
p = (u8 *)pIE;
ielen = pIE->Length;
bmatch = true;
@ -221,8 +206,7 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork, u8
i += (pIE->Length + 2);
}
if (p != NULL && ielen>0)
{
if (p != NULL && ielen>0) {
ielen += 2;
premainder_ie = p+ielen;
@ -237,8 +221,7 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork, u8
dst_ie = (p+ielen);
}
if (remainder_ielen>0)
{
if (remainder_ielen>0) {
pbackup_remainder_ie = rtw_malloc(remainder_ielen);
if (pbackup_remainder_ie && premainder_ie)
memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
@ -251,8 +234,7 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork, u8
dst_ie+=len;
/* copy remainder IE */
if (pbackup_remainder_ie)
{
if (pbackup_remainder_ie) {
memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen);
rtw_mfree(pbackup_remainder_ie, remainder_ielen);
@ -269,8 +251,7 @@ void rtw_remove_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork,
u8 *pie = pnetwork->IEs;
p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, index, &ielen, pnetwork->IELength - _FIXED_IE_LENGTH_);
if (p != NULL && ielen>0)
{
if (p != NULL && ielen>0) {
ielen += 2;
premainder_ie = p+ielen;
@ -285,16 +266,14 @@ void rtw_remove_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork,
return;
}
if (remainder_ielen>0)
{
if (remainder_ielen>0) {
pbackup_remainder_ie = rtw_malloc(remainder_ielen);
if (pbackup_remainder_ie && premainder_ie)
memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
}
/* copy remainder IE */
if (pbackup_remainder_ie)
{
if (pbackup_remainder_ie) {
memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen);
rtw_mfree(pbackup_remainder_ie, remainder_ielen);
@ -308,13 +287,8 @@ u8 chk_sta_is_alive(struct sta_info *psta)
{
u8 ret = false;
if ((psta->sta_stats.last_rx_data_pkts + psta->sta_stats.last_rx_ctrl_pkts) == (psta->sta_stats.rx_data_pkts + psta->sta_stats.rx_ctrl_pkts))
{
}
else
{
if ((psta->sta_stats.last_rx_data_pkts + psta->sta_stats.last_rx_ctrl_pkts) != (psta->sta_stats.rx_data_pkts + psta->sta_stats.rx_ctrl_pkts))
ret = true;
}
sta_update_last_rx_pkts(psta);
@ -338,16 +312,13 @@ void expire_timeout_chk(struct adapter *padapter)
plist = get_next(phead);
/* check auth_queue */
while ((rtw_end_of_queue_search(phead, plist)) == false)
{
while ((rtw_end_of_queue_search(phead, plist)) == false) {
psta = LIST_CONTAINOR(plist, struct sta_info, auth_list);
plist = get_next(plist);
if (psta->expire_to>0)
{
if (psta->expire_to>0) {
psta->expire_to--;
if (psta->expire_to == 0)
{
if (psta->expire_to == 0) {
rtw_list_delete(&psta->auth_list);
pstapriv->auth_list_cnt--;
@ -376,8 +347,7 @@ void expire_timeout_chk(struct adapter *padapter)
plist = get_next(phead);
/* check asoc_queue */
while ((rtw_end_of_queue_search(phead, plist)) == false)
{
while ((rtw_end_of_queue_search(phead, plist)) == false) {
psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
plist = get_next(plist);
if (chk_sta_is_alive(psta) || !psta->expire_to) {
@ -388,12 +358,10 @@ void expire_timeout_chk(struct adapter *padapter)
psta->expire_to--;
}
if (psta->expire_to <= 0)
{
if (psta->expire_to <= 0) {
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
if (padapter->registrypriv.wifi_spec == 1)
{
if (padapter->registrypriv.wifi_spec == 1) {
psta->expire_to = pstapriv->expire_to;
continue;
}
@ -430,9 +398,7 @@ void expire_timeout_chk(struct adapter *padapter)
DBG_871X("asoc expire "MAC_FMT", state =0x%x\n", MAC_ARG(psta->hwaddr), psta->state);
updated = ap_free_sta(padapter, psta, false, WLAN_REASON_DEAUTH_LEAVING);
}
else
{
} else {
/* TODO: Aging mechanism to digest frames in sleep_q to avoid running out of xmitframe */
if (psta->sleepq_len > (NR_XMITFRAME/pstapriv->asoc_list_cnt)
&& padapter->xmitpriv.free_xmitframe_cnt < ((NR_XMITFRAME/pstapriv->asoc_list_cnt)/2)
@ -470,15 +436,12 @@ void expire_timeout_chk(struct adapter *padapter)
ret = issue_nulldata(padapter, psta->hwaddr, 0, 3, 50);
psta->keep_alive_trycnt++;
if (ret == _SUCCESS)
{
if (ret == _SUCCESS) {
DBG_871X("asoc check, sta(" MAC_FMT ") is alive\n", MAC_ARG(psta->hwaddr));
psta->expire_to = pstapriv->expire_to;
psta->keep_alive_trycnt = 0;
continue;
}
else if (psta->keep_alive_trycnt <= 3)
{
} else if (psta->keep_alive_trycnt <= 3) {
DBG_871X("ack check for asoc expire, keep_alive_trycnt =%d\n", psta->keep_alive_trycnt);
psta->expire_to = 1;
continue;
@ -524,14 +487,12 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
return;
/* b/g mode ra_bitmap */
for (i =0; i<sizeof(psta->bssrateset); i++)
{
for (i =0; i<sizeof(psta->bssrateset); i++) {
if (psta->bssrateset[i])
tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i]&0x7f);
}
/* n mode ra_bitmap */
if (psta_ht->ht_option)
{
if (psta_ht->ht_option) {
rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
if (rf_type == RF_2T2R)
limit =16;/* 2R */
@ -571,8 +532,7 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
raid = networktype_to_raid(sta_band);
init_rate = get_highest_rate_idx(tx_ra_bitmap&0x0fffffff)&0x3f;
if (psta->aid < NUM_STA)
{
if (psta->aid < NUM_STA) {
u8 arg = 0;
arg = psta->mac_id&0x1f;
@ -599,10 +559,7 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
/* set ra_id, init_rate */
psta->raid = raid;
psta->init_rate = init_rate;
}
else
{
} else {
DBG_871X("station aid %d exceed the max number\n", psta->aid);
}
@ -619,8 +576,7 @@ void update_bmc_sta(struct adapter *padapter)
struct wlan_bssid_ex *pcur_network = (struct wlan_bssid_ex *)&pmlmepriv->cur_network.network;
struct sta_info *psta = rtw_get_bcmc_stainfo(padapter);
if (psta)
{
if (psta) {
psta->aid = 0;/* default set to 0 */
/* psta->mac_id = psta->aid+4; */
psta->mac_id = psta->aid + 1;
@ -640,8 +596,7 @@ void update_bmc_sta(struct adapter *padapter)
psta->bssratelen = supportRateNum;
/* b/g mode ra_bitmap */
for (i =0; i<supportRateNum; i++)
{
for (i =0; i<supportRateNum; i++) {
if (psta->bssrateset[i])
tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i]&0x7f);
}
@ -664,8 +619,6 @@ void update_bmc_sta(struct adapter *padapter)
/* DBG_871X("Add id %d val %08x to ratr for bmc sta\n", psta->aid, tx_ra_bitmap); */
/* ap mode */
rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, true);
/* if (pHalData->fw_ractrl == true) */
{
u8 arg = 0;
@ -673,19 +626,11 @@ void update_bmc_sta(struct adapter *padapter)
arg |= BIT(7);
/* if (shortGIrate ==true) */
/* arg |= BIT(5); */
tx_ra_bitmap |= ((raid<<28)&0xf0000000);
DBG_871X("update_bmc_sta, mask =0x%x, arg =0x%x\n", tx_ra_bitmap, arg);
/* bitmap[0:27] = tx_rate_bitmap */
/* bitmap[28:31]= Rate Adaptive id */
/* arg[0:4] = macid */
/* arg[5] = Short GI */
rtw_hal_add_ra_tid(padapter, tx_ra_bitmap, arg, 0);
}
/* set ra_id, init_rate */
@ -697,10 +642,7 @@ void update_bmc_sta(struct adapter *padapter)
spin_lock_bh(&psta->lock);
psta->state = _FW_LINKED;
spin_unlock_bh(&psta->lock);
}
else
{
} else {
DBG_871X("add_RATid_bmc_sta error!\n");
}
@ -741,31 +683,23 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta)
/* ERP */
VCS_update(padapter, psta);
/* HT related cap */
if (phtpriv_sta->ht_option)
{
if (phtpriv_sta->ht_option) {
/* check if sta supports rx ampdu */
phtpriv_sta->ampdu_enable = phtpriv_ap->ampdu_enable;
/* check if sta support s Short GI */
if ((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40))
{
phtpriv_sta->sgi = true;
}
/* bwmode */
if ((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH))
{
if ((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH)) {
/* phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_40; */
phtpriv_sta->bwmode = pmlmeext->cur_bwmode;
phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset;
}
psta->qos_option = true;
}
else
{
} else {
phtpriv_sta->ampdu_enable = false;
phtpriv_sta->sgi = false;
@ -857,17 +791,14 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf)
/* if there is wpsie in beacon, the hostapd will update beacon twice when stating hostapd, */
/* and at first time the security ie ( RSN/WPA IE) will not include in beacon. */
if (NULL == rtw_get_wps_ie(pnetwork->IEs+_FIXED_IE_LENGTH_, pnetwork->IELength-_FIXED_IE_LENGTH_, NULL, NULL))
{
pmlmeext->bstart_bss = true;
}
/* todo: update wmm, ht cap */
/* pmlmeinfo->WMM_enable; */
/* pmlmeinfo->HT_enable; */
if (pmlmepriv->qospriv.qos_option)
pmlmeinfo->WMM_enable = true;
if (pmlmepriv->htpriv.ht_option)
{
if (pmlmepriv->htpriv.ht_option) {
pmlmeinfo->WMM_enable = true;
pmlmeinfo->HT_enable = true;
/* pmlmeinfo->HT_info_enable = true; */
@ -876,8 +807,7 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf)
update_hw_ht_param(padapter);
}
if (pmlmepriv->cur_network.join_res != true) /* setting only at first time */
{
if (pmlmepriv->cur_network.join_res != true) { /* setting only at first time */
/* WEP Key will be set before this function, do not clear CAM. */
if ((psecuritypriv->dot11PrivacyAlgrthm != _WEP40_) && (psecuritypriv->dot11PrivacyAlgrthm != _WEP104_))
flush_all_cam_entry(padapter); /* clear CAM */
@ -909,24 +839,20 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf)
UpdateBrateTbl(padapter, pnetwork->SupportedRates);
rtw_hal_set_hwreg(padapter, HW_VAR_BASIC_RATE, pnetwork->SupportedRates);
if (pmlmepriv->cur_network.join_res != true) /* setting only at first time */
{
if (pmlmepriv->cur_network.join_res != true) { /* setting only at first time */
/* turn on all dynamic functions */
Switch_DM_Func(padapter, DYNAMIC_ALL_FUNC_ENABLE, true);
}
/* set channel, bwmode */
p = rtw_get_ie((pnetwork->IEs + sizeof(struct ndis_802_11_fixed_ies)), _HT_ADD_INFO_IE_, &ie_len, (pnetwork->IELength - sizeof(struct ndis_802_11_fixed_ies)));
if ( p && ie_len)
{
if ( p && ie_len) {
pht_info = (struct HT_info_element *)(p+2);
if ((pregpriv->cbw40_enable) && (pht_info->infos[0] & BIT(2)))
{
if ((pregpriv->cbw40_enable) && (pht_info->infos[0] & BIT(2))) {
/* switch to the 40M Hz mode */
/* pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40; */
cur_bwmode = HT_CHANNEL_WIDTH_40;
switch (pht_info->infos[0] & 0x3)
{
switch (pht_info->infos[0] & 0x3) {
case 1:
/* pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; */
cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
@ -972,8 +898,7 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf)
pwdinfo->p2p_group_ssid_len = pnetwork->Ssid.SsidLength;
#endif /* CONFIG_P2P */
if (true == pmlmeext->bstart_bss)
{
if (true == pmlmeext->bstart_bss) {
update_beacon(padapter, _TIM_IE_, NULL, false);
/* issue beacon frame */
@ -1051,8 +976,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
/* SSID */
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SSID_IE_, &ie_len, (pbss_network->IELength -_BEACON_IE_OFFSET_));
if (p && ie_len>0)
{
if (p && ie_len>0) {
memset(&pbss_network->Ssid, 0, sizeof(struct ndis_802_11_ssid));
memcpy(pbss_network->Ssid.Ssid, (p + 2), ie_len);
pbss_network->Ssid.SsidLength = ie_len;
@ -1070,16 +994,14 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX);
/* get supported rates */
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
if (p != NULL)
{
if (p != NULL) {
memcpy(supportRate, p+2, ie_len);
supportRateNum = ie_len;
}
/* get ext_supported rates */
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _EXT_SUPPORTEDRATES_IE_, &ie_len, pbss_network->IELength - _BEACON_IE_OFFSET_);
if (p != NULL)
{
if (p != NULL) {
memcpy(supportRate+supportRateNum, p+2, ie_len);
supportRateNum += ie_len;
@ -1092,9 +1014,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
/* parsing ERP_IE */
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
if (p && ie_len>0)
{
ERP_IE_handler(padapter, (struct ndis_802_11_variable_ies *)p);
}
/* update privacy/security */
if (cap & BIT(4))
@ -1109,10 +1029,8 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
psecuritypriv->wpa2_group_cipher = _NO_PRIVACY_;
psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_;
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _RSN_IE_2_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
if (p && ie_len>0)
{
if (rtw_parse_wpa2_ie(p, ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS)
{
if (p && ie_len>0) {
if (rtw_parse_wpa2_ie(p, ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) {
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
psecuritypriv->dot8021xalg = 1;/* psk, todo:802.1x */
@ -1129,13 +1047,10 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
group_cipher = 0; pairwise_cipher = 0;
psecuritypriv->wpa_group_cipher = _NO_PRIVACY_;
psecuritypriv->wpa_pairwise_cipher = _NO_PRIVACY_;
for (p = ie + _BEACON_IE_OFFSET_; ;p += (ie_len + 2))
{
for (p = ie + _BEACON_IE_OFFSET_; ;p += (ie_len + 2)) {
p = rtw_get_ie(p, _SSN_IE_1_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2)));
if ((p) && (_rtw_memcmp(p+2, OUI1, 4)))
{
if (rtw_parse_wpa_ie(p, ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS)
{
if ((p) && (_rtw_memcmp(p+2, OUI1, 4))) {
if (rtw_parse_wpa_ie(p, ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) {
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
psecuritypriv->dot8021xalg = 1;/* psk, todo:802.1x */
@ -1152,22 +1067,16 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
}
if ((p == NULL) || (ie_len == 0))
{
break;
}
}
/* wmm */
ie_len = 0;
pmlmepriv->qospriv.qos_option = 0;
if (pregistrypriv->wmm_enable)
{
for (p = ie + _BEACON_IE_OFFSET_; ;p += (ie_len + 2))
{
if (pregistrypriv->wmm_enable) {
for (p = ie + _BEACON_IE_OFFSET_; ;p += (ie_len + 2)) {
p = rtw_get_ie(p, _VENDOR_SPECIFIC_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2)));
if ((p) && _rtw_memcmp(p+2, WMM_PARA_IE, 6))
{
if ((p) && _rtw_memcmp(p+2, WMM_PARA_IE, 6)) {
pmlmepriv->qospriv.qos_option = 1;
*(p+8) |= BIT(7);/* QoS Info, support U-APSD */
@ -1182,15 +1091,12 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
}
if ((p == NULL) || (ie_len == 0))
{
break;
}
}
}
/* parsing HT_CAP_IE */
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_CAPABILITY_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
if (p && ie_len>0)
{
if (p && ie_len>0) {
u8 rf_type;
struct ieee80211_ht_cap *pht_cap = (struct ieee80211_ht_cap *)(p+2);
@ -1204,13 +1110,9 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
if ((psecuritypriv->wpa_pairwise_cipher & WPA_CIPHER_CCMP) ||
(psecuritypriv->wpa2_pairwise_cipher & WPA_CIPHER_CCMP))
{
pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&(0x07<<2));
}
else
{
pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&0x00);
}
pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_FACTOR & 0x03); /* set Max Rx AMPDU size to 64K */
@ -1226,11 +1128,8 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
/* parsing HT_INFO_IE */
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_ADD_INFO_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
if (p && ie_len>0)
{
pHT_info_ie =p;
}
switch (network_type)
{
switch (network_type) {
case WIRELESS_11B:
pbss_network->NetworkTypeInUse = Ndis802_11DS;
break;
@ -1252,23 +1151,13 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
pmlmepriv->htpriv.ht_option = false;
if ( (psecuritypriv->wpa2_pairwise_cipher&WPA_CIPHER_TKIP) ||
(psecuritypriv->wpa_pairwise_cipher&WPA_CIPHER_TKIP))
{
/* todo: */
/* ht_cap = false; */
}
/* ht_cap */
if (pregistrypriv->ht_enable && ht_cap ==true)
{
if (pregistrypriv->ht_enable && ht_cap) {
pmlmepriv->htpriv.ht_option = true;
pmlmepriv->qospriv.qos_option = 1;
if (pregistrypriv->ampdu_enable ==1)
{
pmlmepriv->htpriv.ampdu_enable = true;
}
HT_caps_handler(padapter, (struct ndis_802_11_variable_ies *)pHT_caps_ie);
@ -1281,13 +1170,10 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
/* alloc sta_info for ap itself */
psta = rtw_get_stainfo(&padapter->stapriv, pbss_network->MacAddress);
if (!psta)
{
if (!psta) {
psta = rtw_alloc_stainfo(&padapter->stapriv, pbss_network->MacAddress);
if (psta == NULL)
{
return _FAIL;
}
}
psta->state |= WIFI_AP_STATE; /* Aries, add, fix bug of flush_cam_entry at STOP AP mode , 0724 */
rtw_indicate_connect( padapter);
@ -1332,15 +1218,12 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr)
phead = get_list_head(pacl_node_q);
plist = get_next(phead);
while ((rtw_end_of_queue_search(phead, plist)) == false)
{
while ((rtw_end_of_queue_search(phead, plist)) == false) {
paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list);
plist = get_next(plist);
if (_rtw_memcmp(paclnode->addr, addr, ETH_ALEN))
{
if (paclnode->valid == true)
{
if (_rtw_memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid == true) {
added = true;
DBG_871X("%s, sta has been added\n", __func__);
break;
@ -1355,12 +1238,10 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr)
spin_lock_bh(&(pacl_node_q->lock));
for (i =0; i< NUM_ACL; i++)
{
for (i =0; i< NUM_ACL; i++) {
paclnode = &pacl_list->aclnode[i];
if (paclnode->valid == false)
{
if (paclnode->valid == false) {
_rtw_init_listhead(&paclnode->list);
memcpy(paclnode->addr, addr, ETH_ALEN);
@ -1399,15 +1280,12 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr)
phead = get_list_head(pacl_node_q);
plist = get_next(phead);
while ((rtw_end_of_queue_search(phead, plist)) == false)
{
while ((rtw_end_of_queue_search(phead, plist)) == false) {
paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list);
plist = get_next(plist);
if (_rtw_memcmp(paclnode->addr, addr, ETH_ALEN))
{
if (paclnode->valid == true)
{
if (_rtw_memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid == true) {
paclnode->valid = false;
rtw_list_delete(&paclnode->list);
@ -1447,8 +1325,7 @@ static void update_bcn_erpinfo_ie(struct adapter *padapter)
/* parsing ERP_IE */
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &len, (pnetwork->IELength - _BEACON_IE_OFFSET_));
if (p && len>0)
{
if (p && len>0) {
struct ndis_802_11_variable_ies * pIE = (struct ndis_802_11_variable_ies *)p;
if (pmlmepriv->num_sta_non_erp == 1)
@ -1520,8 +1397,7 @@ static void update_bcn_wps_ie(struct adapter *padapter)
remainder_ielen = ielen - wps_offset - wps_ielen;
if (remainder_ielen>0)
{
if (remainder_ielen>0) {
pbackup_remainder_ie = rtw_malloc(remainder_ielen);
if (pbackup_remainder_ie)
memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
@ -1532,8 +1408,7 @@ static void update_bcn_wps_ie(struct adapter *padapter)
return;
wps_ielen = (uint)pwps_ie_src[1];/* to get ie data len */
if ((wps_offset+wps_ielen+2+remainder_ielen)<=MAX_IE_SZ)
{
if ((wps_offset+wps_ielen+2+remainder_ielen)<=MAX_IE_SZ) {
memcpy(pwps_ie, pwps_ie_src, wps_ielen+2);
pwps_ie += (wps_ielen+2);
@ -1558,24 +1433,15 @@ static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8*oui)
{
DBG_871X("%s\n", __FUNCTION__);
if (_rtw_memcmp(RTW_WPA_OUI, oui, 4))
{
if (_rtw_memcmp(RTW_WPA_OUI, oui, 4)) {
update_bcn_wpa_ie(padapter);
}
else if (_rtw_memcmp(WMM_OUI, oui, 4))
{
} else if (_rtw_memcmp(WMM_OUI, oui, 4)) {
update_bcn_wmm_ie(padapter);
}
else if (_rtw_memcmp(WPS_OUI, oui, 4))
{
} else if (_rtw_memcmp(WPS_OUI, oui, 4)) {
update_bcn_wps_ie(padapter);
}
else if (_rtw_memcmp(P2P_OUI, oui, 4))
{
} else if (_rtw_memcmp(P2P_OUI, oui, 4)) {
update_bcn_p2p_ie(padapter);
}
else
{
} else {
DBG_871X("unknown OUI type!\n");
}
@ -1602,8 +1468,7 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)
spin_lock_bh(&pmlmepriv->bcn_update_lock);
switch (ie_id)
{
switch (ie_id) {
case 0xFF:
update_bcn_fixed_ie(padapter);/* 8: TimeStamp, 2: Beacon Interval 2:Capability */
@ -1744,8 +1609,7 @@ static int rtw_ht_operation_update(struct adapter *padapter)
void associated_clients_update(struct adapter *padapter, u8 updated)
{
/* update associcated stations cap. */
if (updated == true)
{
if (updated == true) {
unsigned long irqL;
struct list_head *phead, *plist;
struct sta_info *psta = NULL;
@ -1757,8 +1621,7 @@ void associated_clients_update(struct adapter *padapter, u8 updated)
plist = get_next(phead);
/* check asoc_queue */
while ((rtw_end_of_queue_search(phead, plist)) == false)
{
while ((rtw_end_of_queue_search(phead, plist)) == false) {
psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
plist = get_next(plist);
@ -1831,42 +1694,34 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
}
if (!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT))
{
if (!psta->no_short_slot_time_set)
{
if (!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT)) {
if (!psta->no_short_slot_time_set) {
psta->no_short_slot_time_set = 1;
pmlmepriv->num_sta_no_short_slot_time++;
if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
(pmlmepriv->num_sta_no_short_slot_time == 1))
{
(pmlmepriv->num_sta_no_short_slot_time == 1)) {
beacon_updated = true;
update_beacon(padapter, 0xFF, NULL, true);
}
}
}
else
{
if (psta->no_short_slot_time_set)
{
} else {
if (psta->no_short_slot_time_set) {
psta->no_short_slot_time_set = 0;
pmlmepriv->num_sta_no_short_slot_time--;
if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
(pmlmepriv->num_sta_no_short_slot_time == 0))
{
(pmlmepriv->num_sta_no_short_slot_time == 0)) {
beacon_updated = true;
update_beacon(padapter, 0xFF, NULL, true);
}
}
}
if (psta->flags & WLAN_STA_HT)
{
if (psta->flags & WLAN_STA_HT) {
u16 ht_capab = le16_to_cpu(psta->htpriv.ht_cap.cap_info);
DBG_871X("HT: STA " MAC_FMT " HT Capabilities "
@ -1898,10 +1753,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
__FUNCTION__, MAC_ARG(psta->hwaddr),
pmlmepriv->num_sta_ht_20mhz);
}
}
else
{
} else {
if (!psta->no_ht_set) {
psta->no_ht_set = 1;
pmlmepriv->num_sta_no_ht++;
@ -1914,8 +1766,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
}
}
if (rtw_ht_operation_update(padapter) > 0)
{
if (rtw_ht_operation_update(padapter) > 0) {
update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, false);
update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, true);
}
@ -1939,9 +1790,8 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
if (psta->no_short_preamble_set) {
psta->no_short_preamble_set = 0;
pmlmepriv->num_sta_no_short_preamble--;
if (pmlmeext->cur_wireless_mode > WIRELESS_11B
&& pmlmepriv->num_sta_no_short_preamble == 0)
{
if (pmlmeext->cur_wireless_mode > WIRELESS_11B &&
pmlmepriv->num_sta_no_short_preamble == 0) {
beacon_updated = true;
update_beacon(padapter, 0xFF, NULL, true);
}
@ -1950,8 +1800,7 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
if (psta->nonerp_set) {
psta->nonerp_set = 0;
pmlmepriv->num_sta_non_erp--;
if (pmlmepriv->num_sta_non_erp == 0)
{
if (pmlmepriv->num_sta_non_erp == 0) {
beacon_updated = true;
update_beacon(padapter, _ERPINFO_IE_, NULL, true);
}
@ -1960,9 +1809,8 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
if (psta->no_short_slot_time_set) {
psta->no_short_slot_time_set = 0;
pmlmepriv->num_sta_no_short_slot_time--;
if (pmlmeext->cur_wireless_mode > WIRELESS_11B
&& pmlmepriv->num_sta_no_short_slot_time == 0)
{
if (pmlmeext->cur_wireless_mode > WIRELESS_11B &&
pmlmepriv->num_sta_no_short_slot_time == 0) {
beacon_updated = true;
update_beacon(padapter, 0xFF, NULL, true);
}
@ -1983,8 +1831,7 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
pmlmepriv->num_sta_ht_20mhz--;
}
if (rtw_ht_operation_update(padapter) > 0)
{
if (rtw_ht_operation_update(padapter) > 0) {
update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, false);
update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, true);
}
@ -2006,8 +1853,7 @@ u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta, bool active, u16
if (!psta)
return beacon_updated;
if (active == true)
{
if (active == true) {
/* tear down Rx AMPDU */
send_delba(padapter, 0, psta->hwaddr);/* recipient */
@ -2064,8 +1910,7 @@ int rtw_ap_inform_ch_switch (struct adapter *padapter, u8 new_ch, u8 ch_offset)
plist = get_next(phead);
/* for each sta in asoc_queue */
while ((rtw_end_of_queue_search(phead, plist)) == false)
{
while ((rtw_end_of_queue_search(phead, plist)) == false) {
psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
plist = get_next(plist);
@ -2150,13 +1995,10 @@ void sta_info_update(struct adapter *padapter, struct sta_info *psta)
psta->qos_option = 0;
/* update 802.11n ht cap. */
if (WLAN_STA_HT&flags)
{
if (WLAN_STA_HT&flags) {
psta->htpriv.ht_option = true;
psta->qos_option = 1;
}
else
{
} else {
psta->htpriv.ht_option = false;
}
@ -2169,8 +2011,7 @@ void sta_info_update(struct adapter *padapter, struct sta_info *psta)
/* called >= TSR LEVEL for USB or SDIO Interface*/
void ap_sta_info_defer_update(struct adapter *padapter, struct sta_info *psta)
{
if (psta->state & _FW_LINKED)
{
if (psta->state & _FW_LINKED) {
/* add ratid */
add_RATid(padapter, psta, 0);/* DM_RATR_STA_INIT */
}
@ -2197,8 +2038,7 @@ void rtw_ap_restore_network(struct adapter *padapter)
start_bss_network(padapter, (u8*)&mlmepriv->cur_network.network);
if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_))
{
(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) {
/* restore group key, WEP keys is restored in ips_leave() */
rtw_set_key(padapter, psecuritypriv, psecuritypriv->dot118021XGrpKeyid, 0, false);
}
@ -2227,17 +2067,13 @@ void rtw_ap_restore_network(struct adapter *padapter)
if (psta == NULL) {
DBG_871X(FUNC_ADPT_FMT" sta_info is null\n", FUNC_ADPT_ARG(padapter));
}
else if (psta->state &_FW_LINKED)
{
} else if (psta->state &_FW_LINKED) {
Update_RA_Entry(padapter, psta);
/* pairwise key */
/* per sta pairwise key and settings */
if ( (padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_))
{
if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_))
rtw_setstakey_cmd(padapter, (unsigned char *)psta, true, false);
}
}
}
@ -2286,8 +2122,7 @@ void start_ap_mode(struct adapter *padapter)
_rtw_init_listhead(&(pacl_list->acl_node_q.queue));
pacl_list->num = 0;
pacl_list->mode = 0;
for (i = 0; i < NUM_ACL; i++)
{
for (i = 0; i < NUM_ACL; i++) {
_rtw_init_listhead(&pacl_list->aclnode[i].list);
pacl_list->aclnode[i].valid = false;
}
@ -2317,13 +2152,11 @@ void stop_ap_mode(struct adapter *padapter)
spin_lock_bh(&(pacl_node_q->lock));
phead = get_list_head(pacl_node_q);
plist = get_next(phead);
while ((rtw_end_of_queue_search(phead, plist)) == false)
{
while ((rtw_end_of_queue_search(phead, plist)) == false) {
paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list);
plist = get_next(plist);
if (paclnode->valid == true)
{
if (paclnode->valid == true) {
paclnode->valid = false;
rtw_list_delete(&paclnode->list);