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

staging: rtl8723au: Get rid of struct ndis_802_11_var_ies

Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c164bcff
...@@ -889,7 +889,7 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, u8 *pbuf, ...@@ -889,7 +889,7 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, u8 *pbuf,
p = rtw_get_ie23a(ie + _BEACON_IE_OFFSET_, WLAN_EID_ERP_INFO, &ie_len, p = rtw_get_ie23a(ie + _BEACON_IE_OFFSET_, WLAN_EID_ERP_INFO, &ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_)); (pbss_network->IELength - _BEACON_IE_OFFSET_));
if (p && ie_len > 0) if (p && ie_len > 0)
ERP_IE_handler23a(padapter, (struct ndis_802_11_var_ies *)p); ERP_IE_handler23a(padapter, p);
/* update privacy/security */ /* update privacy/security */
if (cap & BIT(4)) if (cap & BIT(4))
...@@ -1024,9 +1024,9 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, u8 *pbuf, ...@@ -1024,9 +1024,9 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, u8 *pbuf,
if (pregistrypriv->ampdu_enable == 1) if (pregistrypriv->ampdu_enable == 1)
pmlmepriv->htpriv.ampdu_enable = true; pmlmepriv->htpriv.ampdu_enable = true;
HT_caps_handler23a(padapter, (struct ndis_802_11_var_ies *)pHT_caps_ie); HT_caps_handler23a(padapter, pHT_caps_ie);
HT_info_handler23a(padapter, (struct ndis_802_11_var_ies *)pHT_info_ie); HT_info_handler23a(padapter, pHT_info_ie);
} }
pbss_network->Length = get_wlan_bssid_ex_sz(pbss_network); pbss_network->Length = get_wlan_bssid_ex_sz(pbss_network);
...@@ -1182,23 +1182,20 @@ static void update_bcn_erpinfo_ie(struct rtw_adapter *padapter) ...@@ -1182,23 +1182,20 @@ static void update_bcn_erpinfo_ie(struct rtw_adapter *padapter)
/* parsing ERP_IE */ /* 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 + _BEACON_IE_OFFSET_, WLAN_EID_ERP_INFO, &len, (pnetwork->IELength - _BEACON_IE_OFFSET_));
if (p && len>0) if (p && len > 0) {
{
struct ndis_802_11_var_ies * pIE = (struct ndis_802_11_var_ies *)p;
if (pmlmepriv->num_sta_non_erp == 1) if (pmlmepriv->num_sta_non_erp == 1)
pIE->data[0] |= WLAN_ERP_NON_ERP_PRESENT | p[2] |= WLAN_ERP_NON_ERP_PRESENT |
WLAN_ERP_USE_PROTECTION; WLAN_ERP_USE_PROTECTION;
else else
pIE->data[0] &= ~(WLAN_ERP_NON_ERP_PRESENT | p[2] &= ~(WLAN_ERP_NON_ERP_PRESENT |
WLAN_ERP_USE_PROTECTION); WLAN_ERP_USE_PROTECTION);
if (pmlmepriv->num_sta_no_short_preamble > 0) if (pmlmepriv->num_sta_no_short_preamble > 0)
pIE->data[0] |= WLAN_ERP_BARKER_PREAMBLE; p[2] |= WLAN_ERP_BARKER_PREAMBLE;
else else
pIE->data[0] &= ~(WLAN_ERP_BARKER_PREAMBLE); p[2] &= ~(WLAN_ERP_BARKER_PREAMBLE);
ERP_IE_handler23a(padapter, pIE); ERP_IE_handler23a(padapter, p);
} }
} }
......
...@@ -1735,7 +1735,6 @@ OnAssocReq23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) ...@@ -1735,7 +1735,6 @@ OnAssocReq23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
static int static int
OnAssocRsp23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) OnAssocRsp23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
{ {
struct ndis_802_11_var_ies *pIE;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
...@@ -1743,6 +1742,7 @@ OnAssocRsp23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) ...@@ -1743,6 +1742,7 @@ OnAssocRsp23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
struct ieee80211_mgmt *pmgmt = (struct ieee80211_mgmt *) skb->data; struct ieee80211_mgmt *pmgmt = (struct ieee80211_mgmt *) skb->data;
int res, i; int res, i;
unsigned short status; unsigned short status;
u8 *p;
u8 *pframe = skb->data; u8 *pframe = skb->data;
int pkt_len = skb->len; int pkt_len = skb->len;
...@@ -1783,31 +1783,31 @@ OnAssocRsp23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) ...@@ -1783,31 +1783,31 @@ OnAssocRsp23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
/* for not to handle the synchronous IO in the tasklet */ /* for not to handle the synchronous IO in the tasklet */
for (i = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); for (i = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable);
i < pkt_len;) { i < pkt_len;) {
pIE = (struct ndis_802_11_var_ies *)(pframe + i); p = pframe + i;
switch (pIE->ElementID) switch (p[0])
{ {
case WLAN_EID_VENDOR_SPECIFIC: case WLAN_EID_VENDOR_SPECIFIC:
if (!memcmp(pIE->data, WMM_PARA_OUI23A, 6))/* WMM */ if (!memcmp(p + 2, WMM_PARA_OUI23A, 6))/* WMM */
WMM_param_handler23a(padapter, pIE); WMM_param_handler23a(padapter, p);
break; break;
case WLAN_EID_HT_CAPABILITY: /* HT caps */ case WLAN_EID_HT_CAPABILITY: /* HT caps */
HT_caps_handler23a(padapter, pIE); HT_caps_handler23a(padapter, p);
break; break;
case WLAN_EID_HT_OPERATION: /* HT info */ case WLAN_EID_HT_OPERATION: /* HT info */
HT_info_handler23a(padapter, pIE); HT_info_handler23a(padapter, p);
break; break;
case WLAN_EID_ERP_INFO: case WLAN_EID_ERP_INFO:
ERP_IE_handler23a(padapter, pIE); ERP_IE_handler23a(padapter, p);
default: default:
break; break;
} }
i += (pIE->Length + 2); i += (p[1] + 2);
} }
pmlmeinfo->state &= ~WIFI_FW_ASSOC_STATE; pmlmeinfo->state &= ~WIFI_FW_ASSOC_STATE;
...@@ -3272,14 +3272,13 @@ void issue_assocreq23a(struct rtw_adapter *padapter) ...@@ -3272,14 +3272,13 @@ void issue_assocreq23a(struct rtw_adapter *padapter)
__le16 *fctrl; __le16 *fctrl;
unsigned int i, j, index = 0; unsigned int i, j, index = 0;
unsigned char rf_type, bssrate[NumRates], sta_bssrate[NumRates]; unsigned char rf_type, bssrate[NumRates], sta_bssrate[NumRates];
struct ndis_802_11_var_ies *pIE;
struct registry_priv *pregpriv = &padapter->registrypriv; struct registry_priv *pregpriv = &padapter->registrypriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
int bssrate_len = 0, sta_bssrate_len = 0, pie_len, bcn_fixed_size; int bssrate_len = 0, sta_bssrate_len = 0, pie_len, bcn_fixed_size;
u8 * pie; u8 *pie;
pmgntframe = alloc_mgtxmitframe23a(pxmitpriv); pmgntframe = alloc_mgtxmitframe23a(pxmitpriv);
if (!pmgntframe) if (!pmgntframe)
...@@ -3474,26 +3473,25 @@ void issue_assocreq23a(struct rtw_adapter *padapter) ...@@ -3474,26 +3473,25 @@ void issue_assocreq23a(struct rtw_adapter *padapter)
/* vendor specific IE, such as WPA, WMM, WPS */ /* vendor specific IE, such as WPA, WMM, WPS */
for (i = bcn_fixed_size; i < pmlmeinfo->network.IELength;) { for (i = bcn_fixed_size; i < pmlmeinfo->network.IELength;) {
pIE = (struct ndis_802_11_var_ies *) p = pmlmeinfo->network.IEs + i;
(pmlmeinfo->network.IEs + i);
switch (pIE->ElementID) switch (p[0]) {
{
case WLAN_EID_VENDOR_SPECIFIC: case WLAN_EID_VENDOR_SPECIFIC:
if (!memcmp(pIE->data, RTW_WPA_OUI23A_TYPE, 4) || if (!memcmp(p + 2, RTW_WPA_OUI23A_TYPE, 4) ||
!memcmp(pIE->data, WMM_OUI23A, 4) || !memcmp(p + 2, WMM_OUI23A, 4) ||
!memcmp(pIE->data, WPS_OUI23A, 4)) { !memcmp(p + 2, WPS_OUI23A, 4)) {
u8 plen = p[1];
if (!padapter->registrypriv.wifi_spec) { if (!padapter->registrypriv.wifi_spec) {
/* Commented by Kurt 20110629 */ /* Commented by Kurt 20110629 */
/* In some older APs, WPS handshake */ /* In some older APs, WPS handshake */
/* would be fail if we append vender /* would be fail if we append vender
extensions informations to AP */ extensions informations to AP */
if (!memcmp(pIE->data, WPS_OUI23A, 4)) if (!memcmp(p + 2, WPS_OUI23A, 4))
pIE->Length = 14; plen = 14;
} }
pframe = rtw_set_ie23a(pframe, pframe = rtw_set_ie23a(pframe,
WLAN_EID_VENDOR_SPECIFIC, WLAN_EID_VENDOR_SPECIFIC,
pIE->Length, pIE->data, plen, p + 2,
&pattrib->pktlen); &pattrib->pktlen);
} }
break; break;
...@@ -3502,7 +3500,7 @@ void issue_assocreq23a(struct rtw_adapter *padapter) ...@@ -3502,7 +3500,7 @@ void issue_assocreq23a(struct rtw_adapter *padapter)
break; break;
} }
i += pIE->Length + 2; i += p[1] + 2;
} }
if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_REALTEK) if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_REALTEK)
...@@ -5893,7 +5891,6 @@ int createbss_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) ...@@ -5893,7 +5891,6 @@ int createbss_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
int join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) int join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
{ {
struct ndis_802_11_var_ies * pIE;
struct registry_priv *pregpriv = &padapter->registrypriv; struct registry_priv *pregpriv = &padapter->registrypriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
...@@ -5902,6 +5899,7 @@ int join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) ...@@ -5902,6 +5899,7 @@ int join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
struct HT_info_element *pht_info; struct HT_info_element *pht_info;
u32 i; u32 i;
int bcn_fixed_size; int bcn_fixed_size;
u8 *p;
/* u32 initialgain; */ /* u32 initialgain; */
/* u32 acparm; */ /* u32 acparm; */
...@@ -5951,12 +5949,11 @@ int join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) ...@@ -5951,12 +5949,11 @@ int join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
offsetof(struct ieee80211_mgmt, u.beacon); offsetof(struct ieee80211_mgmt, u.beacon);
for (i = bcn_fixed_size; i < pnetwork->IELength;) { for (i = bcn_fixed_size; i < pnetwork->IELength;) {
pIE = (struct ndis_802_11_var_ies *)(pnetwork->IEs + i); p = pnetwork->IEs + i;
switch (pIE->ElementID) switch (p[0]) {
{
case WLAN_EID_VENDOR_SPECIFIC:/* Get WMM IE. */ case WLAN_EID_VENDOR_SPECIFIC:/* Get WMM IE. */
if (!memcmp(pIE->data, WMM_OUI23A, 4)) if (!memcmp(p + 2, WMM_OUI23A, 4))
pmlmeinfo->WMM_enable = 1; pmlmeinfo->WMM_enable = 1;
break; break;
...@@ -5969,7 +5966,7 @@ int join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) ...@@ -5969,7 +5966,7 @@ int join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
/* spec case only for cisco's ap because cisco's ap /* spec case only for cisco's ap because cisco's ap
* issue assoc rsp using mcs rate @40MHz or @20MHz */ * issue assoc rsp using mcs rate @40MHz or @20MHz */
pht_info = (struct HT_info_element *)(pIE->data); pht_info = (struct HT_info_element *)(p + 2);
if ((pregpriv->cbw40_enable) && if ((pregpriv->cbw40_enable) &&
(pht_info->infos[0] & BIT(2))) { (pht_info->infos[0] & BIT(2))) {
...@@ -6001,7 +5998,7 @@ int join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) ...@@ -6001,7 +5998,7 @@ int join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
break; break;
} }
i += (pIE->Length + 2); i += (p[1] + 2);
} }
hw_var_set_bssid(padapter, pmlmeinfo->network.MacAddress); hw_var_set_bssid(padapter, pmlmeinfo->network.MacAddress);
......
...@@ -512,8 +512,7 @@ void flush_all_cam_entry23a(struct rtw_adapter *padapter) ...@@ -512,8 +512,7 @@ void flush_all_cam_entry23a(struct rtw_adapter *padapter)
memset(pmlmeinfo->FW_sta_info, 0, sizeof(pmlmeinfo->FW_sta_info)); memset(pmlmeinfo->FW_sta_info, 0, sizeof(pmlmeinfo->FW_sta_info));
} }
int WMM_param_handler23a(struct rtw_adapter *padapter, int WMM_param_handler23a(struct rtw_adapter *padapter, u8 *p)
struct ndis_802_11_var_ies *pIE)
{ {
/* struct registry_priv *pregpriv = &padapter->registrypriv; */ /* struct registry_priv *pregpriv = &padapter->registrypriv; */
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
...@@ -526,7 +525,7 @@ int WMM_param_handler23a(struct rtw_adapter *padapter, ...@@ -526,7 +525,7 @@ int WMM_param_handler23a(struct rtw_adapter *padapter,
} }
pmlmeinfo->WMM_enable = 1; pmlmeinfo->WMM_enable = 1;
memcpy(&pmlmeinfo->WMM_param, (pIE->data + 6), memcpy(&pmlmeinfo->WMM_param, p + 2 + 6,
sizeof(struct WMM_para_element)); sizeof(struct WMM_para_element));
return true; return true;
} }
...@@ -642,8 +641,7 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter) ...@@ -642,8 +641,7 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter)
return; return;
} }
static void bwmode_update_check(struct rtw_adapter *padapter, static void bwmode_update_check(struct rtw_adapter *padapter, u8 *p)
struct ndis_802_11_var_ies *pIE)
{ {
struct HT_info_element *pHT_info; struct HT_info_element *pHT_info;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
...@@ -654,14 +652,14 @@ static void bwmode_update_check(struct rtw_adapter *padapter, ...@@ -654,14 +652,14 @@ static void bwmode_update_check(struct rtw_adapter *padapter,
unsigned char new_bwmode; unsigned char new_bwmode;
unsigned char new_ch_offset; unsigned char new_ch_offset;
if (!pIE) if (!p)
return; return;
if (!phtpriv->ht_option) if (!phtpriv->ht_option)
return; return;
if (pIE->Length > sizeof(struct HT_info_element)) if (p[1] > sizeof(struct HT_info_element))
return; return;
pHT_info = (struct HT_info_element *)pIE->data; pHT_info = (struct HT_info_element *)(p + 2);
if ((pHT_info->infos[0] & BIT(2)) && pregistrypriv->cbw40_enable) { if ((pHT_info->infos[0] & BIT(2)) && pregistrypriv->cbw40_enable) {
new_bwmode = HT_CHANNEL_WIDTH_40; new_bwmode = HT_CHANNEL_WIDTH_40;
...@@ -690,7 +688,7 @@ static void bwmode_update_check(struct rtw_adapter *padapter, ...@@ -690,7 +688,7 @@ static void bwmode_update_check(struct rtw_adapter *padapter,
pmlmeext->cur_ch_offset = new_ch_offset; pmlmeext->cur_ch_offset = new_ch_offset;
/* update HT info also */ /* update HT info also */
HT_info_handler23a(padapter, pIE); HT_info_handler23a(padapter, p);
} else } else
pmlmeinfo->bwmode_updated = false; pmlmeinfo->bwmode_updated = false;
...@@ -721,8 +719,7 @@ static void bwmode_update_check(struct rtw_adapter *padapter, ...@@ -721,8 +719,7 @@ static void bwmode_update_check(struct rtw_adapter *padapter,
} }
} }
void HT_caps_handler23a(struct rtw_adapter *padapter, void HT_caps_handler23a(struct rtw_adapter *padapter, u8 *p)
struct ndis_802_11_var_ies * pIE)
{ {
unsigned int i; unsigned int i;
u8 rf_type; u8 rf_type;
...@@ -732,7 +729,7 @@ void HT_caps_handler23a(struct rtw_adapter *padapter, ...@@ -732,7 +729,7 @@ void HT_caps_handler23a(struct rtw_adapter *padapter,
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct ht_priv *phtpriv = &pmlmepriv->htpriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv;
if (!pIE) if (!p)
return; return;
if (phtpriv->ht_option == false) if (phtpriv->ht_option == false)
...@@ -740,24 +737,25 @@ void HT_caps_handler23a(struct rtw_adapter *padapter, ...@@ -740,24 +737,25 @@ void HT_caps_handler23a(struct rtw_adapter *padapter,
pmlmeinfo->HT_caps_enable = 1; pmlmeinfo->HT_caps_enable = 1;
for (i = 0; i < pIE->Length; i++) { for (i = 0; i < p[1]; i++) {
if (i != 2) { if (i != 2) {
/* Commented by Albert 2010/07/12 */ /* Commented by Albert 2010/07/12 */
/* Got the endian issue here. */ /* Got the endian issue here. */
pmlmeinfo->HT_caps.u.HT_cap[i] &= (pIE->data[i]); pmlmeinfo->HT_caps.u.HT_cap[i] &= p[i + 2];
} else { } else {
/* modify from fw by Thomas 2010/11/17 */ /* modify from fw by Thomas 2010/11/17 */
if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3) > (pIE->data[i] & 0x3)) if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3) > (p[i + 2] & 0x3))
max_AMPDU_len = pIE->data[i] & 0x3; max_AMPDU_len = p[i + 2] & 0x3;
else else
max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3; max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3;
if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) > (pIE->data[i] & 0x1c)) if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) > (p[i + 2] & 0x1c))
min_MPDU_spacing = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c; min_MPDU_spacing = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c;
else else
min_MPDU_spacing = (pIE->data[i] & 0x1c); min_MPDU_spacing = p[i + 2] & 0x1c;
pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para = max_AMPDU_len | min_MPDU_spacing; pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para =
max_AMPDU_len | min_MPDU_spacing;
} }
} }
...@@ -783,25 +781,24 @@ void HT_caps_handler23a(struct rtw_adapter *padapter, ...@@ -783,25 +781,24 @@ void HT_caps_handler23a(struct rtw_adapter *padapter,
return; return;
} }
void HT_info_handler23a(struct rtw_adapter *padapter, void HT_info_handler23a(struct rtw_adapter *padapter, u8 *p)
struct ndis_802_11_var_ies *pIE)
{ {
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct ht_priv *phtpriv = &pmlmepriv->htpriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv;
if (!pIE) if (!p)
return; return;
if (phtpriv->ht_option == false) if (phtpriv->ht_option == false)
return; return;
if (pIE->Length > sizeof(struct HT_info_element)) if (p[1] > sizeof(struct HT_info_element))
return; return;
pmlmeinfo->HT_info_enable = 1; pmlmeinfo->HT_info_enable = 1;
memcpy(&pmlmeinfo->HT_info, pIE->data, pIE->Length); memcpy(&pmlmeinfo->HT_info, p + 2, p[1]);
return; return;
} }
...@@ -838,17 +835,16 @@ void HTOnAssocRsp23a(struct rtw_adapter *padapter) ...@@ -838,17 +835,16 @@ void HTOnAssocRsp23a(struct rtw_adapter *padapter)
rtl8723a_set_ampdu_factor(padapter, max_AMPDU_len); rtl8723a_set_ampdu_factor(padapter, max_AMPDU_len);
} }
void ERP_IE_handler23a(struct rtw_adapter *padapter, void ERP_IE_handler23a(struct rtw_adapter *padapter, u8 *p)
struct ndis_802_11_var_ies *pIE)
{ {
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
if (pIE->Length > 1) if (p[1] > 1)
return; return;
pmlmeinfo->ERP_enable = 1; pmlmeinfo->ERP_enable = 1;
memcpy(&pmlmeinfo->ERP_IE, pIE->data, pIE->Length); memcpy(&pmlmeinfo->ERP_IE, p + 2, p[1]);
} }
void VCS_update23a(struct rtw_adapter *padapter, struct sta_info *psta) void VCS_update23a(struct rtw_adapter *padapter, struct sta_info *psta)
...@@ -1138,41 +1134,42 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter, ...@@ -1138,41 +1134,42 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
return _FAIL; return _FAIL;
} }
void update_beacon23a_info(struct rtw_adapter *padapter, u8 *pframe, uint pkt_len, struct sta_info *psta) void update_beacon23a_info(struct rtw_adapter *padapter, u8 *pframe,
uint pkt_len, struct sta_info *psta)
{ {
unsigned int i; unsigned int i;
unsigned int len; unsigned int len;
struct ndis_802_11_var_ies * pIE; u8 *p;
len = pkt_len - len = pkt_len -
(_BEACON_IE_OFFSET_ + sizeof(struct ieee80211_hdr_3addr)); (_BEACON_IE_OFFSET_ + sizeof(struct ieee80211_hdr_3addr));
for (i = 0; i < len;) { for (i = 0; i < len;) {
pIE = (struct ndis_802_11_var_ies *)(pframe + (_BEACON_IE_OFFSET_ + sizeof(struct ieee80211_hdr_3addr)) + i); p = (u8 *)(pframe + (_BEACON_IE_OFFSET_ + sizeof(struct ieee80211_hdr_3addr)) + i);
switch (pIE->ElementID) { switch (p[0]) {
case WLAN_EID_HT_OPERATION: /* HT info */ case WLAN_EID_HT_OPERATION: /* HT info */
/* HT_info_handler23a(padapter, pIE); */ /* HT_info_handler23a(padapter, pIE); */
bwmode_update_check(padapter, pIE); bwmode_update_check(padapter, p);
break; break;
case WLAN_EID_ERP_INFO: case WLAN_EID_ERP_INFO:
ERP_IE_handler23a(padapter, pIE); ERP_IE_handler23a(padapter, p);
VCS_update23a(padapter, psta); VCS_update23a(padapter, psta);
break; break;
default: default:
break; break;
} }
i += (pIE->Length + 2); i += (p[1] + 2);
} }
} }
bool is_ap_in_tkip23a(struct rtw_adapter *padapter) bool is_ap_in_tkip23a(struct rtw_adapter *padapter)
{ {
u32 i; u32 i;
struct ndis_802_11_var_ies *pIE;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct wlan_bssid_ex *cur_network = &pmlmeinfo->network; struct wlan_bssid_ex *cur_network = &pmlmeinfo->network;
const u8 *p;
int bcn_fixed_size; int bcn_fixed_size;
bcn_fixed_size = offsetof(struct ieee80211_mgmt, u.beacon.variable) - bcn_fixed_size = offsetof(struct ieee80211_mgmt, u.beacon.variable) -
...@@ -1180,24 +1177,22 @@ bool is_ap_in_tkip23a(struct rtw_adapter *padapter) ...@@ -1180,24 +1177,22 @@ bool is_ap_in_tkip23a(struct rtw_adapter *padapter)
if (rtw_get_capability23a(cur_network) & WLAN_CAPABILITY_PRIVACY) { if (rtw_get_capability23a(cur_network) & WLAN_CAPABILITY_PRIVACY) {
for (i = bcn_fixed_size; i < pmlmeinfo->network.IELength;) { for (i = bcn_fixed_size; i < pmlmeinfo->network.IELength;) {
pIE = (struct ndis_802_11_var_ies *) p = pmlmeinfo->network.IEs + i;
(pmlmeinfo->network.IEs + i);
switch (pIE->ElementID) { switch (p[0]) {
case WLAN_EID_VENDOR_SPECIFIC: case WLAN_EID_VENDOR_SPECIFIC:
if (!memcmp(pIE->data, RTW_WPA_OUI23A_TYPE, 4)&& if (!memcmp(p + 2, RTW_WPA_OUI23A_TYPE, 4) &&
!memcmp((pIE->data + 12), !memcmp(p + 2 + 12, WPA_TKIP_CIPHER, 4))
WPA_TKIP_CIPHER, 4))
return true; return true;
break; break;
case WLAN_EID_RSN: case WLAN_EID_RSN:
if (!memcmp(pIE->data + 8, RSN_TKIP_CIPHER, 4)) if (!memcmp(p + 2 + 8, RSN_TKIP_CIPHER, 4))
return true; return true;
break; break;
default: default:
break; break;
} }
i += (pIE->Length + 2); i += (p[1] + 2);
} }
return false; return false;
} else } else
...@@ -1207,9 +1202,9 @@ bool is_ap_in_tkip23a(struct rtw_adapter *padapter) ...@@ -1207,9 +1202,9 @@ bool is_ap_in_tkip23a(struct rtw_adapter *padapter)
bool should_forbid_n_rate23a(struct rtw_adapter * padapter) bool should_forbid_n_rate23a(struct rtw_adapter * padapter)
{ {
u32 i; u32 i;
struct ndis_802_11_var_ies *pIE;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_bssid_ex *cur_network = &pmlmepriv->cur_network.network; struct wlan_bssid_ex *cur_network = &pmlmepriv->cur_network.network;
const u8 *p;
int bcn_fixed_size; int bcn_fixed_size;
bcn_fixed_size = offsetof(struct ieee80211_mgmt, u.beacon.variable) - bcn_fixed_size = offsetof(struct ieee80211_mgmt, u.beacon.variable) -
...@@ -1217,29 +1212,28 @@ bool should_forbid_n_rate23a(struct rtw_adapter * padapter) ...@@ -1217,29 +1212,28 @@ bool should_forbid_n_rate23a(struct rtw_adapter * padapter)
if (rtw_get_capability23a(cur_network) & WLAN_CAPABILITY_PRIVACY) { if (rtw_get_capability23a(cur_network) & WLAN_CAPABILITY_PRIVACY) {
for (i = bcn_fixed_size; i < cur_network->IELength;) { for (i = bcn_fixed_size; i < cur_network->IELength;) {
pIE = (struct ndis_802_11_var_ies *) p = cur_network->IEs + i;
(cur_network->IEs + i);
switch (pIE->ElementID) { switch (p[0]) {
case WLAN_EID_VENDOR_SPECIFIC: case WLAN_EID_VENDOR_SPECIFIC:
if (!memcmp(pIE->data, RTW_WPA_OUI23A_TYPE, 4)&& if (!memcmp(p + 2, RTW_WPA_OUI23A_TYPE, 4) &&
(!memcmp(pIE->data + 12, (!memcmp(p + 2 + 12,
WPA_CIPHER_SUITE_CCMP23A, 4) || WPA_CIPHER_SUITE_CCMP23A, 4) ||
!memcmp(pIE->data + 16, !memcmp(p + 2 + 16,
WPA_CIPHER_SUITE_CCMP23A, 4))) WPA_CIPHER_SUITE_CCMP23A, 4)))
return false; return false;
break; break;
case WLAN_EID_RSN: case WLAN_EID_RSN:
if (!memcmp(pIE->data + 8, if (!memcmp(p + 2 + 8,
RSN_CIPHER_SUITE_CCMP23A, 4) || RSN_CIPHER_SUITE_CCMP23A, 4) ||
!memcmp(pIE->data + 12, !memcmp(p + 2 + 12,
RSN_CIPHER_SUITE_CCMP23A, 4)) RSN_CIPHER_SUITE_CCMP23A, 4))
return false; return false;
default: default:
break; break;
} }
i += (pIE->Length + 2); i += (p[1] + 2);
} }
return true; return true;
} else { } else {
...@@ -1250,10 +1244,10 @@ bool should_forbid_n_rate23a(struct rtw_adapter * padapter) ...@@ -1250,10 +1244,10 @@ bool should_forbid_n_rate23a(struct rtw_adapter * padapter)
bool is_ap_in_wep23a(struct rtw_adapter *padapter) bool is_ap_in_wep23a(struct rtw_adapter *padapter)
{ {
u32 i; u32 i;
struct ndis_802_11_var_ies *pIE;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct wlan_bssid_ex *cur_network = &pmlmeinfo->network; struct wlan_bssid_ex *cur_network = &pmlmeinfo->network;
const u8 *p;
int bcn_fixed_size; int bcn_fixed_size;
bcn_fixed_size = offsetof(struct ieee80211_mgmt, u.beacon.variable) - bcn_fixed_size = offsetof(struct ieee80211_mgmt, u.beacon.variable) -
...@@ -1261,12 +1255,11 @@ bool is_ap_in_wep23a(struct rtw_adapter *padapter) ...@@ -1261,12 +1255,11 @@ bool is_ap_in_wep23a(struct rtw_adapter *padapter)
if (rtw_get_capability23a(cur_network) & WLAN_CAPABILITY_PRIVACY) { if (rtw_get_capability23a(cur_network) & WLAN_CAPABILITY_PRIVACY) {
for (i = bcn_fixed_size; i < pmlmeinfo->network.IELength;) { for (i = bcn_fixed_size; i < pmlmeinfo->network.IELength;) {
pIE = (struct ndis_802_11_var_ies *) p = pmlmeinfo->network.IEs + i;
(pmlmeinfo->network.IEs + i);
switch (pIE->ElementID) { switch (p[0]) {
case WLAN_EID_VENDOR_SPECIFIC: case WLAN_EID_VENDOR_SPECIFIC:
if (!memcmp(pIE->data, RTW_WPA_OUI23A_TYPE, 4)) if (!memcmp(p + 2, RTW_WPA_OUI23A_TYPE, 4))
return false; return false;
break; break;
case WLAN_EID_RSN: case WLAN_EID_RSN:
...@@ -1276,7 +1269,7 @@ bool is_ap_in_wep23a(struct rtw_adapter *padapter) ...@@ -1276,7 +1269,7 @@ bool is_ap_in_wep23a(struct rtw_adapter *padapter)
break; break;
} }
i += (pIE->Length + 2); i += (p[1] + 2);
} }
return true; return true;
...@@ -1442,9 +1435,9 @@ void update_tx_basic_rate23a(struct rtw_adapter *padapter, u8 wirelessmode) ...@@ -1442,9 +1435,9 @@ void update_tx_basic_rate23a(struct rtw_adapter *padapter, u8 wirelessmode)
unsigned char check_assoc_AP23a(u8 *pframe, uint len) unsigned char check_assoc_AP23a(u8 *pframe, uint len)
{ {
int i, bcn_fixed_size; int i, bcn_fixed_size;
struct ndis_802_11_var_ies *pIE;
u8 epigram_vendor_flag; u8 epigram_vendor_flag;
u8 ralink_vendor_flag; u8 ralink_vendor_flag;
const u8 *p;
epigram_vendor_flag = 0; epigram_vendor_flag = 0;
ralink_vendor_flag = 0; ralink_vendor_flag = 0;
...@@ -1452,39 +1445,39 @@ unsigned char check_assoc_AP23a(u8 *pframe, uint len) ...@@ -1452,39 +1445,39 @@ unsigned char check_assoc_AP23a(u8 *pframe, uint len)
offsetof(struct ieee80211_mgmt, u.beacon); offsetof(struct ieee80211_mgmt, u.beacon);
for (i = bcn_fixed_size; i < len;) { for (i = bcn_fixed_size; i < len;) {
pIE = (struct ndis_802_11_var_ies *)(pframe + i); p = pframe + i;
switch (pIE->ElementID) { switch (p[0]) {
case WLAN_EID_VENDOR_SPECIFIC: case WLAN_EID_VENDOR_SPECIFIC:
if (!memcmp(pIE->data, ARTHEROS_OUI1, 3) || if (!memcmp(p + 2, ARTHEROS_OUI1, 3) ||
!memcmp(pIE->data, ARTHEROS_OUI2, 3)) { !memcmp(p + 2, ARTHEROS_OUI2, 3)) {
DBG_8723A("link to Artheros AP\n"); DBG_8723A("link to Artheros AP\n");
return HT_IOT_PEER_ATHEROS; return HT_IOT_PEER_ATHEROS;
} else if (!memcmp(pIE->data, BROADCOM_OUI1, 3) || } else if (!memcmp(p + 2, BROADCOM_OUI1, 3) ||
!memcmp(pIE->data, BROADCOM_OUI2, 3) || !memcmp(p + 2, BROADCOM_OUI2, 3) ||
!memcmp(pIE->data, BROADCOM_OUI2, 3)) { !memcmp(p + 2, BROADCOM_OUI2, 3)) {
DBG_8723A("link to Broadcom AP\n"); DBG_8723A("link to Broadcom AP\n");
return HT_IOT_PEER_BROADCOM; return HT_IOT_PEER_BROADCOM;
} else if (!memcmp(pIE->data, MARVELL_OUI, 3)) { } else if (!memcmp(p + 2, MARVELL_OUI, 3)) {
DBG_8723A("link to Marvell AP\n"); DBG_8723A("link to Marvell AP\n");
return HT_IOT_PEER_MARVELL; return HT_IOT_PEER_MARVELL;
} else if (!memcmp(pIE->data, RALINK_OUI, 3)) { } else if (!memcmp(p + 2, RALINK_OUI, 3)) {
if (!ralink_vendor_flag) if (!ralink_vendor_flag)
ralink_vendor_flag = 1; ralink_vendor_flag = 1;
else { else {
DBG_8723A("link to Ralink AP\n"); DBG_8723A("link to Ralink AP\n");
return HT_IOT_PEER_RALINK; return HT_IOT_PEER_RALINK;
} }
} else if (!memcmp(pIE->data, CISCO_OUI, 3)) { } else if (!memcmp(p + 2, CISCO_OUI, 3)) {
DBG_8723A("link to Cisco AP\n"); DBG_8723A("link to Cisco AP\n");
return HT_IOT_PEER_CISCO; return HT_IOT_PEER_CISCO;
} else if (!memcmp(pIE->data, REALTEK_OUI, 3)) { } else if (!memcmp(p + 2, REALTEK_OUI, 3)) {
DBG_8723A("link to Realtek 96B\n"); DBG_8723A("link to Realtek 96B\n");
return HT_IOT_PEER_REALTEK; return HT_IOT_PEER_REALTEK;
} else if (!memcmp(pIE->data, AIRGOCAP_OUI, 3)) { } else if (!memcmp(p + 2, AIRGOCAP_OUI, 3)) {
DBG_8723A("link to Airgo Cap\n"); DBG_8723A("link to Airgo Cap\n");
return HT_IOT_PEER_AIRGO; return HT_IOT_PEER_AIRGO;
} else if (!memcmp(pIE->data, EPIGRAM_OUI, 3)) { } else if (!memcmp(p + 2, EPIGRAM_OUI, 3)) {
epigram_vendor_flag = 1; epigram_vendor_flag = 1;
if (ralink_vendor_flag) { if (ralink_vendor_flag) {
DBG_8723A("link to Tenda W311R AP\n"); DBG_8723A("link to Tenda W311R AP\n");
...@@ -1497,7 +1490,7 @@ unsigned char check_assoc_AP23a(u8 *pframe, uint len) ...@@ -1497,7 +1490,7 @@ unsigned char check_assoc_AP23a(u8 *pframe, uint len)
break; break;
} }
i += (pIE->Length + 2); i += (p[1] + 2);
} }
if (ralink_vendor_flag && !epigram_vendor_flag) { if (ralink_vendor_flag && !epigram_vendor_flag) {
......
...@@ -514,18 +514,14 @@ bool is_IBSS_empty23a(struct rtw_adapter *padapter); ...@@ -514,18 +514,14 @@ bool is_IBSS_empty23a(struct rtw_adapter *padapter);
unsigned char check_assoc_AP23a(u8 *pframe, uint len); unsigned char check_assoc_AP23a(u8 *pframe, uint len);
int WMM_param_handler23a(struct rtw_adapter *padapter, int WMM_param_handler23a(struct rtw_adapter *padapter, u8 *p);
struct ndis_802_11_var_ies *pIE);
void WMMOnAssocRsp23a(struct rtw_adapter *padapter); void WMMOnAssocRsp23a(struct rtw_adapter *padapter);
void HT_caps_handler23a(struct rtw_adapter *padapter, void HT_caps_handler23a(struct rtw_adapter *padapter, u8 *p);
struct ndis_802_11_var_ies *pIE); void HT_info_handler23a(struct rtw_adapter *padapter, u8 *p);
void HT_info_handler23a(struct rtw_adapter *padapter,
struct ndis_802_11_var_ies *pIE);
void HTOnAssocRsp23a(struct rtw_adapter *padapter); void HTOnAssocRsp23a(struct rtw_adapter *padapter);
void ERP_IE_handler23a(struct rtw_adapter *padapter, void ERP_IE_handler23a(struct rtw_adapter *padapter, u8 *p);
struct ndis_802_11_var_ies *pIE);
void VCS_update23a(struct rtw_adapter *padapter, struct sta_info *psta); void VCS_update23a(struct rtw_adapter *padapter, struct sta_info *psta);
void update_beacon23a_info(struct rtw_adapter *padapter, u8 *pframe, uint len, void update_beacon23a_info(struct rtw_adapter *padapter, u8 *pframe, uint len,
......
...@@ -22,12 +22,6 @@ ...@@ -22,12 +22,6 @@
#define NDIS_802_11_LENGTH_RATES 8 #define NDIS_802_11_LENGTH_RATES 8
#define NDIS_802_11_LENGTH_RATES_EX 16 #define NDIS_802_11_LENGTH_RATES_EX 16
struct ndis_802_11_var_ies {
u8 ElementID;
u8 Length;
u8 data[1];
};
/* Length is the 4 bytes multiples of the sum of /* Length is the 4 bytes multiples of the sum of
* sizeof(6 * sizeof(unsigned char)) + 2 + sizeof(struct ndis_802_11_ssid) + * sizeof(6 * sizeof(unsigned char)) + 2 + sizeof(struct ndis_802_11_ssid) +
* sizeof(u32) + sizeof(long) + sizeof(enum ndis_802_11_net_type) + * sizeof(u32) + sizeof(long) + sizeof(enum ndis_802_11_net_type) +
......
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