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

staging: rtl8723au: Get rid of obsolete _FIXED_IE_LENGTH_ + _BEACON_IE_OFFSET

Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 68e6c796
......@@ -77,8 +77,8 @@ static void update_BCNTIM(struct rtw_adapter *padapter)
tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap);
p = rtw_get_ie23a(pie + _FIXED_IE_LENGTH_, WLAN_EID_TIM, &tim_ielen,
pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_);
p = rtw_get_ie23a(pie, WLAN_EID_TIM, &tim_ielen,
pnetwork_mlmeext->IELength);
if (p != NULL && tim_ielen>0) {
tim_ielen += 2;
......@@ -94,19 +94,17 @@ static void update_BCNTIM(struct rtw_adapter *padapter)
tim_ielen = 0;
/* calulate head_len */
offset = _FIXED_IE_LENGTH_;
offset = 0;
/* get ssid_ie len */
p = rtw_get_ie23a(pie + _BEACON_IE_OFFSET_, WLAN_EID_SSID,
&tmp_len, (pnetwork_mlmeext->IELength -
_BEACON_IE_OFFSET_));
p = rtw_get_ie23a(pie, WLAN_EID_SSID,
&tmp_len, pnetwork_mlmeext->IELength);
if (p != NULL)
offset += tmp_len+2;
/* get supported rates len */
p = rtw_get_ie23a(pie + _BEACON_IE_OFFSET_, WLAN_EID_SUPP_RATES,
&tmp_len, (pnetwork_mlmeext->IELength -
_BEACON_IE_OFFSET_));
p = rtw_get_ie23a(pie, WLAN_EID_SUPP_RATES,
&tmp_len, pnetwork_mlmeext->IELength);
if (p != NULL)
offset += tmp_len+2;
......@@ -663,9 +661,8 @@ static void start_bss_network(struct rtw_adapter *padapter, u8 *pbuf)
/* and at first time the security ie (RSN/WPA IE) will not include in beacon. */
if (NULL == cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
WLAN_OUI_TYPE_MICROSOFT_WPS,
pnetwork->IEs + _FIXED_IE_LENGTH_,
pnetwork->IELength -
_FIXED_IE_LENGTH_))
pnetwork->IEs,
pnetwork->IELength))
pmlmeext->bstart_bss = true;
/* todo: update wmm, ht cap */
......@@ -804,9 +801,8 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter,
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_bssid_ex *pbss_network = &pmlmepriv->cur_network.network;
u8 *ie = pbss_network->IEs;
u8 *pbuf = mgmt->u.beacon.variable - _FIXED_IE_LENGTH_;
len -= (offsetof(struct ieee80211_mgmt, u.beacon.variable) -
_FIXED_IE_LENGTH_);
u8 *pbuf = mgmt->u.beacon.variable;
len -= offsetof(struct ieee80211_mgmt, u.beacon.variable);
/* SSID */
/* Supported rates */
/* DS Params */
......@@ -841,8 +837,7 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter,
memcpy(pbss_network->MacAddress, myid(&padapter->eeprompriv), ETH_ALEN);
/* SSID */
p = rtw_get_ie23a(ie + _BEACON_IE_OFFSET_, WLAN_EID_SSID, &ie_len,
(pbss_network->IELength -_BEACON_IE_OFFSET_));
p = rtw_get_ie23a(ie, WLAN_EID_SSID, &ie_len, pbss_network->IELength);
if (p && ie_len > 0) {
memset(&pbss_network->Ssid, 0, sizeof(struct cfg80211_ssid));
memcpy(pbss_network->Ssid.ssid, (p + 2), ie_len);
......@@ -851,8 +846,8 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter,
/* chnnel */
channel = 0;
p = rtw_get_ie23a(ie + _BEACON_IE_OFFSET_, WLAN_EID_DS_PARAMS, &ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_));
p = rtw_get_ie23a(ie, WLAN_EID_DS_PARAMS, &ie_len,
pbss_network->IELength);
if (p && ie_len > 0)
channel = *(p + 2);
......@@ -860,16 +855,16 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter,
memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX);
/* get supported rates */
p = rtw_get_ie23a(ie + _BEACON_IE_OFFSET_, WLAN_EID_SUPP_RATES, &ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_));
p = rtw_get_ie23a(ie, WLAN_EID_SUPP_RATES, &ie_len,
pbss_network->IELength);
if (p) {
memcpy(supportRate, p+2, ie_len);
supportRateNum = ie_len;
}
/* get ext_supported rates */
p = rtw_get_ie23a(ie + _BEACON_IE_OFFSET_, WLAN_EID_EXT_SUPP_RATES,
&ie_len, pbss_network->IELength - _BEACON_IE_OFFSET_);
p = rtw_get_ie23a(ie, WLAN_EID_EXT_SUPP_RATES,
&ie_len, pbss_network->IELength);
if (p) {
memcpy(supportRate+supportRateNum, p+2, ie_len);
supportRateNum += ie_len;
......@@ -881,8 +876,8 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter,
rtw_set_supported_rate23a(pbss_network->SupportedRates, network_type);
/* parsing ERP_IE */
p = rtw_get_ie23a(ie + _BEACON_IE_OFFSET_, WLAN_EID_ERP_INFO, &ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_));
p = rtw_get_ie23a(ie, WLAN_EID_ERP_INFO, &ie_len,
pbss_network->IELength);
if (p && ie_len > 0)
ERP_IE_handler23a(padapter, p);
......@@ -898,8 +893,8 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter,
group_cipher = 0; pairwise_cipher = 0;
psecuritypriv->wpa2_group_cipher = 0;
psecuritypriv->wpa2_pairwise_cipher = 0;
p = rtw_get_ie23a(ie + _BEACON_IE_OFFSET_, WLAN_EID_RSN, &ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_));
p = rtw_get_ie23a(ie, WLAN_EID_RSN, &ie_len,
pbss_network->IELength);
if (p && ie_len > 0) {
if (rtw_parse_wpa2_ie23a(p, ie_len+2, &group_cipher,
&pairwise_cipher, NULL) == _SUCCESS) {
......@@ -919,10 +914,9 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter,
pairwise_cipher = 0;
psecuritypriv->wpa_group_cipher = 0;
psecuritypriv->wpa_pairwise_cipher = 0;
for (p = ie + _BEACON_IE_OFFSET_; ;p += (ie_len + 2)) {
for (p = ie; ;p += (ie_len + 2)) {
p = rtw_get_ie23a(p, WLAN_EID_VENDOR_SPECIFIC, &ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_ -
(ie_len + 2)));
pbss_network->IELength - (ie_len + 2));
if ((p) && (!memcmp(p+2, RTW_WPA_OUI23A_TYPE, 4))) {
if (rtw_parse_wpa_ie23a(p, ie_len+2, &group_cipher,
&pairwise_cipher, NULL) == _SUCCESS) {
......@@ -947,10 +941,10 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter,
ie_len = 0;
pmlmepriv->qos_option = 0;
if (pregistrypriv->wmm_enable) {
for (p = ie + _BEACON_IE_OFFSET_; ;p += (ie_len + 2)) {
for (p = ie; ;p += (ie_len + 2)) {
p = rtw_get_ie23a(p, WLAN_EID_VENDOR_SPECIFIC, &ie_len,
(pbss_network->IELength -
_BEACON_IE_OFFSET_ - (ie_len + 2)));
(ie_len + 2)));
if ((p) && !memcmp(p+2, WMM_PARA_IE, 6)) {
pmlmepriv->qos_option = 1;
......@@ -970,8 +964,8 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter,
}
}
/* parsing HT_CAP_IE */
p = rtw_get_ie23a(ie + _BEACON_IE_OFFSET_, WLAN_EID_HT_CAPABILITY, &ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_));
p = rtw_get_ie23a(ie, WLAN_EID_HT_CAPABILITY, &ie_len,
pbss_network->IELength);
if (p && ie_len > 0) {
u8 rf_type;
......@@ -1002,8 +996,8 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter,
}
/* parsing HT_INFO_IE */
p = rtw_get_ie23a(ie + _BEACON_IE_OFFSET_, WLAN_EID_HT_OPERATION, &ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_));
p = rtw_get_ie23a(ie, WLAN_EID_HT_OPERATION, &ie_len,
pbss_network->IELength);
if (p && ie_len > 0)
pHT_info_ie = p;
......@@ -1176,7 +1170,7 @@ static void update_bcn_erpinfo_ie(struct rtw_adapter *padapter)
return;
/* parsing ERP_IE */
p = rtw_get_ie23a(ie + _BEACON_IE_OFFSET_, WLAN_EID_ERP_INFO, &len, (pnetwork->IELength - _BEACON_IE_OFFSET_));
p = rtw_get_ie23a(ie, WLAN_EID_ERP_INFO, &len, pnetwork->IELength);
if (p && len > 0) {
if (pmlmepriv->num_sta_non_erp == 1)
p[2] |= WLAN_ERP_NON_ERP_PRESENT |
......
......@@ -546,10 +546,8 @@ static int rtw_is_desired_network(struct rtw_adapter *adapter,
if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) {
if (cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
WLAN_OUI_TYPE_MICROSOFT_WPA,
pnetwork->network.IEs +
_FIXED_IE_LENGTH_,
pnetwork->network.IELength -
_FIXED_IE_LENGTH_))
pnetwork->network.IEs,
pnetwork->network.IELength))
return true;
else
return false;
......@@ -1916,7 +1914,7 @@ int rtw_restruct_wmm_ie23a(struct rtw_adapter *adapter, u8 *in_ie,
unsigned int ielength = 0;
unsigned int i, j;
i = _FIXED_IE_LENGTH_; /* after the fixed IE */
i = 0; /* after the fixed IE */
while (i < in_len) {
ielength = initial_out_len;
......@@ -2025,9 +2023,7 @@ int rtw_restruct_sec_ie23a(struct rtw_adapter *adapter, u8 *in_ie, u8 *out_ie,
("+rtw_restruct_sec_ie23a: ndisauthmode=%d "
"ndissecuritytype=%d\n", ndisauthmode, ndissecuritytype));
/* copy fixed ie only */
memcpy(out_ie, in_ie, _FIXED_IE_LENGTH_);
ielength = _FIXED_IE_LENGTH_;
ielength = 0;
if (ndisauthmode == Ndis802_11AuthModeWPA ||
ndisauthmode == Ndis802_11AuthModeWPAPSK)
authmode = WLAN_EID_VENDOR_SPECIFIC;
......@@ -2158,8 +2154,7 @@ bool rtw_restructure_ht_ie23a(struct rtw_adapter *padapter, u8 *in_ie,
phtpriv->ht_option = false;
p = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, in_ie + _FIXED_IE_LENGTH_,
in_len - _FIXED_IE_LENGTH_);
p = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, in_ie, in_len);
if (p && p[1] > 0) {
u32 rx_packet_offset, max_recvbuf_sz;
......@@ -2204,9 +2199,7 @@ bool rtw_restructure_ht_ie23a(struct rtw_adapter *padapter, u8 *in_ie,
phtpriv->ht_option = true;
p = cfg80211_find_ie(WLAN_EID_HT_OPERATION,
in_ie + _FIXED_IE_LENGTH_,
in_len - _FIXED_IE_LENGTH_);
p = cfg80211_find_ie(WLAN_EID_HT_OPERATION, in_ie, in_len);
if (p && (p[1] == sizeof(struct ieee80211_ht_operation))) {
out_len = *pout_len;
pframe = rtw_set_ie23a(out_ie + out_len,
......
......@@ -2420,12 +2420,9 @@ void issue_beacon23a(struct rtw_adapter *padapter, int timeout_ms)
if ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE) {
u8 *iebuf;
int buflen;
pframe -= _BEACON_IE_OFFSET_;
/* DBG_8723A("ie len =%d\n", cur_network->IELength); */
memcpy(pframe, cur_network->IEs, cur_network->IELength);
len_diff = update_hidden_ssid(pframe + _BEACON_IE_OFFSET_,
cur_network->IELength -
_BEACON_IE_OFFSET_,
len_diff = update_hidden_ssid(pframe, cur_network->IELength,
pmlmeinfo->hidden_ssid_mode);
pframe += (cur_network->IELength+len_diff);
pattrib->pktlen += (cur_network->IELength+len_diff);
......@@ -2585,13 +2582,10 @@ static void issue_probersp(struct rtw_adapter *padapter, unsigned char *da,
if ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE) {
pwps_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
WLAN_OUI_TYPE_MICROSOFT_WPS,
cur_network->IEs +
_FIXED_IE_LENGTH_,
cur_network->IELength -
_FIXED_IE_LENGTH_);
cur_network->IEs,
cur_network->IELength);
memcpy(pframe, cur_network->IEs + _FIXED_IE_LENGTH_,
cur_network->IELength - _FIXED_IE_LENGTH_);
memcpy(pframe, cur_network->IEs, cur_network->IELength);
pframe += cur_network->IELength;
pattrib->pktlen += cur_network->IELength;
......@@ -3045,9 +3039,8 @@ static void issue_assocrsp(struct rtw_adapter *padapter, unsigned short status,
if (pstat->flags & WLAN_STA_HT && pmlmepriv->htpriv.ht_option) {
/* FILL HT CAP INFO IE */
/* p = hostapd_eid_ht_capabilities_info(hapd, p); */
p = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY,
ie + _BEACON_IE_OFFSET_,
pnetwork->IELength -_BEACON_IE_OFFSET_);
p = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, ie,
pnetwork->IELength);
if (p && p[1]) {
memcpy(pframe, p, p[1] + 2);
pframe += (p[1] + 2);
......@@ -3056,9 +3049,8 @@ static void issue_assocrsp(struct rtw_adapter *padapter, unsigned short status,
/* FILL HT ADD INFO IE */
/* p = hostapd_eid_ht_operation(hapd, p); */
p = cfg80211_find_ie(WLAN_EID_HT_OPERATION,
ie + _BEACON_IE_OFFSET_,
pnetwork->IELength - _BEACON_IE_OFFSET_);
p = cfg80211_find_ie(WLAN_EID_HT_OPERATION, ie,
pnetwork->IELength);
if (p && p[1] > 0) {
memcpy(pframe, p, p[1] + 2);
pframe += (p[1] + 2);
......@@ -3072,10 +3064,9 @@ static void issue_assocrsp(struct rtw_adapter *padapter, unsigned short status,
0x01, 0x01};
int ie_len = 0;
for (p = ie + _BEACON_IE_OFFSET_; ; p += (ie_len + 2)) {
for (p = ie; ; p += (ie_len + 2)) {
p = cfg80211_find_ie(WLAN_EID_VENDOR_SPECIFIC, p,
pnetwork->IELength -
_BEACON_IE_OFFSET_ - (ie_len + 2));
pnetwork->IELength - (ie_len + 2));
if (p)
ie_len = p[1];
else
......@@ -4534,9 +4525,8 @@ static void process_80211d(struct rtw_adapter *padapter,
u8 noc; /* number of channel */
u8 j, k;
ie = cfg80211_find_ie(WLAN_EID_COUNTRY,
bssid->IEs + _FIXED_IE_LENGTH_,
bssid->IELength - _FIXED_IE_LENGTH_);
ie = cfg80211_find_ie(WLAN_EID_COUNTRY, bssid->IEs,
bssid->IELength);
if (!ie || ie[1] < IEEE80211_COUNTRY_IE_MIN_LEN)
return;
......@@ -6065,10 +6055,9 @@ int set_tx_beacon_cmd23a(struct rtw_adapter* padapter)
memcpy(&ptxBeacon_parm->network, &pmlmeinfo->network,
sizeof(struct wlan_bssid_ex));
len_diff = update_hidden_ssid(
ptxBeacon_parm->network.IEs+_BEACON_IE_OFFSET_,
ptxBeacon_parm->network.IELength-_BEACON_IE_OFFSET_,
pmlmeinfo->hidden_ssid_mode);
len_diff = update_hidden_ssid(ptxBeacon_parm->network.IEs,
ptxBeacon_parm->network.IELength,
pmlmeinfo->hidden_ssid_mode);
ptxBeacon_parm->network.IELength += len_diff;
init_h2fwcmd_w_parm_no_rsp(ph2c, ptxBeacon_parm,
......
......@@ -428,10 +428,9 @@ static void ConstructProbeRsp(struct rtw_adapter *padapter, u8 *pframe,
if (cur_network->IELength > MAX_IE_SZ)
return;
memcpy(mgmt->u.probe_resp.variable,
cur_network->IEs + _FIXED_IE_LENGTH_,
cur_network->IELength - _FIXED_IE_LENGTH_);
pktlen += (cur_network->IELength - _FIXED_IE_LENGTH_);
memcpy(mgmt->u.probe_resp.variable, cur_network->IEs,
cur_network->IELength);
pktlen += (cur_network->IELength);
*pLength = pktlen;
}
......
......@@ -23,11 +23,6 @@
*/
#define WiFiNavUpperUs 30000 /* 30 ms */
#define _BEACON_IE_OFFSET_ 0
#define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_
#define EID_BSSIntolerantChlReport 73
/*-----------------------------------------------------------------------------
......
......@@ -264,8 +264,8 @@ static int rtw_cfg80211_inform_bss(struct rtw_adapter *padapter,
notify_channel = ieee80211_get_channel(wiphy, freq);
notify_ie = pnetwork->network.IEs + _FIXED_IE_LENGTH_;
notify_ielen = pnetwork->network.IELength - _FIXED_IE_LENGTH_;
notify_ie = pnetwork->network.IEs;
notify_ielen = pnetwork->network.IELength;
/* We've set wiphy's signal_type as CFG80211_SIGNAL_TYPE_MBM:
* signal strength in mBm (100*dBm)
......@@ -1191,8 +1191,7 @@ static u16 rtw_get_cur_max_rate(struct rtw_adapter *adapter)
u16 mcs_rate = 0;
p = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY,
&pcur_bss->IEs[_FIXED_IE_LENGTH_],
pcur_bss->IELength - _FIXED_IE_LENGTH_);
pcur_bss->IEs, pcur_bss->IELength);
if (p && p[1] > 0) {
pht_capie = (struct ieee80211_ht_cap *)(p + 2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment