static int
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_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct ieee80211_mgmt *pmgmt = (struct ieee80211_mgmt *) skb->data;
int res, i;
unsigned short status;
+ u8 *p;
u8 *pframe = skb->data;
int pkt_len = skb->len;
/* for not to handle the synchronous IO in the tasklet */
for (i = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable);
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:
- if (!memcmp(pIE->data, WMM_PARA_OUI23A, 6))/* WMM */
- WMM_param_handler23a(padapter, pIE);
+ if (!memcmp(p + 2, WMM_PARA_OUI23A, 6))/* WMM */
+ WMM_param_handler23a(padapter, p);
break;
case WLAN_EID_HT_CAPABILITY: /* HT caps */
- HT_caps_handler23a(padapter, pIE);
+ HT_caps_handler23a(padapter, p);
break;
case WLAN_EID_HT_OPERATION: /* HT info */
- HT_info_handler23a(padapter, pIE);
+ HT_info_handler23a(padapter, p);
break;
case WLAN_EID_ERP_INFO:
- ERP_IE_handler23a(padapter, pIE);
+ ERP_IE_handler23a(padapter, p);
default:
break;
}
- i += (pIE->Length + 2);
+ i += (p[1] + 2);
}
pmlmeinfo->state &= ~WIFI_FW_ASSOC_STATE;
__le16 *fctrl;
unsigned int i, j, index = 0;
unsigned char rf_type, bssrate[NumRates], sta_bssrate[NumRates];
- struct ndis_802_11_var_ies *pIE;
struct registry_priv *pregpriv = &padapter->registrypriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
int bssrate_len = 0, sta_bssrate_len = 0, pie_len, bcn_fixed_size;
- u8 * pie;
+ u8 *pie;
pmgntframe = alloc_mgtxmitframe23a(pxmitpriv);
if (!pmgntframe)
/* vendor specific IE, such as WPA, WMM, WPS */
for (i = bcn_fixed_size; i < pmlmeinfo->network.IELength;) {
- pIE = (struct ndis_802_11_var_ies *)
- (pmlmeinfo->network.IEs + i);
+ p = pmlmeinfo->network.IEs + i;
- switch (pIE->ElementID)
- {
+ switch (p[0]) {
case WLAN_EID_VENDOR_SPECIFIC:
- if (!memcmp(pIE->data, RTW_WPA_OUI23A_TYPE, 4) ||
- !memcmp(pIE->data, WMM_OUI23A, 4) ||
- !memcmp(pIE->data, WPS_OUI23A, 4)) {
+ if (!memcmp(p + 2, RTW_WPA_OUI23A_TYPE, 4) ||
+ !memcmp(p + 2, WMM_OUI23A, 4) ||
+ !memcmp(p + 2, WPS_OUI23A, 4)) {
+ u8 plen = p[1];
if (!padapter->registrypriv.wifi_spec) {
/* Commented by Kurt 20110629 */
/* In some older APs, WPS handshake */
/* would be fail if we append vender
extensions informations to AP */
- if (!memcmp(pIE->data, WPS_OUI23A, 4))
- pIE->Length = 14;
+ if (!memcmp(p + 2, WPS_OUI23A, 4))
+ plen = 14;
}
pframe = rtw_set_ie23a(pframe,
WLAN_EID_VENDOR_SPECIFIC,
- pIE->Length, pIE->data,
+ plen, p + 2,
&pattrib->pktlen);
}
break;
break;
}
- i += pIE->Length + 2;
+ i += p[1] + 2;
}
if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_REALTEK)
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 mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct HT_info_element *pht_info;
u32 i;
int bcn_fixed_size;
+ u8 *p;
/* u32 initialgain; */
/* u32 acparm; */
offsetof(struct ieee80211_mgmt, u.beacon);
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. */
- if (!memcmp(pIE->data, WMM_OUI23A, 4))
+ if (!memcmp(p + 2, WMM_OUI23A, 4))
pmlmeinfo->WMM_enable = 1;
break;
/* spec case only for cisco's ap because cisco's ap
* 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) &&
(pht_info->infos[0] & BIT(2))) {
break;
}
- i += (pIE->Length + 2);
+ i += (p[1] + 2);
}
hw_var_set_bssid(padapter, pmlmeinfo->network.MacAddress);
memset(pmlmeinfo->FW_sta_info, 0, sizeof(pmlmeinfo->FW_sta_info));
}
-int WMM_param_handler23a(struct rtw_adapter *padapter,
- struct ndis_802_11_var_ies *pIE)
+int WMM_param_handler23a(struct rtw_adapter *padapter, u8 *p)
{
/* struct registry_priv *pregpriv = &padapter->registrypriv; */
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
}
pmlmeinfo->WMM_enable = 1;
- memcpy(&pmlmeinfo->WMM_param, (pIE->data + 6),
+ memcpy(&pmlmeinfo->WMM_param, p + 2 + 6,
sizeof(struct WMM_para_element));
return true;
}
return;
}
-static void bwmode_update_check(struct rtw_adapter *padapter,
- struct ndis_802_11_var_ies *pIE)
+static void bwmode_update_check(struct rtw_adapter *padapter, u8 *p)
{
struct HT_info_element *pHT_info;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
unsigned char new_bwmode;
unsigned char new_ch_offset;
- if (!pIE)
+ if (!p)
return;
if (!phtpriv->ht_option)
return;
- if (pIE->Length > sizeof(struct HT_info_element))
+ if (p[1] > sizeof(struct HT_info_element))
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) {
new_bwmode = HT_CHANNEL_WIDTH_40;
pmlmeext->cur_ch_offset = new_ch_offset;
/* update HT info also */
- HT_info_handler23a(padapter, pIE);
+ HT_info_handler23a(padapter, p);
} else
pmlmeinfo->bwmode_updated = false;
}
}
-void HT_caps_handler23a(struct rtw_adapter *padapter,
- struct ndis_802_11_var_ies * pIE)
+void HT_caps_handler23a(struct rtw_adapter *padapter, u8 *p)
{
unsigned int i;
u8 rf_type;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct ht_priv *phtpriv = &pmlmepriv->htpriv;
- if (!pIE)
+ if (!p)
return;
if (phtpriv->ht_option == false)
pmlmeinfo->HT_caps_enable = 1;
- for (i = 0; i < pIE->Length; i++) {
+ for (i = 0; i < p[1]; i++) {
if (i != 2) {
/* Commented by Albert 2010/07/12 */
/* 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 {
/* modify from fw by Thomas 2010/11/17 */
- if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3) > (pIE->data[i] & 0x3))
- max_AMPDU_len = pIE->data[i] & 0x3;
+ if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3) > (p[i + 2] & 0x3))
+ max_AMPDU_len = p[i + 2] & 0x3;
else
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;
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;
}
}
return;
}
-void HT_info_handler23a(struct rtw_adapter *padapter,
- struct ndis_802_11_var_ies *pIE)
+void HT_info_handler23a(struct rtw_adapter *padapter, u8 *p)
{
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct ht_priv *phtpriv = &pmlmepriv->htpriv;
- if (!pIE)
+ if (!p)
return;
if (phtpriv->ht_option == false)
return;
- if (pIE->Length > sizeof(struct HT_info_element))
+ if (p[1] > sizeof(struct HT_info_element))
return;
pmlmeinfo->HT_info_enable = 1;
- memcpy(&pmlmeinfo->HT_info, pIE->data, pIE->Length);
+ memcpy(&pmlmeinfo->HT_info, p + 2, p[1]);
return;
}
rtl8723a_set_ampdu_factor(padapter, max_AMPDU_len);
}
-void ERP_IE_handler23a(struct rtw_adapter *padapter,
- struct ndis_802_11_var_ies *pIE)
+void ERP_IE_handler23a(struct rtw_adapter *padapter, u8 *p)
{
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
- if (pIE->Length > 1)
+ if (p[1] > 1)
return;
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)
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 len;
- struct ndis_802_11_var_ies * pIE;
+ u8 *p;
len = pkt_len -
(_BEACON_IE_OFFSET_ + sizeof(struct ieee80211_hdr_3addr));
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 */
/* HT_info_handler23a(padapter, pIE); */
- bwmode_update_check(padapter, pIE);
+ bwmode_update_check(padapter, p);
break;
case WLAN_EID_ERP_INFO:
- ERP_IE_handler23a(padapter, pIE);
+ ERP_IE_handler23a(padapter, p);
VCS_update23a(padapter, psta);
break;
default:
break;
}
- i += (pIE->Length + 2);
+ i += (p[1] + 2);
}
}
bool is_ap_in_tkip23a(struct rtw_adapter *padapter)
{
u32 i;
- struct ndis_802_11_var_ies *pIE;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct wlan_bssid_ex *cur_network = &pmlmeinfo->network;
+ const u8 *p;
int bcn_fixed_size;
bcn_fixed_size = offsetof(struct ieee80211_mgmt, u.beacon.variable) -
if (rtw_get_capability23a(cur_network) & WLAN_CAPABILITY_PRIVACY) {
for (i = bcn_fixed_size; i < pmlmeinfo->network.IELength;) {
- pIE = (struct ndis_802_11_var_ies *)
- (pmlmeinfo->network.IEs + i);
+ p = pmlmeinfo->network.IEs + i;
- switch (pIE->ElementID) {
+ switch (p[0]) {
case WLAN_EID_VENDOR_SPECIFIC:
- if (!memcmp(pIE->data, RTW_WPA_OUI23A_TYPE, 4)&&
- !memcmp((pIE->data + 12),
- WPA_TKIP_CIPHER, 4))
+ if (!memcmp(p + 2, RTW_WPA_OUI23A_TYPE, 4) &&
+ !memcmp(p + 2 + 12, WPA_TKIP_CIPHER, 4))
return true;
break;
case WLAN_EID_RSN:
- if (!memcmp(pIE->data + 8, RSN_TKIP_CIPHER, 4))
+ if (!memcmp(p + 2 + 8, RSN_TKIP_CIPHER, 4))
return true;
break;
default:
break;
}
- i += (pIE->Length + 2);
+ i += (p[1] + 2);
}
return false;
} else
bool should_forbid_n_rate23a(struct rtw_adapter * padapter)
{
u32 i;
- struct ndis_802_11_var_ies *pIE;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_bssid_ex *cur_network = &pmlmepriv->cur_network.network;
+ const u8 *p;
int bcn_fixed_size;
bcn_fixed_size = offsetof(struct ieee80211_mgmt, u.beacon.variable) -
if (rtw_get_capability23a(cur_network) & WLAN_CAPABILITY_PRIVACY) {
for (i = bcn_fixed_size; i < cur_network->IELength;) {
- pIE = (struct ndis_802_11_var_ies *)
- (cur_network->IEs + i);
+ p = cur_network->IEs + i;
- switch (pIE->ElementID) {
+ switch (p[0]) {
case WLAN_EID_VENDOR_SPECIFIC:
- if (!memcmp(pIE->data, RTW_WPA_OUI23A_TYPE, 4)&&
- (!memcmp(pIE->data + 12,
+ if (!memcmp(p + 2, RTW_WPA_OUI23A_TYPE, 4) &&
+ (!memcmp(p + 2 + 12,
WPA_CIPHER_SUITE_CCMP23A, 4) ||
- !memcmp(pIE->data + 16,
+ !memcmp(p + 2 + 16,
WPA_CIPHER_SUITE_CCMP23A, 4)))
return false;
break;
case WLAN_EID_RSN:
- if (!memcmp(pIE->data + 8,
+ if (!memcmp(p + 2 + 8,
RSN_CIPHER_SUITE_CCMP23A, 4) ||
- !memcmp(pIE->data + 12,
+ !memcmp(p + 2 + 12,
RSN_CIPHER_SUITE_CCMP23A, 4))
return false;
default:
break;
}
- i += (pIE->Length + 2);
+ i += (p[1] + 2);
}
return true;
} else {
bool is_ap_in_wep23a(struct rtw_adapter *padapter)
{
u32 i;
- struct ndis_802_11_var_ies *pIE;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct wlan_bssid_ex *cur_network = &pmlmeinfo->network;
+ const u8 *p;
int bcn_fixed_size;
bcn_fixed_size = offsetof(struct ieee80211_mgmt, u.beacon.variable) -
if (rtw_get_capability23a(cur_network) & WLAN_CAPABILITY_PRIVACY) {
for (i = bcn_fixed_size; i < pmlmeinfo->network.IELength;) {
- pIE = (struct ndis_802_11_var_ies *)
- (pmlmeinfo->network.IEs + i);
+ p = pmlmeinfo->network.IEs + i;
- switch (pIE->ElementID) {
+ switch (p[0]) {
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;
break;
case WLAN_EID_RSN:
break;
}
- i += (pIE->Length + 2);
+ i += (p[1] + 2);
}
return true;
unsigned char check_assoc_AP23a(u8 *pframe, uint len)
{
int i, bcn_fixed_size;
- struct ndis_802_11_var_ies *pIE;
u8 epigram_vendor_flag;
u8 ralink_vendor_flag;
+ const u8 *p;
epigram_vendor_flag = 0;
ralink_vendor_flag = 0;
offsetof(struct ieee80211_mgmt, u.beacon);
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:
- if (!memcmp(pIE->data, ARTHEROS_OUI1, 3) ||
- !memcmp(pIE->data, ARTHEROS_OUI2, 3)) {
+ if (!memcmp(p + 2, ARTHEROS_OUI1, 3) ||
+ !memcmp(p + 2, ARTHEROS_OUI2, 3)) {
DBG_8723A("link to Artheros AP\n");
return HT_IOT_PEER_ATHEROS;
- } else if (!memcmp(pIE->data, BROADCOM_OUI1, 3) ||
- !memcmp(pIE->data, BROADCOM_OUI2, 3) ||
- !memcmp(pIE->data, BROADCOM_OUI2, 3)) {
+ } else if (!memcmp(p + 2, BROADCOM_OUI1, 3) ||
+ !memcmp(p + 2, BROADCOM_OUI2, 3) ||
+ !memcmp(p + 2, BROADCOM_OUI2, 3)) {
DBG_8723A("link to Broadcom AP\n");
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");
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)
ralink_vendor_flag = 1;
else {
DBG_8723A("link to Ralink AP\n");
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");
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");
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");
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;
if (ralink_vendor_flag) {
DBG_8723A("link to Tenda W311R AP\n");
break;
}
- i += (pIE->Length + 2);
+ i += (p[1] + 2);
}
if (ralink_vendor_flag && !epigram_vendor_flag) {