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,14 +1170,11 @@ 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,19 +2067,15 @@ 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_) ||
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);

View file

@ -304,33 +304,26 @@ static void convert_ipv6_mac_to_mc(struct sk_buff *skb)
static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
{
if (networkAddr[0] == NAT25_IPV4)
{
if (networkAddr[0] == NAT25_IPV4) {
unsigned long x;
x = networkAddr[7] ^ networkAddr[8] ^ networkAddr[9] ^ networkAddr[10];
return x & (NAT25_HASH_SIZE - 1);
}
else if (networkAddr[0] == NAT25_IPX)
{
} else if (networkAddr[0] == NAT25_IPX) {
unsigned long x;
x = networkAddr[1] ^ networkAddr[2] ^ networkAddr[3] ^ networkAddr[4] ^ networkAddr[5] ^
networkAddr[6] ^ networkAddr[7] ^ networkAddr[8] ^ networkAddr[9] ^ networkAddr[10];
return x & (NAT25_HASH_SIZE - 1);
}
else if (networkAddr[0] == NAT25_APPLE)
{
} else if (networkAddr[0] == NAT25_APPLE) {
unsigned long x;
x = networkAddr[1] ^ networkAddr[2] ^ networkAddr[3];
return x & (NAT25_HASH_SIZE - 1);
}
else if (networkAddr[0] == NAT25_PPPOE)
{
} else if (networkAddr[0] == NAT25_PPPOE) {
unsigned long x;
x = networkAddr[0] ^ networkAddr[1] ^ networkAddr[2] ^ networkAddr[3] ^ networkAddr[4] ^ networkAddr[5] ^ networkAddr[6] ^ networkAddr[7] ^ networkAddr[8];
@ -338,8 +331,7 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
return x & (NAT25_HASH_SIZE - 1);
}
#ifdef CL_IPV6_PASS
else if (networkAddr[0] == NAT25_IPV6)
{
else if (networkAddr[0] == NAT25_IPV6) {
unsigned long x;
x = networkAddr[1] ^ networkAddr[2] ^ networkAddr[3] ^ networkAddr[4] ^ networkAddr[5] ^
@ -350,8 +342,7 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
return x & (NAT25_HASH_SIZE - 1);
}
#endif
else
{
else {
unsigned long x = 0;
int i;
@ -401,12 +392,9 @@ static int __nat25_db_network_lookup_and_replace(struct adapter *priv,
spin_lock_bh(&priv->br_ext_lock);
db = priv->nethash[__nat25_network_hash(networkAddr)];
while (db != NULL)
{
if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN))
{
if (!__nat25_has_expired(priv, db))
{
while (db != NULL) {
if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) {
if (!__nat25_has_expired(priv, db)) {
/* replace the destination mac address */
memcpy(skb->data, db->macAddr, ETH_ALEN);
atomic_inc(&db->use_count);
@ -479,10 +467,8 @@ static void __nat25_db_network_insert(struct adapter *priv,
hash = __nat25_network_hash(networkAddr);
db = priv->nethash[hash];
while (db != NULL)
{
if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN))
{
while (db != NULL) {
if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) {
memcpy(db->macAddr, macAddr, ETH_ALEN);
db->ageing_timer = jiffies;
spin_unlock_bh(&priv->br_ext_lock);
@ -522,16 +508,14 @@ void nat25_db_cleanup(struct adapter *priv)
unsigned long irqL;
spin_lock_bh(&priv->br_ext_lock);
for (i =0; i<NAT25_HASH_SIZE; i++)
{
for (i =0; i<NAT25_HASH_SIZE; i++) {
struct nat25_network_db_entry *f;
f = priv->nethash[i];
while (f != NULL) {
struct nat25_network_db_entry *g;
g = f->next_hash;
if (priv->scdb_entry == f)
{
if (priv->scdb_entry == f) {
memset(priv->scdb_mac, 0, ETH_ALEN);
memset(priv->scdb_ip, 0, 4);
priv->scdb_entry = NULL;
@ -554,22 +538,17 @@ void nat25_db_expire(struct adapter *priv)
/* if (!priv->ethBrExtInfo.nat25_disable) */
{
for (i =0; i<NAT25_HASH_SIZE; i++)
{
for (i =0; i<NAT25_HASH_SIZE; i++) {
struct nat25_network_db_entry *f;
f = priv->nethash[i];
while (f != NULL)
{
while (f != NULL) {
struct nat25_network_db_entry *g;
g = f->next_hash;
if (__nat25_has_expired(priv, f))
{
if (atomic_dec_and_test(&f->use_count))
{
if (priv->scdb_entry == f)
{
if (__nat25_has_expired(priv, f)) {
if (atomic_dec_and_test(&f->use_count)) {
if (priv->scdb_entry == f) {
memset(priv->scdb_mac, 0, ETH_ALEN);
memset(priv->scdb_ip, 0, 4);
priv->scdb_entry = NULL;
@ -578,12 +557,10 @@ void nat25_db_expire(struct adapter *priv)
rtw_mfree((u8 *) f, sizeof(struct nat25_network_db_entry));
}
}
f = g;
}
}
}
spin_unlock_bh(&priv->br_ext_lock);
}
@ -635,8 +612,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
if (protocol == ETH_P_IP) {
struct iphdr* iph = (struct iphdr *)(skb->data + ETH_HLEN);
if (((unsigned char*)(iph) + (iph->ihl<<2)) >= (skb->data + ETH_HLEN + skb->len))
{
if (((unsigned char*)(iph) + (iph->ihl<<2)) >=
(skb->data + ETH_HLEN + skb->len)) {
DEBUG_WARN("NAT25: malformed IP packet !\n");
return -1;
}
@ -646,7 +623,6 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
return -1;
case NAT25_INSERT:
{
tmp = be32_to_cpu(iph->saddr);
/* some muticast with source IP is all zero, maybe other case is illegal */
/* in class A, B, C, host address is all zero or all one is illegal */
@ -658,11 +634,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
__nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr);
__nat25_db_print(priv);
}
return 0;
case NAT25_LOOKUP:
{
DEBUG_INFO("NAT25: Lookup IP, SA =%08x, DA =%08x\n", iph->saddr, iph->daddr);
#ifdef SUPPORT_TX_MCAST2UNI
if (priv->pshare->rf_ft_var.mc2u_disable ||
@ -691,7 +664,6 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
}
}
}
}
return 0;
default:
@ -702,20 +674,17 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
/*---------------------------------------------------*/
/* Handle ARP frame */
/*---------------------------------------------------*/
else if (protocol == ETH_P_ARP)
{
else if (protocol == ETH_P_ARP) {
struct arphdr *arp = (struct arphdr *)(skb->data + ETH_HLEN);
unsigned char *arp_ptr = (unsigned char *)(arp + 1);
unsigned int *sender, *target;
if (arp->ar_pro != __constant_htons(ETH_P_IP))
{
if (arp->ar_pro != __constant_htons(ETH_P_IP)) {
DEBUG_WARN("NAT25: arp protocol unknown (%4x)!\n", htons(arp->ar_pro));
return -1;
}
switch (method)
{
switch (method) {
case NAT25_CHECK:
return 0; /* skb_copy for all ARP frame */
@ -767,71 +736,53 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
/* Handle IPX and Apple Talk frame */
/*---------------------------------------------------*/
else if ((protocol == ETH_P_IPX) ||
(protocol <= ETH_FRAME_LEN))
{
(protocol <= ETH_FRAME_LEN)) {
unsigned char ipx_header[2] = {0xFF, 0xFF};
struct ipxhdr *ipx = NULL;
struct elapaarp *ea = NULL;
struct ddpehdr *ddp = NULL;
unsigned char *framePtr = skb->data + ETH_HLEN;
if (protocol == ETH_P_IPX)
{
if (protocol == ETH_P_IPX) {
DEBUG_INFO("NAT25: Protocol =IPX (Ethernet II)\n");
ipx = (struct ipxhdr *)framePtr;
}
else if (protocol <= ETH_FRAME_LEN)
{
if (!memcmp(ipx_header, framePtr, 2))
{
} else if (protocol <= ETH_FRAME_LEN) {
if (!memcmp(ipx_header, framePtr, 2)) {
DEBUG_INFO("NAT25: Protocol =IPX (Ethernet 802.3)\n");
ipx = (struct ipxhdr *)framePtr;
}
else
{
} else {
unsigned char ipx_8022_type = 0xE0;
unsigned char snap_8022_type = 0xAA;
if (*framePtr == snap_8022_type)
{
if (*framePtr == snap_8022_type) {
unsigned char ipx_snap_id[5] = {0x0, 0x0, 0x0, 0x81, 0x37}; /* IPX SNAP ID */
unsigned char aarp_snap_id[5] = {0x00, 0x00, 0x00, 0x80, 0xF3}; /* Apple Talk AARP SNAP ID */
unsigned char ddp_snap_id[5] = {0x08, 0x00, 0x07, 0x80, 0x9B}; /* Apple Talk DDP SNAP ID */
framePtr += 3; /* eliminate the 802.2 header */
if (!memcmp(ipx_snap_id, framePtr, 5))
{
if (!memcmp(ipx_snap_id, framePtr, 5)) {
framePtr += 5; /* eliminate the SNAP header */
DEBUG_INFO("NAT25: Protocol =IPX (Ethernet SNAP)\n");
ipx = (struct ipxhdr *)framePtr;
}
else if (!memcmp(aarp_snap_id, framePtr, 5))
{
} else if (!memcmp(aarp_snap_id, framePtr, 5)) {
framePtr += 5; /* eliminate the SNAP header */
ea = (struct elapaarp *)framePtr;
}
else if (!memcmp(ddp_snap_id, framePtr, 5))
{
} else if (!memcmp(ddp_snap_id, framePtr, 5)) {
framePtr += 5; /* eliminate the SNAP header */
ddp = (struct ddpehdr *)framePtr;
}
else
{
} else {
DEBUG_WARN("NAT25: Protocol =Ethernet SNAP %02x%02x%02x%02x%02x\n", framePtr[0],
framePtr[1], framePtr[2], framePtr[3], framePtr[4]);
return -1;
}
}
else if (*framePtr == ipx_8022_type)
{
} else if (*framePtr == ipx_8022_type) {
framePtr += 3; /* eliminate the 802.2 header */
if (!memcmp(ipx_header, framePtr, 2))
{
if (!memcmp(ipx_header, framePtr, 2)) {
DEBUG_INFO("NAT25: Protocol =IPX (Ethernet 802.2)\n");
ipx = (struct ipxhdr *)framePtr;
}
@ -846,13 +797,10 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
return -1;
/* IPX */
if (ipx != NULL)
{
switch (method)
{
if (ipx != NULL) {
switch (method) {
case NAT25_CHECK:
if (!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN))
{
if (!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) {
DEBUG_INFO("NAT25: Check IPX skb_copy\n");
return 0;
}
@ -923,20 +871,15 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
default:
return -1;
}
}
} else if (ea != NULL) {
/* AARP */
else if (ea != NULL)
{
/* Sanity check fields. */
if (ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN)
{
if (ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN) {
DEBUG_WARN("NAT25: Appletalk AARP Sanity check fail!\n");
return -1;
}
switch (method)
{
switch (method) {
case NAT25_CHECK:
return 0;
@ -979,13 +922,9 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
default:
return -1;
}
}
} else if (ddp != NULL) {
/* DDP */
else if (ddp != NULL)
{
switch (method)
{
switch (method) {
case NAT25_CHECK:
return -1;
@ -1031,23 +970,19 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
/* Handle PPPoE frame */
/*---------------------------------------------------*/
else if ((protocol == ETH_P_PPP_DISC) ||
(protocol == ETH_P_PPP_SES))
{
(protocol == ETH_P_PPP_SES)) {
struct pppoe_hdr *ph = (struct pppoe_hdr *)(skb->data + ETH_HLEN);
__be16 *pMagic;
switch (method)
{
switch (method) {
case NAT25_CHECK:
if (ph->sid == 0)
return 0;
return 1;
case NAT25_INSERT:
if (ph->sid == 0) /* Discovery phase according to tag */
{
if (ph->code == PADI_CODE || ph->code == PADR_CODE)
{
if (ph->sid == 0) { /* Discovery phase according to tag */
if (ph->code == PADI_CODE || ph->code == PADR_CODE) {
if (priv->ethBrExtInfo.addPPPoETag) {
struct pppoe_tag *tag, *pOldTag;
unsigned char tag_buf[40];
@ -1102,9 +1037,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
}
else
return -1;
}
else /* session phase */
{
} else { /* session phase */
DEBUG_INFO("NAT25: Insert PPPoE, insert session packet to %s\n", skb->dev->name);
__nat25_generate_pppoe_network_addr(networkAddr, skb->data, &(ph->sid));
@ -1121,8 +1054,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
return 0;
case NAT25_LOOKUP:
if (ph->code == PADO_CODE || ph->code == PADS_CODE)
{
if (ph->code == PADO_CODE || ph->code == PADS_CODE) {
if (priv->ethBrExtInfo.addPPPoETag) {
struct pppoe_tag *tag;
unsigned char *ptr;
@ -1199,10 +1131,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
/*---------------------------------------------------*/
/* Handle EAP frame */
/*---------------------------------------------------*/
else if (protocol == 0x888e)
{
switch (method)
{
else if (protocol == 0x888e) {
switch (method) {
case NAT25_CHECK:
return -1;
@ -1221,10 +1151,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
/* Handle C-Media proprietary frame */
/*---------------------------------------------------*/
else if ((protocol == 0xe2ae) ||
(protocol == 0xe2af))
{
switch (method)
{
(protocol == 0xe2af)) {
switch (method) {
case NAT25_CHECK:
return -1;
@ -1243,25 +1171,21 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
/* Handle IPV6 frame */
/*---------------------------------------------------*/
#ifdef CL_IPV6_PASS
else if (protocol == ETH_P_IPV6)
{
else if (protocol == ETH_P_IPV6) {
struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN);
if (sizeof(*iph) >= (skb->len - ETH_HLEN))
{
if (sizeof(*iph) >= (skb->len - ETH_HLEN)) {
DEBUG_WARN("NAT25: malformed IPv6 packet !\n");
return -1;
}
switch (method)
{
switch (method) {
case NAT25_CHECK:
if (skb->data[0] & 1)
return 0;
return -1;
case NAT25_INSERT:
{
case NAT25_INSERT: {
DEBUG_INFO("NAT25: Insert IP, SA =%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x,"
" DA =%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x\n",
iph->saddr.s6_addr16[0], iph->saddr.s6_addr16[1], iph->saddr.s6_addr16[2], iph->saddr.s6_addr16[3],
@ -1318,8 +1242,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
int nat25_handle_frame(struct adapter *priv, struct sk_buff *skb)
{
if (!(skb->data[0] & 1))
{
if (!(skb->data[0] & 1)) {
int is_vlan_tag =0, i, retval =0;
unsigned short vlan_hdr =0;
@ -1331,8 +1254,7 @@ int nat25_handle_frame(struct adapter *priv, struct sk_buff *skb)
skb_pull(skb, 4);
}
if (!priv->ethBrExtInfo.nat25_disable)
{
if (!priv->ethBrExtInfo.nat25_disable) {
unsigned long irqL;
spin_lock_bh(&priv->br_ext_lock);
/*
@ -1411,24 +1333,19 @@ void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb)
if (!priv->ethBrExtInfo.dhcp_bcst_disable) {
__be16 protocol = *((__be16 *)(skb->data + 2 * ETH_ALEN));
if (protocol == __constant_htons(ETH_P_IP)) /* IP */
{
if (protocol == __constant_htons(ETH_P_IP)) { /* IP */
struct iphdr* iph = (struct iphdr *)(skb->data + ETH_HLEN);
if (iph->protocol == IPPROTO_UDP) /* UDP */
{
if (iph->protocol == IPPROTO_UDP) { /* UDP */
struct udphdr *udph = (struct udphdr *)((SIZE_PTR)iph + (iph->ihl << 2));
if ((udph->source == __constant_htons(CLIENT_PORT))
&& (udph->dest == __constant_htons(SERVER_PORT))) /* DHCP request */
{
if ((udph->source == __constant_htons(CLIENT_PORT)) &&
(udph->dest == __constant_htons(SERVER_PORT))) { /* DHCP request */
struct dhcpMessage *dhcph =
(struct dhcpMessage *)((SIZE_PTR)udph + sizeof(struct udphdr));
if (dhcph->cookie == DHCP_MAGIC) /* match magic word */
{
if (!(dhcph->flags & BROADCAST_FLAG)) /* if not broadcast */
{
if (dhcph->cookie == DHCP_MAGIC) { /* match magic word */
if (!(dhcph->flags & BROADCAST_FLAG)) { /* if not broadcast */
register int sum = 0;
DEBUG_INFO("DHCP: change flag of DHCP request to broadcast.\n");
@ -1458,8 +1375,7 @@ void *scdb_findEntry(struct adapter *priv, unsigned char *macAddr,
__nat25_generate_ipv4_network_addr(networkAddr, (unsigned int *)ipAddr);
hash = __nat25_network_hash(networkAddr);
db = priv->nethash[hash];
while (db != NULL)
{
while (db != NULL) {
if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) {
/* spin_unlock_bh(&priv->br_ext_lock); */
return (void *)db;

View file

@ -185,13 +185,10 @@ struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue)
unsigned long irqL;
struct cmd_obj *obj;
;
_enter_critical(&queue->lock, &irqL);
if (rtw_is_list_empty(&(queue->queue)))
if (rtw_is_list_empty(&(queue->queue))) {
obj = NULL;
else
{
} else {
obj = LIST_CONTAINOR(get_next(&(queue->queue)), struct cmd_obj, list);
rtw_list_delete(&obj->list);
}
@ -237,28 +234,20 @@ static int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
u8 bAllow = false; /* set to true to allow enqueuing cmd when hw_init_completed is false */
/* To decide allow or not */
if ( (adapter_to_pwrctl(pcmdpriv->padapter)->bHWPwrPindetect)
&&(!pcmdpriv->padapter->registrypriv.usbss_enable)
)
{
if (cmd_obj->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra) )
{
if ((adapter_to_pwrctl(pcmdpriv->padapter)->bHWPwrPindetect) &&
(!pcmdpriv->padapter->registrypriv.usbss_enable)) {
if (cmd_obj->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra)) {
struct drvextra_cmd_parm *pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)cmd_obj->parmbuf;
if (pdrvextra_cmd_parm->ec_id == POWER_SAVING_CTRL_WK_CID)
{
/* DBG_871X("==>enqueue POWER_SAVING_CTRL_WK_CID\n"); */
bAllow = true;
}
}
}
if (cmd_obj->cmdcode == GEN_CMD_CODE(_SetChannelPlan))
bAllow = true;
if ( (pcmdpriv->padapter->hw_init_completed ==false && bAllow == false)
|| pcmdpriv->cmdthd_running == false /* com_thread not running */
)
{
if ((pcmdpriv->padapter->hw_init_completed ==false && bAllow == false) ||
pcmdpriv->cmdthd_running == false) { /* com_thread not running */
/* DBG_871X("%s:%s: drop cmdcode:%u, hw_init_completed:%u, cmdthd_running:%u\n", caller_func, __FUNCTION__, */
/* cmd_obj->cmdcode, */
/* pcmdpriv->padapter->hw_init_completed, */
@ -322,19 +311,12 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd)
;
if ((pcmd->cmdcode!=_JoinBss_CMD_) &&(pcmd->cmdcode!= _CreateBss_CMD_))
{
/* free parmbuf in cmd_obj */
rtw_mfree((unsigned char*)pcmd->parmbuf, pcmd->cmdsz);
}
if (pcmd->rsp!= NULL)
{
if (pcmd->rsp!= NULL) {
if (pcmd->rspsz!= 0)
{
/* free rsp in cmd_obj */
rtw_mfree((unsigned char*)pcmd->rsp, pcmd->rspsz);
}
}
/* free cmd_obj */
rtw_mfree((unsigned char*)pcmd, sizeof(struct cmd_obj));
@ -345,8 +327,7 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd)
void rtw_stop_cmd_thread(struct adapter *adapter)
{
if (adapter->cmdThread && adapter->cmdpriv.cmdthd_running == true
&& adapter->cmdpriv.stop_req == 0)
{
&& adapter->cmdpriv.stop_req == 0) {
adapter->cmdpriv.stop_req = 1;
_rtw_up_sema(&adapter->cmdpriv.cmd_queue_sema);
_rtw_down_sema(&adapter->cmdpriv.terminate_cmdthread_sema);
@ -376,8 +357,7 @@ int rtw_cmd_thread(void * context)
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("start r871x rtw_cmd_thread !!!!\n"));
while (1)
{
while (1) {
if (_rtw_down_sema(&pcmdpriv->cmd_queue_sema) == _FAIL) {
DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" _rtw_down_sema(&pcmdpriv->cmd_queue_sema) return _FAIL, break\n", FUNC_ADPT_ARG(padapter));
break;
@ -999,8 +979,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork)
t_len = sizeof(struct wlan_bssid_ex);
/* for hidden ap to set fw_state here */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) != true)
{
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) != true) {
switch (ndis_network_mode)
{
case Ndis802_11IBSS:
@ -1020,8 +999,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork)
}
psecnetwork =(struct wlan_bssid_ex *)&psecuritypriv->sec_bss;
if (psecnetwork == NULL)
{
if (psecnetwork == NULL) {
if (pcmd != NULL)
rtw_mfree((unsigned char *)pcmd, sizeof(struct cmd_obj));
@ -1052,46 +1030,36 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork)
/* the driver just has the bssid information for PMKIDList searching. */
if ( pmlmepriv->assoc_by_bssid == false )
{
memcpy( &pmlmepriv->assoc_bssid[ 0 ], &pnetwork->network.MacAddress[ 0 ], ETH_ALEN );
}
psecnetwork->IELength = rtw_restruct_sec_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0], pnetwork->network.IELength);
pqospriv->qos_option = 0;
if (pregistrypriv->wmm_enable)
{
if (pregistrypriv->wmm_enable) {
u32 tmp_len;
tmp_len = rtw_restruct_wmm_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0], pnetwork->network.IELength, psecnetwork->IELength);
if (psecnetwork->IELength != tmp_len)
{
if (psecnetwork->IELength != tmp_len) {
psecnetwork->IELength = tmp_len;
pqospriv->qos_option = 1; /* There is WMM IE in this corresp. beacon */
}
else
{
} else {
pqospriv->qos_option = 0;/* There is no WMM IE in this corresp. beacon */
}
}
phtpriv->ht_option = false;
if (pregistrypriv->ht_enable)
{
if (pregistrypriv->ht_enable) {
/* Added by Albert 2010/06/23 */
/* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */
/* Especially for Realtek 8192u SoftAP. */
if ( ( padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_ ) &&
( padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_ ) &&
( padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_ ))
{
/* rtw_restructure_ht_ie */
rtw_restructure_ht_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0],
pnetwork->network.IELength, &psecnetwork->IELength);
}
}
pmlmeinfo->assoc_AP_vendor = check_assoc_AP(pnetwork->network.IEs, pnetwork->network.IELength);
if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_TENDA)
@ -1238,8 +1206,7 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key, bool en
/* jeff: set this becasue at least sw key is ready */
padapter->securitypriv.busetkipkey =true;
if (enqueue)
{
if (enqueue) {
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
if ( ph2c == NULL) {
rtw_mfree((u8 *) psetstakey_para, sizeof(struct set_stakey_parm));
@ -1282,14 +1249,9 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue)
struct sta_info* sta = (struct sta_info* )psta;
u8 res =_SUCCESS;
;
if (!enqueue)
{
if (!enqueue) {
clear_cam_entry(padapter, entry);
}
else
{
} else {
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
if ( ph2c == NULL) {
res = _FAIL;
@ -1685,8 +1647,7 @@ u8 rtw_set_chplan_cmd(struct adapter*padapter, u8 chplan, u8 enqueue)
}
setChannelPlan_param->channel_plan =chplan;
if (enqueue)
{
if (enqueue) {
/* need enqueue, prepare cmd_obj and enqueue */
pcmdobj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
if (pcmdobj == NULL) {
@ -1697,9 +1658,7 @@ u8 rtw_set_chplan_cmd(struct adapter*padapter, u8 chplan, u8 enqueue)
init_h2fwcmd_w_parm_no_rsp(pcmdobj, setChannelPlan_param, GEN_CMD_CODE(_SetChannelPlan));
res = rtw_enqueue_cmd(pcmdpriv, pcmdobj);
}
else
{
} else {
/* no need to enqueue, do the cmd hdl directly and free cmd parameter */
if ( H2C_SUCCESS !=set_chplan_hdl(padapter, (unsigned char *)setChannelPlan_param) )
res = _FAIL;
@ -1867,30 +1826,20 @@ static void traffic_status_watchdog(struct adapter *padapter)
#endif
{
/* check traffic for powersaving. */
if ( ((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod + pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8 ) ||
(pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 2) )
{
/* DBG_871X("Tx = %d, Rx = %d\n", pmlmepriv->LinkDetectInfo.NumTxOkInPeriod, pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod); */
if (((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod +
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8 ) ||
(pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 2))
bEnterPS = false;
}
else
{
bEnterPS = true;
}
/* LeisurePS only work in infra mode. */
if (bEnterPS)
{
LPS_Enter(padapter);
}
else
{
LPS_Leave(padapter);
}
}
}
else
{
} else {
LPS_Leave(padapter);
}
@ -1915,9 +1864,7 @@ void dynamic_chk_wk_hdl(struct adapter *padapter, u8 *pbuf, int sz)
#ifdef CONFIG_AP_MODE
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)
{
expire_timeout_chk(padapter);
}
#endif
rtw_hal_sreset_xmit_status_check(padapter);
@ -1941,16 +1888,11 @@ static void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type)
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
u8 mstatus;
;
if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)
|| (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true))
{
if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) ||
(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)))
return;
}
switch (lps_ctrl_type)
{
switch (lps_ctrl_type) {
case LPS_CTRL_SCAN:
/* DBG_871X("LPS_CTRL_SCAN\n"); */
#ifdef CONFIG_BT_COEXIST
@ -2047,9 +1989,7 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter*padapter, u8 lps_ctrl_type, u8 enqueue)
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
}
else
{
} else {
lps_ctrl_wk_hdl(padapter, lps_ctrl_type);
}
@ -2121,8 +2061,7 @@ u8 rtw_antenna_select_cmd(struct adapter*padapter, u8 antenna, u8 enqueue)
rtw_hal_get_def_var(padapter, HAL_DEF_IS_SUPPORT_ANT_DIV, &(bSupportAntDiv));
if (false == bSupportAntDiv ) return res;
if (true == enqueue)
{
if (true == enqueue) {
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
if (ph2c == NULL) {
res = _FAIL;
@ -2179,12 +2118,8 @@ u8 p2p_protocol_wk_cmd(struct adapter*padapter, int intCmdType )
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
u8 res = _SUCCESS;
;
if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
{
return res;
}
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
if (ph2c == NULL) {
@ -2263,8 +2198,7 @@ static void rtw_chk_hi_queue_hdl(struct adapter *padapter)
if (!psta_bmc)
return;
if (psta_bmc->sleepq_len == 0)
{
if (psta_bmc->sleepq_len == 0) {
u8 val = 0;
/* while ((rtw_read32(padapter, 0x414)&0x00ffff00)!=0) */
@ -2446,8 +2380,7 @@ u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf)
pdrvextra_cmd = (struct drvextra_cmd_parm*)pbuf;
switch (pdrvextra_cmd->ec_id)
{
switch (pdrvextra_cmd->ec_id) {
case DYNAMIC_CHK_WK_CID:
dynamic_chk_wk_hdl(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size);
break;
@ -2495,9 +2428,7 @@ u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf)
}
if (pdrvextra_cmd->pbuf && pdrvextra_cmd->type_size>0)
{
rtw_mfree(pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size);
}
return H2C_SUCCESS;
}
@ -2508,8 +2439,7 @@ void rtw_survey_cmd_callback(struct adapter* padapter , struct cmd_obj *pcmd)
;
if (pcmd->res == H2C_DROPPED)
{
if (pcmd->res == H2C_DROPPED) {
/* TODO: cancel timer and do timeout handler directly... */
/* need to make timeout handlerOS independent */
_set_timer(&pmlmepriv->scan_to_timer, 1);
@ -2531,8 +2461,7 @@ void rtw_disassoc_cmd_callback(struct adapter* padapter, struct cmd_obj *pcmd)
;
if (pcmd->res != H2C_SUCCESS)
{
if (pcmd->res != H2C_SUCCESS) {
spin_lock_bh(&pmlmepriv->lock);
set_fwstate(pmlmepriv, _FW_LINKED);
spin_unlock_bh(&pmlmepriv->lock);
@ -2559,14 +2488,11 @@ void rtw_joinbss_cmd_callback(struct adapter* padapter, struct cmd_obj *pcmd)
;
if (pcmd->res == H2C_DROPPED)
{
if (pcmd->res == H2C_DROPPED) {
/* TODO: cancel timer and do timeout handler directly... */
/* need to make timeout handlerOS independent */
_set_timer(&pmlmepriv->assoc_timer, 1);
}
else if (pcmd->res != H2C_SUCCESS)
{
} else if (pcmd->res != H2C_SUCCESS) {
RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("********Error:rtw_select_and_join_from_scanned_queue Wait Sema Fail ************\n"));
_set_timer(&pmlmepriv->assoc_timer, 1);
}
@ -2585,8 +2511,7 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
;
if ((pcmd->res != H2C_SUCCESS))
{
if ((pcmd->res != H2C_SUCCESS)) {
RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n ********Error: rtw_createbss_cmd_callback Fail ************\n\n."));
_set_timer(&pmlmepriv->assoc_timer, 1 );
}
@ -2614,23 +2539,18 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
spin_lock_bh(&pmlmepriv->lock);
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) )
{
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) ) {
psta = rtw_get_stainfo(&padapter->stapriv, pnetwork->MacAddress);
if (!psta)
{
if (!psta) {
psta = rtw_alloc_stainfo(&padapter->stapriv, pnetwork->MacAddress);
if (psta == NULL)
{
if (psta == NULL) {
RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nCan't alloc sta_info when createbss_cmd_callback\n"));
goto createbss_cmd_fail ;
}
}
rtw_indicate_connect( padapter);
}
else
{
} else {
unsigned long irqL;
pwlan = _rtw_alloc_network(pmlmepriv);
@ -2686,8 +2606,7 @@ void rtw_setstaKey_cmdrsp_callback(struct adapter* padapter , struct cmd_obj *p
;
if (psta == NULL)
{
if (psta == NULL) {
RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nERROR: rtw_setstaKey_cmdrsp_callback => can't get sta_info\n\n"));
goto exit;
}
@ -2707,8 +2626,7 @@ void rtw_setassocsta_cmdrsp_callback(struct adapter* padapter, struct cmd_obj *
;
if (psta == NULL)
{
if (psta == NULL) {
RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nERROR: setassocsta_cmdrsp_callbac => can't get sta_info\n\n"));
goto exit;
}