diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-06-10 05:30:17 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-06-10 05:30:17 -0300 |
commit | d635711daa98be86d4c7fd01499c34f566b54ccb (patch) | |
tree | aa5cc3760a27c3d57146498cb82fa549547de06c /drivers/staging/rtl8188eu/core/rtw_ap.c | |
parent | c91265cd0efb83778f015b4d4b1129bd2cfd075e (diff) |
Linux-libre 4.6.2-gnu
Diffstat (limited to 'drivers/staging/rtl8188eu/core/rtw_ap.c')
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_ap.c | 137 |
1 files changed, 67 insertions, 70 deletions
diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index e5d29fe9d..012860b34 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -76,90 +76,87 @@ static void update_BCNTIM(struct adapter *padapter) struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct wlan_bssid_ex *pnetwork_mlmeext = &(pmlmeinfo->network); unsigned char *pie = pnetwork_mlmeext->IEs; + u8 *p, *dst_ie, *premainder_ie = NULL; + u8 *pbackup_remainder_ie = NULL; + uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; /* update TIM IE */ - if (true) { - u8 *p, *dst_ie, *premainder_ie = NULL; - u8 *pbackup_remainder_ie = NULL; - uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; - - p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, - pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_); - if (p != NULL && tim_ielen > 0) { - tim_ielen += 2; - premainder_ie = p+tim_ielen; - tim_ie_offset = (int)(p - pie); - remainder_ielen = pnetwork_mlmeext->IELength - - tim_ie_offset - tim_ielen; - /* append TIM IE from dst_ie offset */ - dst_ie = p; - } else { - tim_ielen = 0; + p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, + pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_); + if (p != NULL && tim_ielen > 0) { + tim_ielen += 2; + premainder_ie = p+tim_ielen; + tim_ie_offset = (int)(p - pie); + remainder_ielen = pnetwork_mlmeext->IELength - + tim_ie_offset - tim_ielen; + /* append TIM IE from dst_ie offset */ + dst_ie = p; + } else { + tim_ielen = 0; - /* calculate head_len */ - offset = _FIXED_IE_LENGTH_; - offset += pnetwork_mlmeext->Ssid.SsidLength + 2; + /* calculate head_len */ + offset = _FIXED_IE_LENGTH_; + offset += pnetwork_mlmeext->Ssid.SsidLength + 2; - /* 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; + /* 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; + /* DS Parameter Set IE, len = 3 */ + offset += 3; - premainder_ie = pie + offset; + premainder_ie = pie + offset; - remainder_ielen = pnetwork_mlmeext->IELength - - offset - tim_ielen; + remainder_ielen = pnetwork_mlmeext->IELength - + offset - tim_ielen; - /* append TIM IE from offset */ - dst_ie = pie + offset; - } + /* append TIM IE from offset */ + dst_ie = pie + offset; + } - 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); - } - *dst_ie++ = _TIM_IE_; + 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); + } + *dst_ie++ = _TIM_IE_; - if ((pstapriv->tim_bitmap&0xff00) && - (pstapriv->tim_bitmap&0x00fc)) - tim_ielen = 5; - else - tim_ielen = 4; + if ((pstapriv->tim_bitmap&0xff00) && + (pstapriv->tim_bitmap&0x00fc)) + tim_ielen = 5; + else + tim_ielen = 4; - *dst_ie++ = tim_ielen; + *dst_ie++ = tim_ielen; - *dst_ie++ = 0;/* DTIM count */ - *dst_ie++ = 1;/* DTIM period */ + *dst_ie++ = 0;/* DTIM count */ + *dst_ie++ = 1;/* DTIM period */ - if (pstapriv->tim_bitmap&BIT(0))/* for bc/mc frames */ - *dst_ie++ = BIT(0);/* bitmap ctrl */ - else - *dst_ie++ = 0; + if (pstapriv->tim_bitmap&BIT(0))/* for bc/mc frames */ + *dst_ie++ = BIT(0);/* bitmap ctrl */ + else + *dst_ie++ = 0; - if (tim_ielen == 4) { - *dst_ie++ = pstapriv->tim_bitmap & 0xff; - } else if (tim_ielen == 5) { - put_unaligned_le16(pstapriv->tim_bitmap, dst_ie); - dst_ie += 2; - } + if (tim_ielen == 4) { + *dst_ie++ = pstapriv->tim_bitmap & 0xff; + } else if (tim_ielen == 5) { + put_unaligned_le16(pstapriv->tim_bitmap, dst_ie); + dst_ie += 2; + } - /* copy remainder IE */ - if (pbackup_remainder_ie) { - memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen); + /* copy remainder IE */ + if (pbackup_remainder_ie) { + memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen); - kfree(pbackup_remainder_ie); - } - offset = (uint)(dst_ie - pie); - pnetwork_mlmeext->IELength = offset + remainder_ielen; + kfree(pbackup_remainder_ie); } + offset = (uint)(dst_ie - pie); + pnetwork_mlmeext->IELength = offset + remainder_ielen; set_tx_beacon_cmd(padapter); } @@ -203,7 +200,7 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork, if (bmatch) dst_ie = p; else - dst_ie = (p+ielen); + dst_ie = p+ielen; } if (remainder_ielen > 0) { @@ -569,7 +566,7 @@ static void update_bmc_sta(struct adapter *padapter) psta->ieee8021x_blocked = 0; - memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats)); + memset(&psta->sta_stats, 0, sizeof(struct stainfo_stats)); /* prepare for add_RATid */ supportRateNum = rtw_get_rateset_len((u8 *)&pcur_network->SupportedRates); @@ -692,7 +689,7 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta) /* todo: init other variables */ - memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats)); + memset(&psta->sta_stats, 0, sizeof(struct stainfo_stats)); spin_lock_bh(&psta->lock); psta->state |= _FW_LINKED; |