diff options
Diffstat (limited to 'drivers/staging/rtl8188eu/core')
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_ap.c | 144 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_cmd.c | 3 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_efuse.c | 8 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 9 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_ioctl_set.c | 5 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_led.c | 4 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_mlme.c | 3 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 95 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_pwrctrl.c | 5 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_recv.c | 227 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_security.c | 158 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 1 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 3 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_xmit.c | 8 |
14 files changed, 325 insertions, 348 deletions
diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 553e8d50352f..1c8fa3a1f5bb 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -26,7 +26,7 @@ void init_mlme_ap_info(struct adapter *padapter) { - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct sta_priv *pstapriv = &padapter->stapriv; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; @@ -43,7 +43,7 @@ void free_mlme_ap_info(struct adapter *padapter) { struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -59,17 +59,17 @@ void free_mlme_ap_info(struct adapter *padapter) /* free bc/mc sta_info */ psta = rtw_get_bcmc_stainfo(padapter); - spin_lock_bh(&(pstapriv->sta_hash_lock)); + spin_lock_bh(&pstapriv->sta_hash_lock); rtw_free_stainfo(padapter, psta); - spin_unlock_bh(&(pstapriv->sta_hash_lock)); + spin_unlock_bh(&pstapriv->sta_hash_lock); } static void update_BCNTIM(struct adapter *padapter) { struct sta_priv *pstapriv = &padapter->stapriv; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct wlan_bssid_ex *pnetwork_mlmeext = &(pmlmeinfo->network); + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + 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; @@ -94,10 +94,9 @@ static void update_BCNTIM(struct adapter *padapter) 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_)); + p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, + &tmp_len, (pnetwork_mlmeext->IELength - + _BEACON_IE_OFFSET_)); if (p) offset += tmp_len+2; @@ -116,13 +115,12 @@ static void update_BCNTIM(struct adapter *padapter) 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); + memcpy(pbackup_remainder_ie, premainder_ie, + remainder_ielen); } *dst_ie++ = _TIM_IE_; - if ((pstapriv->tim_bitmap&0xff00) && - (pstapriv->tim_bitmap&0x00fc)) + if ((pstapriv->tim_bitmap&0xff00) && (pstapriv->tim_bitmap&0x00fc)) tim_ielen = 5; else tim_ielen = 4; @@ -157,7 +155,7 @@ static void update_BCNTIM(struct adapter *padapter) } void rtw_add_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork, - u8 index, u8 *data, u8 len) + u8 index, u8 *data, u8 len) { struct ndis_802_11_var_ie *pIE; u8 bmatch = false; @@ -201,8 +199,8 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork, 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); + memcpy(pbackup_remainder_ie, premainder_ie, + remainder_ielen); } *dst_ie++ = index; @@ -223,7 +221,7 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork, } void rtw_remove_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork, - u8 index) + u8 index) { u8 *p, *dst_ie = NULL, *premainder_ie = NULL; u8 *pbackup_remainder_ie = NULL; @@ -247,8 +245,8 @@ void rtw_remove_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork, 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); + memcpy(pbackup_remainder_ie, premainder_ie, + remainder_ielen); } /* copy remainder IE */ @@ -310,9 +308,9 @@ void expire_timeout_chk(struct adapter *padapter) spin_unlock_bh(&pstapriv->auth_list_lock); - spin_lock_bh(&(pstapriv->sta_hash_lock)); + spin_lock_bh(&pstapriv->sta_hash_lock); rtw_free_stainfo(padapter, psta); - spin_unlock_bh(&(pstapriv->sta_hash_lock)); + spin_unlock_bh(&pstapriv->sta_hash_lock); spin_lock_bh(&pstapriv->auth_list_lock); } @@ -361,8 +359,8 @@ void expire_timeout_chk(struct adapter *padapter) * for this station */ pstapriv->tim_bitmap |= BIT(psta->aid); - update_beacon(padapter, _TIM_IE_, - NULL, false); + update_beacon(padapter, _TIM_IE_, NULL, + false); if (!pmlmeext->active_keep_alive_check) continue; @@ -456,7 +454,7 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) unsigned char limit; unsigned int tx_ra_bitmap = 0; struct ht_priv *psta_ht = NULL; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_bssid_ex *pcur_network = (struct wlan_bssid_ex *)&pmlmepriv->cur_network.network; if (psta) @@ -548,7 +546,7 @@ static void update_bmc_sta(struct adapter *padapter) unsigned char network_type, raid; int i, supportRateNum = 0; unsigned int tx_ra_bitmap = 0; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_bssid_ex *pcur_network = (struct wlan_bssid_ex *)&pmlmepriv->cur_network.network; struct sta_info *psta = rtw_get_bcmc_stainfo(padapter); @@ -630,9 +628,9 @@ static void update_bmc_sta(struct adapter *padapter) void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta) { - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv; struct ht_priv *phtpriv_sta = &psta->htpriv; @@ -700,7 +698,7 @@ static void update_hw_ht_param(struct adapter *padapter) unsigned char max_AMPDU_len; unsigned char min_MPDU_spacing; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; DBG_88E("%s\n", __func__); @@ -733,12 +731,12 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf) u32 acparm; int ie_len; struct registry_priv *pregpriv = &padapter->registrypriv; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct security_priv *psecuritypriv = &(padapter->securitypriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct security_priv *psecuritypriv = &padapter->securitypriv; struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)&pmlmepriv->cur_network.network; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct wlan_bssid_ex *pnetwork_mlmeext = &(pmlmeinfo->network); + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; + struct wlan_bssid_ex *pnetwork_mlmeext = &pmlmeinfo->network; struct HT_info_element *pht_info = NULL; bcn_interval = (u16)pnetwork->Configuration.BeaconPeriod; @@ -869,7 +867,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) u8 WMM_PARA_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01}; struct registry_priv *pregistrypriv = &padapter->registrypriv; struct security_priv *psecuritypriv = &padapter->securitypriv; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_bssid_ex *pbss_network = (struct wlan_bssid_ex *)&pmlmepriv->cur_network.network; u8 *ie = pbss_network->IEs; @@ -905,7 +903,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) pbss_network->Rssi = 0; - ether_addr_copy(pbss_network->MacAddress, myid(&(padapter->eeprompriv))); + ether_addr_copy(pbss_network->MacAddress, myid(&padapter->eeprompriv)); /* beacon interval */ p = rtw_get_beacon_interval_from_ie(ie);/* 8: TimeStamp, 2: Beacon Interval 2:Capability */ @@ -1150,7 +1148,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) if ((NUM_ACL - 1) < pacl_list->num) return -1; - spin_lock_bh(&(pacl_node_q->lock)); + spin_lock_bh(&pacl_node_q->lock); phead = get_list_head(pacl_node_q); plist = phead->next; @@ -1168,12 +1166,12 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) } } - spin_unlock_bh(&(pacl_node_q->lock)); + spin_unlock_bh(&pacl_node_q->lock); if (added) return ret; - spin_lock_bh(&(pacl_node_q->lock)); + spin_lock_bh(&pacl_node_q->lock); for (i = 0; i < NUM_ACL; i++) { paclnode = &pacl_list->aclnode[i]; @@ -1195,7 +1193,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) DBG_88E("%s, acl_num =%d\n", __func__, pacl_list->num); - spin_unlock_bh(&(pacl_node_q->lock)); + spin_unlock_bh(&pacl_node_q->lock); return ret; } @@ -1210,7 +1208,7 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) DBG_88E("%s(acl_num =%d) =%pM\n", __func__, pacl_list->num, (addr)); - spin_lock_bh(&(pacl_node_q->lock)); + spin_lock_bh(&pacl_node_q->lock); phead = get_list_head(pacl_node_q); plist = phead->next; @@ -1230,7 +1228,7 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) } } - spin_unlock_bh(&(pacl_node_q->lock)); + spin_unlock_bh(&pacl_node_q->lock); DBG_88E("%s, acl_num =%d\n", __func__, pacl_list->num); return 0; @@ -1238,10 +1236,10 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) static void update_bcn_erpinfo_ie(struct adapter *padapter) { - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct wlan_bssid_ex *pnetwork = &(pmlmeinfo->network); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; + struct wlan_bssid_ex *pnetwork = &pmlmeinfo->network; unsigned char *p, *ie = pnetwork->IEs; u32 len = 0; @@ -1275,10 +1273,10 @@ static void update_bcn_wps_ie(struct adapter *padapter) u8 *pwps_ie = NULL, *pwps_ie_src; u8 *premainder_ie, *pbackup_remainder_ie = NULL; uint wps_ielen = 0, wps_offset, remainder_ielen; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct wlan_bssid_ex *pnetwork = &(pmlmeinfo->network); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; + struct wlan_bssid_ex *pnetwork = &pmlmeinfo->network; unsigned char *ie = pnetwork->IEs; u32 ielen = pnetwork->IELength; @@ -1338,8 +1336,8 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) if (!padapter) return; - pmlmepriv = &(padapter->mlmepriv); - pmlmeext = &(padapter->mlmeextpriv); + pmlmepriv = &padapter->mlmepriv; + pmlmeext = &padapter->mlmeextpriv; if (!pmlmeext->bstart_bss) return; @@ -1384,7 +1382,7 @@ static int rtw_ht_operation_update(struct adapter *padapter) { u16 cur_op_mode, new_op_mode; int op_mode_changes = 0; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv; if (pmlmepriv->htpriv.ht_option) @@ -1477,8 +1475,8 @@ void associated_clients_update(struct adapter *padapter, u8 updated) void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) { u8 beacon_updated = false; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; if (!(psta->flags & WLAN_STA_SHORT_PREAMBLE)) { if (!psta->no_short_preamble_set) { @@ -1573,8 +1571,8 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) pmlmepriv->num_sta_ht_no_gf++; } DBG_88E("%s STA %pM - no greenfield, num of non-gf stations %d\n", - __func__, (psta->hwaddr), - pmlmepriv->num_sta_ht_no_gf); + __func__, (psta->hwaddr), + pmlmepriv->num_sta_ht_no_gf); } if ((ht_capab & IEEE80211_HT_CAP_SUP_WIDTH) == 0) { @@ -1583,8 +1581,8 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) pmlmepriv->num_sta_ht_20mhz++; } DBG_88E("%s STA %pM - 20 MHz HT, num of 20MHz HT STAs %d\n", - __func__, (psta->hwaddr), - pmlmepriv->num_sta_ht_20mhz); + __func__, (psta->hwaddr), + pmlmepriv->num_sta_ht_20mhz); } } else { if (!psta->no_ht_set) { @@ -1612,8 +1610,8 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta) { u8 beacon_updated = false; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; if (!psta) return beacon_updated; @@ -1708,9 +1706,9 @@ u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta, beacon_updated = bss_cap_update_on_sta_leave(padapter, psta); - spin_lock_bh(&(pstapriv->sta_hash_lock)); + spin_lock_bh(&pstapriv->sta_hash_lock); rtw_free_stainfo(padapter, psta); - spin_unlock_bh(&(pstapriv->sta_hash_lock)); + spin_unlock_bh(&pstapriv->sta_hash_lock); return beacon_updated; } @@ -1721,7 +1719,7 @@ int rtw_sta_flush(struct adapter *padapter) struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; DBG_88E(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev)); @@ -1758,7 +1756,7 @@ int rtw_sta_flush(struct adapter *padapter) void sta_info_update(struct adapter *padapter, struct sta_info *psta) { int flags = psta->flags; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; /* update wmm cap. */ if (WLAN_STA_WME&flags) @@ -1795,7 +1793,7 @@ void ap_sta_info_defer_update(struct adapter *padapter, struct sta_info *psta) void start_ap_mode(struct adapter *padapter) { int i; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; @@ -1828,7 +1826,7 @@ void start_ap_mode(struct adapter *padapter) pmlmepriv->wps_assoc_resp_ie = NULL; /* for ACL */ - INIT_LIST_HEAD(&(pacl_list->acl_node_q.queue)); + INIT_LIST_HEAD(&pacl_list->acl_node_q.queue); pacl_list->num = 0; pacl_list->mode = 0; for (i = 0; i < NUM_ACL; i++) { @@ -1843,7 +1841,7 @@ void stop_ap_mode(struct adapter *padapter) struct rtw_wlan_acl_node *paclnode; struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; struct __queue *pacl_node_q = &pacl_list->acl_node_q; @@ -1857,7 +1855,7 @@ void stop_ap_mode(struct adapter *padapter) padapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled; /* for ACL */ - spin_lock_bh(&(pacl_node_q->lock)); + spin_lock_bh(&pacl_node_q->lock); phead = get_list_head(pacl_node_q); plist = phead->next; while (phead != plist) { @@ -1872,7 +1870,7 @@ void stop_ap_mode(struct adapter *padapter) pacl_list->num--; } } - spin_unlock_bh(&(pacl_node_q->lock)); + spin_unlock_bh(&pacl_node_q->lock); DBG_88E("%s, free acl_node_queue, num =%d\n", __func__, pacl_list->num); @@ -1882,9 +1880,9 @@ void stop_ap_mode(struct adapter *padapter) rtw_free_all_stainfo(padapter); psta = rtw_get_bcmc_stainfo(padapter); - spin_lock_bh(&(pstapriv->sta_hash_lock)); + spin_lock_bh(&pstapriv->sta_hash_lock); rtw_free_stainfo(padapter, psta); - spin_unlock_bh(&(pstapriv->sta_hash_lock)); + spin_unlock_bh(&pstapriv->sta_hash_lock); rtw_init_bcmc_stainfo(padapter); diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 36109cec8706..14979666dadd 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -1321,9 +1321,6 @@ void rtw_setassocsta_cmdrsp_callback(struct adapter *padapter, struct cmd_obj * spin_lock_bh(&pmlmepriv->lock); - if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) && (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true)) - _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); - set_fwstate(pmlmepriv, _FW_LINKED); spin_unlock_bh(&pmlmepriv->lock); diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c b/drivers/staging/rtl8188eu/core/rtw_efuse.c index 16cc7706a1e6..b9bdff0490ca 100644 --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c @@ -253,6 +253,7 @@ static void efuse_read_phymap_from_txpktbuf( u8 lenc[2]; u16 lenbak, aaabak; u16 aaa; + lenc[0] = usb_read8(adapter, REG_PKTBUF_DBG_DATA_L); lenc[1] = usb_read8(adapter, REG_PKTBUF_DBG_DATA_L+1); @@ -562,13 +563,14 @@ static bool hal_EfusePgPacketWrite2ByteHeader(struct adapter *pAdapter, u8 efuse } if ((tmp_header & 0x0F) == 0x0F) { /* word_en PG fail */ - if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) { + if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) return false; - } + efuse_addr++; continue; } else if (pg_header != tmp_header) { /* offset PG fail */ struct pgpkt fixPkt; + fixPkt.offset = ((pg_header_temp & 0xE0) >> 5) | ((tmp_header & 0xF0) >> 1); fixPkt.word_en = tmp_header & 0x0F; fixPkt.word_cnts = Efuse_CalculateWordCnts(fixPkt.word_en); @@ -611,6 +613,7 @@ static bool hal_EfusePgPacketWrite1ByteHeader(struct adapter *pAdapter, u8 efuse bRet = true; } else { struct pgpkt fixPkt; + fixPkt.offset = (tmp_header>>4) & 0x0F; fixPkt.word_en = tmp_header & 0x0F; fixPkt.word_cnts = Efuse_CalculateWordCnts(fixPkt.word_en); @@ -819,6 +822,7 @@ bool Efuse_PgPacketWrite(struct adapter *pAdapter, u8 offset, u8 word_en, u8 *pD u8 Efuse_CalculateWordCnts(u8 word_en) { u8 word_cnts = 0; + if (!(word_en & BIT(0))) word_cnts++; /* 0 : write enable */ if (!(word_en & BIT(1))) diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c index 914c4923421b..d1cd34011602 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c @@ -71,8 +71,8 @@ int rtw_get_bit_value_from_ieee_value(u8 val) unsigned char dot11_rate_table[] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 0}; /* last element must be zero!! */ - int i = 0; + while (dot11_rate_table[i] != 0) { if (dot11_rate_table[i] == val) return BIT(i); @@ -162,6 +162,7 @@ u8 *rtw_get_ie(u8 *pbuf, int index, int *len, int limit) { int tmp, i; u8 *p; + if (limit < 1) return NULL; @@ -211,6 +212,7 @@ void rtw_set_supported_rate(u8 *SupportedRates, uint mode) uint rtw_get_rateset_len(u8 *rateset) { uint i = 0; + while (1) { if ((rateset[i]) == 0) break; @@ -998,10 +1000,11 @@ int ieee80211_get_hdrlen(u16 fc) static int rtw_get_cipher_info(struct wlan_network *pnetwork) { - u32 wpa_ielen; + int wpa_ielen; unsigned char *pbuf; int group_cipher = 0, pairwise_cipher = 0, is8021x = 0; int ret = _FAIL; + pbuf = rtw_get_wpa_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength - 12); if (pbuf && (wpa_ielen > 0)) { @@ -1042,7 +1045,7 @@ void rtw_get_bcn_info(struct wlan_network *pnetwork) __le16 le_tmp; u16 wpa_len = 0, rsn_len = 0; struct HT_info_element *pht_info = NULL; - unsigned int len; + int len; unsigned char *p; memcpy(&le_tmp, rtw_get_capability_from_ie(pnetwork->network.IEs), 2); diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c index 6ed23f4db38c..67508a6cf0e5 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c +++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c @@ -573,11 +573,6 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter) u8 bw_40MHz = 0, short_GI_20 = 0, short_GI_40 = 0; u32 ht_ielen = 0; - if (adapter->registrypriv.mp_mode == 1) { - if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) - return 0; - } - if ((!check_fwstate(pmlmepriv, _FW_LINKED)) && (!check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE))) return 0; diff --git a/drivers/staging/rtl8188eu/core/rtw_led.c b/drivers/staging/rtl8188eu/core/rtw_led.c index c1478cff5854..1b9bc9817a57 100644 --- a/drivers/staging/rtl8188eu/core/rtw_led.c +++ b/drivers/staging/rtl8188eu/core/rtw_led.c @@ -39,7 +39,9 @@ void BlinkTimerCallback(unsigned long data) /* */ void BlinkWorkItemCallback(struct work_struct *work) { - struct LED_871x *pLed = container_of(work, struct LED_871x, BlinkWorkItem); + struct LED_871x *pLed = container_of(work, struct LED_871x, + BlinkWorkItem); + BlinkHandler(pLed); } diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index 032f783b0d83..a71928952eca 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -659,6 +659,7 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) } } else { int s_ret; + set_fwstate(pmlmepriv, _FW_UNDER_LINKING); pmlmepriv->to_join = false; s_ret = rtw_select_and_join_from_scanned_queue(pmlmepriv); @@ -1256,6 +1257,7 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf) if (mac_id >= 0) { u16 media_status; + media_status = (mac_id<<8)|0; /* MACID|OPMODE:0 means disconnect */ /* for STA, AP, ADHOC mode, report disconnect stauts to FW */ rtw_hal_set_hwreg(adapter, HW_VAR_H2C_MEDIA_STATUS_RPT, (u8 *)&media_status); @@ -1542,6 +1544,7 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv) rtw_hal_get_def_var(adapter, HAL_DEF_IS_SUPPORT_ANT_DIV, &(supp_ant_div)); if (supp_ant_div) { u8 cur_ant; + rtw_hal_get_def_var(adapter, HAL_DEF_CURRENT_ANTENNA, &(cur_ant)); DBG_88E("#### Opt_Ant_(%s), cur_Ant(%s)\n", (2 == candidate->network.PhyInfo.Optimum_antenna) ? "A" : "B", diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index d9c114776cab..f45af407f76d 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -147,6 +147,7 @@ static const struct rt_channel_plan_map RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE = { int rtw_ch_set_search_ch(struct rt_channel_info *ch_set, const u32 ch) { int i; + for (i = 0; ch_set[i].ChannelNum != 0; i++) { if (ch == ch_set[i].ChannelNum) break; @@ -274,9 +275,8 @@ static s32 dump_mgntframe_and_wait_ack(struct adapter *padapter, pxmitpriv->ack_tx = true; pmgntframe->ack_report = 1; - if (rtw_hal_mgnt_xmit(padapter, pmgntframe) == _SUCCESS) { + if (rtw_hal_mgnt_xmit(padapter, pmgntframe) == _SUCCESS) ret = rtw_ack_tx_wait(pxmitpriv, timeout_ms); - } pxmitpriv->ack_tx = false; mutex_unlock(&pxmitpriv->ack_tx_mutex); @@ -371,6 +371,7 @@ static void issue_beacon(struct adapter *padapter, int timeout_ms) u8 *wps_ie; uint wps_ielen; u8 sr = 0; + memcpy(pframe, cur_network->IEs, cur_network->IELength); len_diff = update_hidden_ssid( pframe+_BEACON_IE_OFFSET_ @@ -829,6 +830,7 @@ static void issue_auth(struct adapter *padapter, struct sta_info *psta, } else { __le32 le_tmp32; __le16 le_tmp16; + ether_addr_copy(pwlanhdr->addr1, pnetwork->MacAddress); ether_addr_copy(pwlanhdr->addr2, myid(&padapter->eeprompriv)); ether_addr_copy(pwlanhdr->addr3, pnetwork->MacAddress); @@ -1963,6 +1965,7 @@ static void site_survey(struct adapter *padapter) if (ScanType == SCAN_ACTIVE) { /* obey the channel plan setting... */ int i; + for (i = 0; i < RTW_SSID_SCAN_AMOUNT; i++) { if (pmlmeext->sitesurvey_res.ssid[i].SsidLength) { /* todo: to issue two probe req??? */ @@ -2050,8 +2053,8 @@ static u8 collect_bss_info(struct adapter *padapter, u32 len; u8 *p; u16 val16, subtype; - u8 *pframe = precv_frame->rx_data; - u32 packet_len = precv_frame->len; + u8 *pframe = precv_frame->pkt->data; + u32 packet_len = precv_frame->pkt->len; u8 ie_offset; struct registry_priv *pregistrypriv = &padapter->registrypriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -2155,6 +2158,7 @@ static u8 collect_bss_info(struct adapter *padapter, p = rtw_get_ie(bssid->IEs + ie_offset, _HT_ADD_INFO_IE_, &len, bssid->IELength - ie_offset); if (p) { struct HT_info_element *HT_info = (struct HT_info_element *)(p + 2); + bssid->Configuration.DSConfig = HT_info->primary_channel; } else { /* use current channel */ bssid->Configuration.DSConfig = rtw_get_oper_ch(padapter); @@ -2192,6 +2196,7 @@ static u8 collect_bss_info(struct adapter *padapter, /* 20/40 BSS Coexistence check */ if ((pregistrypriv->wifi_spec == 1) && (!pmlmeinfo->bwmode_updated)) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + p = rtw_get_ie(bssid->IEs + ie_offset, _HT_CAPABILITY_IE_, &len, bssid->IELength - ie_offset); if (p && len > 0) { struct ieee80211_ht_cap *pHT_caps = @@ -2218,6 +2223,7 @@ static void start_create_ibss(struct adapter *padapter) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)(&(pmlmeinfo->network)); + pmlmeext->cur_channel = (u8)pnetwork->Configuration.DSConfig; pmlmeinfo->bcn_interval = get_beacon_interval(pnetwork); @@ -2557,8 +2563,8 @@ static unsigned int OnProbeReq(struct adapter *padapter, struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct wlan_bssid_ex *cur = &(pmlmeinfo->network); - u8 *pframe = precv_frame->rx_data; - uint len = precv_frame->len; + u8 *pframe = precv_frame->pkt->data; + uint len = precv_frame->pkt->len; if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) return _SUCCESS; @@ -2605,8 +2611,8 @@ static unsigned int OnBeacon(struct adapter *padapter, struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct sta_priv *pstapriv = &padapter->stapriv; - u8 *pframe = precv_frame->rx_data; - uint len = precv_frame->len; + u8 *pframe = precv_frame->pkt->data; + uint len = precv_frame->pkt->len; struct wlan_bssid_ex *pbss; int ret = _SUCCESS; struct wlan_bssid_ex *pnetwork = &(pmlmeinfo->network); @@ -2702,8 +2708,8 @@ static unsigned int OnAuth(struct adapter *padapter, struct security_priv *psecuritypriv = &padapter->securitypriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - u8 *pframe = precv_frame->rx_data; - uint len = precv_frame->len; + u8 *pframe = precv_frame->pkt->data; + uint len = precv_frame->pkt->len; if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) return _FAIL; @@ -2865,8 +2871,8 @@ static unsigned int OnAuthClient(struct adapter *padapter, unsigned int go2asoc = 0; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - u8 *pframe = precv_frame->rx_data; - uint pkt_len = precv_frame->len; + u8 *pframe = precv_frame->pkt->data; + uint pkt_len = precv_frame->pkt->len; DBG_88E("%s\n", __func__); @@ -2953,8 +2959,8 @@ static unsigned int OnAssocReq(struct adapter *padapter, struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct wlan_bssid_ex *cur = &(pmlmeinfo->network); struct sta_priv *pstapriv = &padapter->stapriv; - u8 *pframe = precv_frame->rx_data; - uint pkt_len = precv_frame->len; + u8 *pframe = precv_frame->pkt->data; + uint pkt_len = precv_frame->pkt->len; if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) return _FAIL; @@ -3385,8 +3391,8 @@ static unsigned int OnAssocRsp(struct adapter *padapter, struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); /* struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); */ - u8 *pframe = precv_frame->rx_data; - uint pkt_len = precv_frame->len; + u8 *pframe = precv_frame->pkt->data; + uint pkt_len = precv_frame->pkt->len; DBG_88E("%s\n", __func__); @@ -3453,11 +3459,10 @@ static unsigned int OnAssocRsp(struct adapter *padapter, UpdateBrateTbl(padapter, pmlmeinfo->network.SupportedRates); report_assoc_result: - if (res > 0) { + if (res > 0) rtw_buf_update(&pmlmepriv->assoc_rsp, &pmlmepriv->assoc_rsp_len, pframe, pkt_len); - } else { + else rtw_buf_free(&pmlmepriv->assoc_rsp, &pmlmepriv->assoc_rsp_len); - } report_join_res(padapter, res); @@ -3471,7 +3476,7 @@ static unsigned int OnDeAuth(struct adapter *padapter, struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - u8 *pframe = precv_frame->rx_data; + u8 *pframe = precv_frame->pkt->data; struct wlan_bssid_ex *pnetwork = &(pmlmeinfo->network); /* check A3 */ @@ -3526,7 +3531,7 @@ static unsigned int OnDisassoc(struct adapter *padapter, struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - u8 *pframe = precv_frame->rx_data; + u8 *pframe = precv_frame->pkt->data; struct wlan_bssid_ex *pnetwork = &(pmlmeinfo->network); /* check A3 */ @@ -3585,7 +3590,7 @@ static unsigned int on_action_spct(struct adapter *padapter, { struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; - u8 *pframe = precv_frame->rx_data; + u8 *pframe = precv_frame->pkt->data; u8 *frame_body = pframe + sizeof(struct ieee80211_hdr_3addr); u8 category; u8 action; @@ -3641,7 +3646,7 @@ static unsigned int OnAction_back(struct adapter *padapter, unsigned short tid, status, reason_code = 0; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - u8 *pframe = precv_frame->rx_data; + u8 *pframe = precv_frame->pkt->data; struct sta_priv *pstapriv = &padapter->stapriv; /* check RA matches or not */ if (memcmp(myid(&(padapter->eeprompriv)), GetAddr1Ptr(pframe), @@ -3714,7 +3719,7 @@ static s32 rtw_action_public_decache(struct recv_frame *recv_frame, s32 token) { struct adapter *adapter = recv_frame->adapter; struct mlme_ext_priv *mlmeext = &(adapter->mlmeextpriv); - u8 *frame = recv_frame->rx_data; + u8 *frame = recv_frame->pkt->data; u16 seq_ctrl = ((recv_frame->attrib.seq_num&0xffff) << 4) | (recv_frame->attrib.frag_num & 0xf); @@ -3744,11 +3749,11 @@ static s32 rtw_action_public_decache(struct recv_frame *recv_frame, s32 token) static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) { - u8 *pframe = precv_frame->rx_data; + u8 *pframe = precv_frame->pkt->data; u8 *frame_body; u8 dialogToken = 0; - frame_body = (unsigned char *)(pframe + sizeof(struct ieee80211_hdr_3addr)); + frame_body = (unsigned char *)(pframe + sizeof(struct ieee80211_hdr_3addr)); dialogToken = frame_body[7]; if (rtw_action_public_decache(precv_frame, dialogToken) == _FAIL) @@ -3760,7 +3765,7 @@ static unsigned int on_action_public_p2p(struct recv_frame *precv_frame) static unsigned int on_action_public_vendor(struct recv_frame *precv_frame) { unsigned int ret = _FAIL; - u8 *pframe = precv_frame->rx_data; + u8 *pframe = precv_frame->pkt->data; u8 *frame_body = pframe + sizeof(struct ieee80211_hdr_3addr); if (!memcmp(frame_body + 2, P2P_OUI, 4)) @@ -3772,7 +3777,7 @@ static unsigned int on_action_public_vendor(struct recv_frame *precv_frame) static unsigned int on_action_public_default(struct recv_frame *precv_frame, u8 action) { unsigned int ret = _FAIL; - u8 *pframe = precv_frame->rx_data; + u8 *pframe = precv_frame->pkt->data; u8 *frame_body = pframe + sizeof(struct ieee80211_hdr_3addr); u8 token; @@ -3791,7 +3796,7 @@ static unsigned int on_action_public(struct adapter *padapter, struct recv_frame *precv_frame) { unsigned int ret = _FAIL; - u8 *pframe = precv_frame->rx_data; + u8 *pframe = precv_frame->pkt->data; u8 *frame_body = pframe + sizeof(struct ieee80211_hdr_3addr); u8 category, action; @@ -3862,7 +3867,7 @@ static unsigned int OnAction(struct adapter *padapter, unsigned char category; struct action_handler *ptable; unsigned char *frame_body; - u8 *pframe = precv_frame->rx_data; + u8 *pframe = precv_frame->pkt->data; frame_body = (unsigned char *)(pframe + sizeof(struct ieee80211_hdr_3addr)); @@ -4002,9 +4007,8 @@ static void init_channel_list(struct adapter *padapter, struct rt_channel_info * struct p2p_reg_class *reg = NULL; for (ch = o->min_chan; ch <= o->max_chan; ch += o->inc) { - if (!has_channel(channel_set, chanset_size, ch)) { + if (!has_channel(channel_set, chanset_size, ch)) continue; - } if ((0 == padapter->registrypriv.ht_enable) && (8 == o->inc)) continue; @@ -4119,7 +4123,7 @@ void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext) static void _mgt_dispatcher(struct adapter *padapter, struct mlme_handler *ptable, struct recv_frame *precv_frame) { u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - u8 *pframe = precv_frame->rx_data; + u8 *pframe = precv_frame->pkt->data; if (ptable->func) { /* receive the frames that ra(a1) is my address or ra(a1) is bc address. */ @@ -4138,7 +4142,7 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; #endif /* CONFIG_88EU_AP_MODE */ u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - u8 *pframe = precv_frame->rx_data; + u8 *pframe = precv_frame->pkt->data; struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, GetAddr2Ptr(pframe)); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, @@ -4664,23 +4668,6 @@ void mlmeext_sta_del_event_callback(struct adapter *padapter) Following are the functions for the timer handlers *****************************************************************************/ -void _linked_rx_signal_strehgth_display(struct adapter *padapter); -void _linked_rx_signal_strehgth_display(struct adapter *padapter) -{ - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - u8 mac_id; - int UndecoratedSmoothedPWDB; - if ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) - mac_id = 0; - else if ((pmlmeinfo->state&0x03) == _HW_STATE_AP_) - mac_id = 2; - - rtw_hal_get_def_var(padapter, HW_DEF_RA_INFO_DUMP, &mac_id); - - rtw_hal_get_def_var(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB); - DBG_88E("UndecoratedSmoothedPWDB:%d\n", UndecoratedSmoothedPWDB); -} static u8 chk_ap_is_alive(struct adapter *padapter, struct sta_info *psta) { @@ -4707,9 +4694,6 @@ void linked_status_chk(struct adapter *padapter) struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct sta_priv *pstapriv = &padapter->stapriv; - if (padapter->bRxRSSIDisplay) - _linked_rx_signal_strehgth_display(padapter); - if (is_client_associated_to_ap(padapter)) { /* linked infrastructure client mode */ @@ -4767,9 +4751,8 @@ void linked_status_chk(struct adapter *padapter) } } - if (tx_chk != _SUCCESS && pmlmeinfo->link_count++ == 0xf) { + if (tx_chk != _SUCCESS && pmlmeinfo->link_count++ == 0xf) tx_chk = issue_nulldata(padapter, NULL, 0, 1, 0); - } } if (rx_chk == _FAIL) { diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c index 4032121a06f3..f86c9cebf09a 100644 --- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c @@ -180,9 +180,9 @@ int ips_leave(struct adapter *padapter) DBG_88E("==>ips_leave cnts:%d\n", pwrpriv->ips_leave_cnts); result = rtw_ips_pwr_up(padapter); - if (result == _SUCCESS) { + if (result == _SUCCESS) pwrpriv->rf_pwrstate = rf_on; - } + DBG_88E_LEVEL(_drv_info_, "nolinked power save leave\n"); if ((_WEP40_ == psecuritypriv->dot11PrivacyAlgrthm) || (_WEP104_ == psecuritypriv->dot11PrivacyAlgrthm)) { @@ -279,6 +279,7 @@ exit: static void pwr_state_check_handler(unsigned long data) { struct adapter *padapter = (struct adapter *)data; + rtw_ps_cmd(padapter); } diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 3e6edb63d36b..53dc33c3f913 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -80,7 +80,6 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) &(precvpriv->free_recv_queue.queue)); precvframe->pkt = NULL; - precvframe->len = 0; precvframe->adapter = padapter; precvframe++; @@ -149,8 +148,6 @@ int rtw_free_recvframe(struct recv_frame *precvframe, list_del_init(&(precvframe->list)); - precvframe->len = 0; - list_add_tail(&(precvframe->list), get_list_head(pfree_recv_queue)); spin_unlock_bh(&pfree_recv_queue->lock); @@ -211,6 +208,7 @@ u32 rtw_free_uc_swdec_pending_queue(struct adapter *adapter) { u32 cnt = 0; struct recv_frame *pending_frame; + while ((pending_frame = rtw_alloc_recvframe(&adapter->recvpriv.uc_swdec_pending_queue))) { rtw_free_recvframe(pending_frame, &adapter->recvpriv.free_recv_queue); DBG_88E("%s: dequeue uc_swdec_pending_queue\n", __func__); @@ -261,9 +259,9 @@ static int recvframe_chkmic(struct adapter *adapter, } /* icv_len included the mic code */ - datalen = precvframe->len-prxattrib->hdrlen - + datalen = precvframe->pkt->len-prxattrib->hdrlen - prxattrib->iv_len-prxattrib->icv_len-8; - pframe = precvframe->rx_data; + pframe = precvframe->pkt->data; payload = pframe+prxattrib->hdrlen+prxattrib->iv_len; RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("\n prxattrib->iv_len=%d prxattrib->icv_len=%d\n", prxattrib->iv_len, prxattrib->icv_len)); @@ -296,26 +294,27 @@ static int recvframe_chkmic(struct adapter *adapter, *(pframemic-10), *(pframemic-9))); { uint i; + RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("\n ======demp packet (len=%d)======\n", - precvframe->len)); - for (i = 0; i < precvframe->len; i += 8) { + precvframe->pkt->len)); + for (i = 0; i < precvframe->pkt->len; i += 8) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x", - *(precvframe->rx_data+i), - *(precvframe->rx_data+i+1), - *(precvframe->rx_data+i+2), - *(precvframe->rx_data+i+3), - *(precvframe->rx_data+i+4), - *(precvframe->rx_data+i+5), - *(precvframe->rx_data+i+6), - *(precvframe->rx_data+i+7))); + *(precvframe->pkt->data+i), + *(precvframe->pkt->data+i+1), + *(precvframe->pkt->data+i+2), + *(precvframe->pkt->data+i+3), + *(precvframe->pkt->data+i+4), + *(precvframe->pkt->data+i+5), + *(precvframe->pkt->data+i+6), + *(precvframe->pkt->data+i+7))); } RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("\n ====== demp packet end [len=%d]======\n", - precvframe->len)); + precvframe->pkt->len)); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("\n hrdlen=%d,\n", @@ -352,7 +351,7 @@ static int recvframe_chkmic(struct adapter *adapter, RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("recvframe_chkmic: rtw_get_stainfo==NULL!!!\n")); } - recvframe_pull_tail(precvframe, 8); + skb_trim(precvframe->pkt, precvframe->pkt->len - 8); } exit: @@ -372,7 +371,8 @@ static struct recv_frame *decryptor(struct adapter *padapter, RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("prxstat->decrypted=%x prxattrib->encrypt=0x%03x\n", prxattrib->bdecrypted, prxattrib->encrypt)); if (prxattrib->encrypt > 0) { - u8 *iv = precv_frame->rx_data+prxattrib->hdrlen; + u8 *iv = precv_frame->pkt->data+prxattrib->hdrlen; + prxattrib->key_index = (((iv[3])>>6)&0x3); if (prxattrib->key_index > WEP_KEYS) { @@ -440,7 +440,7 @@ static struct recv_frame *portctrl(struct adapter *adapter, auth_alg = adapter->securitypriv.dot11AuthAlgrthm; - ptr = precv_frame->rx_data; + ptr = precv_frame->pkt->data; pfhdr = precv_frame; pattrib = &pfhdr->attrib; psta_addr = pattrib->ta; @@ -529,7 +529,7 @@ static void process_pwrbit_data(struct adapter *padapter, { #ifdef CONFIG_88EU_AP_MODE unsigned char pwrbit; - u8 *ptr = precv_frame->rx_data; + u8 *ptr = precv_frame->pkt->data; struct rx_pkt_attrib *pattrib = &precv_frame->attrib; struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info *psta = NULL; @@ -617,7 +617,7 @@ static void count_rx_stats(struct adapter *padapter, struct rx_pkt_attrib *pattrib = &prframe->attrib; struct recv_priv *precvpriv = &padapter->recvpriv; - sz = prframe->len; + sz = prframe->pkt->len; precvpriv->rx_bytes += sz; padapter->mlmepriv.LinkDetectInfo.NumRxOkInPeriod++; @@ -647,7 +647,6 @@ int sta2sta_data_frame( int sta2sta_data_frame(struct adapter *adapter, struct recv_frame *precv_frame, struct sta_info **psta) { - u8 *ptr = precv_frame->rx_data; int ret = _SUCCESS; struct rx_pkt_attrib *pattrib = &precv_frame->attrib; struct sta_priv *pstapriv = &adapter->stapriv; @@ -703,14 +702,6 @@ int sta2sta_data_frame(struct adapter *adapter, struct recv_frame *precv_frame, sta_addr = pattrib->src; } - } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) { - memcpy(pattrib->dst, GetAddr1Ptr(ptr), ETH_ALEN); - memcpy(pattrib->src, GetAddr2Ptr(ptr), ETH_ALEN); - memcpy(pattrib->bssid, GetAddr3Ptr(ptr), ETH_ALEN); - memcpy(pattrib->ra, pattrib->dst, ETH_ALEN); - memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - sta_addr = mybssid; } else { ret = _FAIL; } @@ -735,7 +726,7 @@ static int ap2sta_data_frame( struct recv_frame *precv_frame, struct sta_info **psta) { - u8 *ptr = precv_frame->rx_data; + u8 *ptr = precv_frame->pkt->data; struct rx_pkt_attrib *pattrib = &precv_frame->attrib; int ret = _SUCCESS; struct sta_priv *pstapriv = &adapter->stapriv; @@ -799,23 +790,6 @@ static int ap2sta_data_frame( ret = RTW_RX_HANDLED; goto exit; } - } else if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) && - (check_fwstate(pmlmepriv, _FW_LINKED) == true)) { - memcpy(pattrib->dst, GetAddr1Ptr(ptr), ETH_ALEN); - memcpy(pattrib->src, GetAddr2Ptr(ptr), ETH_ALEN); - memcpy(pattrib->bssid, GetAddr3Ptr(ptr), ETH_ALEN); - memcpy(pattrib->ra, pattrib->dst, ETH_ALEN); - memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - /* */ - memcpy(pattrib->bssid, mybssid, ETH_ALEN); - - *psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /* get sta_info */ - if (*psta == NULL) { - RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("can't get psta under MP_MODE ; drop pkt\n")); - ret = _FAIL; - goto exit; - } } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { /* Special case */ ret = RTW_RX_HANDLED; @@ -845,7 +819,7 @@ static int sta2ap_data_frame(struct adapter *adapter, struct rx_pkt_attrib *pattrib = &precv_frame->attrib; struct sta_priv *pstapriv = &adapter->stapriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; - u8 *ptr = precv_frame->rx_data; + u8 *ptr = precv_frame->pkt->data; unsigned char *mybssid = get_bssid(pmlmepriv); int ret = _SUCCESS; @@ -880,6 +854,7 @@ static int sta2ap_data_frame(struct adapter *adapter, } } else { u8 *myhwaddr = myid(&adapter->eeprompriv); + if (memcmp(pattrib->ra, myhwaddr, ETH_ALEN)) { ret = RTW_RX_HANDLED; goto exit; @@ -901,7 +876,7 @@ static int validate_recv_ctrl_frame(struct adapter *padapter, #ifdef CONFIG_88EU_AP_MODE struct rx_pkt_attrib *pattrib = &precv_frame->attrib; struct sta_priv *pstapriv = &padapter->stapriv; - u8 *pframe = precv_frame->rx_data; + u8 *pframe = precv_frame->pkt->data; if (GetFrameType(pframe) != WIFI_CTRL_TYPE) return _FAIL; @@ -1038,19 +1013,19 @@ static int validate_recv_mgnt_frame(struct adapter *padapter, /* for rx pkt statistics */ psta = rtw_get_stainfo(&padapter->stapriv, - GetAddr2Ptr(precv_frame->rx_data)); + GetAddr2Ptr(precv_frame->pkt->data)); if (psta) { psta->sta_stats.rx_mgnt_pkts++; - if (GetFrameSubType(precv_frame->rx_data) == WIFI_BEACON) { + if (GetFrameSubType(precv_frame->pkt->data) == WIFI_BEACON) { psta->sta_stats.rx_beacon_pkts++; - } else if (GetFrameSubType(precv_frame->rx_data) == WIFI_PROBEREQ) { + } else if (GetFrameSubType(precv_frame->pkt->data) == WIFI_PROBEREQ) { psta->sta_stats.rx_probereq_pkts++; - } else if (GetFrameSubType(precv_frame->rx_data) == WIFI_PROBERSP) { + } else if (GetFrameSubType(precv_frame->pkt->data) == WIFI_PROBERSP) { if (!memcmp(padapter->eeprompriv.mac_addr, - GetAddr1Ptr(precv_frame->rx_data), ETH_ALEN)) + GetAddr1Ptr(precv_frame->pkt->data), ETH_ALEN)) psta->sta_stats.rx_probersp_pkts++; - else if (is_broadcast_mac_addr(GetAddr1Ptr(precv_frame->rx_data)) || - is_multicast_mac_addr(GetAddr1Ptr(precv_frame->rx_data))) + else if (is_broadcast_mac_addr(GetAddr1Ptr(precv_frame->pkt->data)) || + is_multicast_mac_addr(GetAddr1Ptr(precv_frame->pkt->data))) psta->sta_stats.rx_probersp_bm_pkts++; else psta->sta_stats.rx_probersp_uo_pkts++; @@ -1068,7 +1043,7 @@ static int validate_recv_data_frame(struct adapter *adapter, u8 bretry; u8 *psa, *pda, *pbssid; struct sta_info *psta = NULL; - u8 *ptr = precv_frame->rx_data; + u8 *ptr = precv_frame->pkt->data; struct rx_pkt_attrib *pattrib = &precv_frame->attrib; struct security_priv *psecuritypriv = &adapter->securitypriv; int ret = _SUCCESS; @@ -1115,11 +1090,10 @@ static int validate_recv_data_frame(struct adapter *adapter, break; } - if (ret == _FAIL) { + if (ret == _FAIL) goto exit; - } else if (ret == RTW_RX_HANDLED) { + else if (ret == RTW_RX_HANDLED) goto exit; - } if (psta == NULL) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, (" after to_fr_ds_chk; psta==NULL\n")); @@ -1191,12 +1165,13 @@ static int validate_recv_frame(struct adapter *adapter, int retval = _SUCCESS; u8 bDumpRxPkt; struct rx_pkt_attrib *pattrib = &precv_frame->attrib; - u8 *ptr = precv_frame->rx_data; + u8 *ptr = precv_frame->pkt->data; u8 ver = (unsigned char)(*ptr)&0x3; struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; if (pmlmeext->sitesurvey_res.state == SCAN_PROCESS) { int ch_set_idx = rtw_ch_set_search_ch(pmlmeext->channel_set, rtw_get_oper_ch(adapter)); + if (ch_set_idx >= 0) pmlmeext->channel_set[ch_set_idx].rx_count++; } @@ -1265,6 +1240,7 @@ static int validate_recv_frame(struct adapter *adapter, retval = validate_recv_data_frame(adapter, precv_frame); if (retval == _FAIL) { struct recv_priv *precvpriv = &adapter->recvpriv; + precvpriv->rx_drop++; } break; @@ -1303,13 +1279,11 @@ static int wlanhdr_to_ethhdr(struct recv_frame *precvframe) u8 *psnap_type; struct ieee80211_snap_hdr *psnap; - struct adapter *adapter = precvframe->adapter; - struct mlme_priv *pmlmepriv = &adapter->mlmepriv; - u8 *ptr = precvframe->rx_data; + u8 *ptr = precvframe->pkt->data; struct rx_pkt_attrib *pattrib = &precvframe->attrib; if (pattrib->encrypt) - recvframe_pull_tail(precvframe, pattrib->icv_len); + skb_trim(precvframe->pkt, precvframe->pkt->len - pattrib->icv_len); psnap = (struct ieee80211_snap_hdr *)(ptr+pattrib->hdrlen + pattrib->iv_len); psnap_type = ptr+pattrib->hdrlen + pattrib->iv_len+SNAP_SIZE; @@ -1326,7 +1300,7 @@ static int wlanhdr_to_ethhdr(struct recv_frame *precvframe) } rmv_len = pattrib->hdrlen + pattrib->iv_len + (bsnaphdr ? SNAP_SIZE : 0); - len = precvframe->len - rmv_len; + len = precvframe->pkt->len - rmv_len; RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("\n===pattrib->hdrlen: %x, pattrib->iv_len:%x===\n\n", pattrib->hdrlen, pattrib->iv_len)); @@ -1335,19 +1309,9 @@ static int wlanhdr_to_ethhdr(struct recv_frame *precvframe) eth_type = ntohs(be_tmp); /* pattrib->ether_type */ pattrib->eth_type = eth_type; - if ((check_fwstate(pmlmepriv, WIFI_MP_STATE))) { - ptr += rmv_len; - *ptr = 0x87; - *(ptr+1) = 0x12; - - eth_type = 0x8712; - /* append rx status for mp test packets */ - ptr = recvframe_pull(precvframe, (rmv_len-sizeof(struct ethhdr)+2)-24); - memcpy(ptr, get_rxmem(precvframe), 24); - ptr += 24; - } else { - ptr = recvframe_pull(precvframe, (rmv_len-sizeof(struct ethhdr) + (bsnaphdr ? 2 : 0))); - } + ptr = skb_pull(precvframe->pkt, rmv_len - sizeof(struct ethhdr) + (bsnaphdr ? 2 : 0)); + if (!ptr) + return _FAIL; memcpy(ptr, pattrib->dst, ETH_ALEN); memcpy(ptr+ETH_ALEN, pattrib->src, ETH_ALEN); @@ -1416,15 +1380,16 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter, wlanhdr_offset = pnfhdr->attrib.hdrlen + pnfhdr->attrib.iv_len; - recvframe_pull(pnextrframe, wlanhdr_offset); + skb_pull(pnextrframe->pkt, wlanhdr_offset); /* append to first fragment frame's tail (if privacy frame, pull the ICV) */ - recvframe_pull_tail(prframe, pfhdr->attrib.icv_len); + skb_trim(prframe->pkt, prframe->pkt->len - pfhdr->attrib.icv_len); /* memcpy */ - memcpy(pfhdr->rx_tail, pnfhdr->rx_data, pnfhdr->len); + memcpy(skb_tail_pointer(pfhdr->pkt), pnfhdr->pkt->data, + pnfhdr->pkt->len); - recvframe_put(prframe, pnfhdr->len); + skb_put(prframe->pkt, pnfhdr->pkt->len); pfhdr->attrib.icv_len = pnfhdr->attrib.icv_len; plist = plist->next; @@ -1465,7 +1430,8 @@ struct recv_frame *recvframe_chk_defrag(struct adapter *padapter, psta_addr = pfhdr->attrib.ta; psta = rtw_get_stainfo(pstapriv, psta_addr); if (psta == NULL) { - u8 type = GetFrameType(pfhdr->rx_data); + u8 type = GetFrameType(pfhdr->pkt->data); + if (type != WIFI_DATA_TYPE) { psta = rtw_get_bcmc_stainfo(padapter); pdefrag_q = &psta->sta_recvpriv.defrag_q; @@ -1548,18 +1514,18 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe) struct sk_buff *sub_skb, *subframes[MAX_SUBFRAME_COUNT]; struct recv_priv *precvpriv = &padapter->recvpriv; struct __queue *pfree_recv_queue = &(precvpriv->free_recv_queue); - nr_subframes = 0; + nr_subframes = 0; pattrib = &prframe->attrib; - recvframe_pull(prframe, prframe->attrib.hdrlen); + skb_pull(prframe->pkt, prframe->attrib.hdrlen); if (prframe->attrib.iv_len > 0) - recvframe_pull(prframe, prframe->attrib.iv_len); + skb_pull(prframe->pkt, prframe->attrib.iv_len); - a_len = prframe->len; + a_len = prframe->pkt->len; - pdata = prframe->rx_data; + pdata = prframe->pkt->data; while (a_len > ETH_HLEN) { /* Offset 12 denote 2 mac address */ @@ -1606,9 +1572,9 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe) if (padding_len == 4) padding_len = 0; - if (a_len < padding_len) { + if (a_len < padding_len) goto exit; - } + pdata += padding_len; a_len -= padding_len; } @@ -1646,8 +1612,6 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe) } exit: - - prframe->len = 0; rtw_free_recvframe(prframe, pfree_recv_queue);/* free this recv_frame */ return _SUCCESS; @@ -2064,45 +2028,48 @@ static void rtw_signal_stat_timer_hdl(unsigned long data) u8 avg_signal_qual = 0; u8 _alpha = 3; /* this value is based on converging_constant = 5000 and sampling_interval = 1000 */ - if (adapter->recvpriv.is_signal_dbg) { - /* update the user specific value, signal_strength_dbg, to signal_strength, rssi */ - adapter->recvpriv.signal_strength = adapter->recvpriv.signal_strength_dbg; - adapter->recvpriv.rssi = (s8)translate_percentage_to_dbm((u8)adapter->recvpriv.signal_strength_dbg); - } else { - if (recvpriv->signal_strength_data.update_req == 0) {/* update_req is clear, means we got rx */ - avg_signal_strength = recvpriv->signal_strength_data.avg_val; - /* after avg_vals are acquired, we can re-stat the signal values */ - recvpriv->signal_strength_data.update_req = 1; - } - - if (recvpriv->signal_qual_data.update_req == 0) {/* update_req is clear, means we got rx */ - avg_signal_qual = recvpriv->signal_qual_data.avg_val; - /* after avg_vals are acquired, we can re-stat the signal values */ - recvpriv->signal_qual_data.update_req = 1; - } + if (recvpriv->signal_strength_data.update_req == 0) { + /* update_req is clear, means we got rx */ + avg_signal_strength = recvpriv->signal_strength_data.avg_val; + /* after avg_vals are acquired, we can re-stat the signal + * values + */ + recvpriv->signal_strength_data.update_req = 1; + } - /* update value of signal_strength, rssi, signal_qual */ - if (check_fwstate(&adapter->mlmepriv, _FW_UNDER_SURVEY) == false) { - tmp_s = avg_signal_strength+(_alpha-1)*recvpriv->signal_strength; - if (tmp_s % _alpha) - tmp_s = tmp_s/_alpha + 1; - else - tmp_s = tmp_s/_alpha; - if (tmp_s > 100) - tmp_s = 100; + if (recvpriv->signal_qual_data.update_req == 0) { + /* update_req is clear, means we got rx */ + avg_signal_qual = recvpriv->signal_qual_data.avg_val; + /* after avg_vals are acquired, we can re-stat the signal + * values + */ + recvpriv->signal_qual_data.update_req = 1; + } - tmp_q = avg_signal_qual+(_alpha-1)*recvpriv->signal_qual; - if (tmp_q % _alpha) - tmp_q = tmp_q/_alpha + 1; - else - tmp_q = tmp_q/_alpha; - if (tmp_q > 100) - tmp_q = 100; + /* update value of signal_strength, rssi, signal_qual */ + if (check_fwstate(&adapter->mlmepriv, _FW_UNDER_SURVEY) == false) { + tmp_s = avg_signal_strength + + (_alpha - 1) * recvpriv->signal_strength; + if (tmp_s % _alpha) + tmp_s = tmp_s / _alpha + 1; + else + tmp_s = tmp_s / _alpha; + if (tmp_s > 100) + tmp_s = 100; + + tmp_q = avg_signal_qual + + (_alpha - 1) * recvpriv->signal_qual; + if (tmp_q % _alpha) + tmp_q = tmp_q / _alpha + 1; + else + tmp_q = tmp_q / _alpha; + if (tmp_q > 100) + tmp_q = 100; - recvpriv->signal_strength = tmp_s; - recvpriv->rssi = (s8)translate_percentage_to_dbm(tmp_s); - recvpriv->signal_qual = tmp_q; - } + recvpriv->signal_strength = tmp_s; + recvpriv->rssi = (s8)translate_percentage_to_dbm(tmp_s); + recvpriv->signal_qual = tmp_q; } + rtw_set_signal_stat_timer(recvpriv); } diff --git a/drivers/staging/rtl8188eu/core/rtw_security.c b/drivers/staging/rtl8188eu/core/rtw_security.c index 85bb441a7214..b283a4903369 100644 --- a/drivers/staging/rtl8188eu/core/rtw_security.c +++ b/drivers/staging/rtl8188eu/core/rtw_security.c @@ -36,6 +36,7 @@ static void arcfour_init(struct arc4context *parc4ctx, u8 *key, u32 key_len) u32 stateindex; u8 *state; u32 counter; + state = parc4ctx->state; parc4ctx->x = 0; parc4ctx->y = 0; @@ -60,6 +61,7 @@ static u32 arcfour_byte(struct arc4context *parc4ctx) u32 y; u32 sx, sy; u8 *state; + state = parc4ctx->state; x = (parc4ctx->x + 1) & 0xff; sx = state[x]; @@ -75,6 +77,7 @@ static u32 arcfour_byte(struct arc4context *parc4ctx) static void arcfour_encrypt(struct arc4context *parc4ctx, u8 *dest, u8 *src, u32 len) { u32 i; + for (i = 0; i < len; i++) dest[i] = src[i] ^ (unsigned char)arcfour_byte(parc4ctx); } @@ -120,6 +123,7 @@ static __le32 getcrc32(u8 *buf, int len) { u8 *p; u32 crc; + if (bcrc32initialized == 0) crc32_init(); @@ -204,7 +208,7 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe) struct security_priv *psecuritypriv = &padapter->securitypriv; - pframe = (unsigned char *)((struct recv_frame *)precvframe)->rx_data; + pframe = (unsigned char *)((struct recv_frame *)precvframe)->pkt->data; /* start to decrypt recvframe */ if ((prxattrib->encrypt == _WEP40_) || (prxattrib->encrypt == _WEP104_)) { @@ -213,7 +217,7 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe) keylength = psecuritypriv->dot11DefKeylen[keyindex]; memcpy(&wepkey[0], iv, 3); memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[keyindex].skey[0], keylength); - length = ((struct recv_frame *)precvframe)->len-prxattrib->hdrlen-prxattrib->iv_len; + length = ((struct recv_frame *)precvframe)->pkt->len-prxattrib->hdrlen-prxattrib->iv_len; payload = pframe+prxattrib->iv_len+prxattrib->hdrlen; @@ -242,6 +246,7 @@ static u32 secmicgetuint32(u8 *p) { s32 i; u32 res = 0; + for (i = 0; i < 4; i++) res |= ((u32)(*p++)) << (8*i); return res; @@ -251,6 +256,7 @@ static void secmicputuint32(u8 *p, u32 val) /* Convert from Us3232 to Byte[] in a portable way */ { long i; + for (i = 0; i < 4; i++) { *p++ = (u8)(val & 0xff); val >>= 8; @@ -328,6 +334,7 @@ void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 data_len, u8 *mic_cod { struct mic_data micdata; u8 priority[4] = {0x0, 0x0, 0x0, 0x0}; + rtw_secmicsetkey(&micdata, key); priority[0] = pri; @@ -378,73 +385,73 @@ void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 data_len, u8 *mic_cod /* 2-unsigned char by 2-unsigned char subset of the full AES S-box table */ static const unsigned short Sbox1[2][256] = { /* Sbox for hash (can be in ROM) */ { - 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, - 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, - 0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B, - 0x41EC, 0xB367, 0x5FFD, 0x45EA, 0x23BF, 0x53F7, 0xE496, 0x9B5B, - 0x75C2, 0xE11C, 0x3DAE, 0x4C6A, 0x6C5A, 0x7E41, 0xF502, 0x834F, - 0x685C, 0x51F4, 0xD134, 0xF908, 0xE293, 0xAB73, 0x6253, 0x2A3F, - 0x080C, 0x9552, 0x4665, 0x9D5E, 0x3028, 0x37A1, 0x0A0F, 0x2FB5, - 0x0E09, 0x2436, 0x1B9B, 0xDF3D, 0xCD26, 0x4E69, 0x7FCD, 0xEA9F, - 0x121B, 0x1D9E, 0x5874, 0x342E, 0x362D, 0xDCB2, 0xB4EE, 0x5BFB, - 0xA4F6, 0x764D, 0xB761, 0x7DCE, 0x527B, 0xDD3E, 0x5E71, 0x1397, - 0xA6F5, 0xB968, 0x0000, 0xC12C, 0x4060, 0xE31F, 0x79C8, 0xB6ED, - 0xD4BE, 0x8D46, 0x67D9, 0x724B, 0x94DE, 0x98D4, 0xB0E8, 0x854A, - 0xBB6B, 0xC52A, 0x4FE5, 0xED16, 0x86C5, 0x9AD7, 0x6655, 0x1194, - 0x8ACF, 0xE910, 0x0406, 0xFE81, 0xA0F0, 0x7844, 0x25BA, 0x4BE3, - 0xA2F3, 0x5DFE, 0x80C0, 0x058A, 0x3FAD, 0x21BC, 0x7048, 0xF104, - 0x63DF, 0x77C1, 0xAF75, 0x4263, 0x2030, 0xE51A, 0xFD0E, 0xBF6D, - 0x814C, 0x1814, 0x2635, 0xC32F, 0xBEE1, 0x35A2, 0x88CC, 0x2E39, - 0x9357, 0x55F2, 0xFC82, 0x7A47, 0xC8AC, 0xBAE7, 0x322B, 0xE695, - 0xC0A0, 0x1998, 0x9ED1, 0xA37F, 0x4466, 0x547E, 0x3BAB, 0x0B83, - 0x8CCA, 0xC729, 0x6BD3, 0x283C, 0xA779, 0xBCE2, 0x161D, 0xAD76, - 0xDB3B, 0x6456, 0x744E, 0x141E, 0x92DB, 0x0C0A, 0x486C, 0xB8E4, - 0x9F5D, 0xBD6E, 0x43EF, 0xC4A6, 0x39A8, 0x31A4, 0xD337, 0xF28B, - 0xD532, 0x8B43, 0x6E59, 0xDAB7, 0x018C, 0xB164, 0x9CD2, 0x49E0, - 0xD8B4, 0xACFA, 0xF307, 0xCF25, 0xCAAF, 0xF48E, 0x47E9, 0x1018, - 0x6FD5, 0xF088, 0x4A6F, 0x5C72, 0x3824, 0x57F1, 0x73C7, 0x9751, - 0xCB23, 0xA17C, 0xE89C, 0x3E21, 0x96DD, 0x61DC, 0x0D86, 0x0F85, - 0xE090, 0x7C42, 0x71C4, 0xCCAA, 0x90D8, 0x0605, 0xF701, 0x1C12, - 0xC2A3, 0x6A5F, 0xAEF9, 0x69D0, 0x1791, 0x9958, 0x3A27, 0x27B9, - 0xD938, 0xEB13, 0x2BB3, 0x2233, 0xD2BB, 0xA970, 0x0789, 0x33A7, - 0x2DB6, 0x3C22, 0x1592, 0xC920, 0x8749, 0xAAFF, 0x5078, 0xA57A, - 0x038F, 0x59F8, 0x0980, 0x1A17, 0x65DA, 0xD731, 0x84C6, 0xD0B8, - 0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A, + 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, + 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, + 0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B, + 0x41EC, 0xB367, 0x5FFD, 0x45EA, 0x23BF, 0x53F7, 0xE496, 0x9B5B, + 0x75C2, 0xE11C, 0x3DAE, 0x4C6A, 0x6C5A, 0x7E41, 0xF502, 0x834F, + 0x685C, 0x51F4, 0xD134, 0xF908, 0xE293, 0xAB73, 0x6253, 0x2A3F, + 0x080C, 0x9552, 0x4665, 0x9D5E, 0x3028, 0x37A1, 0x0A0F, 0x2FB5, + 0x0E09, 0x2436, 0x1B9B, 0xDF3D, 0xCD26, 0x4E69, 0x7FCD, 0xEA9F, + 0x121B, 0x1D9E, 0x5874, 0x342E, 0x362D, 0xDCB2, 0xB4EE, 0x5BFB, + 0xA4F6, 0x764D, 0xB761, 0x7DCE, 0x527B, 0xDD3E, 0x5E71, 0x1397, + 0xA6F5, 0xB968, 0x0000, 0xC12C, 0x4060, 0xE31F, 0x79C8, 0xB6ED, + 0xD4BE, 0x8D46, 0x67D9, 0x724B, 0x94DE, 0x98D4, 0xB0E8, 0x854A, + 0xBB6B, 0xC52A, 0x4FE5, 0xED16, 0x86C5, 0x9AD7, 0x6655, 0x1194, + 0x8ACF, 0xE910, 0x0406, 0xFE81, 0xA0F0, 0x7844, 0x25BA, 0x4BE3, + 0xA2F3, 0x5DFE, 0x80C0, 0x058A, 0x3FAD, 0x21BC, 0x7048, 0xF104, + 0x63DF, 0x77C1, 0xAF75, 0x4263, 0x2030, 0xE51A, 0xFD0E, 0xBF6D, + 0x814C, 0x1814, 0x2635, 0xC32F, 0xBEE1, 0x35A2, 0x88CC, 0x2E39, + 0x9357, 0x55F2, 0xFC82, 0x7A47, 0xC8AC, 0xBAE7, 0x322B, 0xE695, + 0xC0A0, 0x1998, 0x9ED1, 0xA37F, 0x4466, 0x547E, 0x3BAB, 0x0B83, + 0x8CCA, 0xC729, 0x6BD3, 0x283C, 0xA779, 0xBCE2, 0x161D, 0xAD76, + 0xDB3B, 0x6456, 0x744E, 0x141E, 0x92DB, 0x0C0A, 0x486C, 0xB8E4, + 0x9F5D, 0xBD6E, 0x43EF, 0xC4A6, 0x39A8, 0x31A4, 0xD337, 0xF28B, + 0xD532, 0x8B43, 0x6E59, 0xDAB7, 0x018C, 0xB164, 0x9CD2, 0x49E0, + 0xD8B4, 0xACFA, 0xF307, 0xCF25, 0xCAAF, 0xF48E, 0x47E9, 0x1018, + 0x6FD5, 0xF088, 0x4A6F, 0x5C72, 0x3824, 0x57F1, 0x73C7, 0x9751, + 0xCB23, 0xA17C, 0xE89C, 0x3E21, 0x96DD, 0x61DC, 0x0D86, 0x0F85, + 0xE090, 0x7C42, 0x71C4, 0xCCAA, 0x90D8, 0x0605, 0xF701, 0x1C12, + 0xC2A3, 0x6A5F, 0xAEF9, 0x69D0, 0x1791, 0x9958, 0x3A27, 0x27B9, + 0xD938, 0xEB13, 0x2BB3, 0x2233, 0xD2BB, 0xA970, 0x0789, 0x33A7, + 0x2DB6, 0x3C22, 0x1592, 0xC920, 0x8749, 0xAAFF, 0x5078, 0xA57A, + 0x038F, 0x59F8, 0x0980, 0x1A17, 0x65DA, 0xD731, 0x84C6, 0xD0B8, + 0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A, }, { /* second half of table is unsigned char-reversed version of first! */ - 0xA5C6, 0x84F8, 0x99EE, 0x8DF6, 0x0DFF, 0xBDD6, 0xB1DE, 0x5491, - 0x5060, 0x0302, 0xA9CE, 0x7D56, 0x19E7, 0x62B5, 0xE64D, 0x9AEC, - 0x458F, 0x9D1F, 0x4089, 0x87FA, 0x15EF, 0xEBB2, 0xC98E, 0x0BFB, - 0xEC41, 0x67B3, 0xFD5F, 0xEA45, 0xBF23, 0xF753, 0x96E4, 0x5B9B, - 0xC275, 0x1CE1, 0xAE3D, 0x6A4C, 0x5A6C, 0x417E, 0x02F5, 0x4F83, - 0x5C68, 0xF451, 0x34D1, 0x08F9, 0x93E2, 0x73AB, 0x5362, 0x3F2A, - 0x0C08, 0x5295, 0x6546, 0x5E9D, 0x2830, 0xA137, 0x0F0A, 0xB52F, - 0x090E, 0x3624, 0x9B1B, 0x3DDF, 0x26CD, 0x694E, 0xCD7F, 0x9FEA, - 0x1B12, 0x9E1D, 0x7458, 0x2E34, 0x2D36, 0xB2DC, 0xEEB4, 0xFB5B, - 0xF6A4, 0x4D76, 0x61B7, 0xCE7D, 0x7B52, 0x3EDD, 0x715E, 0x9713, - 0xF5A6, 0x68B9, 0x0000, 0x2CC1, 0x6040, 0x1FE3, 0xC879, 0xEDB6, - 0xBED4, 0x468D, 0xD967, 0x4B72, 0xDE94, 0xD498, 0xE8B0, 0x4A85, - 0x6BBB, 0x2AC5, 0xE54F, 0x16ED, 0xC586, 0xD79A, 0x5566, 0x9411, - 0xCF8A, 0x10E9, 0x0604, 0x81FE, 0xF0A0, 0x4478, 0xBA25, 0xE34B, - 0xF3A2, 0xFE5D, 0xC080, 0x8A05, 0xAD3F, 0xBC21, 0x4870, 0x04F1, - 0xDF63, 0xC177, 0x75AF, 0x6342, 0x3020, 0x1AE5, 0x0EFD, 0x6DBF, - 0x4C81, 0x1418, 0x3526, 0x2FC3, 0xE1BE, 0xA235, 0xCC88, 0x392E, - 0x5793, 0xF255, 0x82FC, 0x477A, 0xACC8, 0xE7BA, 0x2B32, 0x95E6, - 0xA0C0, 0x9819, 0xD19E, 0x7FA3, 0x6644, 0x7E54, 0xAB3B, 0x830B, - 0xCA8C, 0x29C7, 0xD36B, 0x3C28, 0x79A7, 0xE2BC, 0x1D16, 0x76AD, - 0x3BDB, 0x5664, 0x4E74, 0x1E14, 0xDB92, 0x0A0C, 0x6C48, 0xE4B8, - 0x5D9F, 0x6EBD, 0xEF43, 0xA6C4, 0xA839, 0xA431, 0x37D3, 0x8BF2, - 0x32D5, 0x438B, 0x596E, 0xB7DA, 0x8C01, 0x64B1, 0xD29C, 0xE049, - 0xB4D8, 0xFAAC, 0x07F3, 0x25CF, 0xAFCA, 0x8EF4, 0xE947, 0x1810, - 0xD56F, 0x88F0, 0x6F4A, 0x725C, 0x2438, 0xF157, 0xC773, 0x5197, - 0x23CB, 0x7CA1, 0x9CE8, 0x213E, 0xDD96, 0xDC61, 0x860D, 0x850F, - 0x90E0, 0x427C, 0xC471, 0xAACC, 0xD890, 0x0506, 0x01F7, 0x121C, - 0xA3C2, 0x5F6A, 0xF9AE, 0xD069, 0x9117, 0x5899, 0x273A, 0xB927, - 0x38D9, 0x13EB, 0xB32B, 0x3322, 0xBBD2, 0x70A9, 0x8907, 0xA733, - 0xB62D, 0x223C, 0x9215, 0x20C9, 0x4987, 0xFFAA, 0x7850, 0x7AA5, - 0x8F03, 0xF859, 0x8009, 0x171A, 0xDA65, 0x31D7, 0xC684, 0xB8D0, - 0xC382, 0xB029, 0x775A, 0x111E, 0xCB7B, 0xFCA8, 0xD66D, 0x3A2C, + 0xA5C6, 0x84F8, 0x99EE, 0x8DF6, 0x0DFF, 0xBDD6, 0xB1DE, 0x5491, + 0x5060, 0x0302, 0xA9CE, 0x7D56, 0x19E7, 0x62B5, 0xE64D, 0x9AEC, + 0x458F, 0x9D1F, 0x4089, 0x87FA, 0x15EF, 0xEBB2, 0xC98E, 0x0BFB, + 0xEC41, 0x67B3, 0xFD5F, 0xEA45, 0xBF23, 0xF753, 0x96E4, 0x5B9B, + 0xC275, 0x1CE1, 0xAE3D, 0x6A4C, 0x5A6C, 0x417E, 0x02F5, 0x4F83, + 0x5C68, 0xF451, 0x34D1, 0x08F9, 0x93E2, 0x73AB, 0x5362, 0x3F2A, + 0x0C08, 0x5295, 0x6546, 0x5E9D, 0x2830, 0xA137, 0x0F0A, 0xB52F, + 0x090E, 0x3624, 0x9B1B, 0x3DDF, 0x26CD, 0x694E, 0xCD7F, 0x9FEA, + 0x1B12, 0x9E1D, 0x7458, 0x2E34, 0x2D36, 0xB2DC, 0xEEB4, 0xFB5B, + 0xF6A4, 0x4D76, 0x61B7, 0xCE7D, 0x7B52, 0x3EDD, 0x715E, 0x9713, + 0xF5A6, 0x68B9, 0x0000, 0x2CC1, 0x6040, 0x1FE3, 0xC879, 0xEDB6, + 0xBED4, 0x468D, 0xD967, 0x4B72, 0xDE94, 0xD498, 0xE8B0, 0x4A85, + 0x6BBB, 0x2AC5, 0xE54F, 0x16ED, 0xC586, 0xD79A, 0x5566, 0x9411, + 0xCF8A, 0x10E9, 0x0604, 0x81FE, 0xF0A0, 0x4478, 0xBA25, 0xE34B, + 0xF3A2, 0xFE5D, 0xC080, 0x8A05, 0xAD3F, 0xBC21, 0x4870, 0x04F1, + 0xDF63, 0xC177, 0x75AF, 0x6342, 0x3020, 0x1AE5, 0x0EFD, 0x6DBF, + 0x4C81, 0x1418, 0x3526, 0x2FC3, 0xE1BE, 0xA235, 0xCC88, 0x392E, + 0x5793, 0xF255, 0x82FC, 0x477A, 0xACC8, 0xE7BA, 0x2B32, 0x95E6, + 0xA0C0, 0x9819, 0xD19E, 0x7FA3, 0x6644, 0x7E54, 0xAB3B, 0x830B, + 0xCA8C, 0x29C7, 0xD36B, 0x3C28, 0x79A7, 0xE2BC, 0x1D16, 0x76AD, + 0x3BDB, 0x5664, 0x4E74, 0x1E14, 0xDB92, 0x0A0C, 0x6C48, 0xE4B8, + 0x5D9F, 0x6EBD, 0xEF43, 0xA6C4, 0xA839, 0xA431, 0x37D3, 0x8BF2, + 0x32D5, 0x438B, 0x596E, 0xB7DA, 0x8C01, 0x64B1, 0xD29C, 0xE049, + 0xB4D8, 0xFAAC, 0x07F3, 0x25CF, 0xAFCA, 0x8EF4, 0xE947, 0x1810, + 0xD56F, 0x88F0, 0x6F4A, 0x725C, 0x2438, 0xF157, 0xC773, 0x5197, + 0x23CB, 0x7CA1, 0x9CE8, 0x213E, 0xDD96, 0xDC61, 0x860D, 0x850F, + 0x90E0, 0x427C, 0xC471, 0xAACC, 0xD890, 0x0506, 0x01F7, 0x121C, + 0xA3C2, 0x5F6A, 0xF9AE, 0xD069, 0x9117, 0x5899, 0x273A, 0xB927, + 0x38D9, 0x13EB, 0xB32B, 0x3322, 0xBBD2, 0x70A9, 0x8907, 0xA733, + 0xB62D, 0x223C, 0x9215, 0x20C9, 0x4987, 0xFFAA, 0x7850, 0x7AA5, + 0x8F03, 0xF859, 0x8009, 0x171A, 0xDA65, 0x31D7, 0xC684, 0xB8D0, + 0xC382, 0xB029, 0x775A, 0x111E, 0xCB7B, 0xFCA8, 0xD66D, 0x3A2C, } }; @@ -652,7 +659,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe) u32 res = _SUCCESS; - pframe = (unsigned char *)((struct recv_frame *)precvframe)->rx_data; + pframe = (unsigned char *)((struct recv_frame *)precvframe)->pkt->data; /* 4 start to decrypt recvframe */ if (prxattrib->encrypt == _TKIP_) { @@ -672,7 +679,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe) iv = pframe+prxattrib->hdrlen; payload = pframe+prxattrib->iv_len+prxattrib->hdrlen; - length = ((struct recv_frame *)precvframe)->len-prxattrib->hdrlen-prxattrib->iv_len; + length = ((struct recv_frame *)precvframe)->pkt->len-prxattrib->hdrlen-prxattrib->iv_len; GET_TKIP_PN(iv, dot11txpn); @@ -776,6 +783,7 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext); static void xor_128(u8 *a, u8 *b, u8 *out) { int i; + for (i = 0; i < 16; i++) out[i] = a[i] ^ b[i]; } @@ -783,6 +791,7 @@ static void xor_128(u8 *a, u8 *b, u8 *out) static void xor_32(u8 *a, u8 *b, u8 *out) { int i; + for (i = 0; i < 4; i++) out[i] = a[i] ^ b[i]; } @@ -800,6 +809,7 @@ static void next_key(u8 *key, int round) 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x36, 0x36 }; + sbox_key[0] = sbox(key[13]); sbox_key[1] = sbox(key[14]); sbox_key[2] = sbox(key[15]); @@ -853,6 +863,7 @@ static void mix_column(u8 *in, u8 *out) u8 rotr[4]; u8 temp[4]; u8 tempb[4]; + for (i = 0 ; i < 4; i++) { if ((in[i] & 0x80) == 0x80) add1b[i] = 0x1b; @@ -905,6 +916,7 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext) u8 intermediatea[16]; u8 intermediateb[16]; u8 round_key[16]; + for (i = 0; i < 16; i++) round_key[i] = key[i]; for (round = 0; round < 11; round++) { @@ -936,6 +948,7 @@ static void construct_mic_iv(u8 *mic_iv, int qc_exists, int a4_exists, u8 *mpdu, uint payload_length, u8 *pn_vector) { int i; + mic_iv[0] = 0x59; if (qc_exists && a4_exists) mic_iv[1] = mpdu[30] & 0x0f; /* QoS_TC */ @@ -984,6 +997,7 @@ static void construct_mic_header1(u8 *mic_header1, int header_length, u8 *mpdu) static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, int qc_exists) { int i; + for (i = 0; i < 16; i++) mic_header2[i] = 0x00; @@ -1025,6 +1039,7 @@ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, int static void construct_ctr_preload(u8 *ctr_preload, int a4_exists, int qc_exists, u8 *mpdu, u8 *pn_vector, int c) { int i; + for (i = 0; i < 16; i++) ctr_preload[i] = 0x00; i = 0; @@ -1050,6 +1065,7 @@ static void construct_ctr_preload(u8 *ctr_preload, int a4_exists, int qc_exists, static void bitwise_xor(u8 *ina, u8 *inb, u8 *out) { int i; + for (i = 0; i < 16; i++) out[i] = ina[i] ^ inb[i]; } @@ -1256,6 +1272,7 @@ static int aes_decipher(u8 *key, uint hdrlen, uint qc_exists, a4_exists, i, j, payload_remainder, num_blocks, payload_index; int res = _SUCCESS; + u8 pn_vector[6]; u8 mic_iv[16]; u8 mic_header1[16]; @@ -1452,7 +1469,8 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe) struct rx_pkt_attrib *prxattrib = &((struct recv_frame *)precvframe)->attrib; struct security_priv *psecuritypriv = &padapter->securitypriv; u32 res = _SUCCESS; - pframe = (unsigned char *)((struct recv_frame *)precvframe)->rx_data; + + pframe = (unsigned char *)((struct recv_frame *)precvframe)->pkt->data; /* 4 start to encrypt each fragment */ if (prxattrib->encrypt == _AES_) { stainfo = rtw_get_stainfo(&padapter->stapriv, &prxattrib->ta[0]); @@ -1476,7 +1494,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe) } else { prwskey = &stainfo->dot118021x_UncstKey.skey[0]; } - length = ((struct recv_frame *)precvframe)->len-prxattrib->hdrlen-prxattrib->iv_len; + length = ((struct recv_frame *)precvframe)->pkt->len-prxattrib->hdrlen-prxattrib->iv_len; res = aes_decipher(prwskey, prxattrib->hdrlen, pframe, length); } else { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_aes_encrypt: stainfo==NULL!!!\n")); diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c index 941d1a069d20..2ecfb117bf3f 100644 --- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c @@ -154,6 +154,7 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) while (phead != plist) { int i; + psta = container_of(plist, struct sta_info, hash_list); plist = plist->next; diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index 2a65ac702129..f6f1b09466a8 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c @@ -379,6 +379,7 @@ int get_bsstype(unsigned short capability) u16 get_beacon_interval(struct wlan_bssid_ex *bss) { __le16 val; + memcpy((unsigned char *)&val, rtw_get_beacon_interval_from_ie(bss->IEs), 2); return le16_to_cpu(val); @@ -1306,6 +1307,7 @@ void set_sta_rate(struct adapter *padapter, struct sta_info *psta) void update_tx_basic_rate(struct adapter *padapter, u8 wirelessmode) { unsigned char supported_rates[NDIS_802_11_LENGTH_RATES_EX]; + memset(supported_rates, 0, NDIS_802_11_LENGTH_RATES_EX); if ((wirelessmode & WIRELESS_11B) && (wirelessmode == WIRELESS_11B)) @@ -1330,6 +1332,7 @@ unsigned char check_assoc_AP(u8 *pframe, uint len) struct ndis_802_11_var_ie *pIE; u8 epigram_vendor_flag; u8 ralink_vendor_flag; + epigram_vendor_flag = 0; ralink_vendor_flag = 0; diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c index b60b126b860e..630fdc33d58a 100644 --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c @@ -246,8 +246,7 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv) pxmitbuf++; } - if (pxmitpriv->pallocated_xmit_extbuf) - vfree(pxmitpriv->pallocated_xmit_extbuf); + vfree(pxmitpriv->pallocated_xmit_extbuf); rtw_free_hwxmits(padapter); @@ -304,6 +303,7 @@ static void update_attrib_vcs_info(struct adapter *padapter, struct xmit_frame * /* check HT op mode */ if (pattrib->ht_en) { u8 htopmode = pmlmeinfo->HT_protection; + if ((pmlmeext->cur_bwmode && (htopmode == 2 || htopmode == 3)) || (!pmlmeext->cur_bwmode && htopmode == 3)) { pattrib->vcs_mode = RTS_CTS; @@ -454,6 +454,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p /* The following is for DHCP and ARP packet, we use cck1M to tx these packets and let LPS awake some time */ /* to prevent DHCP protocol fail */ u8 tmp[24]; + _rtw_pktfile_read(&pktfile, &tmp[0], 24); pattrib->dhcp_pkt = 0; if (pktfile.pkt_len > 282) {/* MINIMUM_DHCP_PACKET_SIZE) { */ @@ -530,7 +531,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p pattrib->encrypt = 0; - if ((pattrib->ether_type != ETH_P_PAE) && !check_fwstate(pmlmepriv, WIFI_MP_STATE)) { + if (pattrib->ether_type != ETH_P_PAE) { RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("\npsta->ieee8021x_blocked == true, pattrib->ether_type(%.4x) != ETH_P_PAE\n", pattrib->ether_type)); res = _FAIL; goto exit; @@ -1605,6 +1606,7 @@ void rtw_free_hwxmits(struct adapter *padapter) void rtw_init_hwxmits(struct hw_xmit *phwxmit, int entry) { int i; + for (i = 0; i < entry; i++, phwxmit++) phwxmit->accnt = 0; } |