rtl8188eu: Fix most sparse warnings other than endedness problems

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-06-03 14:52:18 -05:00
parent 925510ff1a
commit 327817d32a
47 changed files with 667 additions and 1771 deletions

View file

@ -46,8 +46,6 @@ void init_mlme_ap_info(_adapter *padapter)
//for ACL
_rtw_init_queue(&pacl_list->acl_node_q);
//pmlmeext->bstart_bss = false;
start_ap_mode(padapter);
}
@ -60,8 +58,6 @@ void free_mlme_ap_info(_adapter *padapter)
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
//stop_ap_mode(padapter);
pmlmepriv->update_bcn = false;
pmlmeext->bstart_bss = false;
@ -78,9 +74,7 @@ void free_mlme_ap_info(_adapter *padapter)
rtw_free_stainfo(padapter, psta);
_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
_rtw_spinlock_free(&pmlmepriv->bcn_update_lock);
}
static void update_BCNTIM(_adapter *padapter)
@ -91,12 +85,8 @@ static void update_BCNTIM(_adapter *padapter)
WLAN_BSSID_EX *pnetwork_mlmeext = &(pmlmeinfo->network);
unsigned char *pie = pnetwork_mlmeext->IEs;
//DBG_88E("%s\n", __func__);
//update TIM IE
//if (pstapriv->tim_bitmap)
if (true)
{
if (true) {
u8 *p, *dst_ie, *premainder_ie=NULL, *pbackup_remainder_ie=NULL;
u16 tim_bitmap_le;
uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen;
@ -104,21 +94,14 @@ static void update_BCNTIM(_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;
tim_ie_offset = (sint)(p -pie);
remainder_ielen = pnetwork_mlmeext->IELength - tim_ie_offset - tim_ielen;
//append TIM IE from dst_ie offset
dst_ie = p;
}
else
{
} else {
tim_ielen = 0;
//calucate head_len
@ -128,9 +111,7 @@ static void update_BCNTIM(_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;
@ -141,19 +122,13 @@ static void update_BCNTIM(_adapter *padapter)
//append TIM IE from offset
dst_ie = pie + offset;
}
if (remainder_ielen>0)
{
if (remainder_ielen > 0) {
pbackup_remainder_ie = rtw_malloc(remainder_ielen);
if (pbackup_remainder_ie && premainder_ie)
_rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
}
*dst_ie++=_TIM_IE_;
if ((pstapriv->tim_bitmap&0xff00) && (pstapriv->tim_bitmap&0x00fc))
@ -171,27 +146,21 @@ static void update_BCNTIM(_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) {
_rtw_memcpy(dst_ie, &tim_bitmap_le, 2);
dst_ie+=2;
}
//copy remainder IE
if (pbackup_remainder_ie)
{
if (pbackup_remainder_ie) {
_rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen);
rtw_mfree(pbackup_remainder_ie, remainder_ielen);
}
offset = (uint)(dst_ie - pie);
pnetwork_mlmeext->IELength = offset + remainder_ielen;
}
#ifndef CONFIG_INTERRUPT_BASED_TXBCN
@ -199,8 +168,6 @@ static void update_BCNTIM(_adapter *padapter)
set_tx_beacon_cmd(padapter);
#endif
#endif //!CONFIG_INTERRUPT_BASED_TXBCN
}
void rtw_add_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *data, u8 len)
@ -211,29 +178,23 @@ void rtw_add_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *d
u8 *p, *dst_ie, *premainder_ie=NULL, *pbackup_remainder_ie=NULL;
u32 i, offset, ielen, ie_offset, remainder_ielen = 0;
for (i = sizeof(NDIS_802_11_FIXED_IEs); i < pnetwork->IELength;)
{
for (i = sizeof(NDIS_802_11_FIXED_IEs); i < pnetwork->IELength;) {
pIE = (PNDIS_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;
break;
}
p = (u8 *)pIE;
ielen = pIE->Length;
i += (pIE->Length + 2);
}
if (p != NULL && ielen>0)
{
if (p != NULL && ielen > 0) {
ielen += 2;
premainder_ie = p+ielen;
@ -248,8 +209,7 @@ void rtw_add_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *d
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)
_rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
@ -262,8 +222,7 @@ void rtw_add_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *d
dst_ie+=len;
//copy remainder IE
if (pbackup_remainder_ie)
{
if (pbackup_remainder_ie) {
_rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen);
rtw_mfree(pbackup_remainder_ie, remainder_ielen);
@ -280,8 +239,7 @@ void rtw_remove_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index)
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;
@ -293,16 +251,14 @@ void rtw_remove_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index)
dst_ie = p;
}
if (remainder_ielen>0)
{
if (remainder_ielen > 0) {
pbackup_remainder_ie = rtw_malloc(remainder_ielen);
if (pbackup_remainder_ie && premainder_ie)
_rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
}
//copy remainder IE
if (pbackup_remainder_ie)
{
if (pbackup_remainder_ie) {
_rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen);
rtw_mfree(pbackup_remainder_ie, remainder_ielen);
@ -312,31 +268,23 @@ void rtw_remove_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index)
pnetwork->IELength = offset + remainder_ielen;
}
u8 chk_sta_is_alive(struct sta_info *psta);
u8 chk_sta_is_alive(struct sta_info *psta)
static u8 chk_sta_is_alive(struct sta_info *psta)
{
u8 ret = false;
#ifdef DBG_EXPIRATION_CHK
DBG_88E("sta:%pM, rssi:%d, rx:"STA_PKTS_FMT", expire_to:%u, %s%ssq_len:%u\n"
, (psta->hwaddr)
, psta->rssi_stat.UndecoratedSmoothedPWDB
//, STA_RX_PKTS_ARG(psta)
, STA_RX_PKTS_DIFF_ARG(psta)
, psta->expire_to
, psta->state&WIFI_SLEEP_STATE?"PS, ":""
, psta->state&WIFI_STA_ALIVE_CHK_STATE?"SAC, ":""
, psta->sleepq_len
);
DBG_88E("sta:%pM, rssi:%d, rx:"STA_PKTS_FMT", expire_to:%u, %s%ssq_len:%u\n",
(psta->hwaddr), psta->rssi_stat.UndecoratedSmoothedPWDB,
STA_RX_PKTS_DIFF_ARG(psta), psta->expire_to,
psta->state&WIFI_SLEEP_STATE ? "PS, " : "",
psta->state&WIFI_STA_ALIVE_CHK_STATE ? "SAC, " : "",
psta->sleepq_len);
#endif
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))
{
}
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
{
ret = true;
}
sta_update_last_rx_pkts(psta);
@ -366,21 +314,18 @@ void expire_timeout_chk(_adapter *padapter)
, FUNC_NDEV_ARG(padapter->pnetdev), pstapriv->auth_list_cnt);
}
#endif
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--;
DBG_88E("auth expire %02X%02X%02X%02X%02X%02X\n",
psta->hwaddr[0],psta->hwaddr[1],psta->hwaddr[2],psta->hwaddr[3],psta->hwaddr[4],psta->hwaddr[5]);
DBG_88E("auth expire %6ph\n",
psta->hwaddr);
_exit_critical_bh(&pstapriv->auth_list_lock, &irqL);
@ -393,7 +338,6 @@ void expire_timeout_chk(_adapter *padapter)
}
}
_exit_critical_bh(&pstapriv->auth_list_lock, &irqL);
psta = NULL;
@ -411,8 +355,7 @@ void expire_timeout_chk(_adapter *padapter)
, FUNC_NDEV_ARG(padapter->pnetdev), pstapriv->asoc_list_cnt);
}
#endif
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);
@ -432,9 +375,7 @@ void expire_timeout_chk(_adapter *padapter)
if ( (psta->flags & WLAN_STA_HT) && (psta->htpriv.agg_enable_bitmap || psta->under_exist_checking) ) {
// check sta by delba(addba) for 11n STA
// ToDo: use CCX report to check for all STAs
//DBG_88E("asoc check by DELBA/ADDBA! (pstapriv->expire_to=%d s)(psta->expire_to=%d s), [%02x, %d]\n", pstapriv->expire_to*2, psta->expire_to*2, psta->htpriv.agg_enable_bitmap, psta->under_exist_checking);
if ( psta->expire_to <= (pstapriv->expire_to - 50 ) ) {
if ( psta->expire_to <= (pstapriv->expire_to - 50 ) ) {
DBG_88E("asoc expire by DELBA/ADDBA! (%d s)\n", (pstapriv->expire_to-psta->expire_to)*2);
psta->under_exist_checking = 0;
psta->expire_to = 0;
@ -451,13 +392,11 @@ void expire_timeout_chk(_adapter *padapter)
#endif // CONFIG_TX_MCAST2UNI
#endif //CONFIG_ACTIVE_KEEP_ALIVE_CHECK
if (psta->expire_to <= 0)
{
if (psta->expire_to <= 0) {
#ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
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;
}
@ -468,8 +407,6 @@ void expire_timeout_chk(_adapter *padapter)
psta->expire_to = pstapriv->expire_to;
psta->state |= WIFI_STA_ALIVE_CHK_STATE;
//DBG_88E("alive chk, sta:%pM is at ps mode!\n", (psta->hwaddr));
//to update bcn with tim_bitmap for this station
pstapriv->tim_bitmap |= BIT(psta->aid);
update_beacon(padapter, _TIM_IE_, NULL, false);
@ -478,7 +415,6 @@ void expire_timeout_chk(_adapter *padapter)
continue;
}
}
if (pmlmeext->active_keep_alive_check) {
int stainfo_offset;
@ -486,7 +422,6 @@ void expire_timeout_chk(_adapter *padapter)
if (stainfo_offset_valid(stainfo_offset)) {
chk_alive_list[chk_alive_num++] = stainfo_offset;
}
continue;
}
#endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK */
@ -496,16 +431,14 @@ void expire_timeout_chk(_adapter *padapter)
DBG_88E("asoc expire %pM, state=0x%x\n", (psta->hwaddr), psta->state);
updated = ap_free_sta(padapter, psta, true, 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)
){
DBG_88E("%s sta:%pM, sleepq_len:%u, free_xmitframe_cnt:%u, asoc_list_cnt:%u, clear sleep_q\n", __func__
, (psta->hwaddr)
, psta->sleepq_len, padapter->xmitpriv.free_xmitframe_cnt, pstapriv->asoc_list_cnt);
if (psta->sleepq_len > (NR_XMITFRAME/pstapriv->asoc_list_cnt) &&
padapter->xmitpriv.free_xmitframe_cnt < (NR_XMITFRAME/pstapriv->asoc_list_cnt/2)) {
DBG_88E("%s sta:%pM, sleepq_len:%u, free_xmitframe_cnt:%u, asoc_list_cnt:%u, clear sleep_q\n", __func__,
(psta->hwaddr), psta->sleepq_len,
padapter->xmitpriv.free_xmitframe_cnt,
pstapriv->asoc_list_cnt);
wakeup_sta_to_xmit(padapter, psta);
}
}
@ -514,57 +447,52 @@ void expire_timeout_chk(_adapter *padapter)
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
#ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
if (chk_alive_num) {
if (chk_alive_num) {
u8 backup_oper_channel=0;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
/* switch to correct channel of current network before issue keep-alive frames */
if (rtw_get_oper_ch(padapter) != pmlmeext->cur_channel) {
backup_oper_channel = rtw_get_oper_ch(padapter);
SelectChannel(padapter, pmlmeext->cur_channel);
}
u8 backup_oper_channel=0;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
/* switch to correct channel of current network before issue keep-alive frames */
if (rtw_get_oper_ch(padapter) != pmlmeext->cur_channel) {
backup_oper_channel = rtw_get_oper_ch(padapter);
SelectChannel(padapter, pmlmeext->cur_channel);
}
/* issue null data to check sta alive*/
for (i = 0; i < chk_alive_num; i++) {
/* issue null data to check sta alive*/
for (i = 0; i < chk_alive_num; i++) {
int ret = _FAIL;
int ret = _FAIL;
psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]);
psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]);
if (psta->state & WIFI_SLEEP_STATE)
ret = issue_nulldata(padapter, psta->hwaddr, 0, 1, 50);
else
ret = issue_nulldata(padapter, psta->hwaddr, 0, 3, 50);
if (psta->state & WIFI_SLEEP_STATE)
ret = issue_nulldata(padapter, psta->hwaddr, 0, 1, 50);
else
ret = issue_nulldata(padapter, psta->hwaddr, 0, 3, 50);
psta->keep_alive_trycnt++;
if (ret == _SUCCESS) {
DBG_88E("asoc check, sta(%pM) is alive\n", (psta->hwaddr));
psta->expire_to = pstapriv->expire_to;
psta->keep_alive_trycnt = 0;
continue;
} else if (psta->keep_alive_trycnt <= 3) {
DBG_88E("ack check for asoc expire, keep_alive_trycnt=%d\n", psta->keep_alive_trycnt);
psta->expire_to = 1;
continue;
}
psta->keep_alive_trycnt++;
if (ret == _SUCCESS)
{
DBG_88E("asoc check, sta(%pM) is alive\n", (psta->hwaddr));
psta->expire_to = pstapriv->expire_to;
psta->keep_alive_trycnt = 0;
continue;
}
else if (psta->keep_alive_trycnt <= 3)
{
DBG_88E("ack check for asoc expire, keep_alive_trycnt=%d\n", psta->keep_alive_trycnt);
psta->expire_to = 1;
continue;
DBG_88E("asoc expire %pM, state=0x%x\n", (psta->hwaddr), psta->state);
_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
rtw_list_delete(&psta->asoc_list);
pstapriv->asoc_list_cnt--;
updated = ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING);
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
}
psta->keep_alive_trycnt = 0;
DBG_88E("asoc expire %pM, state=0x%x\n", (psta->hwaddr), psta->state);
_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
rtw_list_delete(&psta->asoc_list);
pstapriv->asoc_list_cnt--;
updated = ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING);
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
if (backup_oper_channel>0) /* back to the original operation channel */
SelectChannel(padapter, backup_oper_channel);
}
if (backup_oper_channel>0) /* back to the original operation channel */
SelectChannel(padapter, backup_oper_channel);
}
#endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK */
associated_clients_update(padapter, updated);
@ -593,22 +521,20 @@ void add_RATid(_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);
}
#ifdef CONFIG_80211N_HT
//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
else
limit=8;// 1R
for (i=0; i<limit; i++) {
for (i = 0; i < limit; i++) {
if (psta_ht->ht_cap.supp_mcs_set[i/8] & BIT(i%8))
tx_ra_bitmap |= BIT(i+12);
}
@ -638,8 +564,7 @@ void add_RATid(_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;
@ -660,7 +585,6 @@ void add_RATid(_adapter *padapter, struct sta_info *psta, u8 rssi_level)
//arg[5] = Short GI
rtw_hal_add_ra_tid(padapter, tx_ra_bitmap, arg, rssi_level);
if (shortGIrate==true)
init_rate |= BIT(6);
@ -668,12 +592,9 @@ void add_RATid(_adapter *padapter, struct sta_info *psta, u8 rssi_level)
psta->raid = raid;
psta->init_rate = init_rate;
}
else
{
} else {
DBG_88E("station aid %d exceed the max number\n", psta->aid);
}
}
static void update_bmc_sta(_adapter *padapter)
@ -687,10 +608,8 @@ static void update_bmc_sta(_adapter *padapter)
WLAN_BSSID_EX *pcur_network = (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;
psta->qos_option = 0;
@ -702,10 +621,6 @@ static void update_bmc_sta(_adapter *padapter)
_rtw_memset((void*)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
//psta->dot118021XPrivacy = _NO_PRIVACY_;//!!! remove it, because it has been set before this.
//prepare for add_RATid
supportRateNum = rtw_get_rateset_len((u8*)&pcur_network->SupportedRates);
network_type = rtw_check_network_type((u8*)&pcur_network->SupportedRates, supportRateNum, 1);
@ -714,8 +629,7 @@ static void update_bmc_sta(_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);
}
@ -730,28 +644,18 @@ static void update_bmc_sta(_adapter *padapter)
tx_ra_bitmap = 0xf;
}
//tx_ra_bitmap = update_basic_rate(pcur_network->SupportedRates, supportRateNum);
raid = networktype_to_raid(network_type);
init_rate = get_highest_rate_idx(tx_ra_bitmap&0x0fffffff)&0x3f;
//DBG_88E("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;
arg = psta->mac_id&0x1f;
arg |= BIT(7);
//if (shortGIrate==true)
// arg |= BIT(5);
tx_ra_bitmap |= ((raid<<28)&0xf0000000);
DBG_88E("update_bmc_sta, mask=0x%x, arg=0x%x\n", tx_ra_bitmap, arg);
//bitmap[0:27] = tx_rate_bitmap
@ -759,9 +663,7 @@ static void update_bmc_sta(_adapter *padapter)
//arg[0:4] = macid
//arg[5] = Short GI
rtw_hal_add_ra_tid(padapter, tx_ra_bitmap, arg, 0);
}
//set ra_id, init_rate
psta->raid = raid;
psta->init_rate = init_rate;
@ -772,12 +674,9 @@ static void update_bmc_sta(_adapter *padapter)
psta->state = _FW_LINKED;
_exit_critical_bh(&psta->lock, &irqL);
}
else
{
} else {
DBG_88E("add_RATid_bmc_sta error!\n");
}
}
//notes:
@ -797,10 +696,6 @@ void update_sta_info_apmode(_adapter *padapter, struct sta_info *psta)
struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv;
struct ht_priv *phtpriv_sta = &psta->htpriv;
#endif //CONFIG_80211N_HT
//set intf_tag to if1
//psta->intf_tag = 0;
//psta->mac_id = psta->aid+4;
psta->mac_id = psta->aid+1;
DBG_88E("%s\n",__func__);
@ -819,33 +714,22 @@ void update_sta_info_apmode(_adapter *padapter, struct sta_info *psta)
VCS_update(padapter, psta);
#ifdef CONFIG_80211N_HT
//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))
{
//phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_40;
if ((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH)) {
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;
phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_20;
phtpriv_sta->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
@ -864,16 +748,9 @@ void update_sta_info_apmode(_adapter *padapter, struct sta_info *psta)
_rtw_memset((void*)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
//add ratid
//add_RATid(padapter, psta);//move to ap_sta_info_defer_update()
_enter_critical_bh(&psta->lock, &irqL);
psta->state |= _FW_LINKED;
_exit_critical_bh(&psta->lock, &irqL);
}
static void update_hw_ht_param(_adapter *padapter)
@ -886,7 +763,6 @@ static void update_hw_ht_param(_adapter *padapter)
DBG_88E("%s\n", __func__);
//handle A-MPDU parameter field
/*
AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k
@ -905,21 +781,7 @@ static void update_hw_ht_param(_adapter *padapter)
//
pmlmeinfo->SM_PS = (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & 0x0C) >> 2;
if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC)
{
/*u8 i;
//update the MCS rates
for (i = 0; i < 16; i++)
{
pmlmeinfo->HT_caps.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i];
}*/
DBG_88E("%s(): WLAN_HT_CAP_SM_PS_STATIC\n",__func__);
}
//
// Config current HT Protection mode.
//
//pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3;
}
static void start_bss_network(_adapter *padapter, u8 *pbuf)
@ -941,8 +803,6 @@ static void start_bss_network(_adapter *padapter, u8 *pbuf)
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
#endif //CONFIG_P2P
//DBG_88E("%s\n", __func__);
bcn_interval = (u16)pnetwork->Configuration.BeaconPeriod;
cur_channel = pnetwork->Configuration.DSConfig;
cur_bwmode = HT_CHANNEL_WIDTH_20;;
@ -958,27 +818,21 @@ static void start_bss_network(_adapter *padapter, u8 *pbuf)
}
//todo: update wmm, ht cap
//pmlmeinfo->WMM_enable;
//pmlmeinfo->HT_enable;
if (pmlmepriv->qospriv.qos_option)
pmlmeinfo->WMM_enable = true;
#ifdef CONFIG_80211N_HT
if (pmlmepriv->htpriv.ht_option)
{
if (pmlmepriv->htpriv.ht_option) {
pmlmeinfo->WMM_enable = true;
pmlmeinfo->HT_enable = true;
//pmlmeinfo->HT_info_enable = true;
//pmlmeinfo->HT_caps_enable = true;
update_hw_ht_param(padapter);
}
#endif //#CONFIG_80211N_HT
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_))
if ((psecuritypriv->dot11PrivacyAlgrthm != _WEP40_) &&
(psecuritypriv->dot11PrivacyAlgrthm != _WEP104_))
flush_all_cam_entry(padapter); //clear CAM
}
@ -997,7 +851,6 @@ static void start_bss_network(_adapter *padapter, u8 *pbuf)
rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VO, (u8 *)(&acparm));
acparm = 0x005E4317; // VI
rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VI, (u8 *)(&acparm));
//acparm = 0x00105320; // BE
acparm = 0x005ea42b;
rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acparm));
acparm = 0x0000A444; // BK
@ -1010,90 +863,56 @@ static void start_bss_network(_adapter *padapter, u8 *pbuf)
//Beacon Control related register
rtw_hal_set_hwreg(padapter, HW_VAR_BEACON_INTERVAL, (u8 *)(&bcn_interval));
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
{
//u32 initialgain;
//initialgain = 0x1e;
//disable dynamic functions, such as high power, DIG
//Save_DM_Func_Flag(padapter);
//Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, false);
if (pmlmepriv->cur_network.join_res != true) { //setting only at first time
#ifdef CONFIG_CONCURRENT_MODE
if (padapter->adapter_type > PRIMARY_ADAPTER)
{
if (rtw_buddy_adapter_up(padapter))
{
if (padapter->adapter_type > PRIMARY_ADAPTER) {
if (rtw_buddy_adapter_up(padapter)) {
_adapter *pbuddy_adapter = padapter->pbuddy_adapter;
//turn on all dynamic functions on PRIMARY_ADAPTER, dynamic functions only runs at PRIMARY_ADAPTER
Switch_DM_Func(pbuddy_adapter, DYNAMIC_ALL_FUNC_ENABLE, true);
//rtw_hal_set_hwreg(pbuddy_adapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
}
}
else
} else
#endif
{
//turn on all dynamic functions
Switch_DM_Func(padapter, DYNAMIC_ALL_FUNC_ENABLE, true);
//rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
}
}
#ifdef CONFIG_80211N_HT
//set channel, bwmode
p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _HT_ADD_INFO_IE_, &ie_len, (pnetwork->IELength - sizeof(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)
{
case 1:
//pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
break;
case 3:
//pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
break;
default:
//pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
break;
switch (pht_info->infos[0] & 0x3) {
case 1:
cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
break;
case 3:
cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
break;
default:
cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
break;
}
}
}
#endif //CONFIG_80211N_HT
#ifdef CONFIG_DUALMAC_CONCURRENT
dc_set_ap_channel_bandwidth(padapter, cur_channel, cur_ch_offset, cur_bwmode);
#else
//TODO: need to judge the phy parameters on concurrent mode for single phy
//set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
#ifdef CONFIG_CONCURRENT_MODE
if (!check_buddy_fwstate(padapter, _FW_LINKED|_FW_UNDER_LINKING|_FW_UNDER_SURVEY))
{
set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode);
}
else if (check_buddy_fwstate(padapter, _FW_LINKED)==true)//only second adapter can enter AP Mode
{
if (!check_buddy_fwstate(padapter, _FW_LINKED|_FW_UNDER_LINKING|_FW_UNDER_SURVEY)) {
set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode);
} else if (check_buddy_fwstate(padapter, _FW_LINKED)==true) {//only second adapter can enter AP Mode
_adapter *pbuddy_adapter = padapter->pbuddy_adapter;
struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
@ -1103,40 +922,32 @@ static void start_bss_network(_adapter *padapter, u8 *pbuf)
DBG_88E("second adapter, CH=%d, BW=%d, offset=%d\n", cur_channel, cur_bwmode, cur_ch_offset);
cur_channel = pbuddy_mlmeext->cur_channel;
if (cur_bwmode == HT_CHANNEL_WIDTH_40)
{
if (cur_bwmode == HT_CHANNEL_WIDTH_40) {
if (pht_info)
pht_info->infos[0] &= ~(BIT(0)|BIT(1));
if (pbuddy_mlmeext->cur_bwmode == HT_CHANNEL_WIDTH_40)
{
if (pbuddy_mlmeext->cur_bwmode == HT_CHANNEL_WIDTH_40) {
cur_ch_offset = pbuddy_mlmeext->cur_ch_offset;
//to update cur_ch_offset value in beacon
if (pht_info)
{
switch (cur_ch_offset)
{
case HAL_PRIME_CHNL_OFFSET_LOWER:
pht_info->infos[0] |= 0x1;
break;
case HAL_PRIME_CHNL_OFFSET_UPPER:
pht_info->infos[0] |= 0x3;
break;
case HAL_PRIME_CHNL_OFFSET_DONT_CARE:
default:
break;
if (pht_info) {
switch (cur_ch_offset) {
case HAL_PRIME_CHNL_OFFSET_LOWER:
pht_info->infos[0] |= 0x1;
break;
case HAL_PRIME_CHNL_OFFSET_UPPER:
pht_info->infos[0] |= 0x3;
break;
case HAL_PRIME_CHNL_OFFSET_DONT_CARE:
default:
break;
}
}
}
else if (pbuddy_mlmeext->cur_bwmode == HT_CHANNEL_WIDTH_20)
{
} else if (pbuddy_mlmeext->cur_bwmode == HT_CHANNEL_WIDTH_20) {
cur_bwmode = HT_CHANNEL_WIDTH_20;
cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
if (cur_channel>0 && cur_channel<5)
{
if (cur_channel > 0 && cur_channel < 5) {
if (pht_info)
pht_info->infos[0] |= 0x1;
@ -1144,8 +955,7 @@ static void start_bss_network(_adapter *padapter, u8 *pbuf)
cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
}
if (cur_channel>7 && cur_channel<(14+1))
{
if (cur_channel > 7 && cur_channel < (14+1)) {
if (pht_info)
pht_info->infos[0] |= 0x3;
@ -1155,7 +965,6 @@ static void start_bss_network(_adapter *padapter, u8 *pbuf)
set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode);
}
}
// to update channel value in beacon