mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2025-05-22 20:43:04 +00:00
rtl8188eu: Put the current kernel files into a new branch named kernel_code
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
18c80911a2
commit
adfd7de95d
113 changed files with 8126 additions and 34255 deletions
258
core/rtw_ap.c
258
core/rtw_ap.c
|
@ -33,7 +33,7 @@ void init_mlme_ap_info(struct adapter *padapter)
|
|||
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
|
||||
|
||||
|
||||
_rtw_spinlock_init(&pmlmepriv->bcn_update_lock);
|
||||
spin_lock_init(&pmlmepriv->bcn_update_lock);
|
||||
|
||||
/* for ACL */
|
||||
_rtw_init_queue(&pacl_list->acl_node_q);
|
||||
|
@ -43,7 +43,6 @@ void init_mlme_ap_info(struct adapter *padapter)
|
|||
|
||||
void free_mlme_ap_info(struct adapter *padapter)
|
||||
{
|
||||
unsigned long irqL;
|
||||
struct sta_info *psta = NULL;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
|
@ -62,11 +61,9 @@ void free_mlme_ap_info(struct adapter *padapter)
|
|||
|
||||
/* free bc/mc sta_info */
|
||||
psta = rtw_get_bcmc_stainfo(padapter);
|
||||
_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
|
||||
spin_lock_bh(&(pstapriv->sta_hash_lock));
|
||||
rtw_free_stainfo(padapter, psta);
|
||||
_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
|
||||
|
||||
_rtw_spinlock_free(&pmlmepriv->bcn_update_lock);
|
||||
spin_unlock_bh(&(pstapriv->sta_hash_lock));
|
||||
}
|
||||
|
||||
static void update_BCNTIM(struct adapter *padapter)
|
||||
|
@ -97,7 +94,7 @@ static void update_BCNTIM(struct adapter *padapter)
|
|||
} else {
|
||||
tim_ielen = 0;
|
||||
|
||||
/* calucate head_len */
|
||||
/* calculate head_len */
|
||||
offset = _FIXED_IE_LENGTH_;
|
||||
offset += pnetwork_mlmeext->Ssid.SsidLength + 2;
|
||||
|
||||
|
@ -132,7 +129,7 @@ static void update_BCNTIM(struct adapter *padapter)
|
|||
*dst_ie++ = tim_ielen;
|
||||
|
||||
*dst_ie++ = 0;/* DTIM count */
|
||||
*dst_ie++ = 1;/* DTIM peroid */
|
||||
*dst_ie++ = 1;/* DTIM period */
|
||||
|
||||
if (pstapriv->tim_bitmap&BIT(0))/* for bc/mc frames */
|
||||
*dst_ie++ = BIT(0);/* bitmap ctrl */
|
||||
|
@ -277,7 +274,6 @@ static u8 chk_sta_is_alive(struct sta_info *psta)
|
|||
|
||||
void expire_timeout_chk(struct adapter *padapter)
|
||||
{
|
||||
unsigned long irqL;
|
||||
struct list_head *phead, *plist;
|
||||
u8 updated = 0;
|
||||
struct sta_info *psta = NULL;
|
||||
|
@ -286,49 +282,49 @@ void expire_timeout_chk(struct adapter *padapter)
|
|||
char chk_alive_list[NUM_STA];
|
||||
int i;
|
||||
|
||||
_enter_critical_bh(&pstapriv->auth_list_lock, &irqL);
|
||||
spin_lock_bh(&pstapriv->auth_list_lock);
|
||||
|
||||
phead = &pstapriv->auth_list;
|
||||
plist = get_next(phead);
|
||||
plist = phead->next;
|
||||
|
||||
/* check auth_queue */
|
||||
while ((rtw_end_of_queue_search(phead, plist)) == false) {
|
||||
psta = LIST_CONTAINOR(plist, struct sta_info, auth_list);
|
||||
plist = get_next(plist);
|
||||
while (phead != plist) {
|
||||
psta = container_of(plist, struct sta_info, auth_list);
|
||||
plist = plist->next;
|
||||
|
||||
if (psta->expire_to > 0) {
|
||||
psta->expire_to--;
|
||||
if (psta->expire_to == 0) {
|
||||
rtw_list_delete(&psta->auth_list);
|
||||
list_del_init(&psta->auth_list);
|
||||
pstapriv->auth_list_cnt--;
|
||||
|
||||
DBG_88E("auth expire %6ph\n",
|
||||
psta->hwaddr);
|
||||
|
||||
_exit_critical_bh(&pstapriv->auth_list_lock, &irqL);
|
||||
spin_unlock_bh(&pstapriv->auth_list_lock);
|
||||
|
||||
_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
|
||||
spin_lock_bh(&(pstapriv->sta_hash_lock));
|
||||
rtw_free_stainfo(padapter, psta);
|
||||
_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
|
||||
spin_unlock_bh(&(pstapriv->sta_hash_lock));
|
||||
|
||||
_enter_critical_bh(&pstapriv->auth_list_lock, &irqL);
|
||||
spin_lock_bh(&pstapriv->auth_list_lock);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
_exit_critical_bh(&pstapriv->auth_list_lock, &irqL);
|
||||
spin_unlock_bh(&pstapriv->auth_list_lock);
|
||||
|
||||
psta = NULL;
|
||||
|
||||
_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
|
||||
spin_lock_bh(&pstapriv->asoc_list_lock);
|
||||
|
||||
phead = &pstapriv->asoc_list;
|
||||
plist = get_next(phead);
|
||||
plist = phead->next;
|
||||
|
||||
/* check asoc_queue */
|
||||
while ((rtw_end_of_queue_search(phead, plist)) == false) {
|
||||
psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
|
||||
plist = get_next(plist);
|
||||
while (phead != plist) {
|
||||
psta = container_of(plist, struct sta_info, asoc_list);
|
||||
plist = plist->next;
|
||||
|
||||
if (chk_sta_is_alive(psta) || !psta->expire_to) {
|
||||
psta->expire_to = pstapriv->expire_to;
|
||||
|
@ -369,7 +365,7 @@ void expire_timeout_chk(struct adapter *padapter)
|
|||
continue;
|
||||
}
|
||||
|
||||
rtw_list_delete(&psta->asoc_list);
|
||||
list_del_init(&psta->asoc_list);
|
||||
pstapriv->asoc_list_cnt--;
|
||||
|
||||
DBG_88E("asoc expire %pM, state = 0x%x\n", (psta->hwaddr), psta->state);
|
||||
|
@ -387,7 +383,7 @@ void expire_timeout_chk(struct adapter *padapter)
|
|||
}
|
||||
}
|
||||
|
||||
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
|
||||
spin_unlock_bh(&pstapriv->asoc_list_lock);
|
||||
|
||||
if (chk_alive_num) {
|
||||
u8 backup_oper_channel = 0;
|
||||
|
@ -424,11 +420,11 @@ void expire_timeout_chk(struct adapter *padapter)
|
|||
psta->keep_alive_trycnt = 0;
|
||||
|
||||
DBG_88E("asoc expire %pM, state = 0x%x\n", (psta->hwaddr), psta->state);
|
||||
_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
|
||||
rtw_list_delete(&psta->asoc_list);
|
||||
spin_lock_bh(&pstapriv->asoc_list_lock);
|
||||
list_del_init(&psta->asoc_list);
|
||||
pstapriv->asoc_list_cnt--;
|
||||
updated = ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING);
|
||||
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
|
||||
spin_unlock_bh(&pstapriv->asoc_list_lock);
|
||||
}
|
||||
|
||||
if (backup_oper_channel > 0) /* back to the original operation channel */
|
||||
|
@ -535,7 +531,6 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
|
|||
|
||||
static void update_bmc_sta(struct adapter *padapter)
|
||||
{
|
||||
unsigned long irqL;
|
||||
u32 init_rate = 0;
|
||||
unsigned char network_type, raid;
|
||||
int i, supportRateNum = 0;
|
||||
|
@ -553,7 +548,7 @@ static void update_bmc_sta(struct adapter *padapter)
|
|||
|
||||
psta->ieee8021x_blocked = 0;
|
||||
|
||||
_rtw_memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
|
||||
memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
|
||||
|
||||
/* prepare for add_RATid */
|
||||
supportRateNum = rtw_get_rateset_len((u8 *)&pcur_network->SupportedRates);
|
||||
|
@ -604,9 +599,9 @@ static void update_bmc_sta(struct adapter *padapter)
|
|||
|
||||
rtw_stassoc_hw_rpt(padapter, psta);
|
||||
|
||||
_enter_critical_bh(&psta->lock, &irqL);
|
||||
spin_lock_bh(&psta->lock);
|
||||
psta->state = _FW_LINKED;
|
||||
_exit_critical_bh(&psta->lock, &irqL);
|
||||
spin_unlock_bh(&psta->lock);
|
||||
|
||||
} else {
|
||||
DBG_88E("add_RATid_bmc_sta error!\n");
|
||||
|
@ -622,7 +617,6 @@ static void update_bmc_sta(struct adapter *padapter)
|
|||
|
||||
void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta)
|
||||
{
|
||||
unsigned long irqL;
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
|
||||
|
@ -677,11 +671,11 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta)
|
|||
|
||||
/* todo: init other variables */
|
||||
|
||||
_rtw_memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
|
||||
memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
|
||||
|
||||
_enter_critical_bh(&psta->lock, &irqL);
|
||||
spin_lock_bh(&psta->lock);
|
||||
psta->state |= _FW_LINKED;
|
||||
_exit_critical_bh(&psta->lock, &irqL);
|
||||
spin_unlock_bh(&psta->lock);
|
||||
}
|
||||
|
||||
static void update_hw_ht_param(struct adapter *padapter)
|
||||
|
@ -729,9 +723,6 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf)
|
|||
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
||||
struct wlan_bssid_ex *pnetwork_mlmeext = &(pmlmeinfo->network);
|
||||
struct HT_info_element *pht_info = NULL;
|
||||
#ifdef CONFIG_88EU_P2P
|
||||
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
|
||||
#endif /* CONFIG_88EU_P2P */
|
||||
|
||||
bcn_interval = (u16)pnetwork->Configuration.BeaconPeriod;
|
||||
cur_channel = pnetwork->Configuration.DSConfig;
|
||||
|
@ -827,17 +818,12 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf)
|
|||
/* update cur_wireless_mode */
|
||||
update_wireless_mode(padapter);
|
||||
|
||||
/* udpate capability after cur_wireless_mode updated */
|
||||
/* update capability after cur_wireless_mode updated */
|
||||
update_capinfo(padapter, rtw_get_capability((struct wlan_bssid_ex *)pnetwork));
|
||||
|
||||
/* let pnetwork_mlmeext == pnetwork_mlme. */
|
||||
memcpy(pnetwork_mlmeext, pnetwork, pnetwork->Length);
|
||||
|
||||
#ifdef CONFIG_88EU_P2P
|
||||
memcpy(pwdinfo->p2p_group_ssid, pnetwork->Ssid.Ssid, pnetwork->Ssid.SsidLength);
|
||||
pwdinfo->p2p_group_ssid_len = pnetwork->Ssid.SsidLength;
|
||||
#endif /* CONFIG_88EU_P2P */
|
||||
|
||||
if (pmlmeext->bstart_bss) {
|
||||
update_beacon(padapter, _TIM_IE_, NULL, false);
|
||||
|
||||
|
@ -892,7 +878,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
|
|||
|
||||
pbss_network->IELength = len;
|
||||
|
||||
_rtw_memset(ie, 0, MAX_IE_SZ);
|
||||
memset(ie, 0, MAX_IE_SZ);
|
||||
|
||||
memcpy(ie, pbuf, pbss_network->IELength);
|
||||
|
||||
|
@ -902,19 +888,19 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
|
|||
|
||||
pbss_network->Rssi = 0;
|
||||
|
||||
memcpy(pbss_network->MacAddress, myid(&(padapter->eeprompriv)), ETH_ALEN);
|
||||
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 */
|
||||
pbss_network->Configuration.BeaconPeriod = RTW_GET_LE16(p);
|
||||
pbss_network->Configuration.BeaconPeriod = get_unaligned_le16(p);
|
||||
|
||||
/* capability */
|
||||
cap = RTW_GET_LE16(ie);
|
||||
cap = get_unaligned_le16(ie);
|
||||
|
||||
/* SSID */
|
||||
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SSID_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
|
||||
if (p && ie_len > 0) {
|
||||
_rtw_memset(&pbss_network->Ssid, 0, sizeof(struct ndis_802_11_ssid));
|
||||
memset(&pbss_network->Ssid, 0, sizeof(struct ndis_802_11_ssid));
|
||||
memcpy(pbss_network->Ssid.Ssid, (p + 2), ie_len);
|
||||
pbss_network->Ssid.SsidLength = ie_len;
|
||||
}
|
||||
|
@ -928,7 +914,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
|
|||
|
||||
pbss_network->Configuration.DSConfig = channel;
|
||||
|
||||
_rtw_memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX);
|
||||
memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX);
|
||||
/* get supported rates */
|
||||
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
|
||||
if (p != NULL) {
|
||||
|
@ -986,7 +972,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
|
|||
for (p = ie + _BEACON_IE_OFFSET_;; p += (ie_len + 2)) {
|
||||
p = rtw_get_ie(p, _SSN_IE_1_, &ie_len,
|
||||
(pbss_network->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2)));
|
||||
if ((p) && (_rtw_memcmp(p+2, OUI1, 4))) {
|
||||
if ((p) && (!memcmp(p+2, OUI1, 4))) {
|
||||
if (rtw_parse_wpa_ie(p, ie_len+2, &group_cipher,
|
||||
&pairwise_cipher, NULL) == _SUCCESS) {
|
||||
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
|
||||
|
@ -1011,7 +997,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
|
|||
for (p = ie + _BEACON_IE_OFFSET_;; p += (ie_len + 2)) {
|
||||
p = rtw_get_ie(p, _VENDOR_SPECIFIC_IE_, &ie_len,
|
||||
(pbss_network->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2)));
|
||||
if ((p) && _rtw_memcmp(p+2, WMM_PARA_IE, 6)) {
|
||||
if ((p) && !memcmp(p+2, WMM_PARA_IE, 6)) {
|
||||
pmlmepriv->qospriv.qos_option = 1;
|
||||
|
||||
*(p+8) |= BIT(7);/* QoS Info, support U-APSD */
|
||||
|
@ -1134,7 +1120,6 @@ void rtw_set_macaddr_acl(struct adapter *padapter, int mode)
|
|||
|
||||
int rtw_acl_add_sta(struct adapter *padapter, u8 *addr)
|
||||
{
|
||||
unsigned long irqL;
|
||||
struct list_head *plist, *phead;
|
||||
u8 added = false;
|
||||
int i, ret = 0;
|
||||
|
@ -1148,16 +1133,16 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr)
|
|||
if ((NUM_ACL-1) < pacl_list->num)
|
||||
return -1;
|
||||
|
||||
_enter_critical_bh(&(pacl_node_q->lock), &irqL);
|
||||
spin_lock_bh(&(pacl_node_q->lock));
|
||||
|
||||
phead = get_list_head(pacl_node_q);
|
||||
plist = get_next(phead);
|
||||
plist = phead->next;
|
||||
|
||||
while (!rtw_end_of_queue_search(phead, plist)) {
|
||||
paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list);
|
||||
plist = get_next(plist);
|
||||
while (phead != plist) {
|
||||
paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
|
||||
plist = plist->next;
|
||||
|
||||
if (_rtw_memcmp(paclnode->addr, addr, ETH_ALEN)) {
|
||||
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
|
||||
if (paclnode->valid) {
|
||||
added = true;
|
||||
DBG_88E("%s, sta has been added\n", __func__);
|
||||
|
@ -1166,24 +1151,24 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr)
|
|||
}
|
||||
}
|
||||
|
||||
_exit_critical_bh(&(pacl_node_q->lock), &irqL);
|
||||
spin_unlock_bh(&(pacl_node_q->lock));
|
||||
|
||||
if (added)
|
||||
return ret;
|
||||
|
||||
_enter_critical_bh(&(pacl_node_q->lock), &irqL);
|
||||
spin_lock_bh(&(pacl_node_q->lock));
|
||||
|
||||
for (i = 0; i < NUM_ACL; i++) {
|
||||
paclnode = &pacl_list->aclnode[i];
|
||||
|
||||
if (!paclnode->valid) {
|
||||
_rtw_init_listhead(&paclnode->list);
|
||||
INIT_LIST_HEAD(&paclnode->list);
|
||||
|
||||
memcpy(paclnode->addr, addr, ETH_ALEN);
|
||||
ether_addr_copy(paclnode->addr, addr);
|
||||
|
||||
paclnode->valid = true;
|
||||
|
||||
rtw_list_insert_tail(&paclnode->list, get_list_head(pacl_node_q));
|
||||
list_add_tail(&paclnode->list, get_list_head(pacl_node_q));
|
||||
|
||||
pacl_list->num++;
|
||||
|
||||
|
@ -1193,16 +1178,14 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr)
|
|||
|
||||
DBG_88E("%s, acl_num =%d\n", __func__, pacl_list->num);
|
||||
|
||||
_exit_critical_bh(&(pacl_node_q->lock), &irqL);
|
||||
spin_unlock_bh(&(pacl_node_q->lock));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr)
|
||||
{
|
||||
unsigned long irqL;
|
||||
struct list_head *plist, *phead;
|
||||
int ret = 0;
|
||||
struct rtw_wlan_acl_node *paclnode;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
|
||||
|
@ -1210,30 +1193,30 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr)
|
|||
|
||||
DBG_88E("%s(acl_num =%d) =%pM\n", __func__, pacl_list->num, (addr));
|
||||
|
||||
_enter_critical_bh(&(pacl_node_q->lock), &irqL);
|
||||
spin_lock_bh(&(pacl_node_q->lock));
|
||||
|
||||
phead = get_list_head(pacl_node_q);
|
||||
plist = get_next(phead);
|
||||
plist = phead->next;
|
||||
|
||||
while (!rtw_end_of_queue_search(phead, plist)) {
|
||||
paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list);
|
||||
plist = get_next(plist);
|
||||
while (phead != plist) {
|
||||
paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
|
||||
plist = plist->next;
|
||||
|
||||
if (_rtw_memcmp(paclnode->addr, addr, ETH_ALEN)) {
|
||||
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
|
||||
if (paclnode->valid) {
|
||||
paclnode->valid = false;
|
||||
|
||||
rtw_list_delete(&paclnode->list);
|
||||
list_del_init(&paclnode->list);
|
||||
|
||||
pacl_list->num--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_exit_critical_bh(&(pacl_node_q->lock), &irqL);
|
||||
spin_unlock_bh(&(pacl_node_q->lock));
|
||||
|
||||
DBG_88E("%s, acl_num =%d\n", __func__, pacl_list->num);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void update_bcn_fixed_ie(struct adapter *padapter)
|
||||
|
@ -1314,6 +1297,10 @@ static void update_bcn_wps_ie(struct adapter *padapter)
|
|||
|
||||
DBG_88E("%s\n", __func__);
|
||||
|
||||
pwps_ie_src = pmlmepriv->wps_beacon_ie;
|
||||
if (pwps_ie_src == NULL)
|
||||
return;
|
||||
|
||||
pwps_ie = rtw_get_wps_ie(ie+_FIXED_IE_LENGTH_, ielen-_FIXED_IE_LENGTH_, NULL, &wps_ielen);
|
||||
|
||||
if (pwps_ie == NULL || wps_ielen == 0)
|
||||
|
@ -1331,10 +1318,6 @@ static void update_bcn_wps_ie(struct adapter *padapter)
|
|||
memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
|
||||
}
|
||||
|
||||
pwps_ie_src = pmlmepriv->wps_beacon_ie;
|
||||
if (pwps_ie_src == NULL)
|
||||
return;
|
||||
|
||||
wps_ielen = (uint)pwps_ie_src[1];/* to get ie data len */
|
||||
if ((wps_offset+wps_ielen+2+remainder_ielen) <= MAX_IE_SZ) {
|
||||
memcpy(pwps_ie, pwps_ie_src, wps_ielen+2);
|
||||
|
@ -1347,8 +1330,7 @@ static void update_bcn_wps_ie(struct adapter *padapter)
|
|||
pnetwork->IELength = wps_offset + (wps_ielen+2) + remainder_ielen;
|
||||
}
|
||||
|
||||
if (pbackup_remainder_ie)
|
||||
kfree(pbackup_remainder_ie);
|
||||
kfree(pbackup_remainder_ie);
|
||||
}
|
||||
|
||||
static void update_bcn_p2p_ie(struct adapter *padapter)
|
||||
|
@ -1359,13 +1341,13 @@ static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8 *oui)
|
|||
{
|
||||
DBG_88E("%s\n", __func__);
|
||||
|
||||
if (_rtw_memcmp(RTW_WPA_OUI, oui, 4))
|
||||
if (!memcmp(RTW_WPA_OUI, oui, 4))
|
||||
update_bcn_wpa_ie(padapter);
|
||||
else if (_rtw_memcmp(WMM_OUI, oui, 4))
|
||||
else if (!memcmp(WMM_OUI, oui, 4))
|
||||
update_bcn_wmm_ie(padapter);
|
||||
else if (_rtw_memcmp(WPS_OUI, oui, 4))
|
||||
else if (!memcmp(WPS_OUI, oui, 4))
|
||||
update_bcn_wps_ie(padapter);
|
||||
else if (_rtw_memcmp(P2P_OUI, oui, 4))
|
||||
else if (!memcmp(P2P_OUI, oui, 4))
|
||||
update_bcn_p2p_ie(padapter);
|
||||
else
|
||||
DBG_88E("unknown OUI type!\n");
|
||||
|
@ -1373,7 +1355,6 @@ static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8 *oui)
|
|||
|
||||
void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)
|
||||
{
|
||||
unsigned long irqL;
|
||||
struct mlme_priv *pmlmepriv;
|
||||
struct mlme_ext_priv *pmlmeext;
|
||||
|
||||
|
@ -1386,7 +1367,7 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)
|
|||
if (!pmlmeext->bstart_bss)
|
||||
return;
|
||||
|
||||
_enter_critical_bh(&pmlmepriv->bcn_update_lock, &irqL);
|
||||
spin_lock_bh(&pmlmepriv->bcn_update_lock);
|
||||
|
||||
switch (ie_id) {
|
||||
case 0xFF:
|
||||
|
@ -1416,7 +1397,7 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)
|
|||
|
||||
pmlmepriv->update_bcn = true;
|
||||
|
||||
_exit_critical_bh(&pmlmepriv->bcn_update_lock, &irqL);
|
||||
spin_unlock_bh(&pmlmepriv->bcn_update_lock);
|
||||
|
||||
if (tx)
|
||||
set_tx_beacon_cmd(padapter);
|
||||
|
@ -1424,7 +1405,7 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)
|
|||
|
||||
/*
|
||||
op_mode
|
||||
Set to 0 (HT pure) under the followign conditions
|
||||
Set to 0 (HT pure) under the following conditions
|
||||
- all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or
|
||||
- all STAs in the BSS are 20 MHz HT in 20 MHz BSS
|
||||
Set to 1 (HT non-member protection) if there may be non-HT STAs
|
||||
|
@ -1503,27 +1484,26 @@ static int rtw_ht_operation_update(struct adapter *padapter)
|
|||
|
||||
void associated_clients_update(struct adapter *padapter, u8 updated)
|
||||
{
|
||||
/* update associcated stations cap. */
|
||||
/* update associated stations cap. */
|
||||
if (updated) {
|
||||
unsigned long irqL;
|
||||
struct list_head *phead, *plist;
|
||||
struct sta_info *psta = NULL;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
|
||||
_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
|
||||
spin_lock_bh(&pstapriv->asoc_list_lock);
|
||||
|
||||
phead = &pstapriv->asoc_list;
|
||||
plist = get_next(phead);
|
||||
plist = phead->next;
|
||||
|
||||
/* check asoc_queue */
|
||||
while ((rtw_end_of_queue_search(phead, plist)) == false) {
|
||||
psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
|
||||
while (phead != plist) {
|
||||
psta = container_of(plist, struct sta_info, asoc_list);
|
||||
|
||||
plist = get_next(plist);
|
||||
plist = plist->next;
|
||||
|
||||
VCS_update(padapter, psta);
|
||||
}
|
||||
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
|
||||
spin_unlock_bh(&pstapriv->asoc_list_lock);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1657,7 +1637,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
|
|||
update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, true);
|
||||
}
|
||||
|
||||
/* update associcated stations cap. */
|
||||
/* update associated stations cap. */
|
||||
associated_clients_update(padapter, beacon_updated);
|
||||
|
||||
DBG_88E("%s, updated =%d\n", __func__, beacon_updated);
|
||||
|
@ -1721,7 +1701,7 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
|
|||
update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, true);
|
||||
}
|
||||
|
||||
/* update associcated stations cap. */
|
||||
/* update associated stations cap. */
|
||||
|
||||
DBG_88E("%s, updated =%d\n", __func__, beacon_updated);
|
||||
|
||||
|
@ -1731,7 +1711,6 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
|
|||
u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta,
|
||||
bool active, u16 reason)
|
||||
{
|
||||
unsigned long irqL;
|
||||
u8 beacon_updated = false;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
|
||||
|
@ -1753,9 +1732,9 @@ u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta,
|
|||
rtw_clearstakey_cmd(padapter, (u8 *)psta, (u8)(psta->mac_id + 3), true);
|
||||
|
||||
|
||||
_enter_critical_bh(&psta->lock, &irqL);
|
||||
spin_lock_bh(&psta->lock);
|
||||
psta->state &= ~_FW_LINKED;
|
||||
_exit_critical_bh(&psta->lock, &irqL);
|
||||
spin_unlock_bh(&psta->lock);
|
||||
|
||||
rtw_indicate_sta_disassoc_event(padapter, psta);
|
||||
|
||||
|
@ -1763,18 +1742,16 @@ u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta,
|
|||
|
||||
beacon_updated = bss_cap_update_on_sta_leave(padapter, psta);
|
||||
|
||||
_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
|
||||
spin_lock_bh(&(pstapriv->sta_hash_lock));
|
||||
rtw_free_stainfo(padapter, psta);
|
||||
_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
|
||||
spin_unlock_bh(&(pstapriv->sta_hash_lock));
|
||||
|
||||
return beacon_updated;
|
||||
}
|
||||
|
||||
int rtw_ap_inform_ch_switch(struct adapter *padapter, u8 new_ch, u8 ch_offset)
|
||||
{
|
||||
unsigned long irqL;
|
||||
struct list_head *phead, *plist;
|
||||
int ret = 0;
|
||||
struct sta_info *psta = NULL;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
|
@ -1782,35 +1759,33 @@ int rtw_ap_inform_ch_switch(struct adapter *padapter, u8 new_ch, u8 ch_offset)
|
|||
u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
|
||||
if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE)
|
||||
return ret;
|
||||
return 0;
|
||||
|
||||
DBG_88E(FUNC_NDEV_FMT" with ch:%u, offset:%u\n",
|
||||
FUNC_NDEV_ARG(padapter->pnetdev), new_ch, ch_offset);
|
||||
|
||||
_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
|
||||
spin_lock_bh(&pstapriv->asoc_list_lock);
|
||||
phead = &pstapriv->asoc_list;
|
||||
plist = get_next(phead);
|
||||
plist = phead->next;
|
||||
|
||||
/* for each sta in asoc_queue */
|
||||
while (!rtw_end_of_queue_search(phead, plist)) {
|
||||
psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
|
||||
plist = get_next(plist);
|
||||
while (phead != plist) {
|
||||
psta = container_of(plist, struct sta_info, asoc_list);
|
||||
plist = plist->next;
|
||||
|
||||
issue_action_spct_ch_switch(padapter, psta->hwaddr, new_ch, ch_offset);
|
||||
psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2);
|
||||
}
|
||||
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
|
||||
spin_unlock_bh(&pstapriv->asoc_list_lock);
|
||||
|
||||
issue_action_spct_ch_switch(padapter, bc_addr, new_ch, ch_offset);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rtw_sta_flush(struct adapter *padapter)
|
||||
{
|
||||
unsigned long irqL;
|
||||
struct list_head *phead, *plist;
|
||||
int ret = 0;
|
||||
struct sta_info *psta = NULL;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
|
@ -1820,31 +1795,31 @@ int rtw_sta_flush(struct adapter *padapter)
|
|||
DBG_88E(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev));
|
||||
|
||||
if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE)
|
||||
return ret;
|
||||
return 0;
|
||||
|
||||
_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
|
||||
spin_lock_bh(&pstapriv->asoc_list_lock);
|
||||
phead = &pstapriv->asoc_list;
|
||||
plist = get_next(phead);
|
||||
plist = phead->next;
|
||||
|
||||
/* free sta asoc_queue */
|
||||
while ((rtw_end_of_queue_search(phead, plist)) == false) {
|
||||
psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
|
||||
while (phead != plist) {
|
||||
psta = container_of(plist, struct sta_info, asoc_list);
|
||||
|
||||
plist = get_next(plist);
|
||||
plist = plist->next;
|
||||
|
||||
rtw_list_delete(&psta->asoc_list);
|
||||
list_del_init(&psta->asoc_list);
|
||||
pstapriv->asoc_list_cnt--;
|
||||
|
||||
ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING);
|
||||
}
|
||||
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
|
||||
spin_unlock_bh(&pstapriv->asoc_list_lock);
|
||||
|
||||
|
||||
issue_deauth(padapter, bc_addr, WLAN_REASON_DEAUTH_LEAVING);
|
||||
|
||||
associated_clients_update(padapter, true);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* called > TSR LEVEL for USB or SDIO Interface*/
|
||||
|
@ -1924,18 +1899,17 @@ void start_ap_mode(struct adapter *padapter)
|
|||
pmlmepriv->p2p_probe_resp_ie = NULL;
|
||||
|
||||
/* for ACL */
|
||||
_rtw_init_listhead(&(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++) {
|
||||
_rtw_init_listhead(&pacl_list->aclnode[i].list);
|
||||
INIT_LIST_HEAD(&pacl_list->aclnode[i].list);
|
||||
pacl_list->aclnode[i].valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
void stop_ap_mode(struct adapter *padapter)
|
||||
{
|
||||
unsigned long irqL;
|
||||
struct list_head *phead, *plist;
|
||||
struct rtw_wlan_acl_node *paclnode;
|
||||
struct sta_info *psta = NULL;
|
||||
|
@ -1949,27 +1923,27 @@ void stop_ap_mode(struct adapter *padapter)
|
|||
pmlmeext->bstart_bss = false;
|
||||
|
||||
/* reset and init security priv , this can refine with rtw_reset_securitypriv */
|
||||
_rtw_memset((unsigned char *)&padapter->securitypriv, 0, sizeof(struct security_priv));
|
||||
memset((unsigned char *)&padapter->securitypriv, 0, sizeof(struct security_priv));
|
||||
padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen;
|
||||
padapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled;
|
||||
|
||||
/* for ACL */
|
||||
_enter_critical_bh(&(pacl_node_q->lock), &irqL);
|
||||
spin_lock_bh(&(pacl_node_q->lock));
|
||||
phead = get_list_head(pacl_node_q);
|
||||
plist = get_next(phead);
|
||||
while ((rtw_end_of_queue_search(phead, plist)) == false) {
|
||||
paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list);
|
||||
plist = get_next(plist);
|
||||
plist = phead->next;
|
||||
while (phead != plist) {
|
||||
paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
|
||||
plist = plist->next;
|
||||
|
||||
if (paclnode->valid) {
|
||||
paclnode->valid = false;
|
||||
|
||||
rtw_list_delete(&paclnode->list);
|
||||
list_del_init(&paclnode->list);
|
||||
|
||||
pacl_list->num--;
|
||||
}
|
||||
}
|
||||
_exit_critical_bh(&(pacl_node_q->lock), &irqL);
|
||||
spin_unlock_bh(&(pacl_node_q->lock));
|
||||
|
||||
DBG_88E("%s, free acl_node_queue, num =%d\n", __func__, pacl_list->num);
|
||||
|
||||
|
@ -1979,9 +1953,9 @@ void stop_ap_mode(struct adapter *padapter)
|
|||
rtw_free_all_stainfo(padapter);
|
||||
|
||||
psta = rtw_get_bcmc_stainfo(padapter);
|
||||
_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
|
||||
spin_lock_bh(&(pstapriv->sta_hash_lock));
|
||||
rtw_free_stainfo(padapter, psta);
|
||||
_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
|
||||
spin_unlock_bh(&(pstapriv->sta_hash_lock));
|
||||
|
||||
rtw_init_bcmc_stainfo(padapter);
|
||||
|
||||
|
|
1198
core/rtw_br_ext.c
1198
core/rtw_br_ext.c
File diff suppressed because it is too large
Load diff
1171
core/rtw_cmd.c
1171
core/rtw_cmd.c
File diff suppressed because it is too large
Load diff
|
@ -20,7 +20,7 @@
|
|||
#define _RTW_DEBUG_C_
|
||||
|
||||
#include <rtw_debug.h>
|
||||
#include <rtw_version.h>
|
||||
#include <usb_ops_linux.h>
|
||||
|
||||
int proc_get_drv_version(char *page, char **start,
|
||||
off_t offset, int count,
|
||||
|
@ -45,7 +45,7 @@ int proc_get_write_reg(char *page, char **start,
|
|||
int proc_set_write_reg(struct file *file, const char __user *buffer,
|
||||
unsigned long count, void *data)
|
||||
{
|
||||
struct net_device *dev = (struct net_device *)data;
|
||||
struct net_device *dev = data;
|
||||
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
|
||||
char tmp[32];
|
||||
u32 addr, val, len;
|
||||
|
@ -64,13 +64,13 @@ int proc_set_write_reg(struct file *file, const char __user *buffer,
|
|||
}
|
||||
switch (len) {
|
||||
case 1:
|
||||
rtw_write8(padapter, addr, (u8)val);
|
||||
usb_write8(padapter, addr, (u8)val);
|
||||
break;
|
||||
case 2:
|
||||
rtw_write16(padapter, addr, (u16)val);
|
||||
usb_write16(padapter, addr, (u16)val);
|
||||
break;
|
||||
case 4:
|
||||
rtw_write32(padapter, addr, val);
|
||||
usb_write32(padapter, addr, val);
|
||||
break;
|
||||
default:
|
||||
DBG_88E("error write length =%d", len);
|
||||
|
@ -99,13 +99,13 @@ int proc_get_read_reg(char *page, char **start,
|
|||
|
||||
switch (proc_get_read_len) {
|
||||
case 1:
|
||||
len += snprintf(page + len, count - len, "rtw_read8(0x%x)=0x%x\n", proc_get_read_addr, rtw_read8(padapter, proc_get_read_addr));
|
||||
len += snprintf(page + len, count - len, "usb_read8(0x%x)=0x%x\n", proc_get_read_addr, usb_read8(padapter, proc_get_read_addr));
|
||||
break;
|
||||
case 2:
|
||||
len += snprintf(page + len, count - len, "rtw_read16(0x%x)=0x%x\n", proc_get_read_addr, rtw_read16(padapter, proc_get_read_addr));
|
||||
len += snprintf(page + len, count - len, "usb_read16(0x%x)=0x%x\n", proc_get_read_addr, usb_read16(padapter, proc_get_read_addr));
|
||||
break;
|
||||
case 4:
|
||||
len += snprintf(page + len, count - len, "rtw_read32(0x%x)=0x%x\n", proc_get_read_addr, rtw_read32(padapter, proc_get_read_addr));
|
||||
len += snprintf(page + len, count - len, "usb_read32(0x%x)=0x%x\n", proc_get_read_addr, usb_read32(padapter, proc_get_read_addr));
|
||||
break;
|
||||
default:
|
||||
len += snprintf(page + len, count - len, "error read length=%d\n", proc_get_read_len);
|
||||
|
@ -233,7 +233,7 @@ int proc_get_rf_info(char *page, char **start,
|
|||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
int len = 0;
|
||||
|
||||
len += snprintf(page + len, count - len, "cur_ch=%d, cur_bw=%d, cur_ch_offet=%d\n",
|
||||
len += snprintf(page + len, count - len, "cur_ch=%d, cur_bw=%d, cur_ch_offset=%d\n",
|
||||
pmlmeext->cur_channel, pmlmeext->cur_bwmode, pmlmeext->cur_ch_offset);
|
||||
*eof = 1;
|
||||
return len;
|
||||
|
@ -327,7 +327,7 @@ int proc_get_mac_reg_dump1(char *page, char **start,
|
|||
for (i = 0x0; i < 0x300; i += 4) {
|
||||
if (j%4 == 1)
|
||||
len += snprintf(page + len, count - len, "0x%02x", i);
|
||||
len += snprintf(page + len, count - len, " 0x%08x ", rtw_read32(padapter, i));
|
||||
len += snprintf(page + len, count - len, " 0x%08x ", usb_read32(padapter, i));
|
||||
if ((j++)%4 == 0)
|
||||
len += snprintf(page + len, count - len, "\n");
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ int proc_get_mac_reg_dump2(char *page, char **start,
|
|||
for (i = 0x300; i < 0x600; i += 4) {
|
||||
if (j%4 == 1)
|
||||
len += snprintf(page + len, count - len, "0x%02x", i);
|
||||
len += snprintf(page + len, count - len, " 0x%08x ", rtw_read32(padapter, i));
|
||||
len += snprintf(page + len, count - len, " 0x%08x ", usb_read32(padapter, i));
|
||||
if ((j++)%4 == 0)
|
||||
len += snprintf(page + len, count - len, "\n");
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ int proc_get_mac_reg_dump3(char *page, char **start,
|
|||
for (i = 0x600; i < 0x800; i += 4) {
|
||||
if (j%4 == 1)
|
||||
len += snprintf(page + len, count - len, "0x%02x", i);
|
||||
len += snprintf(page + len, count - len, " 0x%08x ", rtw_read32(padapter, i));
|
||||
len += snprintf(page + len, count - len, " 0x%08x ", usb_read32(padapter, i));
|
||||
if ((j++)%4 == 0)
|
||||
len += snprintf(page + len, count - len, "\n");
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ int proc_get_bb_reg_dump1(char *page, char **start,
|
|||
for (i = 0x800; i < 0xB00; i += 4) {
|
||||
if (j%4 == 1)
|
||||
len += snprintf(page + len, count - len, "0x%02x", i);
|
||||
len += snprintf(page + len, count - len, " 0x%08x ", rtw_read32(padapter, i));
|
||||
len += snprintf(page + len, count - len, " 0x%08x ", usb_read32(padapter, i));
|
||||
if ((j++)%4 == 0)
|
||||
len += snprintf(page + len, count - len, "\n");
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ int proc_get_bb_reg_dump2(char *page, char **start,
|
|||
for (i = 0xB00; i < 0xE00; i += 4) {
|
||||
if (j%4 == 1)
|
||||
len += snprintf(page + len, count - len, "0x%02x", i);
|
||||
len += snprintf(page + len, count - len, " 0x%08x ", rtw_read32(padapter, i));
|
||||
len += snprintf(page + len, count - len, " 0x%08x ", usb_read32(padapter, i));
|
||||
if ((j++)%4 == 0)
|
||||
len += snprintf(page + len, count - len, "\n");
|
||||
}
|
||||
|
@ -437,7 +437,7 @@ int proc_get_bb_reg_dump3(char *page, char **start,
|
|||
for (i = 0xE00; i < 0x1000; i += 4) {
|
||||
if (j%4 == 1)
|
||||
len += snprintf(page + len, count - len, "0x%02x", i);
|
||||
len += snprintf(page + len, count - len, " 0x%08x ", rtw_read32(padapter, i));
|
||||
len += snprintf(page + len, count - len, " 0x%08x ", usb_read32(padapter, i));
|
||||
if ((j++)%4 == 0)
|
||||
len += snprintf(page + len, count - len, "\n");
|
||||
}
|
||||
|
@ -577,7 +577,7 @@ int proc_get_rx_signal(char *page, char **start,
|
|||
int proc_set_rx_signal(struct file *file, const char __user *buffer,
|
||||
unsigned long count, void *data)
|
||||
{
|
||||
struct net_device *dev = (struct net_device *)data;
|
||||
struct net_device *dev = data;
|
||||
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
|
||||
char tmp[32];
|
||||
u32 is_signal_dbg;
|
||||
|
@ -627,7 +627,7 @@ int proc_get_ht_enable(char *page, char **start,
|
|||
int proc_set_ht_enable(struct file *file, const char __user *buffer,
|
||||
unsigned long count, void *data)
|
||||
{
|
||||
struct net_device *dev = (struct net_device *)data;
|
||||
struct net_device *dev = data;
|
||||
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
|
||||
struct registry_priv *pregpriv = &padapter->registrypriv;
|
||||
char tmp[32];
|
||||
|
@ -669,7 +669,7 @@ int proc_get_cbw40_enable(char *page, char **start,
|
|||
int proc_set_cbw40_enable(struct file *file, const char __user *buffer,
|
||||
unsigned long count, void *data)
|
||||
{
|
||||
struct net_device *dev = (struct net_device *)data;
|
||||
struct net_device *dev = data;
|
||||
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
|
||||
struct registry_priv *pregpriv = &padapter->registrypriv;
|
||||
char tmp[32];
|
||||
|
@ -710,7 +710,7 @@ int proc_get_ampdu_enable(char *page, char **start,
|
|||
int proc_set_ampdu_enable(struct file *file, const char __user *buffer,
|
||||
unsigned long count, void *data)
|
||||
{
|
||||
struct net_device *dev = (struct net_device *)data;
|
||||
struct net_device *dev = data;
|
||||
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
|
||||
struct registry_priv *pregpriv = &padapter->registrypriv;
|
||||
char tmp[32];
|
||||
|
@ -771,7 +771,7 @@ int proc_get_rx_stbc(char *page, char **start,
|
|||
int proc_set_rx_stbc(struct file *file, const char __user *buffer,
|
||||
unsigned long count, void *data)
|
||||
{
|
||||
struct net_device *dev = (struct net_device *)data;
|
||||
struct net_device *dev = data;
|
||||
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
|
||||
struct registry_priv *pregpriv = &padapter->registrypriv;
|
||||
char tmp[32];
|
||||
|
@ -783,7 +783,7 @@ int proc_set_rx_stbc(struct file *file, const char __user *buffer,
|
|||
if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
|
||||
if (pregpriv) {
|
||||
pregpriv->rx_stbc = mode;
|
||||
printk("rx_stbc=%d\n", mode);
|
||||
netdev_info(dev, "rx_stbc=%d\n", mode);
|
||||
}
|
||||
}
|
||||
return count;
|
||||
|
@ -800,7 +800,7 @@ int proc_get_rssi_disp(char *page, char **start,
|
|||
int proc_set_rssi_disp(struct file *file, const char __user *buffer,
|
||||
unsigned long count, void *data)
|
||||
{
|
||||
struct net_device *dev = (struct net_device *)data;
|
||||
struct net_device *dev = data;
|
||||
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
|
||||
char tmp[32];
|
||||
u32 enable = 0;
|
||||
|
@ -820,7 +820,7 @@ int proc_set_rssi_disp(struct file *file, const char __user *buffer,
|
|||
|
||||
if (enable) {
|
||||
DBG_88E("Turn On Rx RSSI Display Function\n");
|
||||
padapter->bRxRSSIDisplay = enable ;
|
||||
padapter->bRxRSSIDisplay = enable;
|
||||
} else {
|
||||
DBG_88E("Turn Off Rx RSSI Display Function\n");
|
||||
padapter->bRxRSSIDisplay = 0;
|
||||
|
@ -835,7 +835,6 @@ int proc_get_all_sta_info(char *page, char **start,
|
|||
off_t offset, int count,
|
||||
int *eof, void *data)
|
||||
{
|
||||
unsigned long irqL;
|
||||
struct sta_info *psta;
|
||||
struct net_device *dev = data;
|
||||
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
|
||||
|
@ -848,16 +847,16 @@ int proc_get_all_sta_info(char *page, char **start,
|
|||
|
||||
len += snprintf(page + len, count - len, "sta_dz_bitmap=0x%x, tim_bitmap=0x%x\n", pstapriv->sta_dz_bitmap, pstapriv->tim_bitmap);
|
||||
|
||||
_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
|
||||
spin_lock_bh(&pstapriv->sta_hash_lock);
|
||||
|
||||
for (i = 0; i < NUM_STA; i++) {
|
||||
phead = &(pstapriv->sta_hash[i]);
|
||||
plist = get_next(phead);
|
||||
plist = phead->next;
|
||||
|
||||
while ((rtw_end_of_queue_search(phead, plist)) == false) {
|
||||
psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
|
||||
while (phead != plist) {
|
||||
psta = container_of(plist, struct sta_info, hash_list);
|
||||
|
||||
plist = get_next(plist);
|
||||
plist = plist->next;
|
||||
|
||||
len += snprintf(page + len, count - len, "sta's macaddr: %pM\n", psta->hwaddr);
|
||||
len += snprintf(page + len, count - len, "rtsen=%d, cts2slef=%d\n", psta->rtsen, psta->cts2self);
|
||||
|
@ -882,7 +881,7 @@ int proc_get_all_sta_info(char *page, char **start,
|
|||
}
|
||||
}
|
||||
}
|
||||
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
|
||||
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
||||
|
||||
*eof = 1;
|
||||
return len;
|
||||
|
|
1625
core/rtw_efuse.c
1625
core/rtw_efuse.c
File diff suppressed because it is too large
Load diff
|
@ -20,11 +20,11 @@
|
|||
#define _IEEE80211_C
|
||||
|
||||
#include <drv_types.h>
|
||||
#include <osdep_intf.h>
|
||||
#include <ieee80211.h>
|
||||
#include <wifi.h>
|
||||
#include <osdep_service.h>
|
||||
#include <wlan_bssdef.h>
|
||||
#include <usb_osintf.h>
|
||||
|
||||
u8 RTW_WPA_OUI_TYPE[] = { 0x00, 0x50, 0xf2, 1 };
|
||||
u16 RTW_WPA_VERSION = 1;
|
||||
|
@ -147,7 +147,6 @@ u8 *rtw_set_ie
|
|||
uint *frlen /* frame length */
|
||||
)
|
||||
{
|
||||
_func_enter_;
|
||||
*pbuf = (u8)index;
|
||||
|
||||
*(pbuf + 1) = (u8)len;
|
||||
|
@ -157,11 +156,10 @@ _func_enter_;
|
|||
|
||||
*frlen = *frlen + (len + 2);
|
||||
|
||||
_func_exit_;
|
||||
return pbuf + len + 2;
|
||||
}
|
||||
|
||||
inline u8 *rtw_set_ie_ch_switch (u8 *buf, u32 *buf_len, u8 ch_switch_mode,
|
||||
inline u8 *rtw_set_ie_ch_switch(u8 *buf, u32 *buf_len, u8 ch_switch_mode,
|
||||
u8 new_ch, u8 ch_switch_cnt)
|
||||
{
|
||||
u8 ie_data[3];
|
||||
|
@ -208,8 +206,8 @@ inline u8 *rtw_set_ie_mesh_ch_switch_parm(u8 *buf, u32 *buf_len, u8 ttl,
|
|||
|
||||
ie_data[0] = ttl;
|
||||
ie_data[1] = flags;
|
||||
RTW_PUT_LE16((u8 *)&ie_data[2], reason);
|
||||
RTW_PUT_LE16((u8 *)&ie_data[4], precedence);
|
||||
*(u16 *)(ie_data+2) = cpu_to_le16(reason);
|
||||
*(u16 *)(ie_data+4) = cpu_to_le16(precedence);
|
||||
|
||||
return rtw_set_ie(buf, 0x118, 6, ie_data, buf_len);
|
||||
}
|
||||
|
@ -221,11 +219,8 @@ u8 *rtw_get_ie(u8 *pbuf, int index, int *len, int limit)
|
|||
{
|
||||
int tmp, i;
|
||||
u8 *p;
|
||||
_func_enter_;
|
||||
if (limit < 1) {
|
||||
_func_exit_;
|
||||
if (limit < 1)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p = pbuf;
|
||||
i = 0;
|
||||
|
@ -242,7 +237,6 @@ _func_enter_;
|
|||
if (i >= limit)
|
||||
break;
|
||||
}
|
||||
_func_exit_;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -273,7 +267,7 @@ u8 *rtw_get_ie_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui, u8 oui_len, u8 *ie, u
|
|||
cnt = 0;
|
||||
|
||||
while (cnt < in_len) {
|
||||
if (eid == in_ie[cnt] && (!oui || _rtw_memcmp(&in_ie[cnt+2], oui, oui_len))) {
|
||||
if (eid == in_ie[cnt] && (!oui || !memcmp(&in_ie[cnt+2], oui, oui_len))) {
|
||||
target_ie = &in_ie[cnt];
|
||||
|
||||
if (ie)
|
||||
|
@ -339,9 +333,8 @@ exit:
|
|||
|
||||
void rtw_set_supported_rate(u8 *SupportedRates, uint mode)
|
||||
{
|
||||
_func_enter_;
|
||||
|
||||
_rtw_memset(SupportedRates, 0, NDIS_802_11_LENGTH_RATES_EX);
|
||||
memset(SupportedRates, 0, NDIS_802_11_LENGTH_RATES_EX);
|
||||
|
||||
switch (mode) {
|
||||
case WIRELESS_11B:
|
||||
|
@ -361,13 +354,11 @@ _func_enter_;
|
|||
memcpy(SupportedRates + IEEE80211_CCK_RATE_LEN, WIFI_OFDMRATES, IEEE80211_NUM_OFDM_RATESLEN);
|
||||
break;
|
||||
}
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
uint rtw_get_rateset_len(u8 *rateset)
|
||||
{
|
||||
uint i = 0;
|
||||
_func_enter_;
|
||||
while (1) {
|
||||
if ((rateset[i]) == 0)
|
||||
break;
|
||||
|
@ -375,7 +366,6 @@ _func_enter_;
|
|||
break;
|
||||
i++;
|
||||
}
|
||||
_func_exit_;
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -386,7 +376,6 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv)
|
|||
struct wlan_bssid_ex *pdev_network = &pregistrypriv->dev_network;
|
||||
u8 *ie = pdev_network->IEs;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
/* timestamp will be inserted by hardware */
|
||||
sz += 8;
|
||||
|
@ -444,7 +433,6 @@ _func_enter_;
|
|||
|
||||
if (rateLen > 8)
|
||||
ie = rtw_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8), (pdev_network->SupportedRates + 8), &sz);
|
||||
_func_exit_;
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
@ -463,7 +451,7 @@ unsigned char *rtw_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit)
|
|||
|
||||
if (pbuf) {
|
||||
/* check if oui matches... */
|
||||
if (_rtw_memcmp((pbuf + 2), wpa_oui_type, sizeof (wpa_oui_type)) == false)
|
||||
if (!memcmp((pbuf + 2), wpa_oui_type, sizeof(wpa_oui_type)) == false)
|
||||
goto check_next_ie;
|
||||
|
||||
/* check version... */
|
||||
|
@ -497,15 +485,15 @@ unsigned char *rtw_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len, int limit)
|
|||
|
||||
int rtw_get_wpa_cipher_suite(u8 *s)
|
||||
{
|
||||
if (_rtw_memcmp(s, WPA_CIPHER_SUITE_NONE, WPA_SELECTOR_LEN) == true)
|
||||
if (!memcmp(s, WPA_CIPHER_SUITE_NONE, WPA_SELECTOR_LEN))
|
||||
return WPA_CIPHER_NONE;
|
||||
if (_rtw_memcmp(s, WPA_CIPHER_SUITE_WEP40, WPA_SELECTOR_LEN) == true)
|
||||
if (!memcmp(s, WPA_CIPHER_SUITE_WEP40, WPA_SELECTOR_LEN))
|
||||
return WPA_CIPHER_WEP40;
|
||||
if (_rtw_memcmp(s, WPA_CIPHER_SUITE_TKIP, WPA_SELECTOR_LEN) == true)
|
||||
if (!memcmp(s, WPA_CIPHER_SUITE_TKIP, WPA_SELECTOR_LEN))
|
||||
return WPA_CIPHER_TKIP;
|
||||
if (_rtw_memcmp(s, WPA_CIPHER_SUITE_CCMP, WPA_SELECTOR_LEN) == true)
|
||||
if (!memcmp(s, WPA_CIPHER_SUITE_CCMP, WPA_SELECTOR_LEN))
|
||||
return WPA_CIPHER_CCMP;
|
||||
if (_rtw_memcmp(s, WPA_CIPHER_SUITE_WEP104, WPA_SELECTOR_LEN) == true)
|
||||
if (!memcmp(s, WPA_CIPHER_SUITE_WEP104, WPA_SELECTOR_LEN))
|
||||
return WPA_CIPHER_WEP104;
|
||||
|
||||
return 0;
|
||||
|
@ -513,15 +501,15 @@ int rtw_get_wpa_cipher_suite(u8 *s)
|
|||
|
||||
int rtw_get_wpa2_cipher_suite(u8 *s)
|
||||
{
|
||||
if (_rtw_memcmp(s, RSN_CIPHER_SUITE_NONE, RSN_SELECTOR_LEN) == true)
|
||||
if (!memcmp(s, RSN_CIPHER_SUITE_NONE, RSN_SELECTOR_LEN))
|
||||
return WPA_CIPHER_NONE;
|
||||
if (_rtw_memcmp(s, RSN_CIPHER_SUITE_WEP40, RSN_SELECTOR_LEN) == true)
|
||||
if (!memcmp(s, RSN_CIPHER_SUITE_WEP40, RSN_SELECTOR_LEN))
|
||||
return WPA_CIPHER_WEP40;
|
||||
if (_rtw_memcmp(s, RSN_CIPHER_SUITE_TKIP, RSN_SELECTOR_LEN) == true)
|
||||
if (!memcmp(s, RSN_CIPHER_SUITE_TKIP, RSN_SELECTOR_LEN))
|
||||
return WPA_CIPHER_TKIP;
|
||||
if (_rtw_memcmp(s, RSN_CIPHER_SUITE_CCMP, RSN_SELECTOR_LEN) == true)
|
||||
if (!memcmp(s, RSN_CIPHER_SUITE_CCMP, RSN_SELECTOR_LEN))
|
||||
return WPA_CIPHER_CCMP;
|
||||
if (_rtw_memcmp(s, RSN_CIPHER_SUITE_WEP104, RSN_SELECTOR_LEN) == true)
|
||||
if (!memcmp(s, RSN_CIPHER_SUITE_WEP104, RSN_SELECTOR_LEN))
|
||||
return WPA_CIPHER_WEP104;
|
||||
|
||||
return 0;
|
||||
|
@ -542,7 +530,7 @@ int rtw_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwis
|
|||
|
||||
|
||||
if ((*wpa_ie != _WPA_IE_ID_) || (*(wpa_ie+1) != (u8)(wpa_ie_len - 2)) ||
|
||||
(_rtw_memcmp(wpa_ie+2, RTW_WPA_OUI_TYPE, WPA_SELECTOR_LEN) != true))
|
||||
(memcmp(wpa_ie+2, RTW_WPA_OUI_TYPE, WPA_SELECTOR_LEN)))
|
||||
return _FAIL;
|
||||
|
||||
pos = wpa_ie;
|
||||
|
@ -563,7 +551,7 @@ int rtw_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwis
|
|||
|
||||
/* pairwise_cipher */
|
||||
if (left >= 2) {
|
||||
count = RTW_GET_LE16(pos);
|
||||
count = get_unaligned_le16(pos);
|
||||
pos += 2;
|
||||
left -= 2;
|
||||
|
||||
|
@ -587,7 +575,7 @@ int rtw_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwis
|
|||
if (is_8021x) {
|
||||
if (left >= 6) {
|
||||
pos += 2;
|
||||
if (_rtw_memcmp(pos, SUITE_1X, 4) == 1) {
|
||||
if (!memcmp(pos, SUITE_1X, 4)) {
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("%s : there has 802.1x auth\n", __func__));
|
||||
*is_8021x = 1;
|
||||
}
|
||||
|
@ -631,7 +619,7 @@ int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi
|
|||
|
||||
/* pairwise_cipher */
|
||||
if (left >= 2) {
|
||||
count = RTW_GET_LE16(pos);
|
||||
count = get_unaligned_le16(pos);
|
||||
pos += 2;
|
||||
left -= 2;
|
||||
|
||||
|
@ -657,7 +645,7 @@ int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi
|
|||
if (is_8021x) {
|
||||
if (left >= 6) {
|
||||
pos += 2;
|
||||
if (_rtw_memcmp(pos, SUITE_1X, 4) == 1) {
|
||||
if (!memcmp(pos, SUITE_1X, 4)) {
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("%s (): there has 802.1x auth\n", __func__));
|
||||
*is_8021x = 1;
|
||||
}
|
||||
|
@ -672,7 +660,6 @@ int rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 *wpa_ie,
|
|||
u8 wpa_oui[4] = {0x0, 0x50, 0xf2, 0x01};
|
||||
uint cnt;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
/* Search required WPA or WPA2 IE and copy to sec_ie[] */
|
||||
|
||||
|
@ -683,7 +670,7 @@ _func_enter_;
|
|||
while (cnt < in_len) {
|
||||
authmode = in_ie[cnt];
|
||||
|
||||
if ((authmode == _WPA_IE_ID_) && (_rtw_memcmp(&in_ie[cnt+2], &wpa_oui[0], 4))) {
|
||||
if ((authmode == _WPA_IE_ID_) && (!memcmp(&in_ie[cnt+2], &wpa_oui[0], 4))) {
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
|
||||
("\n rtw_get_wpa_ie: sec_idx =%d in_ie[cnt+1]+2 =%d\n",
|
||||
sec_idx, in_ie[cnt+1]+2));
|
||||
|
@ -726,7 +713,6 @@ _func_enter_;
|
|||
}
|
||||
}
|
||||
|
||||
_func_exit_;
|
||||
|
||||
return *rsn_len + *wpa_len;
|
||||
}
|
||||
|
@ -741,7 +727,7 @@ u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen)
|
|||
|
||||
eid = ie_ptr[0];
|
||||
|
||||
if ((eid == _WPA_IE_ID_) && (_rtw_memcmp(&ie_ptr[2], wps_oui, 4))) {
|
||||
if ((eid == _WPA_IE_ID_) && (!memcmp(&ie_ptr[2], wps_oui, 4))) {
|
||||
*wps_ielen = ie_ptr[1]+2;
|
||||
match = true;
|
||||
}
|
||||
|
@ -774,7 +760,7 @@ u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen)
|
|||
while (cnt < in_len) {
|
||||
eid = in_ie[cnt];
|
||||
|
||||
if ((eid == _WPA_IE_ID_) && (_rtw_memcmp(&in_ie[cnt+2], wps_oui, 4))) {
|
||||
if ((eid == _WPA_IE_ID_) && (!memcmp(&in_ie[cnt+2], wps_oui, 4))) {
|
||||
wpsie_ptr = &in_ie[cnt];
|
||||
|
||||
if (wps_ie)
|
||||
|
@ -813,7 +799,7 @@ u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id , u8 *buf_at
|
|||
*len_attr = 0;
|
||||
|
||||
if ((wps_ie[0] != _VENDOR_SPECIFIC_IE_) ||
|
||||
(_rtw_memcmp(wps_ie + 2, wps_oui , 4) != true))
|
||||
(memcmp(wps_ie + 2, wps_oui , 4)))
|
||||
return attr_ptr;
|
||||
|
||||
/* 6 = 1(Element ID) + 1(Length) + 4(WPS OUI) */
|
||||
|
@ -821,8 +807,8 @@ u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id , u8 *buf_at
|
|||
|
||||
while (attr_ptr - wps_ie < wps_ielen) {
|
||||
/* 4 = 2(Attribute ID) + 2(Length) */
|
||||
u16 attr_id = RTW_GET_BE16(attr_ptr);
|
||||
u16 attr_data_len = RTW_GET_BE16(attr_ptr + 2);
|
||||
u16 attr_id = get_unaligned_be16(attr_ptr);
|
||||
u16 attr_data_len = get_unaligned_be16(attr_ptr + 2);
|
||||
u16 attr_len = attr_data_len + 4;
|
||||
|
||||
if (attr_id == target_attr_id) {
|
||||
|
@ -884,7 +870,7 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen,
|
|||
if (elen < 4) {
|
||||
if (show_errors) {
|
||||
DBG_88E("short vendor specific information element ignored (len=%lu)\n",
|
||||
(unsigned long) elen);
|
||||
(unsigned long)elen);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -904,7 +890,7 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen,
|
|||
case WME_OUI_TYPE: /* this is a Wi-Fi WME info. element */
|
||||
if (elen < 5) {
|
||||
DBG_88E("short WME information element ignored (len=%lu)\n",
|
||||
(unsigned long) elen);
|
||||
(unsigned long)elen);
|
||||
return -1;
|
||||
}
|
||||
switch (pos[4]) {
|
||||
|
@ -919,7 +905,7 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen,
|
|||
break;
|
||||
default:
|
||||
DBG_88E("unknown WME information element ignored (subtype=%d len=%lu)\n",
|
||||
pos[4], (unsigned long) elen);
|
||||
pos[4], (unsigned long)elen);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
@ -930,7 +916,7 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen,
|
|||
break;
|
||||
default:
|
||||
DBG_88E("Unknown Microsoft information element ignored (type=%d len=%lu)\n",
|
||||
pos[3], (unsigned long) elen);
|
||||
pos[3], (unsigned long)elen);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
@ -943,13 +929,13 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen,
|
|||
break;
|
||||
default:
|
||||
DBG_88E("Unknown Broadcom information element ignored (type=%d len=%lu)\n",
|
||||
pos[3], (unsigned long) elen);
|
||||
pos[3], (unsigned long)elen);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DBG_88E("unknown vendor specific information element ignored (vendor OUI %02x:%02x:%02x len=%lu)\n",
|
||||
pos[0], pos[1], pos[2], (unsigned long) elen);
|
||||
pos[0], pos[1], pos[2], (unsigned long)elen);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -971,7 +957,7 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len,
|
|||
u8 *pos = start;
|
||||
int unknown = 0;
|
||||
|
||||
_rtw_memset(elems, 0, sizeof(*elems));
|
||||
memset(elems, 0, sizeof(*elems));
|
||||
|
||||
while (left >= 2) {
|
||||
u8 id, elen;
|
||||
|
@ -983,7 +969,7 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len,
|
|||
if (elen > left) {
|
||||
if (show_errors) {
|
||||
DBG_88E("IEEE 802.11 element parse failed (id=%d elen=%d left=%lu)\n",
|
||||
id, elen, (unsigned long) left);
|
||||
id, elen, (unsigned long)left);
|
||||
}
|
||||
return ParseFailed;
|
||||
}
|
||||
|
@ -1081,41 +1067,18 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len,
|
|||
return unknown ? ParseUnknown : ParseOK;
|
||||
}
|
||||
|
||||
u8 key_char2num(u8 ch)
|
||||
{
|
||||
if ((ch >= '0') && (ch <= '9'))
|
||||
return ch - '0';
|
||||
else if ((ch >= 'a') && (ch <= 'f'))
|
||||
return ch - 'a' + 10;
|
||||
else if ((ch >= 'A') && (ch <= 'F'))
|
||||
return ch - 'A' + 10;
|
||||
else
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
u8 str_2char2num(u8 hch, u8 lch)
|
||||
{
|
||||
return (key_char2num(hch) * 10) + key_char2num(lch);
|
||||
}
|
||||
|
||||
u8 key_2char2num(u8 hch, u8 lch)
|
||||
{
|
||||
return (key_char2num(hch) << 4) | key_char2num(lch);
|
||||
}
|
||||
|
||||
void rtw_macaddr_cfg(u8 *mac_addr)
|
||||
{
|
||||
u8 mac[ETH_ALEN];
|
||||
|
||||
if (mac_addr == NULL)
|
||||
return;
|
||||
|
||||
if (rtw_initmac) { /* Users specify the mac address */
|
||||
int jj, kk;
|
||||
|
||||
for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3)
|
||||
mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk + 1]);
|
||||
if (rtw_initmac && mac_pton(rtw_initmac, mac)) {
|
||||
/* Users specify the mac address */
|
||||
memcpy(mac_addr, mac, ETH_ALEN);
|
||||
} else { /* Use the mac address stored in the Efuse */
|
||||
} else {
|
||||
/* Use the mac address stored in the Efuse */
|
||||
memcpy(mac, mac_addr, ETH_ALEN);
|
||||
}
|
||||
|
||||
|
@ -1129,7 +1092,7 @@ void rtw_macaddr_cfg(u8 *mac_addr)
|
|||
mac[3] = 0x87;
|
||||
mac[4] = 0x00;
|
||||
mac[5] = 0x00;
|
||||
/* use default mac addresss */
|
||||
/* use default mac address */
|
||||
memcpy(mac_addr, mac, ETH_ALEN);
|
||||
DBG_88E("MAC Address from efuse error, assign default one !!!\n");
|
||||
}
|
||||
|
@ -1147,9 +1110,6 @@ void dump_ies(u8 *buf, u32 buf_len)
|
|||
len = *(pos+1);
|
||||
|
||||
DBG_88E("%s ID:%u, LEN:%u\n", __func__, id, len);
|
||||
#ifdef CONFIG_88EU_P2P
|
||||
dump_p2p_ie(pos, len);
|
||||
#endif
|
||||
dump_wps_ie(pos, len);
|
||||
|
||||
pos += (2 + len);
|
||||
|
@ -1170,217 +1130,13 @@ void dump_wps_ie(u8 *ie, u32 ie_len)
|
|||
|
||||
pos += 6;
|
||||
while (pos-ie < ie_len) {
|
||||
id = RTW_GET_BE16(pos);
|
||||
len = RTW_GET_BE16(pos + 2);
|
||||
id = get_unaligned_be16(pos);
|
||||
len = get_unaligned_be16(pos + 2);
|
||||
DBG_88E("%s ID:0x%04x, LEN:%u\n", __func__, id, len);
|
||||
pos += (4+len);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_88EU_P2P
|
||||
void dump_p2p_ie(u8 *ie, u32 ie_len)
|
||||
{
|
||||
u8 *pos = (u8 *)ie;
|
||||
u8 id;
|
||||
u16 len;
|
||||
u8 *p2p_ie;
|
||||
uint p2p_ielen;
|
||||
|
||||
p2p_ie = rtw_get_p2p_ie(ie, ie_len, NULL, &p2p_ielen);
|
||||
if (p2p_ie != ie || p2p_ielen == 0)
|
||||
return;
|
||||
|
||||
pos += 6;
|
||||
while (pos-ie < ie_len) {
|
||||
id = *pos;
|
||||
len = RTW_GET_LE16(pos+1);
|
||||
DBG_88E("%s ID:%u, LEN:%u\n", __func__, id, len);
|
||||
pos += (3+len);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* rtw_get_p2p_ie - Search P2P IE from a series of IEs
|
||||
* @in_ie: Address of IEs to search
|
||||
* @in_len: Length limit from in_ie
|
||||
* @p2p_ie: If not NULL and P2P IE is found, P2P IE will be copied to the buf starting from p2p_ie
|
||||
* @p2p_ielen: If not NULL and P2P IE is found, will set to the length of the entire P2P IE
|
||||
*
|
||||
* Returns: The address of the P2P IE found, or NULL
|
||||
*/
|
||||
u8 *rtw_get_p2p_ie(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_ielen)
|
||||
{
|
||||
uint cnt = 0;
|
||||
u8 *p2p_ie_ptr;
|
||||
u8 eid, p2p_oui[4] = {0x50, 0x6F, 0x9A, 0x09};
|
||||
|
||||
if (p2p_ielen != NULL)
|
||||
*p2p_ielen = 0;
|
||||
|
||||
while (cnt < in_len) {
|
||||
eid = in_ie[cnt];
|
||||
if ((in_len < 0) || (cnt > MAX_IE_SZ)) {
|
||||
dump_stack();
|
||||
return NULL;
|
||||
}
|
||||
if ((eid == _VENDOR_SPECIFIC_IE_) && (_rtw_memcmp(&in_ie[cnt+2], p2p_oui, 4) == true)) {
|
||||
p2p_ie_ptr = in_ie + cnt;
|
||||
|
||||
if (p2p_ie != NULL)
|
||||
memcpy(p2p_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
|
||||
if (p2p_ielen != NULL)
|
||||
*p2p_ielen = in_ie[cnt + 1] + 2;
|
||||
return p2p_ie_ptr;
|
||||
} else {
|
||||
cnt += in_ie[cnt + 1] + 2; /* goto next */
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* rtw_get_p2p_attr - Search a specific P2P attribute from a given P2P IE
|
||||
* @p2p_ie: Address of P2P IE to search
|
||||
* @p2p_ielen: Length limit from p2p_ie
|
||||
* @target_attr_id: The attribute ID of P2P attribute to search
|
||||
* @buf_attr: If not NULL and the P2P attribute is found, P2P attribute will be copied to the buf starting from buf_attr
|
||||
* @len_attr: If not NULL and the P2P attribute is found, will set to the length of the entire P2P attribute
|
||||
*
|
||||
* Returns: the address of the specific WPS attribute found, or NULL
|
||||
*/
|
||||
u8 *rtw_get_p2p_attr(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id , u8 *buf_attr, u32 *len_attr)
|
||||
{
|
||||
u8 *attr_ptr = NULL;
|
||||
u8 *target_attr_ptr = NULL;
|
||||
u8 p2p_oui[4] = {0x50, 0x6F, 0x9A, 0x09};
|
||||
|
||||
if (len_attr)
|
||||
*len_attr = 0;
|
||||
|
||||
if (!p2p_ie || (p2p_ie[0] != _VENDOR_SPECIFIC_IE_) ||
|
||||
(_rtw_memcmp(p2p_ie + 2, p2p_oui , 4) != true))
|
||||
return attr_ptr;
|
||||
|
||||
/* 6 = 1(Element ID) + 1(Length) + 3 (OUI) + 1(OUI Type) */
|
||||
attr_ptr = p2p_ie + 6; /* goto first attr */
|
||||
|
||||
while (attr_ptr - p2p_ie < p2p_ielen) {
|
||||
/* 3 = 1(Attribute ID) + 2(Length) */
|
||||
u8 attr_id = *attr_ptr;
|
||||
u16 attr_data_len = RTW_GET_LE16(attr_ptr + 1);
|
||||
u16 attr_len = attr_data_len + 3;
|
||||
|
||||
if (attr_id == target_attr_id) {
|
||||
target_attr_ptr = attr_ptr;
|
||||
|
||||
if (buf_attr)
|
||||
memcpy(buf_attr, attr_ptr, attr_len);
|
||||
if (len_attr)
|
||||
*len_attr = attr_len;
|
||||
break;
|
||||
} else {
|
||||
attr_ptr += attr_len; /* goto next */
|
||||
}
|
||||
}
|
||||
return target_attr_ptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* rtw_get_p2p_attr_content - Search a specific P2P attribute content from a given P2P IE
|
||||
* @p2p_ie: Address of P2P IE to search
|
||||
* @p2p_ielen: Length limit from p2p_ie
|
||||
* @target_attr_id: The attribute ID of P2P attribute to search
|
||||
* @buf_content: If not NULL and the P2P attribute is found, P2P attribute content will be copied to the buf starting from buf_content
|
||||
* @len_content: If not NULL and the P2P attribute is found, will set to the length of the P2P attribute content
|
||||
*
|
||||
* Returns: the address of the specific P2P attribute content found, or NULL
|
||||
*/
|
||||
u8 *rtw_get_p2p_attr_content(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id , u8 *buf_content, uint *len_content)
|
||||
{
|
||||
u8 *attr_ptr;
|
||||
u32 attr_len;
|
||||
|
||||
if (len_content)
|
||||
*len_content = 0;
|
||||
|
||||
attr_ptr = rtw_get_p2p_attr(p2p_ie, p2p_ielen, target_attr_id, NULL, &attr_len);
|
||||
|
||||
if (attr_ptr && attr_len) {
|
||||
if (buf_content)
|
||||
memcpy(buf_content, attr_ptr+3, attr_len-3);
|
||||
|
||||
if (len_content)
|
||||
*len_content = attr_len-3;
|
||||
|
||||
return attr_ptr+3;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
u32 rtw_set_p2p_attr_content(u8 *pbuf, u8 attr_id, u16 attr_len, u8 *pdata_attr)
|
||||
{
|
||||
u32 a_len;
|
||||
|
||||
*pbuf = attr_id;
|
||||
|
||||
/* u16*)(pbuf + 1) = cpu_to_le16(attr_len); */
|
||||
RTW_PUT_LE16(pbuf + 1, attr_len);
|
||||
|
||||
if (pdata_attr)
|
||||
memcpy(pbuf + 3, pdata_attr, attr_len);
|
||||
|
||||
a_len = attr_len + 3;
|
||||
|
||||
return a_len;
|
||||
}
|
||||
|
||||
static uint rtw_p2p_attr_remove(u8 *ie, uint ielen_ori, u8 attr_id)
|
||||
{
|
||||
u8 *target_attr;
|
||||
u32 target_attr_len;
|
||||
uint ielen = ielen_ori;
|
||||
|
||||
while (1) {
|
||||
target_attr = rtw_get_p2p_attr(ie, ielen, attr_id, NULL, &target_attr_len);
|
||||
if (target_attr && target_attr_len) {
|
||||
u8 *next_attr = target_attr+target_attr_len;
|
||||
uint remain_len = ielen-(next_attr-ie);
|
||||
|
||||
_rtw_memset(target_attr, 0, target_attr_len);
|
||||
memcpy(target_attr, next_attr, remain_len);
|
||||
_rtw_memset(target_attr+remain_len, 0, target_attr_len);
|
||||
*(ie+1) -= target_attr_len;
|
||||
ielen -= target_attr_len;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ielen;
|
||||
}
|
||||
|
||||
void rtw_wlan_bssid_ex_remove_p2p_attr(struct wlan_bssid_ex *bss_ex, u8 attr_id)
|
||||
{
|
||||
u8 *p2p_ie;
|
||||
uint p2p_ielen, p2p_ielen_ori;
|
||||
|
||||
p2p_ie = rtw_get_p2p_ie(bss_ex->IEs+_FIXED_IE_LENGTH_, bss_ex->IELength-_FIXED_IE_LENGTH_, NULL, &p2p_ielen_ori);
|
||||
if (p2p_ie) {
|
||||
p2p_ielen = rtw_p2p_attr_remove(p2p_ie, p2p_ielen_ori, attr_id);
|
||||
if (p2p_ielen != p2p_ielen_ori) {
|
||||
u8 *next_ie_ori = p2p_ie+p2p_ielen_ori;
|
||||
u8 *next_ie = p2p_ie+p2p_ielen;
|
||||
uint remain_len = bss_ex->IELength-(next_ie_ori-bss_ex->IEs);
|
||||
|
||||
memcpy(next_ie, next_ie_ori, remain_len);
|
||||
_rtw_memset(next_ie+remain_len, 0, p2p_ielen_ori-p2p_ielen);
|
||||
bss_ex->IELength -= p2p_ielen_ori-p2p_ielen;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_88EU_P2P */
|
||||
|
||||
/* Baron adds to avoid FreeBSD warning */
|
||||
int ieee80211_is_empty_essid(const char *essid, int essid_len)
|
||||
{
|
||||
|
|
329
core/rtw_io.c
329
core/rtw_io.c
|
@ -1,329 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
/*
|
||||
|
||||
The purpose of rtw_io.c
|
||||
|
||||
a. provides the API
|
||||
|
||||
b. provides the protocol engine
|
||||
|
||||
c. provides the software interface between caller and the hardware interface
|
||||
|
||||
|
||||
Compiler Flag Option:
|
||||
|
||||
USB:
|
||||
a. USE_ASYNC_IRP: Both sync/async operations are provided.
|
||||
|
||||
Only sync read/rtw_write_mem operations are provided.
|
||||
|
||||
jackson@realtek.com.tw
|
||||
|
||||
*/
|
||||
|
||||
#define _RTW_IO_C_
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <rtw_io.h>
|
||||
#include <osdep_intf.h>
|
||||
#include <usb_ops.h>
|
||||
|
||||
#define rtw_le16_to_cpu(val) le16_to_cpu(val)
|
||||
#define rtw_le32_to_cpu(val) le32_to_cpu(val)
|
||||
#define rtw_cpu_to_le16(val) cpu_to_le16(val)
|
||||
#define rtw_cpu_to_le32(val) cpu_to_le32(val)
|
||||
|
||||
|
||||
u8 _rtw_read8(struct adapter *adapter, u32 addr)
|
||||
{
|
||||
u8 r_val;
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
|
||||
_func_enter_;
|
||||
_read8 = pintfhdl->io_ops._read8;
|
||||
r_val = _read8(pintfhdl, addr);
|
||||
_func_exit_;
|
||||
return r_val;
|
||||
}
|
||||
|
||||
u16 _rtw_read16(struct adapter *adapter, u32 addr)
|
||||
{
|
||||
u16 r_val;
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
_func_enter_;
|
||||
_read16 = pintfhdl->io_ops._read16;
|
||||
|
||||
r_val = _read16(pintfhdl, addr);
|
||||
_func_exit_;
|
||||
return r_val;
|
||||
}
|
||||
|
||||
u32 _rtw_read32(struct adapter *adapter, u32 addr)
|
||||
{
|
||||
u32 r_val;
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
_func_enter_;
|
||||
_read32 = pintfhdl->io_ops._read32;
|
||||
|
||||
r_val = _read32(pintfhdl, addr);
|
||||
_func_exit_;
|
||||
return r_val;
|
||||
}
|
||||
|
||||
int _rtw_write8(struct adapter *adapter, u32 addr, u8 val)
|
||||
{
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
|
||||
int ret;
|
||||
_func_enter_;
|
||||
_write8 = pintfhdl->io_ops._write8;
|
||||
|
||||
ret = _write8(pintfhdl, addr, val);
|
||||
_func_exit_;
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
int _rtw_write16(struct adapter *adapter, u32 addr, u16 val)
|
||||
{
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
|
||||
int ret;
|
||||
_func_enter_;
|
||||
_write16 = pintfhdl->io_ops._write16;
|
||||
|
||||
ret = _write16(pintfhdl, addr, val);
|
||||
_func_exit_;
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
int _rtw_write32(struct adapter *adapter, u32 addr, u32 val)
|
||||
{
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
|
||||
int ret;
|
||||
_func_enter_;
|
||||
_write32 = pintfhdl->io_ops._write32;
|
||||
|
||||
ret = _write32(pintfhdl, addr, val);
|
||||
_func_exit_;
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
int _rtw_writeN(struct adapter *adapter, u32 addr , u32 length , u8 *pdata)
|
||||
{
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = (struct intf_hdl *)(&(pio_priv->intf));
|
||||
int (*_writeN)(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata);
|
||||
int ret;
|
||||
_func_enter_;
|
||||
_writeN = pintfhdl->io_ops._writeN;
|
||||
|
||||
ret = _writeN(pintfhdl, addr, length, pdata);
|
||||
_func_exit_;
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
int _rtw_write8_async(struct adapter *adapter, u32 addr, u8 val)
|
||||
{
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write8_async)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
|
||||
int ret;
|
||||
_func_enter_;
|
||||
_write8_async = pintfhdl->io_ops._write8_async;
|
||||
|
||||
ret = _write8_async(pintfhdl, addr, val);
|
||||
_func_exit_;
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
int _rtw_write16_async(struct adapter *adapter, u32 addr, u16 val)
|
||||
{
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write16_async)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
|
||||
int ret;
|
||||
|
||||
_func_enter_;
|
||||
_write16_async = pintfhdl->io_ops._write16_async;
|
||||
ret = _write16_async(pintfhdl, addr, val);
|
||||
_func_exit_;
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
int _rtw_write32_async(struct adapter *adapter, u32 addr, u32 val)
|
||||
{
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write32_async)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
|
||||
int ret;
|
||||
|
||||
_func_enter_;
|
||||
_write32_async = pintfhdl->io_ops._write32_async;
|
||||
ret = _write32_async(pintfhdl, addr, val);
|
||||
_func_exit_;
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
void _rtw_read_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
{
|
||||
void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
|
||||
_func_enter_;
|
||||
if (adapter->bDriverStopped || adapter->bSurpriseRemoved) {
|
||||
RT_TRACE(_module_rtl871x_io_c_, _drv_info_,
|
||||
("rtw_read_mem:bDriverStopped(%d) OR bSurpriseRemoved(%d)",
|
||||
adapter->bDriverStopped, adapter->bSurpriseRemoved));
|
||||
return;
|
||||
}
|
||||
_read_mem = pintfhdl->io_ops._read_mem;
|
||||
_read_mem(pintfhdl, addr, cnt, pmem);
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
void _rtw_write_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
{
|
||||
void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
|
||||
_func_enter_;
|
||||
|
||||
_write_mem = pintfhdl->io_ops._write_mem;
|
||||
|
||||
_write_mem(pintfhdl, addr, cnt, pmem);
|
||||
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
void _rtw_read_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
{
|
||||
u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
|
||||
_func_enter_;
|
||||
|
||||
if (adapter->bDriverStopped || adapter->bSurpriseRemoved) {
|
||||
RT_TRACE(_module_rtl871x_io_c_, _drv_info_,
|
||||
("rtw_read_port:bDriverStopped(%d) OR bSurpriseRemoved(%d)",
|
||||
adapter->bDriverStopped, adapter->bSurpriseRemoved));
|
||||
return;
|
||||
}
|
||||
|
||||
_read_port = pintfhdl->io_ops._read_port;
|
||||
|
||||
_read_port(pintfhdl, addr, cnt, pmem);
|
||||
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
void _rtw_read_port_cancel(struct adapter *adapter)
|
||||
{
|
||||
void (*_read_port_cancel)(struct intf_hdl *pintfhdl);
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
|
||||
_read_port_cancel = pintfhdl->io_ops._read_port_cancel;
|
||||
|
||||
if (_read_port_cancel)
|
||||
_read_port_cancel(pintfhdl);
|
||||
}
|
||||
|
||||
u32 _rtw_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
{
|
||||
u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u32 ret = _SUCCESS;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
_write_port = pintfhdl->io_ops._write_port;
|
||||
|
||||
ret = _write_port(pintfhdl, addr, cnt, pmem);
|
||||
|
||||
_func_exit_;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 _rtw_write_port_and_wait(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem, int timeout_ms)
|
||||
{
|
||||
int ret = _SUCCESS;
|
||||
struct xmit_buf *pxmitbuf = (struct xmit_buf *)pmem;
|
||||
struct submit_ctx sctx;
|
||||
|
||||
rtw_sctx_init(&sctx, timeout_ms);
|
||||
pxmitbuf->sctx = &sctx;
|
||||
|
||||
ret = _rtw_write_port(adapter, addr, cnt, pmem);
|
||||
|
||||
if (ret == _SUCCESS)
|
||||
ret = rtw_sctx_wait(&sctx);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void _rtw_write_port_cancel(struct adapter *adapter)
|
||||
{
|
||||
void (*_write_port_cancel)(struct intf_hdl *pintfhdl);
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
|
||||
_write_port_cancel = pintfhdl->io_ops._write_port_cancel;
|
||||
|
||||
if (_write_port_cancel)
|
||||
_write_port_cancel(pintfhdl);
|
||||
}
|
||||
|
||||
int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct _io_ops *pops))
|
||||
{
|
||||
struct io_priv *piopriv = &padapter->iopriv;
|
||||
struct intf_hdl *pintf = &piopriv->intf;
|
||||
|
||||
if (set_intf_ops == NULL)
|
||||
return _FAIL;
|
||||
|
||||
piopriv->padapter = padapter;
|
||||
pintf->padapter = padapter;
|
||||
pintf->pintf_dev = adapter_to_dvobj(padapter);
|
||||
|
||||
set_intf_ops(&pintf->io_ops);
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
|
@ -25,9 +25,6 @@
|
|||
#include <rtw_ioctl_set.h>
|
||||
#include <hal_intf.h>
|
||||
|
||||
#include <usb_osintf.h>
|
||||
#include <usb_ops.h>
|
||||
|
||||
extern void indicate_wx_scan_complete_event(struct adapter *padapter);
|
||||
|
||||
#define IS_MAC_ADDRESS_BROADCAST(addr) \
|
||||
|
@ -37,49 +34,18 @@ extern void indicate_wx_scan_complete_event(struct adapter *padapter);
|
|||
(addr[4] == 0xff) && (addr[5] == 0xff)) ? true : false \
|
||||
)
|
||||
|
||||
u8 rtw_validate_ssid(struct ndis_802_11_ssid *ssid)
|
||||
{
|
||||
u8 i;
|
||||
u8 ret = true;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
if (ssid->SsidLength > 32) {
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("ssid length >32\n"));
|
||||
ret = false;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
for (i = 0; i < ssid->SsidLength; i++) {
|
||||
/* wifi, printable ascii code must be supported */
|
||||
if (!((ssid->Ssid[i] >= 0x20) && (ssid->Ssid[i] <= 0x7e))) {
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("ssid has nonprintabl ascii\n"));
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
_func_exit_;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
u8 rtw_do_join(struct adapter *padapter)
|
||||
{
|
||||
unsigned long irqL;
|
||||
struct list_head *plist, *phead;
|
||||
u8 *pibss = NULL;
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
struct __queue *queue = &(pmlmepriv->scanned_queue);
|
||||
u8 ret = _SUCCESS;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
_enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
|
||||
spin_lock_bh(&(pmlmepriv->scanned_queue.lock));
|
||||
phead = get_list_head(queue);
|
||||
plist = get_next(phead);
|
||||
plist = phead->next;
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, ("\n rtw_do_join: phead = %p; plist = %p\n\n\n", phead, plist));
|
||||
|
||||
|
@ -91,8 +57,8 @@ _func_enter_;
|
|||
|
||||
pmlmepriv->to_join = true;
|
||||
|
||||
if (_rtw_queue_empty(queue)) {
|
||||
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
|
||||
if (list_empty(&queue->queue)) {
|
||||
spin_unlock_bh(&(pmlmepriv->scanned_queue.lock));
|
||||
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
|
||||
|
||||
/* when set_ssid/set_bssid for rtw_do_join(), but scanning queue is empty */
|
||||
|
@ -116,7 +82,7 @@ _func_enter_;
|
|||
} else {
|
||||
int select_ret;
|
||||
|
||||
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
|
||||
spin_unlock_bh(&(pmlmepriv->scanned_queue.lock));
|
||||
select_ret = rtw_select_and_join_from_scanned_queue(pmlmepriv);
|
||||
if (select_ret == _SUCCESS) {
|
||||
pmlmepriv->to_join = false;
|
||||
|
@ -132,7 +98,6 @@ _func_enter_;
|
|||
|
||||
pibss = padapter->registrypriv.dev_network.MacAddress;
|
||||
|
||||
_rtw_memset(&pdev_network->Ssid, 0, sizeof(struct ndis_802_11_ssid));
|
||||
memcpy(&pdev_network->Ssid, &pmlmepriv->assoc_ssid, sizeof(struct ndis_802_11_ssid));
|
||||
|
||||
rtw_update_registrypriv_dev_network(padapter);
|
||||
|
@ -171,19 +136,16 @@ _func_enter_;
|
|||
|
||||
exit:
|
||||
|
||||
_func_exit_;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid)
|
||||
{
|
||||
unsigned long irqL;
|
||||
u8 status = _SUCCESS;
|
||||
u32 cur_time = 0;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
DBG_88E_LEVEL(_drv_info_, "set bssid:%pM\n", bssid);
|
||||
|
||||
|
@ -195,7 +157,7 @@ _func_enter_;
|
|||
goto exit;
|
||||
}
|
||||
|
||||
_enter_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
spin_lock_bh(&pmlmepriv->lock);
|
||||
|
||||
|
||||
DBG_88E("Set BSSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv));
|
||||
|
@ -207,7 +169,7 @@ _func_enter_;
|
|||
if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) {
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, ("set_bssid: _FW_LINKED||WIFI_ADHOC_MASTER_STATE\n"));
|
||||
|
||||
if (_rtw_memcmp(&pmlmepriv->cur_network.network.MacAddress, bssid, ETH_ALEN)) {
|
||||
if (!memcmp(&pmlmepriv->cur_network.network.MacAddress, bssid, ETH_ALEN)) {
|
||||
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == false)
|
||||
goto release_mlme_lock;/* it means driver is in WIFI_ADHOC_MASTER_STATE, we needn't create bss again. */
|
||||
} else {
|
||||
|
@ -233,7 +195,7 @@ handle_tkip_countermeasure:
|
|||
/* should we add something here...? */
|
||||
|
||||
if (padapter->securitypriv.btkip_countermeasure) {
|
||||
cur_time = rtw_get_current_time();
|
||||
cur_time = jiffies;
|
||||
|
||||
if ((cur_time - padapter->securitypriv.btkip_countermeasure_time) > 60 * HZ) {
|
||||
padapter->securitypriv.btkip_countermeasure = false;
|
||||
|
@ -253,27 +215,24 @@ handle_tkip_countermeasure:
|
|||
status = rtw_do_join(padapter);
|
||||
|
||||
release_mlme_lock:
|
||||
_exit_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
spin_unlock_bh(&pmlmepriv->lock);
|
||||
|
||||
exit:
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("rtw_set_802_11_bssid: status=%d\n", status));
|
||||
|
||||
_func_exit_;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid)
|
||||
{
|
||||
unsigned long irqL;
|
||||
u8 status = _SUCCESS;
|
||||
u32 cur_time = 0;
|
||||
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct wlan_network *pnetwork = &pmlmepriv->cur_network;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
DBG_88E_LEVEL(_drv_info_, "set ssid [%s] fw_state=0x%08x\n",
|
||||
ssid->Ssid, get_fwstate(pmlmepriv));
|
||||
|
@ -285,21 +244,20 @@ _func_enter_;
|
|||
goto exit;
|
||||
}
|
||||
|
||||
_enter_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
spin_lock_bh(&pmlmepriv->lock);
|
||||
|
||||
DBG_88E("Set SSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv));
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) {
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
|
||||
goto handle_tkip_countermeasure;
|
||||
} else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) {
|
||||
else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true)
|
||||
goto release_mlme_lock;
|
||||
}
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) {
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
("set_ssid: _FW_LINKED||WIFI_ADHOC_MASTER_STATE\n"));
|
||||
|
||||
if ((pmlmepriv->assoc_ssid.SsidLength == ssid->SsidLength) &&
|
||||
(_rtw_memcmp(&pmlmepriv->assoc_ssid.Ssid, ssid->Ssid, ssid->SsidLength))) {
|
||||
(!memcmp(&pmlmepriv->assoc_ssid.Ssid, ssid->Ssid, ssid->SsidLength))) {
|
||||
if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == false)) {
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("Set SSID is the same ssid, fw_state = 0x%08x\n",
|
||||
|
@ -346,7 +304,7 @@ _func_enter_;
|
|||
handle_tkip_countermeasure:
|
||||
|
||||
if (padapter->securitypriv.btkip_countermeasure) {
|
||||
cur_time = rtw_get_current_time();
|
||||
cur_time = jiffies;
|
||||
|
||||
if ((cur_time - padapter->securitypriv.btkip_countermeasure_time) > 60 * HZ) {
|
||||
padapter->securitypriv.btkip_countermeasure = false;
|
||||
|
@ -360,38 +318,34 @@ handle_tkip_countermeasure:
|
|||
memcpy(&pmlmepriv->assoc_ssid, ssid, sizeof(struct ndis_802_11_ssid));
|
||||
pmlmepriv->assoc_by_bssid = false;
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) {
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
|
||||
pmlmepriv->to_join = true;
|
||||
} else {
|
||||
else
|
||||
status = rtw_do_join(padapter);
|
||||
}
|
||||
|
||||
release_mlme_lock:
|
||||
_exit_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
spin_unlock_bh(&pmlmepriv->lock);
|
||||
|
||||
exit:
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("-rtw_set_802_11_ssid: status =%d\n", status));
|
||||
_func_exit_;
|
||||
return status;
|
||||
}
|
||||
|
||||
u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter,
|
||||
enum ndis_802_11_network_infra networktype)
|
||||
{
|
||||
unsigned long irqL;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct wlan_network *cur_network = &pmlmepriv->cur_network;
|
||||
enum ndis_802_11_network_infra *pold_state = &(cur_network->network.InfrastructureMode);
|
||||
|
||||
_func_enter_;
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_notice_,
|
||||
("+rtw_set_802_11_infrastructure_mode: old =%d new =%d fw_state = 0x%08x\n",
|
||||
*pold_state, networktype, get_fwstate(pmlmepriv)));
|
||||
|
||||
if (*pold_state != networktype) {
|
||||
_enter_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
spin_lock_bh(&pmlmepriv->lock);
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, (" change mode!"));
|
||||
/* DBG_88E("change mode, old_mode =%d, new_mode =%d, fw_state = 0x%x\n", *pold_state, networktype, get_fwstate(pmlmepriv)); */
|
||||
|
@ -415,7 +369,7 @@ _func_enter_;
|
|||
|
||||
if ((*pold_state == Ndis802_11Infrastructure) || (*pold_state == Ndis802_11IBSS)) {
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
|
||||
rtw_indicate_disconnect(padapter); /* will clr Linked_state; before this function, we must have chked whether issue dis-assoc_cmd or not */
|
||||
rtw_indicate_disconnect(padapter); /* will clr Linked_state; before this function, we must have checked whether issue dis-assoc_cmd or not */
|
||||
}
|
||||
|
||||
*pold_state = networktype;
|
||||
|
@ -439,10 +393,9 @@ _func_enter_;
|
|||
case Ndis802_11InfrastructureMax:
|
||||
break;
|
||||
}
|
||||
_exit_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
spin_unlock_bh(&pmlmepriv->lock);
|
||||
}
|
||||
|
||||
_func_exit_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -450,12 +403,10 @@ _func_exit_;
|
|||
|
||||
u8 rtw_set_802_11_disassociate(struct adapter *padapter)
|
||||
{
|
||||
unsigned long irqL;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
_enter_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
spin_lock_bh(&pmlmepriv->lock);
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
|
@ -467,20 +418,17 @@ _func_enter_;
|
|||
rtw_pwr_wakeup(padapter);
|
||||
}
|
||||
|
||||
_exit_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
spin_unlock_bh(&pmlmepriv->lock);
|
||||
|
||||
_func_exit_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_ssid *pssid, int ssid_max_num)
|
||||
{
|
||||
unsigned long irqL;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
u8 res = true;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("+rtw_set_802_11_bssid_list_scan(), fw_state =%x\n", get_fwstate(pmlmepriv)));
|
||||
|
||||
|
@ -500,11 +448,12 @@ _func_enter_;
|
|||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("rtw_set_802_11_bssid_list_scan fail since fw_state = %x\n", get_fwstate(pmlmepriv)));
|
||||
res = true;
|
||||
|
||||
if (check_fwstate(pmlmepriv, (_FW_UNDER_SURVEY|_FW_UNDER_LINKING)) == true) {
|
||||
if (check_fwstate(pmlmepriv,
|
||||
(_FW_UNDER_SURVEY|_FW_UNDER_LINKING)) == true)
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("\n###_FW_UNDER_SURVEY|_FW_UNDER_LINKING\n\n"));
|
||||
} else {
|
||||
else
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("\n###pmlmepriv->sitesurveyctrl.traffic_busy == true\n\n"));
|
||||
}
|
||||
|
||||
} else {
|
||||
if (rtw_is_scan_deny(padapter)) {
|
||||
DBG_88E(FUNC_ADPT_FMT": scan deny\n", FUNC_ADPT_ARG(padapter));
|
||||
|
@ -512,15 +461,14 @@ _func_enter_;
|
|||
return _SUCCESS;
|
||||
}
|
||||
|
||||
_enter_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
spin_lock_bh(&pmlmepriv->lock);
|
||||
|
||||
res = rtw_sitesurvey_cmd(padapter, pssid, ssid_max_num, NULL, 0);
|
||||
|
||||
_exit_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
spin_unlock_bh(&pmlmepriv->lock);
|
||||
}
|
||||
exit:
|
||||
|
||||
_func_exit_;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -531,7 +479,6 @@ u8 rtw_set_802_11_authentication_mode(struct adapter *padapter, enum ndis_802_11
|
|||
int res;
|
||||
u8 ret;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, ("set_802_11_auth.mode(): mode =%x\n", authmode));
|
||||
|
||||
|
@ -551,7 +498,6 @@ _func_enter_;
|
|||
else
|
||||
ret = false;
|
||||
|
||||
_func_exit_;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -562,7 +508,6 @@ u8 rtw_set_802_11_add_wep(struct adapter *padapter, struct ndis_802_11_wep *wep)
|
|||
struct security_priv *psecuritypriv = &(padapter->securitypriv);
|
||||
u8 ret = _SUCCESS;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
keyid = wep->KeyIndex & 0x3fffffff;
|
||||
|
||||
|
@ -587,7 +532,7 @@ _func_enter_;
|
|||
break;
|
||||
}
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
("rtw_set_802_11_add_wep:befor memcpy, wep->KeyLength = 0x%x wep->KeyIndex = 0x%x keyid =%x\n",
|
||||
("rtw_set_802_11_add_wep:before memcpy, wep->KeyLength = 0x%x wep->KeyIndex = 0x%x keyid =%x\n",
|
||||
wep->KeyLength, wep->KeyIndex, keyid));
|
||||
|
||||
memcpy(&(psecuritypriv->dot11DefKey[keyid].skey[0]), &(wep->KeyMaterial), wep->KeyLength);
|
||||
|
@ -617,428 +562,6 @@ _func_enter_;
|
|||
if (res == _FAIL)
|
||||
ret = false;
|
||||
exit:
|
||||
_func_exit_;
|
||||
return ret;
|
||||
}
|
||||
|
||||
u8 rtw_set_802_11_remove_wep(struct adapter *padapter, u32 keyindex)
|
||||
{
|
||||
u8 ret = _SUCCESS;
|
||||
|
||||
_func_enter_;
|
||||
if (keyindex >= 0x80000000 || padapter == NULL) {
|
||||
ret = false;
|
||||
goto exit;
|
||||
} else {
|
||||
int res;
|
||||
struct security_priv *psecuritypriv = &(padapter->securitypriv);
|
||||
if (keyindex < 4) {
|
||||
_rtw_memset(&psecuritypriv->dot11DefKey[keyindex], 0, 16);
|
||||
res = rtw_set_key(padapter, psecuritypriv, keyindex, 0);
|
||||
psecuritypriv->dot11DefKeylen[keyindex] = 0;
|
||||
if (res == _FAIL)
|
||||
ret = _FAIL;
|
||||
} else {
|
||||
ret = _FAIL;
|
||||
}
|
||||
}
|
||||
exit:
|
||||
|
||||
_func_exit_;
|
||||
return ret;
|
||||
}
|
||||
|
||||
u8 rtw_set_802_11_add_key(struct adapter *padapter, struct ndis_802_11_key *key)
|
||||
{
|
||||
uint encryptionalgo;
|
||||
u8 *pbssid;
|
||||
struct sta_info *stainfo;
|
||||
u8 bgroup = false;
|
||||
u8 bgrouptkey = false;/* can be removed later */
|
||||
u8 ret = _SUCCESS;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
if (((key->KeyIndex & 0x80000000) == 0) && ((key->KeyIndex & 0x40000000) > 0)) {
|
||||
/* It is invalid to clear bit 31 and set bit 30. If the miniport driver encounters this combination, */
|
||||
/* it must fail the request and return NDIS_STATUS_INVALID_DATA. */
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
("rtw_set_802_11_add_key: ((key->KeyIndex & 0x80000000)==0)[=%d]",
|
||||
(int)(key->KeyIndex & 0x80000000) == 0));
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
("rtw_set_802_11_add_key:((key->KeyIndex & 0x40000000)>0)[=%d]",
|
||||
(int)(key->KeyIndex & 0x40000000) > 0));
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
("rtw_set_802_11_add_key: key->KeyIndex=%d\n",
|
||||
(int)key->KeyIndex));
|
||||
ret = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (key->KeyIndex & 0x40000000) {
|
||||
/* Pairwise key */
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("OID_802_11_ADD_KEY: +++++ Pairwise key +++++\n"));
|
||||
|
||||
pbssid = get_bssid(&padapter->mlmepriv);
|
||||
stainfo = rtw_get_stainfo(&padapter->stapriv, pbssid);
|
||||
|
||||
if ((stainfo != NULL) && (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)) {
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("OID_802_11_ADD_KEY:(stainfo!=NULL)&&(Adapter->securitypriv.dot11AuthAlgrthm==dot11AuthAlgrthm_8021X)\n"));
|
||||
encryptionalgo = stainfo->dot118021XPrivacy;
|
||||
} else {
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("OID_802_11_ADD_KEY: stainfo == NULL)||(Adapter->securitypriv.dot11AuthAlgrthm!= dot11AuthAlgrthm_8021X)\n"));
|
||||
encryptionalgo = padapter->securitypriv.dot11PrivacyAlgrthm;
|
||||
}
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("rtw_set_802_11_add_key: (encryptionalgo==%d)!\n",
|
||||
encryptionalgo));
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("rtw_set_802_11_add_key: (Adapter->securitypriv.dot11PrivacyAlgrthm==%d)!\n",
|
||||
padapter->securitypriv.dot11PrivacyAlgrthm));
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("rtw_set_802_11_add_key: (Adapter->securitypriv.dot11AuthAlgrthm==%d)!\n",
|
||||
padapter->securitypriv.dot11AuthAlgrthm));
|
||||
|
||||
if ((stainfo != NULL))
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("rtw_set_802_11_add_key: (stainfo->dot118021XPrivacy==%d)!\n",
|
||||
stainfo->dot118021XPrivacy));
|
||||
|
||||
if (key->KeyIndex & 0x000000FF) {
|
||||
/* The key index is specified in the lower 8 bits by values of zero to 255. */
|
||||
/* The key index should be set to zero for a Pairwise key, and the driver should fail with */
|
||||
/* NDIS_STATUS_INVALID_DATA if the lower 8 bits is not zero */
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, (" key->KeyIndex & 0x000000FF.\n"));
|
||||
ret = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* check BSSID */
|
||||
if (IS_MAC_ADDRESS_BROADCAST(key->BSSID) == true) {
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("MacAddr_isBcst(key->BSSID)\n"));
|
||||
ret = false;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Check key length for TKIP. */
|
||||
if ((encryptionalgo == _TKIP_) && (key->KeyLength != 32)) {
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("TKIP KeyLength:0x%x != 32\n", key->KeyLength));
|
||||
ret = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Check key length for AES. */
|
||||
if ((encryptionalgo == _AES_) && (key->KeyLength != 16)) {
|
||||
/* For our supplicant, EAPPkt9x.vxd, cannot differentiate TKIP and AES case. */
|
||||
if (key->KeyLength == 32) {
|
||||
key->KeyLength = 16;
|
||||
} else {
|
||||
ret = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check key length for WEP. For NDTEST, 2005.01.27, by rcnjko. */
|
||||
if ((encryptionalgo == _WEP40_ || encryptionalgo == _WEP104_) &&
|
||||
(key->KeyLength != 5 && key->KeyLength != 13)) {
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("WEP KeyLength:0x%x != 5 or 13\n", key->KeyLength));
|
||||
ret = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
bgroup = false;
|
||||
|
||||
/* Check the pairwise key. Added by Annie, 2005-07-06. */
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("------------------------------------------\n"));
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("[Pairwise Key set]\n"));
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("------------------------------------------\n"));
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("key index: 0x%8x(0x%8x)\n", key->KeyIndex, (key->KeyIndex&0x3)));
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("key Length: %d\n", key->KeyLength));
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("------------------------------------------\n"));
|
||||
|
||||
} else {
|
||||
/* Group key - KeyIndex(BIT30 == 0) */
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("OID_802_11_ADD_KEY: +++++ Group key +++++\n"));
|
||||
|
||||
|
||||
/* when add wep key through add key and didn't assigned encryption type before */
|
||||
if ((padapter->securitypriv.ndisauthtype <= 3) &&
|
||||
(padapter->securitypriv.dot118021XGrpPrivacy == 0)) {
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("keylen =%d(Adapter->securitypriv.dot11PrivacyAlgrthm=%x )padapter->securitypriv.dot118021XGrpPrivacy(%x)\n",
|
||||
key->KeyLength, padapter->securitypriv.dot11PrivacyAlgrthm,
|
||||
padapter->securitypriv.dot118021XGrpPrivacy));
|
||||
switch (key->KeyLength) {
|
||||
case 5:
|
||||
padapter->securitypriv.dot11PrivacyAlgrthm = _WEP40_;
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("Adapter->securitypriv.dot11PrivacyAlgrthm=%x key->KeyLength=%u\n",
|
||||
padapter->securitypriv.dot11PrivacyAlgrthm, key->KeyLength));
|
||||
break;
|
||||
case 13:
|
||||
padapter->securitypriv.dot11PrivacyAlgrthm = _WEP104_;
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("Adapter->securitypriv.dot11PrivacyAlgrthm=%x key->KeyLength=%u\n",
|
||||
padapter->securitypriv.dot11PrivacyAlgrthm, key->KeyLength));
|
||||
break;
|
||||
default:
|
||||
padapter->securitypriv.dot11PrivacyAlgrthm = _NO_PRIVACY_;
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("Adapter->securitypriv.dot11PrivacyAlgrthm=%x key->KeyLength=%u\n",
|
||||
padapter->securitypriv.dot11PrivacyAlgrthm, key->KeyLength));
|
||||
break;
|
||||
}
|
||||
|
||||
encryptionalgo = padapter->securitypriv.dot11PrivacyAlgrthm;
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
(" Adapter->securitypriv.dot11PrivacyAlgrthm=%x\n",
|
||||
padapter->securitypriv.dot11PrivacyAlgrthm));
|
||||
|
||||
} else {
|
||||
encryptionalgo = padapter->securitypriv.dot118021XGrpPrivacy;
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("(Adapter->securitypriv.dot11PrivacyAlgrthm=%x)encryptionalgo(%x)=padapter->securitypriv.dot118021XGrpPrivacy(%x)keylen=%d\n",
|
||||
padapter->securitypriv.dot11PrivacyAlgrthm, encryptionalgo,
|
||||
padapter->securitypriv.dot118021XGrpPrivacy, key->KeyLength));
|
||||
}
|
||||
|
||||
if ((check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE) == true) && (IS_MAC_ADDRESS_BROADCAST(key->BSSID) == false)) {
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
(" IBSS but BSSID is not Broadcast Address.\n"));
|
||||
ret = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Check key length for TKIP */
|
||||
if ((encryptionalgo == _TKIP_) && (key->KeyLength != 32)) {
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
(" TKIP GTK KeyLength:%u != 32\n", key->KeyLength));
|
||||
ret = _FAIL;
|
||||
goto exit;
|
||||
} else if (encryptionalgo == _AES_ && (key->KeyLength != 16 && key->KeyLength != 32)) {
|
||||
/* Check key length for AES */
|
||||
/* For NDTEST, we allow keylen = 32 in this case. 2005.01.27, by rcnjko. */
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("<=== SetInfo, OID_802_11_ADD_KEY: AES GTK KeyLength:%u != 16 or 32\n",
|
||||
key->KeyLength));
|
||||
ret = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Change the key length for EAPPkt9x.vxd. Added by Annie, 2005-11-03. */
|
||||
if ((encryptionalgo == _AES_) && (key->KeyLength == 32)) {
|
||||
key->KeyLength = 16;
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("AES key length changed: %u\n", key->KeyLength));
|
||||
}
|
||||
|
||||
if (key->KeyIndex & 0x8000000) {/* error ??? 0x8000_0000 */
|
||||
bgrouptkey = true;
|
||||
}
|
||||
|
||||
if ((check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE)) &&
|
||||
(check_fwstate(&padapter->mlmepriv, _FW_LINKED)))
|
||||
bgrouptkey = true;
|
||||
bgroup = true;
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("------------------------------------------\n"));
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("[Group Key set]\n"));
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("------------------------------------------\n")) ;
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("key index: 0x%8x(0x%8x)\n", key->KeyIndex, (key->KeyIndex&0x3)));
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("key Length: %d\n", key->KeyLength)) ;
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("------------------------------------------\n"));
|
||||
}
|
||||
|
||||
/* If WEP encryption algorithm, just call rtw_set_802_11_add_wep(). */
|
||||
if ((padapter->securitypriv.dot11AuthAlgrthm != dot11AuthAlgrthm_8021X) &&
|
||||
(encryptionalgo == _WEP40_ || encryptionalgo == _WEP104_)) {
|
||||
u32 keyindex;
|
||||
u32 len = FIELD_OFFSET(struct ndis_802_11_key, KeyMaterial) + key->KeyLength;
|
||||
struct ndis_802_11_wep *wep = &padapter->securitypriv.ndiswep;
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("OID_802_11_ADD_KEY: +++++ WEP key +++++\n"));
|
||||
|
||||
wep->Length = len;
|
||||
keyindex = key->KeyIndex&0x7fffffff;
|
||||
wep->KeyIndex = keyindex ;
|
||||
wep->KeyLength = key->KeyLength;
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("OID_802_11_ADD_KEY:Before memcpy\n"));
|
||||
|
||||
memcpy(wep->KeyMaterial, key->KeyMaterial, key->KeyLength);
|
||||
memcpy(&(padapter->securitypriv.dot11DefKey[keyindex].skey[0]), key->KeyMaterial, key->KeyLength);
|
||||
|
||||
padapter->securitypriv.dot11DefKeylen[keyindex] = key->KeyLength;
|
||||
padapter->securitypriv.dot11PrivacyKeyIndex = keyindex;
|
||||
|
||||
ret = rtw_set_802_11_add_wep(padapter, wep);
|
||||
goto exit;
|
||||
}
|
||||
if (key->KeyIndex & 0x20000000) {
|
||||
/* SetRSC */
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("OID_802_11_ADD_KEY: +++++ SetRSC+++++\n"));
|
||||
if (bgroup) {
|
||||
unsigned long long keysrc = key->KeyRSC & 0x00FFFFFFFFFFFFULL;
|
||||
memcpy(&padapter->securitypriv.dot11Grprxpn, &keysrc, 8);
|
||||
} else {
|
||||
unsigned long long keysrc = key->KeyRSC & 0x00FFFFFFFFFFFFULL;
|
||||
memcpy(&padapter->securitypriv.dot11Grptxpn, &keysrc, 8);
|
||||
}
|
||||
}
|
||||
|
||||
/* Indicate this key idx is used for TX */
|
||||
/* Save the key in KeyMaterial */
|
||||
if (bgroup) { /* Group transmit key */
|
||||
int res;
|
||||
|
||||
if (bgrouptkey)
|
||||
padapter->securitypriv.dot118021XGrpKeyid = (u8)key->KeyIndex;
|
||||
if ((key->KeyIndex&0x3) == 0) {
|
||||
ret = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
_rtw_memset(&padapter->securitypriv.dot118021XGrpKey[(u8)((key->KeyIndex) & 0x03)], 0, 16);
|
||||
_rtw_memset(&padapter->securitypriv.dot118021XGrptxmickey[(u8)((key->KeyIndex) & 0x03)], 0, 16);
|
||||
_rtw_memset(&padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)], 0, 16);
|
||||
|
||||
if ((key->KeyIndex & 0x10000000)) {
|
||||
memcpy(&padapter->securitypriv.dot118021XGrptxmickey[(u8)((key->KeyIndex) & 0x03)], key->KeyMaterial + 16, 8);
|
||||
memcpy(&padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)], key->KeyMaterial + 24, 8);
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("\n rtw_set_802_11_add_key:rx mic :0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x\n",
|
||||
padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)].skey[0],
|
||||
padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex-1) & 0x03)].skey[1],
|
||||
padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)].skey[2],
|
||||
padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex-1) & 0x03)].skey[3],
|
||||
padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)].skey[4],
|
||||
padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex-1) & 0x03)].skey[5],
|
||||
padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)].skey[6],
|
||||
padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex-1) & 0x03)].skey[7]));
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("\n rtw_set_802_11_add_key:set Group mic key!!!!!!!!\n"));
|
||||
} else {
|
||||
memcpy(&padapter->securitypriv.dot118021XGrptxmickey[(u8)((key->KeyIndex) & 0x03)], key->KeyMaterial + 24, 8);
|
||||
memcpy(&padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)], key->KeyMaterial + 16, 8);
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("\n rtw_set_802_11_add_key:rx mic :0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x\n",
|
||||
padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)].skey[0],
|
||||
padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex-1) & 0x03)].skey[1],
|
||||
padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)].skey[2],
|
||||
padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex-1) & 0x03)].skey[3],
|
||||
padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)].skey[4],
|
||||
padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex-1) & 0x03)].skey[5],
|
||||
padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)].skey[6],
|
||||
padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex-1) & 0x03)].skey[7]));
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("\n rtw_set_802_11_add_key:set Group mic key!!!!!!!!\n"));
|
||||
}
|
||||
|
||||
/* set group key by index */
|
||||
memcpy(&padapter->securitypriv.dot118021XGrpKey[(u8)((key->KeyIndex) & 0x03)], key->KeyMaterial, key->KeyLength);
|
||||
|
||||
key->KeyIndex = key->KeyIndex & 0x03;
|
||||
|
||||
padapter->securitypriv.binstallGrpkey = true;
|
||||
|
||||
padapter->securitypriv.bcheck_grpkey = false;
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("reset group key"));
|
||||
|
||||
res = rtw_set_key(padapter, &padapter->securitypriv, key->KeyIndex, 1);
|
||||
|
||||
if (res == _FAIL)
|
||||
ret = _FAIL;
|
||||
|
||||
goto exit;
|
||||
|
||||
} else { /* Pairwise Key */
|
||||
u8 res;
|
||||
|
||||
pbssid = get_bssid(&padapter->mlmepriv);
|
||||
stainfo = rtw_get_stainfo(&padapter->stapriv, pbssid);
|
||||
|
||||
if (stainfo != NULL) {
|
||||
_rtw_memset(&stainfo->dot118021x_UncstKey, 0, 16);/* clear keybuffer */
|
||||
|
||||
memcpy(&stainfo->dot118021x_UncstKey, key->KeyMaterial, 16);
|
||||
|
||||
if (encryptionalgo == _TKIP_) {
|
||||
padapter->securitypriv.busetkipkey = false;
|
||||
|
||||
/* _set_timer(&padapter->securitypriv.tkip_timer, 50); */
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("\n========== _set_timer\n"));
|
||||
|
||||
/* if TKIP, save the Receive/Transmit MIC key in KeyMaterial[128-255] */
|
||||
if ((key->KeyIndex & 0x10000000)) {
|
||||
memcpy(&stainfo->dot11tkiptxmickey, key->KeyMaterial + 16, 8);
|
||||
memcpy(&stainfo->dot11tkiprxmickey, key->KeyMaterial + 24, 8);
|
||||
|
||||
} else {
|
||||
memcpy(&stainfo->dot11tkiptxmickey, key->KeyMaterial + 24, 8);
|
||||
memcpy(&stainfo->dot11tkiprxmickey, key->KeyMaterial + 16, 8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Set key to CAM through H2C command */
|
||||
if (bgrouptkey) { /* never go to here */
|
||||
res = rtw_setstakey_cmd(padapter, (unsigned char *)stainfo, false);
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("\n rtw_set_802_11_add_key:rtw_setstakey_cmd(group)\n"));
|
||||
} else {
|
||||
res = rtw_setstakey_cmd(padapter, (unsigned char *)stainfo, true);
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("\n rtw_set_802_11_add_key:rtw_setstakey_cmd(unicast)\n"));
|
||||
}
|
||||
if (!res)
|
||||
ret = _FAIL;
|
||||
}
|
||||
}
|
||||
exit:
|
||||
|
||||
_func_exit_;
|
||||
return ret;
|
||||
}
|
||||
|
||||
u8 rtw_set_802_11_remove_key(struct adapter *padapter, struct ndis_802_11_remove_key *key)
|
||||
{
|
||||
u8 *pbssid;
|
||||
struct sta_info *stainfo;
|
||||
u8 bgroup = (key->KeyIndex & 0x4000000) > 0 ? false : true;
|
||||
u8 keyIndex = (u8)key->KeyIndex & 0x03;
|
||||
u8 ret = _SUCCESS;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
if ((key->KeyIndex & 0xbffffffc) > 0) {
|
||||
ret = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (bgroup) {
|
||||
/* clear group key by index */
|
||||
|
||||
_rtw_memset(&padapter->securitypriv.dot118021XGrpKey[keyIndex], 0, 16);
|
||||
|
||||
/* \todo Send a H2C Command to Firmware for removing this Key in CAM Entry. */
|
||||
} else {
|
||||
pbssid = get_bssid(&padapter->mlmepriv);
|
||||
stainfo = rtw_get_stainfo(&padapter->stapriv, pbssid);
|
||||
if (stainfo) {
|
||||
/* clear key by BSSID */
|
||||
_rtw_memset(&stainfo->dot118021x_UncstKey, 0, 16);
|
||||
|
||||
/* \todo Send a H2C Command to Firmware for disable this Key in CAM Entry. */
|
||||
} else {
|
||||
ret = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
exit:
|
||||
|
||||
_func_exit_;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1109,36 +632,6 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter)
|
|||
return max_rate;
|
||||
}
|
||||
|
||||
/*
|
||||
* rtw_set_scan_mode -
|
||||
* @adapter: pointer to struct adapter structure
|
||||
* @scan_mode:
|
||||
*
|
||||
* Return _SUCCESS or _FAIL
|
||||
*/
|
||||
int rtw_set_scan_mode(struct adapter *adapter, enum rt_scan_type scan_mode)
|
||||
{
|
||||
if (scan_mode != SCAN_ACTIVE && scan_mode != SCAN_PASSIVE)
|
||||
return _FAIL;
|
||||
|
||||
adapter->mlmepriv.scan_mode = scan_mode;
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* rtw_set_channel_plan -
|
||||
* @adapter: pointer to struct adapter structure
|
||||
* @channel_plan:
|
||||
*
|
||||
* Return _SUCCESS or _FAIL
|
||||
*/
|
||||
int rtw_set_channel_plan(struct adapter *adapter, u8 channel_plan)
|
||||
{
|
||||
/* handle by cmd_thread to sync with scan operation */
|
||||
return rtw_set_chplan_cmd(adapter, channel_plan, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* rtw_set_country -
|
||||
* @adapter: pointer to struct adapter structure
|
||||
|
@ -1165,5 +658,5 @@ int rtw_set_country(struct adapter *adapter, const char *country_code)
|
|||
else
|
||||
DBG_88E("%s unknown country_code:%s\n", __func__, country_code);
|
||||
|
||||
return rtw_set_channel_plan(adapter, channel_plan);
|
||||
return rtw_set_chplan_cmd(adapter, channel_plan, 1);
|
||||
}
|
||||
|
|
178
core/rtw_iol.c
178
core/rtw_iol.c
|
@ -20,65 +20,6 @@
|
|||
|
||||
#include<rtw_iol.h>
|
||||
|
||||
struct xmit_frame *rtw_IOL_accquire_xmit_frame(struct adapter *adapter)
|
||||
{
|
||||
struct xmit_frame *xmit_frame;
|
||||
struct xmit_buf *xmitbuf;
|
||||
struct pkt_attrib *pattrib;
|
||||
struct xmit_priv *pxmitpriv = &(adapter->xmitpriv);
|
||||
|
||||
xmit_frame = rtw_alloc_xmitframe(pxmitpriv);
|
||||
if (xmit_frame == NULL) {
|
||||
DBG_88E("%s rtw_alloc_xmitframe return null\n", __func__);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
xmitbuf = rtw_alloc_xmitbuf(pxmitpriv);
|
||||
if (xmitbuf == NULL) {
|
||||
DBG_88E("%s rtw_alloc_xmitbuf return null\n", __func__);
|
||||
rtw_free_xmitframe(pxmitpriv, xmit_frame);
|
||||
xmit_frame = NULL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
xmit_frame->frame_tag = MGNT_FRAMETAG;
|
||||
xmit_frame->pxmitbuf = xmitbuf;
|
||||
xmit_frame->buf_addr = xmitbuf->pbuf;
|
||||
xmitbuf->priv_data = xmit_frame;
|
||||
|
||||
pattrib = &xmit_frame->attrib;
|
||||
update_mgntframe_attrib(adapter, pattrib);
|
||||
pattrib->qsel = 0x10;/* Beacon */
|
||||
pattrib->subtype = WIFI_BEACON;
|
||||
pattrib->pktlen = 0;
|
||||
pattrib->last_txcmdsz = 0;
|
||||
exit:
|
||||
return xmit_frame;
|
||||
}
|
||||
|
||||
int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len)
|
||||
{
|
||||
struct pkt_attrib *pattrib = &xmit_frame->attrib;
|
||||
u16 buf_offset;
|
||||
u32 ori_len;
|
||||
|
||||
buf_offset = TXDESC_OFFSET;
|
||||
ori_len = buf_offset+pattrib->pktlen;
|
||||
|
||||
/* check if the io_buf can accommodate new cmds */
|
||||
if (ori_len + cmd_len + 8 > MAX_XMITBUF_SZ) {
|
||||
DBG_88E("%s %u is large than MAX_XMITBUF_SZ:%u, can't accommodate new cmds\n",
|
||||
__func__ , ori_len + cmd_len + 8, MAX_XMITBUF_SZ);
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
memcpy(xmit_frame->buf_addr + buf_offset + pattrib->pktlen, IOL_cmds, cmd_len);
|
||||
pattrib->pktlen += cmd_len;
|
||||
pattrib->last_txcmdsz += cmd_len;
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
bool rtw_IOL_applied(struct adapter *adapter)
|
||||
{
|
||||
if (1 == adapter->registrypriv.fw_iol)
|
||||
|
@ -88,122 +29,3 @@ bool rtw_IOL_applied(struct adapter *adapter)
|
|||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int rtw_IOL_exec_cmds_sync(struct adapter *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt)
|
||||
{
|
||||
return rtw_hal_iol_cmd(adapter, xmit_frame, max_wating_ms, bndy_cnt);
|
||||
}
|
||||
|
||||
int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary)
|
||||
{
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, u8 mask)
|
||||
{
|
||||
struct ioreg_cfg cmd = {8, IOREG_CMD_WB_REG, 0x0, 0x0, 0x0};
|
||||
|
||||
cmd.address = cpu_to_le16(addr);
|
||||
cmd.data = cpu_to_le32(value);
|
||||
|
||||
if (mask != 0xFF) {
|
||||
cmd.length = 12;
|
||||
cmd.mask = cpu_to_le32(mask);
|
||||
}
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
|
||||
}
|
||||
|
||||
int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, u16 mask)
|
||||
{
|
||||
struct ioreg_cfg cmd = {8, IOREG_CMD_WW_REG, 0x0, 0x0, 0x0};
|
||||
|
||||
cmd.address = cpu_to_le16(addr);
|
||||
cmd.data = cpu_to_le32(value);
|
||||
|
||||
if (mask != 0xFFFF) {
|
||||
cmd.length = 12;
|
||||
cmd.mask = cpu_to_le32(mask);
|
||||
}
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
|
||||
}
|
||||
|
||||
int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, u32 mask)
|
||||
{
|
||||
struct ioreg_cfg cmd = {8, IOREG_CMD_WD_REG, 0x0, 0x0, 0x0};
|
||||
|
||||
cmd.address = cpu_to_le16(addr);
|
||||
cmd.data = cpu_to_le32(value);
|
||||
|
||||
if (mask != 0xFFFFFFFF) {
|
||||
cmd.length = 12;
|
||||
cmd.mask = cpu_to_le32(mask);
|
||||
}
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
|
||||
}
|
||||
|
||||
int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr, u32 value, u32 mask)
|
||||
{
|
||||
struct ioreg_cfg cmd = {8, IOREG_CMD_W_RF, 0x0, 0x0, 0x0};
|
||||
|
||||
cmd.address = cpu_to_le16((rf_path<<8) | ((addr) & 0xFF));
|
||||
cmd.data = cpu_to_le32(value);
|
||||
|
||||
if (mask != 0x000FFFFF) {
|
||||
cmd.length = 12;
|
||||
cmd.mask = cpu_to_le32(mask);
|
||||
}
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
|
||||
}
|
||||
|
||||
int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us)
|
||||
{
|
||||
struct ioreg_cfg cmd = {4, IOREG_CMD_DELAY_US, 0x0, 0x0, 0x0};
|
||||
cmd.address = cpu_to_le16(us);
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4);
|
||||
}
|
||||
|
||||
int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms)
|
||||
{
|
||||
struct ioreg_cfg cmd = {4, IOREG_CMD_DELAY_US, 0x0, 0x0, 0x0};
|
||||
|
||||
cmd.address = cpu_to_le16(ms);
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4);
|
||||
}
|
||||
|
||||
int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame)
|
||||
{
|
||||
struct ioreg_cfg cmd = {4, IOREG_CMD_END, cpu_to_le16(0xFFFF), cpu_to_le32(0xFF), 0x0};
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4);
|
||||
}
|
||||
|
||||
u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame)
|
||||
{
|
||||
u8 is_cmd_bndy = false;
|
||||
if (((pxmit_frame->attrib.pktlen+32)%256) + 8 >= 256) {
|
||||
rtw_IOL_append_END_cmd(pxmit_frame);
|
||||
pxmit_frame->attrib.pktlen = ((((pxmit_frame->attrib.pktlen+32)/256)+1)*256);
|
||||
|
||||
pxmit_frame->attrib.last_txcmdsz = pxmit_frame->attrib.pktlen;
|
||||
is_cmd_bndy = true;
|
||||
}
|
||||
return is_cmd_bndy;
|
||||
}
|
||||
|
||||
void rtw_IOL_cmd_buf_dump(struct adapter *Adapter, int buf_len, u8 *pbuf)
|
||||
{
|
||||
int i;
|
||||
int j = 1;
|
||||
|
||||
pr_info("###### %s ######\n", __func__);
|
||||
for (i = 0; i < buf_len; i++) {
|
||||
printk("%02x-", *(pbuf+i));
|
||||
|
||||
if (j%32 == 0)
|
||||
printk("\n");
|
||||
j++;
|
||||
}
|
||||
printk("\n");
|
||||
pr_info("=============ioreg_cmd len=%d===============\n", buf_len);
|
||||
}
|
||||
|
|
1275
core/rtw_led.c
1275
core/rtw_led.c
File diff suppressed because it is too large
Load diff
702
core/rtw_mlme.c
702
core/rtw_mlme.c
File diff suppressed because it is too large
Load diff
3610
core/rtw_mlme_ext.c
3610
core/rtw_mlme_ext.c
File diff suppressed because it is too large
Load diff
997
core/rtw_mp.c
997
core/rtw_mp.c
|
@ -1,997 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
*published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTW_MP_C_
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
#include "odm_precomp.h"
|
||||
#include "rtl8188e_hal.h"
|
||||
|
||||
u32 read_macreg(struct adapter *padapter, u32 addr, u32 sz)
|
||||
{
|
||||
u32 val = 0;
|
||||
|
||||
switch (sz) {
|
||||
case 1:
|
||||
val = rtw_read8(padapter, addr);
|
||||
break;
|
||||
case 2:
|
||||
val = rtw_read16(padapter, addr);
|
||||
break;
|
||||
case 4:
|
||||
val = rtw_read32(padapter, addr);
|
||||
break;
|
||||
default:
|
||||
val = 0xffffffff;
|
||||
break;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
void write_macreg(struct adapter *padapter, u32 addr, u32 val, u32 sz)
|
||||
{
|
||||
switch (sz) {
|
||||
case 1:
|
||||
rtw_write8(padapter, addr, (u8)val);
|
||||
break;
|
||||
case 2:
|
||||
rtw_write16(padapter, addr, (u16)val);
|
||||
break;
|
||||
case 4:
|
||||
rtw_write32(padapter, addr, val);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
u32 read_bbreg(struct adapter *padapter, u32 addr, u32 bitmask)
|
||||
{
|
||||
return rtw_hal_read_bbreg(padapter, addr, bitmask);
|
||||
}
|
||||
|
||||
void write_bbreg(struct adapter *padapter, u32 addr, u32 bitmask, u32 val)
|
||||
{
|
||||
rtw_hal_write_bbreg(padapter, addr, bitmask, val);
|
||||
}
|
||||
|
||||
u32 _read_rfreg(struct adapter *padapter, u8 rfpath, u32 addr, u32 bitmask)
|
||||
{
|
||||
return rtw_hal_read_rfreg(padapter, (enum rf_radio_path)rfpath, addr, bitmask);
|
||||
}
|
||||
|
||||
void _write_rfreg(struct adapter *padapter, u8 rfpath, u32 addr, u32 bitmask, u32 val)
|
||||
{
|
||||
rtw_hal_write_rfreg(padapter, (enum rf_radio_path)rfpath, addr, bitmask, val);
|
||||
}
|
||||
|
||||
u32 read_rfreg(struct adapter *padapter, u8 rfpath, u32 addr)
|
||||
{
|
||||
return _read_rfreg(padapter, (enum rf_radio_path)rfpath, addr, bRFRegOffsetMask);
|
||||
}
|
||||
|
||||
void write_rfreg(struct adapter *padapter, u8 rfpath, u32 addr, u32 val)
|
||||
{
|
||||
_write_rfreg(padapter, (enum rf_radio_path)rfpath, addr, bRFRegOffsetMask, val);
|
||||
}
|
||||
|
||||
static void _init_mp_priv_(struct mp_priv *pmp_priv)
|
||||
{
|
||||
struct wlan_bssid_ex *pnetwork;
|
||||
|
||||
_rtw_memset(pmp_priv, 0, sizeof(struct mp_priv));
|
||||
|
||||
pmp_priv->mode = MP_OFF;
|
||||
|
||||
pmp_priv->channel = 1;
|
||||
pmp_priv->bandwidth = HT_CHANNEL_WIDTH_20;
|
||||
pmp_priv->prime_channel_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
||||
pmp_priv->rateidx = MPT_RATE_1M;
|
||||
pmp_priv->txpoweridx = 0x2A;
|
||||
|
||||
pmp_priv->antenna_tx = ANTENNA_A;
|
||||
pmp_priv->antenna_rx = ANTENNA_AB;
|
||||
|
||||
pmp_priv->check_mp_pkt = 0;
|
||||
|
||||
pmp_priv->tx_pktcount = 0;
|
||||
|
||||
pmp_priv->rx_pktcount = 0;
|
||||
pmp_priv->rx_crcerrpktcount = 0;
|
||||
|
||||
pmp_priv->network_macaddr[0] = 0x00;
|
||||
pmp_priv->network_macaddr[1] = 0xE0;
|
||||
pmp_priv->network_macaddr[2] = 0x4C;
|
||||
pmp_priv->network_macaddr[3] = 0x87;
|
||||
pmp_priv->network_macaddr[4] = 0x66;
|
||||
pmp_priv->network_macaddr[5] = 0x55;
|
||||
|
||||
pnetwork = &pmp_priv->mp_network.network;
|
||||
memcpy(pnetwork->MacAddress, pmp_priv->network_macaddr, ETH_ALEN);
|
||||
|
||||
pnetwork->Ssid.SsidLength = 8;
|
||||
memcpy(pnetwork->Ssid.Ssid, "mp_871x", pnetwork->Ssid.SsidLength);
|
||||
}
|
||||
|
||||
static void mp_init_xmit_attrib(struct mp_tx *pmptx, struct adapter *padapter)
|
||||
{
|
||||
struct pkt_attrib *pattrib;
|
||||
struct tx_desc *desc;
|
||||
|
||||
/* init xmitframe attribute */
|
||||
pattrib = &pmptx->attrib;
|
||||
_rtw_memset(pattrib, 0, sizeof(struct pkt_attrib));
|
||||
desc = &pmptx->desc;
|
||||
_rtw_memset(desc, 0, TXDESC_SIZE);
|
||||
|
||||
pattrib->ether_type = 0x8712;
|
||||
_rtw_memset(pattrib->dst, 0xFF, ETH_ALEN);
|
||||
pattrib->ack_policy = 0;
|
||||
pattrib->hdrlen = WLAN_HDR_A3_LEN;
|
||||
pattrib->subtype = WIFI_DATA;
|
||||
pattrib->priority = 0;
|
||||
pattrib->qsel = pattrib->priority;
|
||||
pattrib->nr_frags = 1;
|
||||
pattrib->encrypt = 0;
|
||||
pattrib->bswenc = false;
|
||||
pattrib->qos_en = false;
|
||||
}
|
||||
|
||||
s32 init_mp_priv(struct adapter *padapter)
|
||||
{
|
||||
struct mp_priv *pmppriv = &padapter->mppriv;
|
||||
|
||||
_init_mp_priv_(pmppriv);
|
||||
pmppriv->papdater = padapter;
|
||||
|
||||
pmppriv->tx.stop = 1;
|
||||
mp_init_xmit_attrib(&pmppriv->tx, padapter);
|
||||
|
||||
switch (padapter->registrypriv.rf_config) {
|
||||
case RF_1T1R:
|
||||
pmppriv->antenna_tx = ANTENNA_A;
|
||||
pmppriv->antenna_rx = ANTENNA_A;
|
||||
break;
|
||||
case RF_1T2R:
|
||||
default:
|
||||
pmppriv->antenna_tx = ANTENNA_A;
|
||||
pmppriv->antenna_rx = ANTENNA_AB;
|
||||
break;
|
||||
case RF_2T2R:
|
||||
case RF_2T2R_GREEN:
|
||||
pmppriv->antenna_tx = ANTENNA_AB;
|
||||
pmppriv->antenna_rx = ANTENNA_AB;
|
||||
break;
|
||||
case RF_2T4R:
|
||||
pmppriv->antenna_tx = ANTENNA_AB;
|
||||
pmppriv->antenna_rx = ANTENNA_ABCD;
|
||||
break;
|
||||
}
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
void free_mp_priv(struct mp_priv *pmp_priv)
|
||||
{
|
||||
kfree(pmp_priv->pallocated_mp_xmitframe_buf);
|
||||
pmp_priv->pallocated_mp_xmitframe_buf = NULL;
|
||||
pmp_priv->pmp_xmtframe_buf = NULL;
|
||||
}
|
||||
|
||||
#define PHY_IQCalibrate(a, b) PHY_IQCalibrate_8188E(a, b)
|
||||
#define PHY_LCCalibrate(a) PHY_LCCalibrate_8188E(a)
|
||||
#define PHY_SetRFPathSwitch(a, b) PHY_SetRFPathSwitch_8188E(a, b)
|
||||
|
||||
s32 MPT_InitializeAdapter(struct adapter *pAdapter, u8 Channel)
|
||||
{
|
||||
struct hal_data_8188e *pHalData = GET_HAL_DATA(pAdapter);
|
||||
s32 rtStatus = _SUCCESS;
|
||||
struct mpt_context *pMptCtx = &pAdapter->mppriv.MptCtx;
|
||||
struct mlme_priv *pmlmepriv = &pAdapter->mlmepriv;
|
||||
|
||||
/* HW Initialization for 8190 MPT. */
|
||||
/* SW Initialization for 8190 MP. */
|
||||
pMptCtx->bMptDrvUnload = false;
|
||||
pMptCtx->bMassProdTest = false;
|
||||
pMptCtx->bMptIndexEven = true; /* default gain index is -6.0db */
|
||||
pMptCtx->h2cReqNum = 0x0;
|
||||
/* Init mpt event. */
|
||||
/* init for BT MP */
|
||||
|
||||
pMptCtx->bMptWorkItemInProgress = false;
|
||||
pMptCtx->CurrMptAct = NULL;
|
||||
/* */
|
||||
|
||||
/* Don't accept any packets */
|
||||
rtw_write32(pAdapter, REG_RCR, 0);
|
||||
|
||||
PHY_IQCalibrate(pAdapter, false);
|
||||
dm_CheckTXPowerTracking(&pHalData->odmpriv); /* trigger thermal meter */
|
||||
PHY_LCCalibrate(pAdapter);
|
||||
|
||||
pMptCtx->backup0xc50 = (u8)PHY_QueryBBReg(pAdapter, rOFDM0_XAAGCCore1, bMaskByte0);
|
||||
pMptCtx->backup0xc58 = (u8)PHY_QueryBBReg(pAdapter, rOFDM0_XBAGCCore1, bMaskByte0);
|
||||
pMptCtx->backup0xc30 = (u8)PHY_QueryBBReg(pAdapter, rOFDM0_RxDetector1, bMaskByte0);
|
||||
pMptCtx->backup0x52_RF_A = (u8)PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0);
|
||||
pMptCtx->backup0x52_RF_B = (u8)PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0);
|
||||
|
||||
/* set ant to wifi side in mp mode */
|
||||
rtw_write16(pAdapter, 0x870, 0x300);
|
||||
rtw_write16(pAdapter, 0x860, 0x110);
|
||||
|
||||
if (pAdapter->registrypriv.mp_mode == 1)
|
||||
pmlmepriv->fw_state = WIFI_MP_STATE;
|
||||
|
||||
return rtStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: MPT_DeInitAdapter()
|
||||
*
|
||||
* Overview: Extra DeInitialization for Mass Production Test.
|
||||
*
|
||||
* Input: struct adapter * pAdapter
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Revised History:
|
||||
* When Who Remark
|
||||
* 05/08/2007 MHC Create Version 0.
|
||||
* 05/18/2007 MHC Add normal driver MPHalt code.
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MPT_DeInitAdapter(struct adapter *pAdapter)
|
||||
{
|
||||
struct mpt_context *pMptCtx = &pAdapter->mppriv.MptCtx;
|
||||
|
||||
pMptCtx->bMptDrvUnload = true;
|
||||
}
|
||||
|
||||
static u8 mpt_ProStartTest(struct adapter *padapter)
|
||||
{
|
||||
struct mpt_context *pMptCtx = &padapter->mppriv.MptCtx;
|
||||
|
||||
pMptCtx->bMassProdTest = true;
|
||||
pMptCtx->bStartContTx = false;
|
||||
pMptCtx->bCckContTx = false;
|
||||
pMptCtx->bOfdmContTx = false;
|
||||
pMptCtx->bSingleCarrier = false;
|
||||
pMptCtx->bCarrierSuppression = false;
|
||||
pMptCtx->bSingleTone = false;
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* General use
|
||||
*/
|
||||
s32 SetPowerTracking(struct adapter *padapter, u8 enable)
|
||||
{
|
||||
Hal_SetPowerTracking(padapter, enable);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GetPowerTracking(struct adapter *padapter, u8 *enable)
|
||||
{
|
||||
Hal_GetPowerTracking(padapter, enable);
|
||||
}
|
||||
|
||||
static void disable_dm(struct adapter *padapter)
|
||||
{
|
||||
u8 v8;
|
||||
|
||||
/* 3 1. disable firmware dynamic mechanism */
|
||||
/* disable Power Training, Rate Adaptive */
|
||||
v8 = rtw_read8(padapter, REG_BCN_CTRL);
|
||||
v8 &= ~EN_BCN_FUNCTION;
|
||||
rtw_write8(padapter, REG_BCN_CTRL, v8);
|
||||
|
||||
/* 3 2. disable driver dynamic mechanism */
|
||||
/* disable Dynamic Initial Gain */
|
||||
/* disable High Power */
|
||||
/* disable Power Tracking */
|
||||
Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, false);
|
||||
|
||||
/* enable APK, LCK and IQK but disable power tracking */
|
||||
Switch_DM_Func(padapter, DYNAMIC_RF_CALIBRATION, true);
|
||||
}
|
||||
|
||||
/* This function initializes the DUT to the MP test mode */
|
||||
s32 mp_start_test(struct adapter *padapter)
|
||||
{
|
||||
struct wlan_bssid_ex bssid;
|
||||
struct sta_info *psta;
|
||||
u32 length;
|
||||
u8 val8;
|
||||
|
||||
unsigned long irqL;
|
||||
s32 res = _SUCCESS;
|
||||
|
||||
struct mp_priv *pmppriv = &padapter->mppriv;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct wlan_network *tgt_network = &pmlmepriv->cur_network;
|
||||
|
||||
padapter->registrypriv.mp_mode = 1;
|
||||
pmppriv->bSetTxPower = 0; /* for manually set tx power */
|
||||
|
||||
/* 3 disable dynamic mechanism */
|
||||
disable_dm(padapter);
|
||||
|
||||
/* 3 0. update mp_priv */
|
||||
|
||||
if (padapter->registrypriv.rf_config == RF_819X_MAX_TYPE) {
|
||||
switch (GET_RF_TYPE(padapter)) {
|
||||
case RF_1T1R:
|
||||
pmppriv->antenna_tx = ANTENNA_A;
|
||||
pmppriv->antenna_rx = ANTENNA_A;
|
||||
break;
|
||||
case RF_1T2R:
|
||||
default:
|
||||
pmppriv->antenna_tx = ANTENNA_A;
|
||||
pmppriv->antenna_rx = ANTENNA_AB;
|
||||
break;
|
||||
case RF_2T2R:
|
||||
case RF_2T2R_GREEN:
|
||||
pmppriv->antenna_tx = ANTENNA_AB;
|
||||
pmppriv->antenna_rx = ANTENNA_AB;
|
||||
break;
|
||||
case RF_2T4R:
|
||||
pmppriv->antenna_tx = ANTENNA_AB;
|
||||
pmppriv->antenna_rx = ANTENNA_ABCD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mpt_ProStartTest(padapter);
|
||||
|
||||
/* 3 1. initialize a new struct wlan_bssid_ex */
|
||||
/* _rtw_memset(&bssid, 0, sizeof(struct wlan_bssid_ex)); */
|
||||
memcpy(bssid.MacAddress, pmppriv->network_macaddr, ETH_ALEN);
|
||||
bssid.Ssid.SsidLength = strlen("mp_pseudo_adhoc");
|
||||
memcpy(bssid.Ssid.Ssid, (u8 *)"mp_pseudo_adhoc", bssid.Ssid.SsidLength);
|
||||
bssid.InfrastructureMode = Ndis802_11IBSS;
|
||||
bssid.NetworkTypeInUse = Ndis802_11DS;
|
||||
bssid.IELength = 0;
|
||||
|
||||
length = get_wlan_bssid_ex_sz(&bssid);
|
||||
if (length % 4)
|
||||
bssid.Length = ((length >> 2) + 1) << 2; /* round up to multiple of 4 bytes. */
|
||||
else
|
||||
bssid.Length = length;
|
||||
|
||||
_enter_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true)
|
||||
goto end_of_mp_start_test;
|
||||
|
||||
/* init mp_start_test status */
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) {
|
||||
rtw_disassoc_cmd(padapter, 500, true);
|
||||
rtw_indicate_disconnect(padapter);
|
||||
rtw_free_assoc_resources(padapter, 1);
|
||||
}
|
||||
pmppriv->prev_fw_state = get_fwstate(pmlmepriv);
|
||||
if (padapter->registrypriv.mp_mode == 1)
|
||||
pmlmepriv->fw_state = WIFI_MP_STATE;
|
||||
set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
|
||||
|
||||
/* 3 2. create a new psta for mp driver */
|
||||
/* clear psta in the cur_network, if any */
|
||||
psta = rtw_get_stainfo(&padapter->stapriv, tgt_network->network.MacAddress);
|
||||
if (psta)
|
||||
rtw_free_stainfo(padapter, psta);
|
||||
|
||||
psta = rtw_alloc_stainfo(&padapter->stapriv, bssid.MacAddress);
|
||||
if (psta == NULL) {
|
||||
RT_TRACE(_module_mp_, _drv_err_, ("mp_start_test: Can't alloc sta_info!\n"));
|
||||
pmlmepriv->fw_state = pmppriv->prev_fw_state;
|
||||
res = _FAIL;
|
||||
goto end_of_mp_start_test;
|
||||
}
|
||||
|
||||
/* 3 3. join psudo AdHoc */
|
||||
tgt_network->join_res = 1;
|
||||
tgt_network->aid = 1;
|
||||
psta->aid = 1;
|
||||
memcpy(&tgt_network->network, &bssid, length);
|
||||
|
||||
rtw_indicate_connect(padapter);
|
||||
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
|
||||
|
||||
end_of_mp_start_test:
|
||||
|
||||
_exit_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
|
||||
if (res == _SUCCESS) {
|
||||
/* set MSR to WIFI_FW_ADHOC_STATE */
|
||||
val8 = rtw_read8(padapter, MSR) & 0xFC; /* 0x0102 */
|
||||
val8 |= WIFI_FW_ADHOC_STATE;
|
||||
rtw_write8(padapter, MSR, val8); /* Link in ad hoc network */
|
||||
}
|
||||
return res;
|
||||
}
|
||||
/* */
|
||||
/* This function change the DUT from the MP test mode into normal mode */
|
||||
void mp_stop_test(struct adapter *padapter)
|
||||
{
|
||||
struct mp_priv *pmppriv = &padapter->mppriv;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct wlan_network *tgt_network = &pmlmepriv->cur_network;
|
||||
struct sta_info *psta;
|
||||
|
||||
unsigned long irqL;
|
||||
|
||||
if (pmppriv->mode == MP_ON) {
|
||||
pmppriv->bSetTxPower = 0;
|
||||
_enter_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == false)
|
||||
goto end_of_mp_stop_test;
|
||||
|
||||
/* 3 1. disconnect psudo AdHoc */
|
||||
rtw_indicate_disconnect(padapter);
|
||||
|
||||
/* 3 2. clear psta used in mp test mode. */
|
||||
psta = rtw_get_stainfo(&padapter->stapriv, tgt_network->network.MacAddress);
|
||||
if (psta)
|
||||
rtw_free_stainfo(padapter, psta);
|
||||
|
||||
/* 3 3. return to normal state (default:station mode) */
|
||||
pmlmepriv->fw_state = pmppriv->prev_fw_state; /* WIFI_STATION_STATE; */
|
||||
|
||||
/* flush the cur_network */
|
||||
_rtw_memset(tgt_network, 0, sizeof(struct wlan_network));
|
||||
|
||||
_clr_fwstate_(pmlmepriv, WIFI_MP_STATE);
|
||||
|
||||
end_of_mp_stop_test:
|
||||
|
||||
_exit_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------hal\rtl8192c\MPT_HelperFunc.c---------------------------*/
|
||||
/*
|
||||
* SetChannel
|
||||
* Description
|
||||
* Use H2C command to change channel,
|
||||
* not only modify rf register, but also other setting need to be done.
|
||||
*/
|
||||
void SetChannel(struct adapter *pAdapter)
|
||||
{
|
||||
Hal_SetChannel(pAdapter);
|
||||
}
|
||||
|
||||
/*
|
||||
* Notice
|
||||
* Switch bandwitdth may change center frequency(channel)
|
||||
*/
|
||||
void SetBandwidth(struct adapter *pAdapter)
|
||||
{
|
||||
Hal_SetBandwidth(pAdapter);
|
||||
}
|
||||
|
||||
void SetAntenna(struct adapter *pAdapter)
|
||||
{
|
||||
Hal_SetAntenna(pAdapter);
|
||||
}
|
||||
|
||||
void SetAntennaPathPower(struct adapter *pAdapter)
|
||||
{
|
||||
Hal_SetAntennaPathPower(pAdapter);
|
||||
}
|
||||
|
||||
void SetTxPower(struct adapter *pAdapter)
|
||||
{
|
||||
Hal_SetTxPower(pAdapter);
|
||||
}
|
||||
|
||||
void SetDataRate(struct adapter *pAdapter)
|
||||
{
|
||||
Hal_SetDataRate(pAdapter);
|
||||
}
|
||||
|
||||
void MP_PHY_SetRFPathSwitch(struct adapter *pAdapter , bool bMain)
|
||||
{
|
||||
PHY_SetRFPathSwitch(pAdapter, bMain);
|
||||
}
|
||||
|
||||
s32 SetThermalMeter(struct adapter *pAdapter, u8 target_ther)
|
||||
{
|
||||
return Hal_SetThermalMeter(pAdapter, target_ther);
|
||||
}
|
||||
|
||||
void GetThermalMeter(struct adapter *pAdapter, u8 *value)
|
||||
{
|
||||
Hal_GetThermalMeter(pAdapter, value);
|
||||
}
|
||||
|
||||
void SetSingleCarrierTx(struct adapter *pAdapter, u8 bStart)
|
||||
{
|
||||
PhySetTxPowerLevel(pAdapter);
|
||||
Hal_SetSingleCarrierTx(pAdapter, bStart);
|
||||
}
|
||||
|
||||
void SetSingleToneTx(struct adapter *pAdapter, u8 bStart)
|
||||
{
|
||||
PhySetTxPowerLevel(pAdapter);
|
||||
Hal_SetSingleToneTx(pAdapter, bStart);
|
||||
}
|
||||
|
||||
void SetCarrierSuppressionTx(struct adapter *pAdapter, u8 bStart)
|
||||
{
|
||||
PhySetTxPowerLevel(pAdapter);
|
||||
Hal_SetCarrierSuppressionTx(pAdapter, bStart);
|
||||
}
|
||||
|
||||
void SetContinuousTx(struct adapter *pAdapter, u8 bStart)
|
||||
{
|
||||
PhySetTxPowerLevel(pAdapter);
|
||||
Hal_SetContinuousTx(pAdapter, bStart);
|
||||
}
|
||||
|
||||
|
||||
void PhySetTxPowerLevel(struct adapter *pAdapter)
|
||||
{
|
||||
struct mp_priv *pmp_priv = &pAdapter->mppriv;
|
||||
|
||||
if (pmp_priv->bSetTxPower == 0) /* for NO manually set power index */
|
||||
PHY_SetTxPowerLevel8188E(pAdapter, pmp_priv->channel);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void dump_mpframe(struct adapter *padapter, struct xmit_frame *pmpframe)
|
||||
{
|
||||
rtw_hal_mgnt_xmit(padapter, pmpframe);
|
||||
}
|
||||
|
||||
static struct xmit_frame *alloc_mp_xmitframe(struct xmit_priv *pxmitpriv)
|
||||
{
|
||||
struct xmit_frame *pmpframe;
|
||||
struct xmit_buf *pxmitbuf;
|
||||
|
||||
pmpframe = rtw_alloc_xmitframe(pxmitpriv);
|
||||
if (pmpframe == NULL)
|
||||
return NULL;
|
||||
|
||||
pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv);
|
||||
if (pxmitbuf == NULL) {
|
||||
rtw_free_xmitframe(pxmitpriv, pmpframe);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pmpframe->frame_tag = MP_FRAMETAG;
|
||||
|
||||
pmpframe->pxmitbuf = pxmitbuf;
|
||||
|
||||
pmpframe->buf_addr = pxmitbuf->pbuf;
|
||||
|
||||
pxmitbuf->priv_data = pmpframe;
|
||||
|
||||
return pmpframe;
|
||||
}
|
||||
|
||||
static int mp_xmit_packet_thread(void *context)
|
||||
{
|
||||
struct xmit_frame *pxmitframe;
|
||||
struct mp_tx *pmptx;
|
||||
struct mp_priv *pmp_priv;
|
||||
struct xmit_priv *pxmitpriv;
|
||||
struct adapter *padapter;
|
||||
|
||||
pmp_priv = (struct mp_priv *)context;
|
||||
pmptx = &pmp_priv->tx;
|
||||
padapter = pmp_priv->papdater;
|
||||
pxmitpriv = &(padapter->xmitpriv);
|
||||
|
||||
thread_enter("RTW_MP_THREAD");
|
||||
|
||||
/* DBG_88E("%s:pkTx Start\n", __func__); */
|
||||
while (1) {
|
||||
pxmitframe = alloc_mp_xmitframe(pxmitpriv);
|
||||
if (pxmitframe == NULL) {
|
||||
if (pmptx->stop ||
|
||||
padapter->bSurpriseRemoved ||
|
||||
padapter->bDriverStopped) {
|
||||
goto exit;
|
||||
} else {
|
||||
rtw_msleep_os(1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy((u8 *)(pxmitframe->buf_addr+TXDESC_OFFSET), pmptx->buf, pmptx->write_size);
|
||||
memcpy(&(pxmitframe->attrib), &(pmptx->attrib), sizeof(struct pkt_attrib));
|
||||
|
||||
dump_mpframe(padapter, pxmitframe);
|
||||
|
||||
pmptx->sended++;
|
||||
pmp_priv->tx_pktcount++;
|
||||
|
||||
if (pmptx->stop ||
|
||||
padapter->bSurpriseRemoved ||
|
||||
padapter->bDriverStopped)
|
||||
goto exit;
|
||||
if ((pmptx->count != 0) &&
|
||||
(pmptx->count == pmptx->sended))
|
||||
goto exit;
|
||||
|
||||
flush_signals_thread();
|
||||
}
|
||||
|
||||
exit:
|
||||
kfree(pmptx->pallocated_buf);
|
||||
pmptx->pallocated_buf = NULL;
|
||||
pmptx->stop = 1;
|
||||
|
||||
thread_exit();
|
||||
}
|
||||
|
||||
void fill_txdesc_for_mp(struct adapter *padapter, struct tx_desc *ptxdesc)
|
||||
{
|
||||
struct mp_priv *pmp_priv = &padapter->mppriv;
|
||||
memcpy(ptxdesc, &(pmp_priv->tx.desc), TXDESC_SIZE);
|
||||
}
|
||||
|
||||
void SetPacketTx(struct adapter *padapter)
|
||||
{
|
||||
u8 *ptr, *pkt_start, *pkt_end;
|
||||
u32 pkt_size;
|
||||
struct tx_desc *desc;
|
||||
struct rtw_ieee80211_hdr *hdr;
|
||||
u8 payload;
|
||||
s32 bmcast;
|
||||
struct pkt_attrib *pattrib;
|
||||
struct mp_priv *pmp_priv;
|
||||
|
||||
|
||||
pmp_priv = &padapter->mppriv;
|
||||
if (pmp_priv->tx.stop)
|
||||
return;
|
||||
pmp_priv->tx.sended = 0;
|
||||
pmp_priv->tx.stop = 0;
|
||||
pmp_priv->tx_pktcount = 0;
|
||||
|
||||
/* 3 1. update_attrib() */
|
||||
pattrib = &pmp_priv->tx.attrib;
|
||||
memcpy(pattrib->src, padapter->eeprompriv.mac_addr, ETH_ALEN);
|
||||
memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
|
||||
memcpy(pattrib->ra, pattrib->dst, ETH_ALEN);
|
||||
bmcast = IS_MCAST(pattrib->ra);
|
||||
if (bmcast) {
|
||||
pattrib->mac_id = 1;
|
||||
pattrib->psta = rtw_get_bcmc_stainfo(padapter);
|
||||
} else {
|
||||
pattrib->mac_id = 0;
|
||||
pattrib->psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv));
|
||||
}
|
||||
|
||||
pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->pktlen;
|
||||
|
||||
/* 3 2. allocate xmit buffer */
|
||||
pkt_size = pattrib->last_txcmdsz;
|
||||
|
||||
kfree(pmp_priv->tx.pallocated_buf);
|
||||
pmp_priv->tx.write_size = pkt_size;
|
||||
pmp_priv->tx.buf_size = pkt_size + XMITBUF_ALIGN_SZ;
|
||||
pmp_priv->tx.pallocated_buf = rtw_zmalloc(pmp_priv->tx.buf_size);
|
||||
if (pmp_priv->tx.pallocated_buf == NULL) {
|
||||
DBG_88E("%s: malloc(%d) fail!!\n", __func__, pmp_priv->tx.buf_size);
|
||||
return;
|
||||
}
|
||||
pmp_priv->tx.buf = (u8 *)N_BYTE_ALIGMENT((size_t)(pmp_priv->tx.pallocated_buf), XMITBUF_ALIGN_SZ);
|
||||
ptr = pmp_priv->tx.buf;
|
||||
|
||||
desc = &(pmp_priv->tx.desc);
|
||||
_rtw_memset(desc, 0, TXDESC_SIZE);
|
||||
pkt_start = ptr;
|
||||
pkt_end = pkt_start + pkt_size;
|
||||
|
||||
/* 3 3. init TX descriptor */
|
||||
/* offset 0 */
|
||||
desc->txdw0 |= cpu_to_le32(OWN | FSG | LSG);
|
||||
desc->txdw0 |= cpu_to_le32(pkt_size & 0x0000FFFF); /* packet size */
|
||||
desc->txdw0 |= cpu_to_le32(((TXDESC_SIZE + OFFSET_SZ) << OFFSET_SHT) & 0x00FF0000); /* 32 bytes for TX Desc */
|
||||
if (bmcast)
|
||||
desc->txdw0 |= cpu_to_le32(BMC); /* broadcast packet */
|
||||
|
||||
desc->txdw1 |= cpu_to_le32((0x01 << 26) & 0xff000000);
|
||||
/* offset 4 */
|
||||
desc->txdw1 |= cpu_to_le32((pattrib->mac_id) & 0x3F); /* CAM_ID(MAC_ID) */
|
||||
desc->txdw1 |= cpu_to_le32((pattrib->qsel << QSEL_SHT) & 0x00001F00); /* Queue Select, TID */
|
||||
|
||||
desc->txdw1 |= cpu_to_le32((pattrib->raid << RATE_ID_SHT) & 0x000F0000); /* Rate Adaptive ID */
|
||||
/* offset 8 */
|
||||
/* offset 12 */
|
||||
|
||||
desc->txdw3 |= cpu_to_le32((pattrib->seqnum<<16)&0x0fff0000);
|
||||
|
||||
/* offset 16 */
|
||||
desc->txdw4 |= cpu_to_le32(HW_SSN);
|
||||
desc->txdw4 |= cpu_to_le32(USERATE);
|
||||
desc->txdw4 |= cpu_to_le32(DISDATAFB);
|
||||
|
||||
if (pmp_priv->preamble) {
|
||||
if (pmp_priv->rateidx <= MPT_RATE_54M)
|
||||
desc->txdw4 |= cpu_to_le32(DATA_SHORT); /* CCK Short Preamble */
|
||||
}
|
||||
if (pmp_priv->bandwidth == HT_CHANNEL_WIDTH_40)
|
||||
desc->txdw4 |= cpu_to_le32(DATA_BW);
|
||||
|
||||
/* offset 20 */
|
||||
desc->txdw5 |= cpu_to_le32(pmp_priv->rateidx & 0x0000001F);
|
||||
|
||||
if (pmp_priv->preamble) {
|
||||
if (pmp_priv->rateidx > MPT_RATE_54M)
|
||||
desc->txdw5 |= cpu_to_le32(SGI); /* MCS Short Guard Interval */
|
||||
}
|
||||
desc->txdw5 |= cpu_to_le32(RTY_LMT_EN); /* retry limit enable */
|
||||
desc->txdw5 |= cpu_to_le32(0x00180000); /* DATA/RTS Rate Fallback Limit */
|
||||
|
||||
/* 3 4. make wlan header, make_wlanhdr() */
|
||||
hdr = (struct rtw_ieee80211_hdr *)pkt_start;
|
||||
SetFrameSubType(&hdr->frame_ctl, pattrib->subtype);
|
||||
memcpy(hdr->addr1, pattrib->dst, ETH_ALEN); /* DA */
|
||||
memcpy(hdr->addr2, pattrib->src, ETH_ALEN); /* SA */
|
||||
memcpy(hdr->addr3, get_bssid(&padapter->mlmepriv), ETH_ALEN); /* RA, BSSID */
|
||||
|
||||
/* 3 5. make payload */
|
||||
ptr = pkt_start + pattrib->hdrlen;
|
||||
|
||||
switch (pmp_priv->tx.payload) {
|
||||
case 0:
|
||||
payload = 0x00;
|
||||
break;
|
||||
case 1:
|
||||
payload = 0x5a;
|
||||
break;
|
||||
case 2:
|
||||
payload = 0xa5;
|
||||
break;
|
||||
case 3:
|
||||
payload = 0xff;
|
||||
break;
|
||||
default:
|
||||
payload = 0x00;
|
||||
break;
|
||||
}
|
||||
|
||||
_rtw_memset(ptr, payload, pkt_end - ptr);
|
||||
|
||||
/* 3 6. start thread */
|
||||
pmp_priv->tx.PktTxThread = kthread_run(mp_xmit_packet_thread, pmp_priv, "RTW_MP_THREAD");
|
||||
if (IS_ERR(pmp_priv->tx.PktTxThread))
|
||||
DBG_88E("Create PktTx Thread Fail !!!!!\n");
|
||||
}
|
||||
|
||||
void SetPacketRx(struct adapter *pAdapter, u8 bStartRx)
|
||||
{
|
||||
struct hal_data_8188e *pHalData = GET_HAL_DATA(pAdapter);
|
||||
|
||||
if (bStartRx) {
|
||||
/* Accept CRC error and destination address */
|
||||
pHalData->ReceiveConfig = AAP | APM | AM | AB | APP_ICV | ADF | AMF | HTC_LOC_CTRL | APP_MIC | APP_PHYSTS;
|
||||
|
||||
pHalData->ReceiveConfig |= ACRC32;
|
||||
|
||||
rtw_write32(pAdapter, REG_RCR, pHalData->ReceiveConfig);
|
||||
|
||||
/* Accept all data frames */
|
||||
rtw_write16(pAdapter, REG_RXFLTMAP2, 0xFFFF);
|
||||
} else {
|
||||
rtw_write32(pAdapter, REG_RCR, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void ResetPhyRxPktCount(struct adapter *pAdapter)
|
||||
{
|
||||
u32 i, phyrx_set = 0;
|
||||
|
||||
for (i = 0; i <= 0xF; i++) {
|
||||
phyrx_set = 0;
|
||||
phyrx_set |= _RXERR_RPT_SEL(i); /* select */
|
||||
phyrx_set |= RXERR_RPT_RST; /* set counter to zero */
|
||||
rtw_write32(pAdapter, REG_RXERR_RPT, phyrx_set);
|
||||
}
|
||||
}
|
||||
|
||||
static u32 GetPhyRxPktCounts(struct adapter *pAdapter, u32 selbit)
|
||||
{
|
||||
/* selection */
|
||||
u32 phyrx_set = 0, count = 0;
|
||||
|
||||
phyrx_set = _RXERR_RPT_SEL(selbit & 0xF);
|
||||
rtw_write32(pAdapter, REG_RXERR_RPT, phyrx_set);
|
||||
|
||||
/* Read packet count */
|
||||
count = rtw_read32(pAdapter, REG_RXERR_RPT) & RXERR_COUNTER_MASK;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
u32 GetPhyRxPktReceived(struct adapter *pAdapter)
|
||||
{
|
||||
u32 OFDM_cnt = 0, CCK_cnt = 0, HT_cnt = 0;
|
||||
|
||||
OFDM_cnt = GetPhyRxPktCounts(pAdapter, RXERR_TYPE_OFDM_MPDU_OK);
|
||||
CCK_cnt = GetPhyRxPktCounts(pAdapter, RXERR_TYPE_CCK_MPDU_OK);
|
||||
HT_cnt = GetPhyRxPktCounts(pAdapter, RXERR_TYPE_HT_MPDU_OK);
|
||||
|
||||
return OFDM_cnt + CCK_cnt + HT_cnt;
|
||||
}
|
||||
|
||||
u32 GetPhyRxPktCRC32Error(struct adapter *pAdapter)
|
||||
{
|
||||
u32 OFDM_cnt = 0, CCK_cnt = 0, HT_cnt = 0;
|
||||
|
||||
OFDM_cnt = GetPhyRxPktCounts(pAdapter, RXERR_TYPE_OFDM_MPDU_FAIL);
|
||||
CCK_cnt = GetPhyRxPktCounts(pAdapter, RXERR_TYPE_CCK_MPDU_FAIL);
|
||||
HT_cnt = GetPhyRxPktCounts(pAdapter, RXERR_TYPE_HT_MPDU_FAIL);
|
||||
|
||||
return OFDM_cnt + CCK_cnt + HT_cnt;
|
||||
}
|
||||
|
||||
/* reg 0x808[9:0]: FFT data x */
|
||||
/* reg 0x808[22]: 0 --> 1 to get 1 FFT data y */
|
||||
/* reg 0x8B4[15:0]: FFT data y report */
|
||||
static u32 rtw_GetPSDData(struct adapter *pAdapter, u32 point)
|
||||
{
|
||||
int psd_val;
|
||||
|
||||
|
||||
psd_val = rtw_read32(pAdapter, 0x808);
|
||||
psd_val &= 0xFFBFFC00;
|
||||
psd_val |= point;
|
||||
|
||||
rtw_write32(pAdapter, 0x808, psd_val);
|
||||
rtw_mdelay_os(1);
|
||||
psd_val |= 0x00400000;
|
||||
|
||||
rtw_write32(pAdapter, 0x808, psd_val);
|
||||
rtw_mdelay_os(1);
|
||||
psd_val = rtw_read32(pAdapter, 0x8B4);
|
||||
|
||||
psd_val &= 0x0000FFFF;
|
||||
|
||||
return psd_val;
|
||||
}
|
||||
|
||||
/*
|
||||
*pts start_point_min stop_point_max
|
||||
* 128 64 64 + 128 = 192
|
||||
* 256 128 128 + 256 = 384
|
||||
* 512 256 256 + 512 = 768
|
||||
* 1024 512 512 + 1024 = 1536
|
||||
*
|
||||
*/
|
||||
u32 mp_query_psd(struct adapter *pAdapter, u8 *data)
|
||||
{
|
||||
u32 i, psd_pts = 0, psd_start = 0, psd_stop = 0;
|
||||
u32 psd_data = 0;
|
||||
|
||||
|
||||
if (!netif_running(pAdapter->pnetdev)) {
|
||||
RT_TRACE(_module_mp_, _drv_warning_, ("mp_query_psd: Fail! interface not opened!\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (check_fwstate(&pAdapter->mlmepriv, WIFI_MP_STATE) == false) {
|
||||
RT_TRACE(_module_mp_, _drv_warning_, ("mp_query_psd: Fail! not in MP mode!\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strlen(data) == 0) { /* default value */
|
||||
psd_pts = 128;
|
||||
psd_start = 64;
|
||||
psd_stop = 128;
|
||||
} else {
|
||||
sscanf(data, "pts =%d, start =%d, stop =%d", &psd_pts, &psd_start, &psd_stop);
|
||||
}
|
||||
|
||||
_rtw_memset(data, '\0', sizeof(*data));
|
||||
|
||||
i = psd_start;
|
||||
while (i < psd_stop) {
|
||||
if (i >= psd_pts) {
|
||||
psd_data = rtw_GetPSDData(pAdapter, i-psd_pts);
|
||||
} else {
|
||||
psd_data = rtw_GetPSDData(pAdapter, i);
|
||||
}
|
||||
sprintf(data, "%s%x ", data, psd_data);
|
||||
i++;
|
||||
}
|
||||
|
||||
rtw_msleep_os(100);
|
||||
return strlen(data)+1;
|
||||
}
|
||||
|
||||
void _rtw_mp_xmit_priv(struct xmit_priv *pxmitpriv)
|
||||
{
|
||||
int i, res;
|
||||
struct adapter *padapter = pxmitpriv->adapter;
|
||||
struct xmit_buf *pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;
|
||||
|
||||
u32 max_xmit_extbuf_size = MAX_XMIT_EXTBUF_SZ;
|
||||
u32 num_xmit_extbuf = NR_XMIT_EXTBUFF;
|
||||
if (padapter->registrypriv.mp_mode == 0) {
|
||||
max_xmit_extbuf_size = MAX_XMIT_EXTBUF_SZ;
|
||||
num_xmit_extbuf = NR_XMIT_EXTBUFF;
|
||||
} else {
|
||||
max_xmit_extbuf_size = 20000;
|
||||
num_xmit_extbuf = 1;
|
||||
}
|
||||
|
||||
pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmit_extbuf;
|
||||
for (i = 0; i < num_xmit_extbuf; i++) {
|
||||
rtw_os_xmit_resource_free(padapter, pxmitbuf, (max_xmit_extbuf_size + XMITBUF_ALIGN_SZ));
|
||||
|
||||
pxmitbuf++;
|
||||
}
|
||||
|
||||
if (pxmitpriv->pallocated_xmit_extbuf)
|
||||
rtw_vmfree(pxmitpriv->pallocated_xmit_extbuf, num_xmit_extbuf * sizeof(struct xmit_buf) + 4);
|
||||
|
||||
if (padapter->registrypriv.mp_mode == 0) {
|
||||
max_xmit_extbuf_size = 20000;
|
||||
num_xmit_extbuf = 1;
|
||||
} else {
|
||||
max_xmit_extbuf_size = MAX_XMIT_EXTBUF_SZ;
|
||||
num_xmit_extbuf = NR_XMIT_EXTBUFF;
|
||||
}
|
||||
|
||||
/* Init xmit extension buff */
|
||||
_rtw_init_queue(&pxmitpriv->free_xmit_extbuf_queue);
|
||||
|
||||
pxmitpriv->pallocated_xmit_extbuf = rtw_zvmalloc(num_xmit_extbuf * sizeof(struct xmit_buf) + 4);
|
||||
|
||||
if (pxmitpriv->pallocated_xmit_extbuf == NULL) {
|
||||
RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("alloc xmit_extbuf fail!\n"));
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pxmitpriv->pxmit_extbuf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitpriv->pallocated_xmit_extbuf), 4);
|
||||
|
||||
pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmit_extbuf;
|
||||
|
||||
for (i = 0; i < num_xmit_extbuf; i++) {
|
||||
_rtw_init_listhead(&pxmitbuf->list);
|
||||
|
||||
pxmitbuf->priv_data = NULL;
|
||||
pxmitbuf->padapter = padapter;
|
||||
pxmitbuf->ext_tag = true;
|
||||
|
||||
res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf, max_xmit_extbuf_size + XMITBUF_ALIGN_SZ);
|
||||
if (res == _FAIL) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
rtw_list_insert_tail(&pxmitbuf->list, &(pxmitpriv->free_xmit_extbuf_queue.queue));
|
||||
pxmitbuf++;
|
||||
}
|
||||
|
||||
pxmitpriv->free_xmit_extbuf_cnt = num_xmit_extbuf;
|
||||
|
||||
exit:
|
||||
;
|
||||
}
|
1508
core/rtw_mp_ioctl.c
1508
core/rtw_mp_ioctl.c
File diff suppressed because it is too large
Load diff
2064
core/rtw_p2p.c
2064
core/rtw_p2p.c
File diff suppressed because it is too large
Load diff
|
@ -22,8 +22,111 @@
|
|||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <osdep_intf.h>
|
||||
#include <usb_ops_linux.h>
|
||||
#include <linux/usb.h>
|
||||
|
||||
static int rtw_hw_suspend(struct adapter *padapter)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
struct net_device *pnetdev = padapter->pnetdev;
|
||||
|
||||
|
||||
if ((!padapter->bup) || (padapter->bDriverStopped) ||
|
||||
(padapter->bSurpriseRemoved)) {
|
||||
DBG_88E("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n",
|
||||
padapter->bup, padapter->bDriverStopped,
|
||||
padapter->bSurpriseRemoved);
|
||||
goto error_exit;
|
||||
}
|
||||
|
||||
/* system suspend */
|
||||
LeaveAllPowerSaveMode(padapter);
|
||||
|
||||
DBG_88E("==> rtw_hw_suspend\n");
|
||||
_enter_pwrlock(&pwrpriv->lock);
|
||||
pwrpriv->bips_processing = true;
|
||||
/* s1. */
|
||||
if (pnetdev) {
|
||||
netif_carrier_off(pnetdev);
|
||||
netif_tx_stop_all_queues(pnetdev);
|
||||
}
|
||||
|
||||
/* s2. */
|
||||
rtw_disassoc_cmd(padapter, 500, false);
|
||||
|
||||
/* s2-2. indicate disconnect to os */
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
|
||||
_clr_fwstate_(pmlmepriv, _FW_LINKED);
|
||||
|
||||
rtw_led_control(padapter, LED_CTL_NO_LINK);
|
||||
|
||||
rtw_os_indicate_disconnect(padapter);
|
||||
|
||||
/* donnot enqueue cmd */
|
||||
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_DISCONNECT, 0);
|
||||
}
|
||||
}
|
||||
/* s2-3. */
|
||||
rtw_free_assoc_resources(padapter, 1);
|
||||
|
||||
/* s2-4. */
|
||||
rtw_free_network_queue(padapter, true);
|
||||
rtw_ips_dev_unload(padapter);
|
||||
pwrpriv->rf_pwrstate = rf_off;
|
||||
pwrpriv->bips_processing = false;
|
||||
|
||||
_exit_pwrlock(&pwrpriv->lock);
|
||||
|
||||
return 0;
|
||||
|
||||
error_exit:
|
||||
DBG_88E("%s, failed\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int rtw_hw_resume(struct adapter *padapter)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
struct net_device *pnetdev = padapter->pnetdev;
|
||||
|
||||
|
||||
/* system resume */
|
||||
DBG_88E("==> rtw_hw_resume\n");
|
||||
_enter_pwrlock(&pwrpriv->lock);
|
||||
pwrpriv->bips_processing = true;
|
||||
rtw_reset_drv_sw(padapter);
|
||||
|
||||
if (pm_netdev_open(pnetdev, false) != 0) {
|
||||
_exit_pwrlock(&pwrpriv->lock);
|
||||
goto error_exit;
|
||||
}
|
||||
|
||||
netif_device_attach(pnetdev);
|
||||
netif_carrier_on(pnetdev);
|
||||
|
||||
if (!netif_queue_stopped(pnetdev))
|
||||
netif_start_queue(pnetdev);
|
||||
else
|
||||
netif_wake_queue(pnetdev);
|
||||
|
||||
pwrpriv->bkeepfwalive = false;
|
||||
pwrpriv->brfoffbyhw = false;
|
||||
|
||||
pwrpriv->rf_pwrstate = rf_on;
|
||||
pwrpriv->bips_processing = false;
|
||||
|
||||
_exit_pwrlock(&pwrpriv->lock);
|
||||
|
||||
|
||||
return 0;
|
||||
error_exit:
|
||||
DBG_88E("%s, Open net dev failed\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ips_enter(struct adapter *padapter)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
|
@ -100,7 +203,7 @@ int ips_leave(struct adapter *padapter)
|
|||
}
|
||||
}
|
||||
|
||||
DBG_88E("==> ips_leave.....LED(0x%08x)...\n", rtw_read32(padapter, 0x4c));
|
||||
DBG_88E("==> ips_leave.....LED(0x%08x)...\n", usb_read32(padapter, 0x4c));
|
||||
pwrpriv->bips_processing = false;
|
||||
|
||||
pwrpriv->bkeepfwalive = false;
|
||||
|
@ -114,46 +217,18 @@ int ips_leave(struct adapter *padapter)
|
|||
|
||||
static bool rtw_pwr_unassociated_idle(struct adapter *adapter)
|
||||
{
|
||||
struct adapter *buddy = adapter->pbuddy_adapter;
|
||||
struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
|
||||
#ifdef CONFIG_88EU_P2P
|
||||
struct wifidirect_info *pwdinfo = &(adapter->wdinfo);
|
||||
#endif
|
||||
|
||||
bool ret = false;
|
||||
|
||||
if (adapter->pwrctrlpriv.ips_deny_time >= rtw_get_current_time())
|
||||
if (time_after_eq(adapter->pwrctrlpriv.ips_deny_time, jiffies))
|
||||
goto exit;
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE|WIFI_SITE_MONITOR) ||
|
||||
check_fwstate(pmlmepriv, WIFI_UNDER_LINKING|WIFI_UNDER_WPS) ||
|
||||
check_fwstate(pmlmepriv, WIFI_AP_STATE) ||
|
||||
check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE|WIFI_ADHOC_STATE) ||
|
||||
#if defined(CONFIG_88EU_P2P)
|
||||
!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
|
||||
#else
|
||||
0)
|
||||
#endif
|
||||
check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE|WIFI_ADHOC_STATE))
|
||||
goto exit;
|
||||
|
||||
/* consider buddy, if exist */
|
||||
if (buddy) {
|
||||
struct mlme_priv *b_pmlmepriv = &(buddy->mlmepriv);
|
||||
#ifdef CONFIG_88EU_P2P
|
||||
struct wifidirect_info *b_pwdinfo = &(buddy->wdinfo);
|
||||
#endif
|
||||
|
||||
if (check_fwstate(b_pmlmepriv, WIFI_ASOC_STATE|WIFI_SITE_MONITOR) ||
|
||||
check_fwstate(b_pmlmepriv, WIFI_UNDER_LINKING|WIFI_UNDER_WPS) ||
|
||||
check_fwstate(b_pmlmepriv, WIFI_AP_STATE) ||
|
||||
check_fwstate(b_pmlmepriv, WIFI_ADHOC_MASTER_STATE|WIFI_ADHOC_STATE) ||
|
||||
#if defined(CONFIG_88EU_P2P)
|
||||
!rtw_p2p_chk_state(b_pwdinfo, P2P_STATE_NONE))
|
||||
#else
|
||||
0)
|
||||
#endif
|
||||
goto exit;
|
||||
}
|
||||
ret = true;
|
||||
|
||||
exit:
|
||||
|
@ -179,7 +254,6 @@ void rtw_ps_processor(struct adapter *padapter)
|
|||
if (rfpwrstate == rf_off) {
|
||||
pwrpriv->change_rfpwrstate = rf_off;
|
||||
pwrpriv->brfoffbyhw = true;
|
||||
padapter->bCardDisableWOHSM = true;
|
||||
rtw_hw_suspend(padapter);
|
||||
} else {
|
||||
pwrpriv->change_rfpwrstate = rf_on;
|
||||
|
@ -205,12 +279,11 @@ void rtw_ps_processor(struct adapter *padapter)
|
|||
exit:
|
||||
rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv);
|
||||
pwrpriv->ps_processing = false;
|
||||
return;
|
||||
}
|
||||
|
||||
static void pwr_state_check_handler(void *FunctionContext)
|
||||
{
|
||||
struct adapter *padapter = (struct adapter *)FunctionContext;
|
||||
struct adapter *padapter = FunctionContext;
|
||||
rtw_ps_cmd(padapter);
|
||||
}
|
||||
|
||||
|
@ -226,11 +299,8 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
|
|||
u8 rpwm;
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
pslv = PS_STATE(pslv);
|
||||
|
||||
|
||||
if (pwrpriv->btcoex_rfon) {
|
||||
if (pslv < PS_STATE_S4)
|
||||
pslv = PS_STATE_S3;
|
||||
|
@ -274,8 +344,6 @@ _func_enter_;
|
|||
|
||||
pwrpriv->tog += 0x80;
|
||||
pwrpriv->cpwm = pslv;
|
||||
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
static u8 PS_RDY_CHECK(struct adapter *padapter)
|
||||
|
@ -285,7 +353,7 @@ static u8 PS_RDY_CHECK(struct adapter *padapter)
|
|||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
|
||||
|
||||
curr_time = rtw_get_current_time();
|
||||
curr_time = jiffies;
|
||||
delta_time = curr_time - pwrpriv->DelayLPSLastTimeStamp;
|
||||
|
||||
if (delta_time < LPS_DELAY_TIME)
|
||||
|
@ -309,11 +377,6 @@ static u8 PS_RDY_CHECK(struct adapter *padapter)
|
|||
void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
#ifdef CONFIG_88EU_P2P
|
||||
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
|
||||
#endif /* CONFIG_88EU_P2P */
|
||||
|
||||
_func_enter_;
|
||||
|
||||
RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_notice_,
|
||||
("%s: PowerMode=%d Smart_PS=%d\n",
|
||||
|
@ -335,16 +398,6 @@ _func_enter_;
|
|||
|
||||
/* if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) */
|
||||
if (ps_mode == PS_MODE_ACTIVE) {
|
||||
#ifdef CONFIG_88EU_P2P
|
||||
if (pwdinfo->opp_ps == 0) {
|
||||
DBG_88E("rtw_set_ps_mode: Leave 802.11 power save\n");
|
||||
pwrpriv->pwr_mode = ps_mode;
|
||||
rtw_set_rpwm(padapter, PS_STATE_S4);
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&ps_mode));
|
||||
pwrpriv->bFwCurrentInPSMode = false;
|
||||
}
|
||||
} else {
|
||||
#endif /* CONFIG_88EU_P2P */
|
||||
if (PS_RDY_CHECK(padapter)) {
|
||||
DBG_88E("%s: Enter 802.11 power save\n", __func__);
|
||||
pwrpriv->bFwCurrentInPSMode = true;
|
||||
|
@ -352,18 +405,9 @@ _func_enter_;
|
|||
pwrpriv->smart_ps = smart_ps;
|
||||
pwrpriv->bcn_ant_mode = bcn_ant_mode;
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&ps_mode));
|
||||
|
||||
#ifdef CONFIG_88EU_P2P
|
||||
/* Set CTWindow after LPS */
|
||||
if (pwdinfo->opp_ps == 1)
|
||||
p2p_ps_wk_cmd(padapter, P2P_PS_ENABLE, 0);
|
||||
#endif /* CONFIG_88EU_P2P */
|
||||
|
||||
rtw_set_rpwm(padapter, PS_STATE_S2);
|
||||
}
|
||||
}
|
||||
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -379,7 +423,7 @@ s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms)
|
|||
s32 err = 0;
|
||||
|
||||
|
||||
start_time = rtw_get_current_time();
|
||||
start_time = jiffies;
|
||||
while (1) {
|
||||
rtw_hal_get_hwreg(padapter, HW_VAR_FWLPS_RF_ON, &bAwake);
|
||||
if (bAwake)
|
||||
|
@ -396,7 +440,7 @@ s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms)
|
|||
DBG_88E("%s: Wait for FW LPS leave more than %u ms!!!\n", __func__, delay_ms);
|
||||
break;
|
||||
}
|
||||
rtw_usleep_os(100);
|
||||
msleep(1);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
@ -410,8 +454,6 @@ void LPS_Enter(struct adapter *padapter)
|
|||
{
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
if (PS_RDY_CHECK(padapter) == false)
|
||||
return;
|
||||
|
||||
|
@ -428,8 +470,6 @@ _func_enter_;
|
|||
pwrpriv->LpsIdleCount++;
|
||||
}
|
||||
}
|
||||
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
#define LPS_LEAVE_TIMEOUT_MS 100
|
||||
|
@ -440,8 +480,6 @@ void LPS_Leave(struct adapter *padapter)
|
|||
{
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
if (pwrpriv->bLeisurePs) {
|
||||
if (pwrpriv->pwr_mode != PS_MODE_ACTIVE) {
|
||||
rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0);
|
||||
|
@ -452,8 +490,6 @@ _func_enter_;
|
|||
}
|
||||
|
||||
pwrpriv->bpower_saving = false;
|
||||
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
/* */
|
||||
|
@ -465,23 +501,14 @@ void LeaveAllPowerSaveMode(struct adapter *Adapter)
|
|||
struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
|
||||
u8 enqueue = 0;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED)) { /* connect */
|
||||
p2p_ps_wk_cmd(Adapter, P2P_PS_DISABLE, enqueue);
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED))
|
||||
rtw_lps_ctrl_wk_cmd(Adapter, LPS_CTRL_LEAVE, enqueue);
|
||||
}
|
||||
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
void rtw_init_pwrctrl_priv(struct adapter *padapter)
|
||||
{
|
||||
struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
_init_pwrlock(&pwrctrlpriv->lock);
|
||||
pwrctrlpriv->rf_pwrstate = rf_on;
|
||||
pwrctrlpriv->ips_enter_cnts = 0;
|
||||
|
@ -499,7 +526,7 @@ _func_enter_;
|
|||
|
||||
pwrctrlpriv->LpsIdleCount = 0;
|
||||
if (padapter->registrypriv.mp_mode == 1)
|
||||
pwrctrlpriv->power_mgnt = PS_MODE_ACTIVE ;
|
||||
pwrctrlpriv->power_mgnt = PS_MODE_ACTIVE;
|
||||
else
|
||||
pwrctrlpriv->power_mgnt = padapter->registrypriv.power_mgnt;/* PS_MODE_MIN; */
|
||||
pwrctrlpriv->bLeisurePs = (PS_MODE_ACTIVE != pwrctrlpriv->power_mgnt) ? true : false;
|
||||
|
@ -518,40 +545,18 @@ _func_enter_;
|
|||
pwrctrlpriv->btcoex_rfon = false;
|
||||
|
||||
_init_timer(&(pwrctrlpriv->pwr_state_check_timer), padapter->pnetdev, pwr_state_check_handler, (u8 *)padapter);
|
||||
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
void rtw_free_pwrctrl_priv(struct adapter *adapter)
|
||||
{
|
||||
struct pwrctrl_priv *pwrctrlpriv = &adapter->pwrctrlpriv;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
_free_pwrlock(&pwrctrlpriv->lock);
|
||||
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
u8 rtw_interface_ps_func(struct adapter *padapter, enum hal_intf_ps_func efunc_id, u8 *val)
|
||||
{
|
||||
u8 bResult = true;
|
||||
rtw_hal_intf_ps_func(padapter, efunc_id, val);
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
|
||||
inline void rtw_set_ips_deny(struct adapter *padapter, u32 ms)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
pwrpriv->ips_deny_time = rtw_get_current_time() + rtw_ms_to_systime(ms);
|
||||
pwrpriv->ips_deny_time = jiffies + msecs_to_jiffies(ms);
|
||||
}
|
||||
|
||||
/*
|
||||
* rtw_pwr_wakeup - Wake the NIC up from: 1)IPS. 2)USB autosuspend
|
||||
* @adapter: pointer to struct adapter structure
|
||||
* @ips_deffer_ms: the ms wiil prevent from falling into IPS after wakeup
|
||||
* @ips_deffer_ms: the ms will prevent from falling into IPS after wakeup
|
||||
* Return _SUCCESS or _FAIL
|
||||
*/
|
||||
|
||||
|
@ -559,17 +564,19 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal
|
|||
{
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
unsigned long expires;
|
||||
int ret = _SUCCESS;
|
||||
|
||||
if (pwrpriv->ips_deny_time < rtw_get_current_time() + rtw_ms_to_systime(ips_deffer_ms))
|
||||
pwrpriv->ips_deny_time = rtw_get_current_time() + rtw_ms_to_systime(ips_deffer_ms);
|
||||
expires = jiffies + msecs_to_jiffies(ips_deffer_ms);
|
||||
if (time_before(pwrpriv->ips_deny_time, expires))
|
||||
pwrpriv->ips_deny_time = jiffies + msecs_to_jiffies(ips_deffer_ms);
|
||||
|
||||
{
|
||||
u32 start = rtw_get_current_time();
|
||||
u32 start = jiffies;
|
||||
if (pwrpriv->ps_processing) {
|
||||
DBG_88E("%s wait ps_processing...\n", __func__);
|
||||
while (pwrpriv->ps_processing && rtw_get_passing_time_ms(start) <= 3000)
|
||||
rtw_msleep_os(10);
|
||||
usleep_range(1000, 3000);
|
||||
if (pwrpriv->ps_processing)
|
||||
DBG_88E("%s wait ps_processing timeout\n", __func__);
|
||||
else
|
||||
|
@ -616,8 +623,9 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal
|
|||
}
|
||||
|
||||
exit:
|
||||
if (pwrpriv->ips_deny_time < rtw_get_current_time() + rtw_ms_to_systime(ips_deffer_ms))
|
||||
pwrpriv->ips_deny_time = rtw_get_current_time() + rtw_ms_to_systime(ips_deffer_ms);
|
||||
expires = jiffies + msecs_to_jiffies(ips_deffer_ms);
|
||||
if (time_before(pwrpriv->ips_deny_time, expires))
|
||||
pwrpriv->ips_deny_time = jiffies + msecs_to_jiffies(ips_deffer_ms);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
710
core/rtw_recv.c
710
core/rtw_recv.c
File diff suppressed because it is too large
Load diff
|
@ -41,7 +41,6 @@ static void arcfour_init(struct arc4context *parc4ctx, u8 *key, u32 key_len)
|
|||
u32 stateindex;
|
||||
u8 *state;
|
||||
u32 counter;
|
||||
_func_enter_;
|
||||
state = parc4ctx->state;
|
||||
parc4ctx->x = 0;
|
||||
parc4ctx->y = 0;
|
||||
|
@ -58,7 +57,6 @@ _func_enter_;
|
|||
if (++keyindex >= key_len)
|
||||
keyindex = 0;
|
||||
}
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
static u32 arcfour_byte(struct arc4context *parc4ctx)
|
||||
|
@ -67,7 +65,6 @@ static u32 arcfour_byte(struct arc4context *parc4ctx)
|
|||
u32 y;
|
||||
u32 sx, sy;
|
||||
u8 *state;
|
||||
_func_enter_;
|
||||
state = parc4ctx->state;
|
||||
x = (parc4ctx->x + 1) & 0xff;
|
||||
sx = state[x];
|
||||
|
@ -77,17 +74,14 @@ _func_enter_;
|
|||
parc4ctx->y = y;
|
||||
state[y] = (u8)sx;
|
||||
state[x] = (u8)sy;
|
||||
_func_exit_;
|
||||
return state[(sx + sy) & 0xff];
|
||||
}
|
||||
|
||||
static void arcfour_encrypt(struct arc4context *parc4ctx, u8 *dest, u8 *src, u32 len)
|
||||
{
|
||||
u32 i;
|
||||
_func_enter_;
|
||||
for (i = 0; i < len; i++)
|
||||
dest[i] = src[i] ^ (unsigned char)arcfour_byte(parc4ctx);
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
static int bcrc32initialized;
|
||||
|
@ -102,9 +96,8 @@ static u8 crc32_reverseBit(u8 data)
|
|||
|
||||
static void crc32_init(void)
|
||||
{
|
||||
_func_enter_;
|
||||
if (bcrc32initialized == 1) {
|
||||
goto exit;
|
||||
return;
|
||||
} else {
|
||||
int i, j;
|
||||
u32 c;
|
||||
|
@ -126,15 +119,12 @@ _func_enter_;
|
|||
}
|
||||
bcrc32initialized = 1;
|
||||
}
|
||||
exit:
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
static __le32 getcrc32(u8 *buf, int len)
|
||||
{
|
||||
u8 *p;
|
||||
u32 crc;
|
||||
_func_enter_;
|
||||
if (bcrc32initialized == 0)
|
||||
crc32_init();
|
||||
|
||||
|
@ -142,7 +132,6 @@ _func_enter_;
|
|||
|
||||
for (p = buf; len > 0; ++p, --len)
|
||||
crc = crc32_table[(crc ^ *p) & 0xff] ^ (crc >> 8);
|
||||
_func_exit_;
|
||||
return cpu_to_le32(~crc); /* transmit complement, per CRC-32 spec */
|
||||
}
|
||||
|
||||
|
@ -165,7 +154,6 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
|
|||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
|
||||
return;
|
||||
|
@ -201,12 +189,11 @@ _func_enter_;
|
|||
arcfour_encrypt(&mycontext, payload+length, crc, 4);
|
||||
|
||||
pframe += pxmitpriv->frag_len;
|
||||
pframe = (u8 *)RND4((size_t)(pframe));
|
||||
pframe = (u8 *)round_up((size_t)(pframe), 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
|
||||
|
@ -218,12 +205,11 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
|
|||
u32 keylength;
|
||||
u8 *pframe, *payload, *iv, wepkey[16];
|
||||
u8 keyindex;
|
||||
struct rx_pkt_attrib *prxattrib = &(((union recv_frame *)precvframe)->u.hdr.attrib);
|
||||
struct rx_pkt_attrib *prxattrib = &(((struct recv_frame *)precvframe)->attrib);
|
||||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
pframe = (unsigned char *)((union recv_frame *)precvframe)->u.hdr.rx_data;
|
||||
pframe = (unsigned char *)((struct recv_frame *)precvframe)->rx_data;
|
||||
|
||||
/* start to decrypt recvframe */
|
||||
if ((prxattrib->encrypt == _WEP40_) || (prxattrib->encrypt == _WEP104_)) {
|
||||
|
@ -232,7 +218,7 @@ _func_enter_;
|
|||
keylength = psecuritypriv->dot11DefKeylen[keyindex];
|
||||
memcpy(&wepkey[0], iv, 3);
|
||||
memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[keyindex].skey[0], keylength);
|
||||
length = ((union recv_frame *)precvframe)->u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len;
|
||||
length = ((struct recv_frame *)precvframe)->len-prxattrib->hdrlen-prxattrib->iv_len;
|
||||
|
||||
payload = pframe+prxattrib->iv_len+prxattrib->hdrlen;
|
||||
|
||||
|
@ -252,7 +238,6 @@ _func_enter_;
|
|||
&crc, &payload[length-4]));
|
||||
}
|
||||
}
|
||||
_func_exit_;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -263,10 +248,8 @@ static u32 secmicgetuint32(u8 *p)
|
|||
{
|
||||
s32 i;
|
||||
u32 res = 0;
|
||||
_func_enter_;
|
||||
for (i = 0; i < 4; i++)
|
||||
res |= ((u32)(*p++)) << (8*i);
|
||||
_func_exit_;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -274,39 +257,32 @@ static void secmicputuint32(u8 *p, u32 val)
|
|||
/* Convert from Us3232 to Byte[] in a portable way */
|
||||
{
|
||||
long i;
|
||||
_func_enter_;
|
||||
for (i = 0; i < 4; i++) {
|
||||
*p++ = (u8) (val & 0xff);
|
||||
*p++ = (u8)(val & 0xff);
|
||||
val >>= 8;
|
||||
}
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
static void secmicclear(struct mic_data *pmicdata)
|
||||
{
|
||||
/* Reset the state to the empty message. */
|
||||
_func_enter_;
|
||||
pmicdata->L = pmicdata->K0;
|
||||
pmicdata->R = pmicdata->K1;
|
||||
pmicdata->nBytesInM = 0;
|
||||
pmicdata->M = 0;
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
void rtw_secmicsetkey(struct mic_data *pmicdata, u8 *key)
|
||||
{
|
||||
/* Set the key */
|
||||
_func_enter_;
|
||||
pmicdata->K0 = secmicgetuint32(key);
|
||||
pmicdata->K1 = secmicgetuint32(key + 4);
|
||||
/* and reset the message */
|
||||
secmicclear(pmicdata);
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b)
|
||||
{
|
||||
_func_enter_;
|
||||
/* Append the byte to our word-sized buffer */
|
||||
pmicdata->M |= ((unsigned long)b) << (8*pmicdata->nBytesInM);
|
||||
pmicdata->nBytesInM++;
|
||||
|
@ -325,23 +301,19 @@ _func_enter_;
|
|||
pmicdata->M = 0;
|
||||
pmicdata->nBytesInM = 0;
|
||||
}
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
void rtw_secmicappend(struct mic_data *pmicdata, u8 *src, u32 nbytes)
|
||||
{
|
||||
_func_enter_;
|
||||
/* This is simple */
|
||||
while (nbytes > 0) {
|
||||
rtw_secmicappendbyte(pmicdata, *src++);
|
||||
nbytes--;
|
||||
}
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
void rtw_secgetmic(struct mic_data *pmicdata, u8 *dst)
|
||||
{
|
||||
_func_enter_;
|
||||
/* Append the minimum padding */
|
||||
rtw_secmicappendbyte(pmicdata, 0x5a);
|
||||
rtw_secmicappendbyte(pmicdata, 0);
|
||||
|
@ -356,14 +328,12 @@ _func_enter_;
|
|||
secmicputuint32(dst+4, pmicdata->R);
|
||||
/* Reset to the empty message. */
|
||||
secmicclear(pmicdata);
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 data_len, u8 *mic_code, u8 pri)
|
||||
{
|
||||
struct mic_data micdata;
|
||||
u8 priority[4] = {0x0, 0x0, 0x0, 0x0};
|
||||
_func_enter_;
|
||||
rtw_secmicsetkey(&micdata, key);
|
||||
priority[0] = pri;
|
||||
|
||||
|
@ -386,7 +356,6 @@ _func_enter_;
|
|||
rtw_secmicappend(&micdata, data, data_len);
|
||||
|
||||
rtw_secgetmic(&micdata, mic_code);
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
|
||||
|
@ -505,7 +474,6 @@ static const unsigned short Sbox1[2][256] = { /* Sbox for hash (can be in ROM)
|
|||
static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32)
|
||||
{
|
||||
int i;
|
||||
_func_enter_;
|
||||
/* Initialize the 80 bits of P1K[] from IV32 and TA[0..5] */
|
||||
p1k[0] = Lo16(iv32);
|
||||
p1k[1] = Hi16(iv32);
|
||||
|
@ -523,7 +491,6 @@ _func_enter_;
|
|||
p1k[4] += _S_(p1k[3] ^ TK16((i&1)+0));
|
||||
p1k[4] += (unsigned short)i; /* avoid "slide attacks" */
|
||||
}
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -553,7 +520,6 @@ static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16)
|
|||
{
|
||||
int i;
|
||||
u16 PPK[6]; /* temporary key for mixing */
|
||||
_func_enter_;
|
||||
/* Note: all adds in the PPK[] equations below are mod 2**16 */
|
||||
for (i = 0; i < 5; i++)
|
||||
PPK[i] = p1k[i]; /* first, copy P1K to PPK */
|
||||
|
@ -590,7 +556,6 @@ _func_enter_;
|
|||
rc4key[4+2*i] = Lo8(PPK[i]);
|
||||
rc4key[5+2*i] = Hi8(PPK[i]);
|
||||
}
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
/* The hlen isn't include the IV */
|
||||
|
@ -612,7 +577,6 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
|
|||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
u32 res = _SUCCESS;
|
||||
_func_enter_;
|
||||
|
||||
if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
|
||||
return _FAIL;
|
||||
|
@ -657,14 +621,14 @@ _func_enter_;
|
|||
arcfour_encrypt(&mycontext, payload, payload, length);
|
||||
arcfour_encrypt(&mycontext, payload+length, crc, 4);
|
||||
} else {
|
||||
length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ;
|
||||
length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len;
|
||||
*((__le32 *)crc) = getcrc32(payload, length);/* modified by Amy*/
|
||||
arcfour_init(&mycontext, rc4key, 16);
|
||||
arcfour_encrypt(&mycontext, payload, payload, length);
|
||||
arcfour_encrypt(&mycontext, payload+length, crc, 4);
|
||||
|
||||
pframe += pxmitpriv->frag_len;
|
||||
pframe = (u8 *)RND4((size_t)(pframe));
|
||||
pframe = (u8 *)round_up((size_t)(pframe), 4);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -672,7 +636,6 @@ _func_enter_;
|
|||
res = _FAIL;
|
||||
}
|
||||
}
|
||||
_func_exit_;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -690,13 +653,12 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
|
|||
u8 *pframe, *payload, *iv, *prwskey;
|
||||
union pn48 dot11txpn;
|
||||
struct sta_info *stainfo;
|
||||
struct rx_pkt_attrib *prxattrib = &((union recv_frame *)precvframe)->u.hdr.attrib;
|
||||
struct rx_pkt_attrib *prxattrib = &((struct recv_frame *)precvframe)->attrib;
|
||||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
u32 res = _SUCCESS;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
pframe = (unsigned char *)((union recv_frame *)precvframe)->u.hdr.rx_data;
|
||||
pframe = (unsigned char *)((struct recv_frame *)precvframe)->rx_data;
|
||||
|
||||
/* 4 start to decrypt recvframe */
|
||||
if (prxattrib->encrypt == _TKIP_) {
|
||||
|
@ -716,7 +678,7 @@ _func_enter_;
|
|||
|
||||
iv = pframe+prxattrib->hdrlen;
|
||||
payload = pframe+prxattrib->iv_len+prxattrib->hdrlen;
|
||||
length = ((union recv_frame *)precvframe)->u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len;
|
||||
length = ((struct recv_frame *)precvframe)->len-prxattrib->hdrlen-prxattrib->iv_len;
|
||||
|
||||
GET_TKIP_PN(iv, dot11txpn);
|
||||
|
||||
|
@ -747,7 +709,6 @@ _func_enter_;
|
|||
res = _FAIL;
|
||||
}
|
||||
}
|
||||
_func_exit_;
|
||||
exit:
|
||||
return res;
|
||||
}
|
||||
|
@ -821,19 +782,15 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext);
|
|||
static void xor_128(u8 *a, u8 *b, u8 *out)
|
||||
{
|
||||
int i;
|
||||
_func_enter_;
|
||||
for (i = 0; i < 16; i++)
|
||||
out[i] = a[i] ^ b[i];
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
static void xor_32(u8 *a, u8 *b, u8 *out)
|
||||
{
|
||||
int i;
|
||||
_func_enter_;
|
||||
for (i = 0; i < 4; i++)
|
||||
out[i] = a[i] ^ b[i];
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
static u8 sbox(u8 a)
|
||||
|
@ -849,7 +806,6 @@ static void next_key(u8 *key, int round)
|
|||
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
|
||||
0x1b, 0x36, 0x36, 0x36
|
||||
};
|
||||
_func_enter_;
|
||||
sbox_key[0] = sbox(key[13]);
|
||||
sbox_key[1] = sbox(key[14]);
|
||||
sbox_key[2] = sbox(key[15]);
|
||||
|
@ -863,21 +819,17 @@ _func_enter_;
|
|||
xor_32(&key[4], &key[0], &key[4]);
|
||||
xor_32(&key[8], &key[4], &key[8]);
|
||||
xor_32(&key[12], &key[8], &key[12]);
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
static void byte_sub(u8 *in, u8 *out)
|
||||
{
|
||||
int i;
|
||||
_func_enter_;
|
||||
for (i = 0; i < 16; i++)
|
||||
out[i] = sbox(in[i]);
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
static void shift_row(u8 *in, u8 *out)
|
||||
{
|
||||
_func_enter_;
|
||||
out[0] = in[0];
|
||||
out[1] = in[5];
|
||||
out[2] = in[10];
|
||||
|
@ -894,7 +846,6 @@ _func_enter_;
|
|||
out[13] = in[1];
|
||||
out[14] = in[6];
|
||||
out[15] = in[11];
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
static void mix_column(u8 *in, u8 *out)
|
||||
|
@ -908,7 +859,6 @@ static void mix_column(u8 *in, u8 *out)
|
|||
u8 rotr[4];
|
||||
u8 temp[4];
|
||||
u8 tempb[4];
|
||||
_func_enter_;
|
||||
for (i = 0 ; i < 4; i++) {
|
||||
if ((in[i] & 0x80) == 0x80)
|
||||
add1b[i] = 0x1b;
|
||||
|
@ -952,7 +902,6 @@ _func_enter_;
|
|||
xor_32(add1bf7, rotr, temp);
|
||||
xor_32(swap_halfs, rotl, tempb);
|
||||
xor_32(temp, tempb, out);
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext)
|
||||
|
@ -962,7 +911,6 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext)
|
|||
u8 intermediatea[16];
|
||||
u8 intermediateb[16];
|
||||
u8 round_key[16];
|
||||
_func_enter_;
|
||||
for (i = 0; i < 16; i++)
|
||||
round_key[i] = key[i];
|
||||
for (round = 0; round < 11; round++) {
|
||||
|
@ -984,7 +932,6 @@ _func_enter_;
|
|||
next_key(round_key, round);
|
||||
}
|
||||
}
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
/************************************************/
|
||||
|
@ -995,7 +942,6 @@ static void construct_mic_iv(u8 *mic_iv, int qc_exists, int a4_exists, u8 *mpdu,
|
|||
uint payload_length, u8 *pn_vector)
|
||||
{
|
||||
int i;
|
||||
_func_enter_;
|
||||
mic_iv[0] = 0x59;
|
||||
if (qc_exists && a4_exists)
|
||||
mic_iv[1] = mpdu[30] & 0x0f; /* QoS_TC */
|
||||
|
@ -1007,9 +953,8 @@ _func_enter_;
|
|||
mic_iv[i] = mpdu[i + 8]; /* mic_iv[2:7] = A2[0:5] = mpdu[10:15] */
|
||||
for (i = 8; i < 14; i++)
|
||||
mic_iv[i] = pn_vector[13 - i]; /* mic_iv[8:13] = PN[5:0] */
|
||||
mic_iv[14] = (unsigned char) (payload_length / 256);
|
||||
mic_iv[15] = (unsigned char) (payload_length % 256);
|
||||
_func_exit_;
|
||||
mic_iv[14] = (unsigned char)(payload_length / 256);
|
||||
mic_iv[15] = (unsigned char)(payload_length % 256);
|
||||
}
|
||||
|
||||
/************************************************/
|
||||
|
@ -1019,7 +964,6 @@ _func_exit_;
|
|||
/************************************************/
|
||||
static void construct_mic_header1(u8 *mic_header1, int header_length, u8 *mpdu)
|
||||
{
|
||||
_func_enter_;
|
||||
mic_header1[0] = (u8)((header_length - 2) / 256);
|
||||
mic_header1[1] = (u8)((header_length - 2) % 256);
|
||||
mic_header1[2] = mpdu[0] & 0xcf; /* Mute CF poll & CF ack bits */
|
||||
|
@ -1036,7 +980,6 @@ _func_enter_;
|
|||
mic_header1[13] = mpdu[13];
|
||||
mic_header1[14] = mpdu[14];
|
||||
mic_header1[15] = mpdu[15];
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
/************************************************/
|
||||
|
@ -1047,7 +990,6 @@ _func_exit_;
|
|||
static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, int qc_exists)
|
||||
{
|
||||
int i;
|
||||
_func_enter_;
|
||||
for (i = 0; i < 16; i++)
|
||||
mic_header2[i] = 0x00;
|
||||
|
||||
|
@ -1079,7 +1021,6 @@ _func_enter_;
|
|||
mic_header2[15] = mpdu[31] & 0x00;
|
||||
}
|
||||
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
/************************************************/
|
||||
|
@ -1090,7 +1031,6 @@ _func_exit_;
|
|||
static void construct_ctr_preload(u8 *ctr_preload, int a4_exists, int qc_exists, u8 *mpdu, u8 *pn_vector, int c)
|
||||
{
|
||||
int i;
|
||||
_func_enter_;
|
||||
for (i = 0; i < 16; i++)
|
||||
ctr_preload[i] = 0x00;
|
||||
i = 0;
|
||||
|
@ -1105,9 +1045,8 @@ _func_enter_;
|
|||
ctr_preload[i] = mpdu[i + 8]; /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */
|
||||
for (i = 8; i < 14; i++)
|
||||
ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */
|
||||
ctr_preload[14] = (unsigned char) (c / 256); /* Ctr */
|
||||
ctr_preload[15] = (unsigned char) (c % 256);
|
||||
_func_exit_;
|
||||
ctr_preload[14] = (unsigned char)(c / 256); /* Ctr */
|
||||
ctr_preload[15] = (unsigned char)(c % 256);
|
||||
}
|
||||
|
||||
/************************************/
|
||||
|
@ -1117,10 +1056,8 @@ _func_exit_;
|
|||
static void bitwise_xor(u8 *ina, u8 *inb, u8 *out)
|
||||
{
|
||||
int i;
|
||||
_func_enter_;
|
||||
for (i = 0; i < 16; i++)
|
||||
out[i] = ina[i] ^ inb[i];
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
static int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen)
|
||||
|
@ -1142,16 +1079,15 @@ static int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen)
|
|||
uint frtype = GetFrameType(pframe);
|
||||
uint frsubtype = GetFrameSubType(pframe);
|
||||
|
||||
_func_enter_;
|
||||
frsubtype = frsubtype>>4;
|
||||
|
||||
_rtw_memset((void *)mic_iv, 0, 16);
|
||||
_rtw_memset((void *)mic_header1, 0, 16);
|
||||
_rtw_memset((void *)mic_header2, 0, 16);
|
||||
_rtw_memset((void *)ctr_preload, 0, 16);
|
||||
_rtw_memset((void *)chain_buffer, 0, 16);
|
||||
_rtw_memset((void *)aes_out, 0, 16);
|
||||
_rtw_memset((void *)padded_buffer, 0, 16);
|
||||
memset((void *)mic_iv, 0, 16);
|
||||
memset((void *)mic_header1, 0, 16);
|
||||
memset((void *)mic_header2, 0, 16);
|
||||
memset((void *)ctr_preload, 0, 16);
|
||||
memset((void *)chain_buffer, 0, 16);
|
||||
memset((void *)aes_out, 0, 16);
|
||||
memset((void *)padded_buffer, 0, 16);
|
||||
|
||||
if ((hdrlen == WLAN_HDR_A3_LEN) || (hdrlen == WLAN_HDR_A3_QOS_LEN))
|
||||
a4_exists = 0;
|
||||
|
@ -1217,7 +1153,7 @@ _func_enter_;
|
|||
|
||||
/* Insert MIC into payload */
|
||||
for (j = 0; j < 8; j++)
|
||||
pframe[payload_index+j] = mic[j]; /* message[payload_index+j] = mic[j]; */
|
||||
pframe[payload_index+j] = mic[j];
|
||||
|
||||
payload_index = hdrlen + 8;
|
||||
for (i = 0; i < num_blocks; i++) {
|
||||
|
@ -1253,7 +1189,6 @@ _func_enter_;
|
|||
bitwise_xor(aes_out, padded_buffer, chain_buffer);
|
||||
for (j = 0; j < 8; j++)
|
||||
pframe[payload_index++] = chain_buffer[j];
|
||||
_func_exit_;
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1274,7 +1209,6 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
|
|||
|
||||
/* uint offset = 0; */
|
||||
u32 res = _SUCCESS;
|
||||
_func_enter_;
|
||||
|
||||
if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
|
||||
return _FAIL;
|
||||
|
@ -1285,7 +1219,7 @@ _func_enter_;
|
|||
pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + hw_hdr_offset;
|
||||
|
||||
/* 4 start to encrypt each fragment */
|
||||
if ((pattrib->encrypt == _AES_)) {
|
||||
if (pattrib->encrypt == _AES_) {
|
||||
if (pattrib->psta)
|
||||
stainfo = pattrib->psta;
|
||||
else
|
||||
|
@ -1304,11 +1238,11 @@ _func_enter_;
|
|||
|
||||
aes_cipher(prwskey, pattrib->hdrlen, pframe, length);
|
||||
} else{
|
||||
length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ;
|
||||
length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len;
|
||||
|
||||
aes_cipher(prwskey, pattrib->hdrlen, pframe, length);
|
||||
pframe += pxmitpriv->frag_len;
|
||||
pframe = (u8 *)RND4((size_t)(pframe));
|
||||
pframe = (u8 *)round_up((size_t)(pframe), 8);
|
||||
}
|
||||
}
|
||||
} else{
|
||||
|
@ -1318,7 +1252,6 @@ _func_enter_;
|
|||
}
|
||||
|
||||
|
||||
_func_exit_;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1344,16 +1277,15 @@ static int aes_decipher(u8 *key, uint hdrlen,
|
|||
/* uint offset = 0; */
|
||||
uint frtype = GetFrameType(pframe);
|
||||
uint frsubtype = GetFrameSubType(pframe);
|
||||
_func_enter_;
|
||||
frsubtype = frsubtype>>4;
|
||||
|
||||
_rtw_memset((void *)mic_iv, 0, 16);
|
||||
_rtw_memset((void *)mic_header1, 0, 16);
|
||||
_rtw_memset((void *)mic_header2, 0, 16);
|
||||
_rtw_memset((void *)ctr_preload, 0, 16);
|
||||
_rtw_memset((void *)chain_buffer, 0, 16);
|
||||
_rtw_memset((void *)aes_out, 0, 16);
|
||||
_rtw_memset((void *)padded_buffer, 0, 16);
|
||||
memset((void *)mic_iv, 0, 16);
|
||||
memset((void *)mic_header1, 0, 16);
|
||||
memset((void *)mic_header2, 0, 16);
|
||||
memset((void *)ctr_preload, 0, 16);
|
||||
memset((void *)chain_buffer, 0, 16);
|
||||
memset((void *)aes_out, 0, 16);
|
||||
memset((void *)padded_buffer, 0, 16);
|
||||
|
||||
/* start to decrypt the payload */
|
||||
|
||||
|
@ -1514,7 +1446,6 @@ _func_enter_;
|
|||
res = _FAIL;
|
||||
}
|
||||
}
|
||||
_func_exit_;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1524,13 +1455,12 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
|
|||
int length;
|
||||
u8 *pframe, *prwskey; /* *payload,*iv */
|
||||
struct sta_info *stainfo;
|
||||
struct rx_pkt_attrib *prxattrib = &((union recv_frame *)precvframe)->u.hdr.attrib;
|
||||
struct rx_pkt_attrib *prxattrib = &((struct recv_frame *)precvframe)->attrib;
|
||||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
u32 res = _SUCCESS;
|
||||
_func_enter_;
|
||||
pframe = (unsigned char *)((union recv_frame *)precvframe)->u.hdr.rx_data;
|
||||
pframe = (unsigned char *)((struct recv_frame *)precvframe)->rx_data;
|
||||
/* 4 start to encrypt each fragment */
|
||||
if ((prxattrib->encrypt == _AES_)) {
|
||||
if (prxattrib->encrypt == _AES_) {
|
||||
stainfo = rtw_get_stainfo(&padapter->stapriv, &prxattrib->ta[0]);
|
||||
if (stainfo != NULL) {
|
||||
RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_aes_decrypt: stainfo!= NULL!!!\n"));
|
||||
|
@ -1552,14 +1482,13 @@ _func_enter_;
|
|||
} else {
|
||||
prwskey = &stainfo->dot118021x_UncstKey.skey[0];
|
||||
}
|
||||
length = ((union recv_frame *)precvframe)->u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len;
|
||||
length = ((struct recv_frame *)precvframe)->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"));
|
||||
res = _FAIL;
|
||||
}
|
||||
}
|
||||
_func_exit_;
|
||||
exit:
|
||||
return res;
|
||||
}
|
||||
|
@ -1750,30 +1679,3 @@ do { \
|
|||
d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \
|
||||
d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3]; \
|
||||
} while (0);
|
||||
|
||||
/**
|
||||
* omac1_aes_128 - One-Key CBC MAC (OMAC1) hash with AES-128 (aka AES-CMAC)
|
||||
* @key: 128-bit key for the hash operation
|
||||
* @data: Data buffer for which a MAC is determined
|
||||
* @data_len: Length of data buffer in bytes
|
||||
* @mac: Buffer for MAC (128 bits, i.e., 16 bytes)
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* This is a mode for using block cipher (AES in this case) for authentication.
|
||||
* OMAC1 was standardized with the name CMAC by NIST in a Special Publication
|
||||
* (SP) 800-38B.
|
||||
*/
|
||||
void rtw_use_tkipkey_handler(void *FunctionContext)
|
||||
{
|
||||
struct adapter *padapter = (struct adapter *)FunctionContext;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("^^^rtw_use_tkipkey_handler ^^^\n"));
|
||||
|
||||
padapter->securitypriv.busetkipkey = true;
|
||||
|
||||
RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("^^^rtw_use_tkipkey_handler padapter->securitypriv.busetkipkey=%d^^^\n", padapter->securitypriv.busetkipkey));
|
||||
|
||||
_func_exit_;
|
||||
}
|
||||
|
|
|
@ -19,27 +19,14 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include <rtw_sreset.h>
|
||||
#include <usb_ops_linux.h>
|
||||
|
||||
void sreset_init_value(struct adapter *padapter)
|
||||
{
|
||||
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
|
||||
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
||||
|
||||
_rtw_mutex_init(&psrtpriv->silentreset_mutex);
|
||||
psrtpriv->silent_reset_inprogress = false;
|
||||
psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
|
||||
psrtpriv->last_tx_time = 0;
|
||||
psrtpriv->last_tx_complete_time = 0;
|
||||
}
|
||||
void sreset_reset_value(struct adapter *padapter)
|
||||
{
|
||||
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
|
||||
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
||||
|
||||
psrtpriv->silent_reset_inprogress = false;
|
||||
psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
|
||||
psrtpriv->last_tx_time = 0;
|
||||
psrtpriv->last_tx_complete_time = 0;
|
||||
}
|
||||
|
||||
u8 sreset_get_wifi_status(struct adapter *padapter)
|
||||
|
@ -50,9 +37,7 @@ u8 sreset_get_wifi_status(struct adapter *padapter)
|
|||
u8 status = WIFI_STATUS_SUCCESS;
|
||||
u32 val32 = 0;
|
||||
|
||||
if (psrtpriv->silent_reset_inprogress)
|
||||
return status;
|
||||
val32 = rtw_read32(padapter, REG_TXDMA_STATUS);
|
||||
val32 = usb_read32(padapter, REG_TXDMA_STATUS);
|
||||
if (val32 == 0xeaeaeaea) {
|
||||
psrtpriv->Wifi_Error_Status = WIFI_IF_NOT_EXIST;
|
||||
} else if (val32 != 0) {
|
||||
|
|
|
@ -25,15 +25,15 @@
|
|||
#include <xmit_osdep.h>
|
||||
#include <mlme_osdep.h>
|
||||
#include <sta_info.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
static void _rtw_init_stainfo(struct sta_info *psta)
|
||||
{
|
||||
_func_enter_;
|
||||
_rtw_memset((u8 *)psta, 0, sizeof (struct sta_info));
|
||||
memset((u8 *)psta, 0, sizeof(struct sta_info));
|
||||
|
||||
_rtw_spinlock_init(&psta->lock);
|
||||
_rtw_init_listhead(&psta->list);
|
||||
_rtw_init_listhead(&psta->hash_list);
|
||||
spin_lock_init(&psta->lock);
|
||||
INIT_LIST_HEAD(&psta->list);
|
||||
INIT_LIST_HEAD(&psta->hash_list);
|
||||
_rtw_init_queue(&psta->sleep_q);
|
||||
psta->sleepq_len = 0;
|
||||
|
||||
|
@ -42,9 +42,9 @@ _func_enter_;
|
|||
|
||||
#ifdef CONFIG_88EU_AP_MODE
|
||||
|
||||
_rtw_init_listhead(&psta->asoc_list);
|
||||
INIT_LIST_HEAD(&psta->asoc_list);
|
||||
|
||||
_rtw_init_listhead(&psta->auth_list);
|
||||
INIT_LIST_HEAD(&psta->auth_list);
|
||||
|
||||
psta->expire_to = 0;
|
||||
|
||||
|
@ -69,7 +69,6 @@ _func_enter_;
|
|||
|
||||
#endif /* CONFIG_88EU_AP_MODE */
|
||||
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
|
||||
|
@ -77,9 +76,8 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
|
|||
struct sta_info *psta;
|
||||
s32 i;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
pstapriv->pallocated_stainfo_buf = rtw_zvmalloc(sizeof(struct sta_info) * NUM_STA + 4);
|
||||
pstapriv->pallocated_stainfo_buf = vzalloc(sizeof(struct sta_info) * NUM_STA + 4);
|
||||
|
||||
if (!pstapriv->pallocated_stainfo_buf)
|
||||
return _FAIL;
|
||||
|
@ -89,7 +87,7 @@ _func_enter_;
|
|||
|
||||
_rtw_init_queue(&pstapriv->free_sta_queue);
|
||||
|
||||
_rtw_spinlock_init(&pstapriv->sta_hash_lock);
|
||||
spin_lock_init(&pstapriv->sta_hash_lock);
|
||||
|
||||
pstapriv->asoc_sta_count = 0;
|
||||
_rtw_init_queue(&pstapriv->sleep_q);
|
||||
|
@ -100,9 +98,9 @@ _func_enter_;
|
|||
for (i = 0; i < NUM_STA; i++) {
|
||||
_rtw_init_stainfo(psta);
|
||||
|
||||
_rtw_init_listhead(&(pstapriv->sta_hash[i]));
|
||||
INIT_LIST_HEAD(&(pstapriv->sta_hash[i]));
|
||||
|
||||
rtw_list_insert_tail(&psta->list, get_list_head(&pstapriv->free_sta_queue));
|
||||
list_add_tail(&psta->list, get_list_head(&pstapriv->free_sta_queue));
|
||||
|
||||
psta++;
|
||||
}
|
||||
|
@ -112,10 +110,10 @@ _func_enter_;
|
|||
pstapriv->sta_dz_bitmap = 0;
|
||||
pstapriv->tim_bitmap = 0;
|
||||
|
||||
_rtw_init_listhead(&pstapriv->asoc_list);
|
||||
_rtw_init_listhead(&pstapriv->auth_list);
|
||||
_rtw_spinlock_init(&pstapriv->asoc_list_lock);
|
||||
_rtw_spinlock_init(&pstapriv->auth_list_lock);
|
||||
INIT_LIST_HEAD(&pstapriv->asoc_list);
|
||||
INIT_LIST_HEAD(&pstapriv->auth_list);
|
||||
spin_lock_init(&pstapriv->asoc_list_lock);
|
||||
spin_lock_init(&pstapriv->auth_list_lock);
|
||||
pstapriv->asoc_list_cnt = 0;
|
||||
pstapriv->auth_list_cnt = 0;
|
||||
|
||||
|
@ -125,7 +123,6 @@ _func_enter_;
|
|||
pstapriv->max_num_sta = NUM_STA;
|
||||
#endif
|
||||
|
||||
_func_exit_;
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
@ -148,136 +145,71 @@ inline struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int
|
|||
return (struct sta_info *)(stapriv->pstainfo_buf + offset * sizeof(struct sta_info));
|
||||
}
|
||||
|
||||
void _rtw_free_sta_xmit_priv_lock(struct sta_xmit_priv *psta_xmitpriv);
|
||||
void _rtw_free_sta_xmit_priv_lock(struct sta_xmit_priv *psta_xmitpriv)
|
||||
{
|
||||
_func_enter_;
|
||||
|
||||
_rtw_spinlock_free(&psta_xmitpriv->lock);
|
||||
|
||||
_rtw_spinlock_free(&(psta_xmitpriv->be_q.sta_pending.lock));
|
||||
_rtw_spinlock_free(&(psta_xmitpriv->bk_q.sta_pending.lock));
|
||||
_rtw_spinlock_free(&(psta_xmitpriv->vi_q.sta_pending.lock));
|
||||
_rtw_spinlock_free(&(psta_xmitpriv->vo_q.sta_pending.lock));
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
static void _rtw_free_sta_recv_priv_lock(struct sta_recv_priv *psta_recvpriv)
|
||||
{
|
||||
_func_enter_;
|
||||
|
||||
_rtw_spinlock_free(&psta_recvpriv->lock);
|
||||
|
||||
_rtw_spinlock_free(&(psta_recvpriv->defrag_q.lock));
|
||||
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
void rtw_mfree_stainfo(struct sta_info *psta);
|
||||
void rtw_mfree_stainfo(struct sta_info *psta)
|
||||
{
|
||||
_func_enter_;
|
||||
|
||||
if (&psta->lock != NULL)
|
||||
_rtw_spinlock_free(&psta->lock);
|
||||
|
||||
_rtw_free_sta_xmit_priv_lock(&psta->sta_xmitpriv);
|
||||
_rtw_free_sta_recv_priv_lock(&psta->sta_recvpriv);
|
||||
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
/* this function is used to free the memory of lock || sema for all stainfos */
|
||||
void rtw_mfree_all_stainfo(struct sta_priv *pstapriv);
|
||||
void rtw_mfree_all_stainfo(struct sta_priv *pstapriv)
|
||||
static void rtw_mfree_all_stainfo(struct sta_priv *pstapriv)
|
||||
{
|
||||
unsigned long irql;
|
||||
struct list_head *plist, *phead;
|
||||
struct sta_info *psta = NULL;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
_enter_critical_bh(&pstapriv->sta_hash_lock, &irql);
|
||||
spin_lock_bh(&pstapriv->sta_hash_lock);
|
||||
|
||||
phead = get_list_head(&pstapriv->free_sta_queue);
|
||||
plist = get_next(phead);
|
||||
plist = phead->next;
|
||||
|
||||
while ((rtw_end_of_queue_search(phead, plist)) == false) {
|
||||
psta = LIST_CONTAINOR(plist, struct sta_info , list);
|
||||
plist = get_next(plist);
|
||||
|
||||
rtw_mfree_stainfo(psta);
|
||||
while (phead != plist) {
|
||||
psta = container_of(plist, struct sta_info , list);
|
||||
plist = plist->next;
|
||||
}
|
||||
|
||||
_exit_critical_bh(&pstapriv->sta_hash_lock, &irql);
|
||||
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
||||
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
static void rtw_mfree_sta_priv_lock(struct sta_priv *pstapriv)
|
||||
{
|
||||
#ifdef CONFIG_88EU_AP_MODE
|
||||
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
|
||||
#endif
|
||||
|
||||
rtw_mfree_all_stainfo(pstapriv); /* be done before free sta_hash_lock */
|
||||
|
||||
_rtw_spinlock_free(&pstapriv->free_sta_queue.lock);
|
||||
|
||||
_rtw_spinlock_free(&pstapriv->sta_hash_lock);
|
||||
_rtw_spinlock_free(&pstapriv->wakeup_q.lock);
|
||||
_rtw_spinlock_free(&pstapriv->sleep_q.lock);
|
||||
|
||||
#ifdef CONFIG_88EU_AP_MODE
|
||||
_rtw_spinlock_free(&pstapriv->asoc_list_lock);
|
||||
_rtw_spinlock_free(&pstapriv->auth_list_lock);
|
||||
_rtw_spinlock_free(&pacl_list->acl_node_q.lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)
|
||||
{
|
||||
unsigned long irql;
|
||||
struct list_head *phead, *plist;
|
||||
struct sta_info *psta = NULL;
|
||||
struct recv_reorder_ctrl *preorder_ctrl;
|
||||
int index;
|
||||
|
||||
_func_enter_;
|
||||
if (pstapriv) {
|
||||
/* delete all reordering_ctrl_timer */
|
||||
_enter_critical_bh(&pstapriv->sta_hash_lock, &irql);
|
||||
spin_lock_bh(&pstapriv->sta_hash_lock);
|
||||
for (index = 0; index < NUM_STA; index++) {
|
||||
phead = &(pstapriv->sta_hash[index]);
|
||||
plist = get_next(phead);
|
||||
plist = phead->next;
|
||||
|
||||
while ((rtw_end_of_queue_search(phead, plist)) == false) {
|
||||
while (phead != plist) {
|
||||
int i;
|
||||
psta = LIST_CONTAINOR(plist, struct sta_info , hash_list);
|
||||
plist = get_next(plist);
|
||||
psta = container_of(plist, struct sta_info , hash_list);
|
||||
plist = plist->next;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
preorder_ctrl = &psta->recvreorder_ctrl[i];
|
||||
_cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer);
|
||||
del_timer_sync(&preorder_ctrl->reordering_ctrl_timer);
|
||||
}
|
||||
}
|
||||
}
|
||||
_exit_critical_bh(&pstapriv->sta_hash_lock, &irql);
|
||||
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
||||
/*===============================*/
|
||||
|
||||
rtw_mfree_sta_priv_lock(pstapriv);
|
||||
|
||||
if (pstapriv->pallocated_stainfo_buf)
|
||||
rtw_vmfree(pstapriv->pallocated_stainfo_buf, sizeof(struct sta_info)*NUM_STA+4);
|
||||
}
|
||||
vfree(pstapriv->pallocated_stainfo_buf);
|
||||
}
|
||||
|
||||
_func_exit_;
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
|
||||
{
|
||||
unsigned long irql, irql2;
|
||||
s32 index;
|
||||
struct list_head *phash_list;
|
||||
struct sta_info *psta;
|
||||
|
@ -286,19 +218,18 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
|
|||
int i = 0;
|
||||
u16 wRxSeqInitialValue = 0xffff;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
pfree_sta_queue = &pstapriv->free_sta_queue;
|
||||
|
||||
_enter_critical_bh(&(pfree_sta_queue->lock), &irql);
|
||||
spin_lock_bh(&(pfree_sta_queue->lock));
|
||||
|
||||
if (_rtw_queue_empty(pfree_sta_queue) == true) {
|
||||
_exit_critical_bh(&(pfree_sta_queue->lock), &irql);
|
||||
if (list_empty(&pfree_sta_queue->queue)) {
|
||||
spin_unlock_bh(&pfree_sta_queue->lock);
|
||||
psta = NULL;
|
||||
} else {
|
||||
psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list);
|
||||
rtw_list_delete(&(psta->list));
|
||||
_exit_critical_bh(&(pfree_sta_queue->lock), &irql);
|
||||
psta = container_of((&pfree_sta_queue->queue)->next, struct sta_info, list);
|
||||
list_del_init(&(psta->list));
|
||||
spin_unlock_bh(&pfree_sta_queue->lock);
|
||||
_rtw_init_stainfo(psta);
|
||||
memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
|
||||
index = wifi_mac_hash(hwaddr);
|
||||
|
@ -310,13 +241,13 @@ _func_enter_;
|
|||
}
|
||||
phash_list = &(pstapriv->sta_hash[index]);
|
||||
|
||||
_enter_critical_bh(&(pstapriv->sta_hash_lock), &irql2);
|
||||
spin_lock_bh(&(pstapriv->sta_hash_lock));
|
||||
|
||||
rtw_list_insert_tail(&psta->hash_list, phash_list);
|
||||
list_add_tail(&psta->hash_list, phash_list);
|
||||
|
||||
pstapriv->asoc_sta_count++ ;
|
||||
pstapriv->asoc_sta_count++;
|
||||
|
||||
_exit_critical_bh(&(pstapriv->sta_hash_lock), &irql2);
|
||||
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
||||
|
||||
/* Commented by Albert 2009/08/13 */
|
||||
/* For the SMC router, the sequence number of first packet of WPS handshake will be 0. */
|
||||
|
@ -358,9 +289,6 @@ _func_enter_;
|
|||
}
|
||||
|
||||
exit:
|
||||
|
||||
_func_exit_;
|
||||
|
||||
return psta;
|
||||
}
|
||||
|
||||
|
@ -368,14 +296,12 @@ _func_exit_;
|
|||
u32 rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta)
|
||||
{
|
||||
int i;
|
||||
unsigned long irql0;
|
||||
struct __queue *pfree_sta_queue;
|
||||
struct recv_reorder_ctrl *preorder_ctrl;
|
||||
struct sta_xmit_priv *pstaxmitpriv;
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
if (psta == NULL)
|
||||
goto exit;
|
||||
|
@ -384,30 +310,30 @@ _func_enter_;
|
|||
|
||||
pstaxmitpriv = &psta->sta_xmitpriv;
|
||||
|
||||
_enter_critical_bh(&pxmitpriv->lock, &irql0);
|
||||
spin_lock_bh(&pxmitpriv->lock);
|
||||
|
||||
rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q);
|
||||
psta->sleepq_len = 0;
|
||||
|
||||
rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vo_q.sta_pending);
|
||||
|
||||
rtw_list_delete(&(pstaxmitpriv->vo_q.tx_pending));
|
||||
list_del_init(&(pstaxmitpriv->vo_q.tx_pending));
|
||||
|
||||
rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vi_q.sta_pending);
|
||||
|
||||
rtw_list_delete(&(pstaxmitpriv->vi_q.tx_pending));
|
||||
list_del_init(&(pstaxmitpriv->vi_q.tx_pending));
|
||||
|
||||
rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->bk_q.sta_pending);
|
||||
|
||||
rtw_list_delete(&(pstaxmitpriv->bk_q.tx_pending));
|
||||
list_del_init(&(pstaxmitpriv->bk_q.tx_pending));
|
||||
|
||||
rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->be_q.sta_pending);
|
||||
|
||||
rtw_list_delete(&(pstaxmitpriv->be_q.tx_pending));
|
||||
list_del_init(&(pstaxmitpriv->be_q.tx_pending));
|
||||
|
||||
_exit_critical_bh(&pxmitpriv->lock, &irql0);
|
||||
spin_unlock_bh(&pxmitpriv->lock);
|
||||
|
||||
rtw_list_delete(&psta->hash_list);
|
||||
list_del_init(&psta->hash_list);
|
||||
RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, ("\n free number_%d stainfo with hwaddr=0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x\n", pstapriv->asoc_sta_count , psta->hwaddr[0], psta->hwaddr[1], psta->hwaddr[2], psta->hwaddr[3], psta->hwaddr[4], psta->hwaddr[5]));
|
||||
pstapriv->asoc_sta_count--;
|
||||
|
||||
|
@ -415,38 +341,39 @@ _func_enter_;
|
|||
_rtw_init_sta_xmit_priv(&psta->sta_xmitpriv);
|
||||
_rtw_init_sta_recv_priv(&psta->sta_recvpriv);
|
||||
|
||||
_cancel_timer_ex(&psta->addba_retry_timer);
|
||||
del_timer_sync(&psta->addba_retry_timer);
|
||||
|
||||
/* for A-MPDU Rx reordering buffer control, cancel reordering_ctrl_timer */
|
||||
for (i = 0; i < 16 ; i++) {
|
||||
unsigned long irql;
|
||||
for (i = 0; i < 16; i++) {
|
||||
struct list_head *phead, *plist;
|
||||
union recv_frame *prframe;
|
||||
struct recv_frame *prhdr;
|
||||
struct recv_frame *prframe;
|
||||
struct __queue *ppending_recvframe_queue;
|
||||
struct __queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue;
|
||||
|
||||
preorder_ctrl = &psta->recvreorder_ctrl[i];
|
||||
|
||||
_cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer);
|
||||
del_timer_sync(&preorder_ctrl->reordering_ctrl_timer);
|
||||
|
||||
ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
|
||||
|
||||
_enter_critical_bh(&ppending_recvframe_queue->lock, &irql);
|
||||
spin_lock_bh(&ppending_recvframe_queue->lock);
|
||||
|
||||
phead = get_list_head(ppending_recvframe_queue);
|
||||
plist = get_next(phead);
|
||||
plist = phead->next;
|
||||
|
||||
while (!rtw_is_list_empty(phead)) {
|
||||
prframe = LIST_CONTAINOR(plist, union recv_frame, u);
|
||||
while (!list_empty(phead)) {
|
||||
prhdr = container_of(plist, struct recv_frame, list);
|
||||
prframe = (struct recv_frame *)prhdr;
|
||||
|
||||
plist = get_next(plist);
|
||||
plist = plist->next;
|
||||
|
||||
rtw_list_delete(&(prframe->u.hdr.list));
|
||||
list_del_init(&(prframe->list));
|
||||
|
||||
rtw_free_recvframe(prframe, pfree_recv_queue);
|
||||
}
|
||||
|
||||
_exit_critical_bh(&ppending_recvframe_queue->lock, &irql);
|
||||
spin_unlock_bh(&ppending_recvframe_queue->lock);
|
||||
}
|
||||
|
||||
if (!(psta->state & WIFI_AP_STATE))
|
||||
|
@ -454,12 +381,12 @@ _func_enter_;
|
|||
|
||||
#ifdef CONFIG_88EU_AP_MODE
|
||||
|
||||
_enter_critical_bh(&pstapriv->auth_list_lock, &irql0);
|
||||
if (!rtw_is_list_empty(&psta->auth_list)) {
|
||||
rtw_list_delete(&psta->auth_list);
|
||||
spin_lock_bh(&pstapriv->auth_list_lock);
|
||||
if (!list_empty(&psta->auth_list)) {
|
||||
list_del_init(&psta->auth_list);
|
||||
pstapriv->auth_list_cnt--;
|
||||
}
|
||||
_exit_critical_bh(&pstapriv->auth_list_lock, &irql0);
|
||||
spin_unlock_bh(&pstapriv->auth_list_lock);
|
||||
|
||||
psta->expire_to = 0;
|
||||
|
||||
|
@ -485,13 +412,12 @@ _func_enter_;
|
|||
|
||||
#endif /* CONFIG_88EU_AP_MODE */
|
||||
|
||||
_enter_critical_bh(&(pfree_sta_queue->lock), &irql0);
|
||||
rtw_list_insert_tail(&psta->list, get_list_head(pfree_sta_queue));
|
||||
_exit_critical_bh(&(pfree_sta_queue->lock), &irql0);
|
||||
spin_lock_bh(&(pfree_sta_queue->lock));
|
||||
list_add_tail(&psta->list, get_list_head(pfree_sta_queue));
|
||||
spin_unlock_bh(&pfree_sta_queue->lock);
|
||||
|
||||
exit:
|
||||
|
||||
_func_exit_;
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
@ -499,52 +425,43 @@ _func_exit_;
|
|||
/* free all stainfo which in sta_hash[all] */
|
||||
void rtw_free_all_stainfo(struct adapter *padapter)
|
||||
{
|
||||
unsigned long irql;
|
||||
struct list_head *plist, *phead;
|
||||
s32 index;
|
||||
struct sta_info *psta = NULL;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
struct sta_info *pbcmc_stainfo = rtw_get_bcmc_stainfo(padapter);
|
||||
|
||||
_func_enter_;
|
||||
|
||||
if (pstapriv->asoc_sta_count == 1)
|
||||
goto exit;
|
||||
return;
|
||||
|
||||
_enter_critical_bh(&pstapriv->sta_hash_lock, &irql);
|
||||
spin_lock_bh(&pstapriv->sta_hash_lock);
|
||||
|
||||
for (index = 0; index < NUM_STA; index++) {
|
||||
phead = &(pstapriv->sta_hash[index]);
|
||||
plist = get_next(phead);
|
||||
plist = phead->next;
|
||||
|
||||
while ((!rtw_end_of_queue_search(phead, plist))) {
|
||||
psta = LIST_CONTAINOR(plist, struct sta_info , hash_list);
|
||||
while (phead != plist) {
|
||||
psta = container_of(plist, struct sta_info , hash_list);
|
||||
|
||||
plist = get_next(plist);
|
||||
plist = plist->next;
|
||||
|
||||
if (pbcmc_stainfo != psta)
|
||||
rtw_free_stainfo(padapter , psta);
|
||||
}
|
||||
}
|
||||
|
||||
_exit_critical_bh(&pstapriv->sta_hash_lock, &irql);
|
||||
|
||||
exit:
|
||||
|
||||
_func_exit_;
|
||||
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
||||
}
|
||||
|
||||
/* any station allocated can be searched by hash list */
|
||||
struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
|
||||
{
|
||||
unsigned long irql;
|
||||
struct list_head *plist, *phead;
|
||||
struct sta_info *psta = NULL;
|
||||
u32 index;
|
||||
u8 *addr;
|
||||
u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
|
||||
_func_enter_;
|
||||
|
||||
if (hwaddr == NULL)
|
||||
return NULL;
|
||||
|
@ -556,24 +473,23 @@ _func_enter_;
|
|||
|
||||
index = wifi_mac_hash(addr);
|
||||
|
||||
_enter_critical_bh(&pstapriv->sta_hash_lock, &irql);
|
||||
spin_lock_bh(&pstapriv->sta_hash_lock);
|
||||
|
||||
phead = &(pstapriv->sta_hash[index]);
|
||||
plist = get_next(phead);
|
||||
plist = phead->next;
|
||||
|
||||
while ((!rtw_end_of_queue_search(phead, plist))) {
|
||||
psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
|
||||
while (phead != plist) {
|
||||
psta = container_of(plist, struct sta_info, hash_list);
|
||||
|
||||
if ((_rtw_memcmp(psta->hwaddr, addr, ETH_ALEN)) == true) {
|
||||
if ((!memcmp(psta->hwaddr, addr, ETH_ALEN)) == true) {
|
||||
/* if found the matched address */
|
||||
break;
|
||||
}
|
||||
psta = NULL;
|
||||
plist = get_next(plist);
|
||||
plist = plist->next;
|
||||
}
|
||||
|
||||
_exit_critical_bh(&pstapriv->sta_hash_lock, &irql);
|
||||
_func_exit_;
|
||||
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
||||
return psta;
|
||||
}
|
||||
|
||||
|
@ -584,7 +500,6 @@ u32 rtw_init_bcmc_stainfo(struct adapter *padapter)
|
|||
unsigned char bcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
psta = rtw_alloc_stainfo(pstapriv, bcast_addr);
|
||||
|
||||
|
@ -598,7 +513,6 @@ _func_enter_;
|
|||
psta->mac_id = 1;
|
||||
|
||||
exit:
|
||||
_func_exit_;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -607,9 +521,7 @@ struct sta_info *rtw_get_bcmc_stainfo(struct adapter *padapter)
|
|||
struct sta_info *psta;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
_func_enter_;
|
||||
psta = rtw_get_stainfo(pstapriv, bc_addr);
|
||||
_func_exit_;
|
||||
return psta;
|
||||
}
|
||||
|
||||
|
@ -617,7 +529,6 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)
|
|||
{
|
||||
u8 res = true;
|
||||
#ifdef CONFIG_88EU_AP_MODE
|
||||
unsigned long irql;
|
||||
struct list_head *plist, *phead;
|
||||
struct rtw_wlan_acl_node *paclnode;
|
||||
u8 match = false;
|
||||
|
@ -625,21 +536,21 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)
|
|||
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
|
||||
struct __queue *pacl_node_q = &pacl_list->acl_node_q;
|
||||
|
||||
_enter_critical_bh(&(pacl_node_q->lock), &irql);
|
||||
spin_lock_bh(&(pacl_node_q->lock));
|
||||
phead = get_list_head(pacl_node_q);
|
||||
plist = get_next(phead);
|
||||
while ((!rtw_end_of_queue_search(phead, plist))) {
|
||||
paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list);
|
||||
plist = get_next(plist);
|
||||
plist = phead->next;
|
||||
while (phead != plist) {
|
||||
paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
|
||||
plist = plist->next;
|
||||
|
||||
if (_rtw_memcmp(paclnode->addr, mac_addr, ETH_ALEN)) {
|
||||
if (!memcmp(paclnode->addr, mac_addr, ETH_ALEN)) {
|
||||
if (paclnode->valid) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
_exit_critical_bh(&(pacl_node_q->lock), &irql);
|
||||
spin_unlock_bh(&pacl_node_q->lock);
|
||||
|
||||
if (pacl_list->mode == 1)/* accept unless in deny list */
|
||||
res = (match) ? false : true;
|
||||
|
|
|
@ -80,7 +80,7 @@ int cckratesonly_included(unsigned char *rate, int ratelen)
|
|||
for (i = 0; i < ratelen; i++) {
|
||||
if ((((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) &&
|
||||
(((rate[i]) & 0x7f) != 11) && (((rate[i]) & 0x7f) != 22))
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -239,7 +239,7 @@ void get_rate_set(struct adapter *padapter, unsigned char *pbssrate, int *bssrat
|
|||
{
|
||||
unsigned char supportedrates[NumRates];
|
||||
|
||||
_rtw_memset(supportedrates, 0, NumRates);
|
||||
memset(supportedrates, 0, NumRates);
|
||||
*bssrate_len = ratetbl2rateset(padapter, supportedrates);
|
||||
memcpy(pbssrate, supportedrates, *bssrate_len);
|
||||
}
|
||||
|
@ -541,7 +541,7 @@ void flush_all_cam_entry(struct adapter *padapter)
|
|||
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, NULL);
|
||||
|
||||
_rtw_memset((u8 *)(pmlmeinfo->FW_sta_info), 0, sizeof(pmlmeinfo->FW_sta_info));
|
||||
memset((u8 *)(pmlmeinfo->FW_sta_info), 0, sizeof(pmlmeinfo->FW_sta_info));
|
||||
}
|
||||
|
||||
int WMM_param_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
|
||||
|
@ -766,7 +766,7 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
|
|||
|
||||
for (i = 0; i < (pIE->Length); i++) {
|
||||
if (i != 2) {
|
||||
/* Got the endian issue here. */
|
||||
/* Got the endian issue here. */
|
||||
pmlmeinfo->HT_caps.u.HT_cap[i] &= (pIE->data[i]);
|
||||
} else {
|
||||
/* modify from fw by Thomas 2010/11/17 */
|
||||
|
@ -912,12 +912,12 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)
|
|||
unsigned char *pbuf;
|
||||
u32 wpa_ielen = 0;
|
||||
u8 *pbssid = GetAddr3Ptr(pframe);
|
||||
u32 hidden_ssid = 0;
|
||||
struct HT_info_element *pht_info = NULL;
|
||||
struct rtw_ieee80211_ht_cap *pht_cap = NULL;
|
||||
u32 bcn_channel;
|
||||
unsigned short ht_cap_info;
|
||||
unsigned char ht_info_infos_0;
|
||||
int ssid_len;
|
||||
|
||||
if (is_client_associated_to_ap(Adapter) == false)
|
||||
return true;
|
||||
|
@ -929,13 +929,13 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)
|
|||
return _FAIL;
|
||||
}
|
||||
|
||||
if (_rtw_memcmp(cur_network->network.MacAddress, pbssid, 6) == false) {
|
||||
if (!memcmp(cur_network->network.MacAddress, pbssid, 6) == false) {
|
||||
DBG_88E("Oops: rtw_check_network_encrypt linked but recv other bssid bcn\n%pM %pM\n",
|
||||
(pbssid), (cur_network->network.MacAddress));
|
||||
return true;
|
||||
}
|
||||
|
||||
bssid = (struct wlan_bssid_ex *)rtw_zmalloc(sizeof(struct wlan_bssid_ex));
|
||||
bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC);
|
||||
|
||||
subtype = GetFrameSubType(pframe) >> 4;
|
||||
|
||||
|
@ -999,28 +999,22 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)
|
|||
}
|
||||
|
||||
/* checking SSID */
|
||||
ssid_len = 0;
|
||||
p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SSID_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
|
||||
if (p == NULL) {
|
||||
DBG_88E("%s marc: cannot find SSID for survey event\n", __func__);
|
||||
hidden_ssid = true;
|
||||
} else {
|
||||
hidden_ssid = false;
|
||||
}
|
||||
|
||||
if ((NULL != p) && (false == hidden_ssid && (*(p + 1)))) {
|
||||
memcpy(bssid->Ssid.Ssid, (p + 2), *(p + 1));
|
||||
bssid->Ssid.SsidLength = *(p + 1);
|
||||
} else {
|
||||
bssid->Ssid.SsidLength = 0;
|
||||
bssid->Ssid.Ssid[0] = '\0';
|
||||
if (p) {
|
||||
ssid_len = *(p + 1);
|
||||
if (ssid_len > NDIS_802_11_LENGTH_SSID)
|
||||
ssid_len = 0;
|
||||
}
|
||||
memcpy(bssid->Ssid.Ssid, (p + 2), ssid_len);
|
||||
bssid->Ssid.SsidLength = ssid_len;
|
||||
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("%s bssid.Ssid.Ssid:%s bssid.Ssid.SsidLength:%d "
|
||||
"cur_network->network.Ssid.Ssid:%s len:%d\n", __func__, bssid->Ssid.Ssid,
|
||||
bssid->Ssid.SsidLength, cur_network->network.Ssid.Ssid,
|
||||
cur_network->network.Ssid.SsidLength));
|
||||
|
||||
if (!_rtw_memcmp(bssid->Ssid.Ssid, cur_network->network.Ssid.Ssid, 32) ||
|
||||
if (memcmp(bssid->Ssid.Ssid, cur_network->network.Ssid.Ssid, 32) ||
|
||||
bssid->Ssid.SsidLength != cur_network->network.Ssid.SsidLength) {
|
||||
if (bssid->Ssid.Ssid[0] != '\0' && bssid->Ssid.SsidLength != 0) { /* not hidden ssid */
|
||||
DBG_88E("%s(), SSID is not match return FAIL\n", __func__);
|
||||
|
@ -1056,7 +1050,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)
|
|||
}
|
||||
|
||||
if (cur_network->BcnInfo.encryp_protocol != encryp_protocol) {
|
||||
DBG_88E("%s(): enctyp is not match , return FAIL\n", __func__);
|
||||
DBG_88E("%s(): encryption protocol is not match , return FAIL\n", __func__);
|
||||
goto _mismatch;
|
||||
}
|
||||
|
||||
|
@ -1096,12 +1090,10 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)
|
|||
}
|
||||
|
||||
kfree(bssid);
|
||||
_func_exit_;
|
||||
return _SUCCESS;
|
||||
|
||||
_mismatch:
|
||||
kfree(bssid);
|
||||
_func_exit_;
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
|
@ -1147,11 +1139,11 @@ unsigned int is_ap_in_tkip(struct adapter *padapter)
|
|||
|
||||
switch (pIE->ElementID) {
|
||||
case _VENDOR_SPECIFIC_IE_:
|
||||
if ((_rtw_memcmp(pIE->data, RTW_WPA_OUI, 4)) && (_rtw_memcmp((pIE->data + 12), WPA_TKIP_CIPHER, 4)))
|
||||
if ((!memcmp(pIE->data, RTW_WPA_OUI, 4)) && (!memcmp((pIE->data + 12), WPA_TKIP_CIPHER, 4)))
|
||||
return true;
|
||||
break;
|
||||
case _RSN_IE_2_:
|
||||
if (_rtw_memcmp((pIE->data + 8), RSN_TKIP_CIPHER, 4))
|
||||
if (!memcmp((pIE->data + 8), RSN_TKIP_CIPHER, 4))
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
|
@ -1178,15 +1170,15 @@ unsigned int should_forbid_n_rate(struct adapter *padapter)
|
|||
|
||||
switch (pIE->ElementID) {
|
||||
case _VENDOR_SPECIFIC_IE_:
|
||||
if (_rtw_memcmp(pIE->data, RTW_WPA_OUI, 4) &&
|
||||
((_rtw_memcmp((pIE->data + 12), WPA_CIPHER_SUITE_CCMP, 4)) ||
|
||||
(_rtw_memcmp((pIE->data + 16), WPA_CIPHER_SUITE_CCMP, 4))))
|
||||
if (!memcmp(pIE->data, RTW_WPA_OUI, 4) &&
|
||||
((!memcmp((pIE->data + 12), WPA_CIPHER_SUITE_CCMP, 4)) ||
|
||||
(!memcmp((pIE->data + 16), WPA_CIPHER_SUITE_CCMP, 4))))
|
||||
return false;
|
||||
break;
|
||||
case _RSN_IE_2_:
|
||||
if ((_rtw_memcmp((pIE->data + 8), RSN_CIPHER_SUITE_CCMP, 4)) ||
|
||||
(_rtw_memcmp((pIE->data + 12), RSN_CIPHER_SUITE_CCMP, 4)))
|
||||
return false;
|
||||
if ((!memcmp((pIE->data + 8), RSN_CIPHER_SUITE_CCMP, 4)) ||
|
||||
(!memcmp((pIE->data + 12), RSN_CIPHER_SUITE_CCMP, 4)))
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1214,7 +1206,7 @@ unsigned int is_ap_in_wep(struct adapter *padapter)
|
|||
|
||||
switch (pIE->ElementID) {
|
||||
case _VENDOR_SPECIFIC_IE_:
|
||||
if (_rtw_memcmp(pIE->data, RTW_WPA_OUI, 4))
|
||||
if (!memcmp(pIE->data, RTW_WPA_OUI, 4))
|
||||
return false;
|
||||
break;
|
||||
case _RSN_IE_2_:
|
||||
|
@ -1230,7 +1222,7 @@ unsigned int is_ap_in_wep(struct adapter *padapter)
|
|||
}
|
||||
}
|
||||
|
||||
int wifirate2_ratetbl_inx(unsigned char rate)
|
||||
static int wifirate2_ratetbl_inx(unsigned char rate)
|
||||
{
|
||||
int inx = 0;
|
||||
rate = rate & 0x7f;
|
||||
|
@ -1365,16 +1357,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];
|
||||
#ifdef CONFIG_88EU_P2P
|
||||
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
|
||||
|
||||
/* Added by Albert 2011/03/22 */
|
||||
/* In the P2P mode, the driver should not support the b mode. */
|
||||
/* So, the Tx packet shouldn't use the CCK rate */
|
||||
if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
|
||||
return;
|
||||
#endif /* CONFIG_88EU_P2P */
|
||||
_rtw_memset(supported_rates, 0, NDIS_802_11_LENGTH_RATES_EX);
|
||||
memset(supported_rates, 0, NDIS_802_11_LENGTH_RATES_EX);
|
||||
|
||||
if ((wirelessmode & WIRELESS_11B) && (wirelessmode == WIRELESS_11B))
|
||||
memcpy(supported_rates, rtw_basic_rate_cck, 4);
|
||||
|
@ -1406,36 +1389,35 @@ unsigned char check_assoc_AP(u8 *pframe, uint len)
|
|||
|
||||
switch (pIE->ElementID) {
|
||||
case _VENDOR_SPECIFIC_IE_:
|
||||
if ((_rtw_memcmp(pIE->data, ARTHEROS_OUI1, 3)) ||
|
||||
(_rtw_memcmp(pIE->data, ARTHEROS_OUI2, 3))) {
|
||||
if ((!memcmp(pIE->data, ARTHEROS_OUI1, 3)) ||
|
||||
(!memcmp(pIE->data, ARTHEROS_OUI2, 3))) {
|
||||
DBG_88E("link to Artheros AP\n");
|
||||
return HT_IOT_PEER_ATHEROS;
|
||||
} else if ((_rtw_memcmp(pIE->data, BROADCOM_OUI1, 3)) ||
|
||||
(_rtw_memcmp(pIE->data, BROADCOM_OUI2, 3)) ||
|
||||
(_rtw_memcmp(pIE->data, BROADCOM_OUI2, 3))) {
|
||||
} else if ((!memcmp(pIE->data, BROADCOM_OUI1, 3)) ||
|
||||
(!memcmp(pIE->data, BROADCOM_OUI2, 3))) {
|
||||
DBG_88E("link to Broadcom AP\n");
|
||||
return HT_IOT_PEER_BROADCOM;
|
||||
} else if (_rtw_memcmp(pIE->data, MARVELL_OUI, 3)) {
|
||||
} else if (!memcmp(pIE->data, MARVELL_OUI, 3)) {
|
||||
DBG_88E("link to Marvell AP\n");
|
||||
return HT_IOT_PEER_MARVELL;
|
||||
} else if (_rtw_memcmp(pIE->data, RALINK_OUI, 3)) {
|
||||
} else if (!memcmp(pIE->data, RALINK_OUI, 3)) {
|
||||
if (!ralink_vendor_flag) {
|
||||
ralink_vendor_flag = 1;
|
||||
} else {
|
||||
DBG_88E("link to Ralink AP\n");
|
||||
return HT_IOT_PEER_RALINK;
|
||||
}
|
||||
} else if (_rtw_memcmp(pIE->data, CISCO_OUI, 3)) {
|
||||
} else if (!memcmp(pIE->data, CISCO_OUI, 3)) {
|
||||
DBG_88E("link to Cisco AP\n");
|
||||
return HT_IOT_PEER_CISCO;
|
||||
} else if (_rtw_memcmp(pIE->data, REALTEK_OUI, 3)) {
|
||||
} else if (!memcmp(pIE->data, REALTEK_OUI, 3)) {
|
||||
DBG_88E("link to Realtek 96B\n");
|
||||
return HT_IOT_PEER_REALTEK;
|
||||
} else if (_rtw_memcmp(pIE->data, AIRGOCAP_OUI, 3)) {
|
||||
} else if (!memcmp(pIE->data, AIRGOCAP_OUI, 3)) {
|
||||
DBG_88E("link to Airgo Cap\n");
|
||||
return HT_IOT_PEER_AIRGO;
|
||||
} else if (_rtw_memcmp(pIE->data, EPIGRAM_OUI, 3)) {
|
||||
epigram_vendor_flag = 1;
|
||||
} else if (!memcmp(pIE->data, EPIGRAM_OUI, 3)) {
|
||||
epigram_vendor_flag = 1;
|
||||
if (ralink_vendor_flag) {
|
||||
DBG_88E("link to Tenda W311R AP\n");
|
||||
return HT_IOT_PEER_TENDA;
|
||||
|
@ -1607,13 +1589,18 @@ int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie, uint var_ie_l
|
|||
pIE = (struct ndis_802_11_var_ie *)rtw_get_ie(pvar_ie, _SUPPORTEDRATES_IE_, &ie_len, var_ie_len);
|
||||
if (pIE == NULL)
|
||||
return _FAIL;
|
||||
if (ie_len > NDIS_802_11_LENGTH_RATES_EX)
|
||||
return _FAIL;
|
||||
|
||||
memcpy(pmlmeinfo->FW_sta_info[cam_idx].SupportedRates, pIE->data, ie_len);
|
||||
supportRateNum = ie_len;
|
||||
|
||||
pIE = (struct ndis_802_11_var_ie *)rtw_get_ie(pvar_ie, _EXT_SUPPORTEDRATES_IE_, &ie_len, var_ie_len);
|
||||
if (pIE)
|
||||
if (pIE) {
|
||||
if (supportRateNum + ie_len > NDIS_802_11_LENGTH_RATES_EX)
|
||||
return _FAIL;
|
||||
memcpy((pmlmeinfo->FW_sta_info[cam_idx].SupportedRates + supportRateNum), pIE->data, ie_len);
|
||||
}
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
@ -1664,26 +1651,3 @@ void beacon_timing_control(struct adapter *padapter)
|
|||
{
|
||||
rtw_hal_bcn_related_reg_setting(padapter);
|
||||
}
|
||||
|
||||
static struct adapter *pbuddy_padapter;
|
||||
|
||||
int rtw_handle_dualmac(struct adapter *adapter, bool init)
|
||||
{
|
||||
int status = _SUCCESS;
|
||||
|
||||
if (init) {
|
||||
if (pbuddy_padapter == NULL) {
|
||||
pbuddy_padapter = adapter;
|
||||
DBG_88E("%s(): pbuddy_padapter == NULL, Set pbuddy_padapter\n", __func__);
|
||||
} else {
|
||||
adapter->pbuddy_adapter = pbuddy_padapter;
|
||||
pbuddy_padapter->pbuddy_adapter = adapter;
|
||||
/* clear global value */
|
||||
pbuddy_padapter = NULL;
|
||||
DBG_88E("%s(): pbuddy_padapter exist, Exchange Information\n", __func__);
|
||||
}
|
||||
} else {
|
||||
pbuddy_padapter = NULL;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
|
527
core/rtw_xmit.c
527
core/rtw_xmit.c
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue