diff --git a/core/rtw_ap.c b/core/rtw_ap.c index 468bab6..6c3e7d0 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -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,9 +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(&pstapriv->sta_hash_lock); rtw_free_stainfo(padapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + spin_unlock(&pstapriv->sta_hash_lock); _rtw_spinlock_free(&pmlmepriv->bcn_update_lock); } @@ -277,7 +276,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,7 +284,7 @@ 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(&pstapriv->auth_list_lock); phead = &pstapriv->auth_list; plist = get_next(phead); @@ -305,22 +303,22 @@ void expire_timeout_chk(struct adapter *padapter) DBG_88E("auth expire %6ph\n", psta->hwaddr); - _exit_critical_bh(&pstapriv->auth_list_lock, &irqL); + spin_unlock(&pstapriv->auth_list_lock); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + spin_lock(&pstapriv->sta_hash_lock); rtw_free_stainfo(padapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + spin_unlock(&pstapriv->sta_hash_lock); - _enter_critical_bh(&pstapriv->auth_list_lock, &irqL); + spin_lock(&pstapriv->auth_list_lock); } } } - _exit_critical_bh(&pstapriv->auth_list_lock, &irqL); + spin_unlock(&pstapriv->auth_list_lock); psta = NULL; - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_lock(&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list; plist = get_next(phead); @@ -387,7 +385,7 @@ void expire_timeout_chk(struct adapter *padapter) } } - _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_unlock(&pstapriv->asoc_list_lock); if (chk_alive_num) { u8 backup_oper_channel = 0; @@ -424,11 +422,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); + spin_lock(&pstapriv->asoc_list_lock); rtw_list_delete(&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(&pstapriv->asoc_list_lock); } if (backup_oper_channel > 0) /* back to the original operation channel */ @@ -535,7 +533,6 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) void update_bmc_sta(struct adapter *padapter) { - unsigned long irqL; u32 init_rate = 0; unsigned char network_type, raid; int i, supportRateNum = 0; @@ -604,9 +601,9 @@ void update_bmc_sta(struct adapter *padapter) rtw_sta_media_status_rpt(padapter, psta, 1); - _enter_critical_bh(&psta->lock, &irqL); + spin_lock(&psta->lock); psta->state = _FW_LINKED; - _exit_critical_bh(&psta->lock, &irqL); + spin_unlock(&psta->lock); } else { DBG_88E("add_RATid_bmc_sta error!\n"); @@ -622,7 +619,6 @@ 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); @@ -679,9 +675,9 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta) _rtw_memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats)); - _enter_critical_bh(&psta->lock, &irqL); + spin_lock(&psta->lock); psta->state |= _FW_LINKED; - _exit_critical_bh(&psta->lock, &irqL); + spin_unlock(&psta->lock); } static void update_hw_ht_param(struct adapter *padapter) @@ -1134,7 +1130,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,7 +1143,7 @@ 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(&pacl_node_q->lock); phead = get_list_head(pacl_node_q); plist = get_next(phead); @@ -1166,12 +1161,12 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) } } - _exit_critical_bh(&(pacl_node_q->lock), &irqL); + spin_unlock(&pacl_node_q->lock); if (added) return ret; - _enter_critical_bh(&(pacl_node_q->lock), &irqL); + spin_lock(&pacl_node_q->lock); for (i = 0; i < NUM_ACL; i++) { paclnode = &pacl_list->aclnode[i]; @@ -1193,14 +1188,13 @@ 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(&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; @@ -1210,7 +1204,7 @@ 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(&pacl_node_q->lock); phead = get_list_head(pacl_node_q); plist = get_next(phead); @@ -1230,7 +1224,7 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) } } - _exit_critical_bh(&(pacl_node_q->lock), &irqL); + spin_unlock(&pacl_node_q->lock); DBG_88E("%s, acl_num =%d\n", __func__, pacl_list->num); return ret; @@ -1373,7 +1367,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 +1379,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(&pmlmepriv->bcn_update_lock); switch (ie_id) { case 0xFF: @@ -1416,7 +1409,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(&pmlmepriv->bcn_update_lock); if (tx) set_tx_beacon_cmd(padapter); @@ -1505,12 +1498,11 @@ void associated_clients_update(struct adapter *padapter, u8 updated) { /* update associcated 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(&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list; plist = get_next(phead); @@ -1523,7 +1515,7 @@ void associated_clients_update(struct adapter *padapter, u8 updated) VCS_update(padapter, psta); } - _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_unlock(&pstapriv->asoc_list_lock); } } @@ -1731,7 +1723,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 +1744,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(&psta->lock); psta->state &= ~_FW_LINKED; - _exit_critical_bh(&psta->lock, &irqL); + spin_unlock(&psta->lock); rtw_indicate_sta_disassoc_event(padapter, psta); @@ -1763,16 +1754,15 @@ 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(&pstapriv->sta_hash_lock); rtw_free_stainfo(padapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + spin_unlock(&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; @@ -1787,7 +1777,7 @@ int rtw_ap_inform_ch_switch(struct adapter *padapter, u8 new_ch, u8 ch_offset) 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(&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list; plist = get_next(phead); @@ -1799,7 +1789,7 @@ int rtw_ap_inform_ch_switch(struct adapter *padapter, u8 new_ch, u8 ch_offset) 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(&pstapriv->asoc_list_lock); issue_action_spct_ch_switch(padapter, bc_addr, new_ch, ch_offset); @@ -1808,7 +1798,6 @@ int rtw_ap_inform_ch_switch(struct adapter *padapter, u8 new_ch, u8 ch_offset) int rtw_sta_flush(struct adapter *padapter) { - unsigned long irqL; struct list_head *phead, *plist; int ret = 0; struct sta_info *psta = NULL; @@ -1822,7 +1811,7 @@ int rtw_sta_flush(struct adapter *padapter) if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) return ret; - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_lock(&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list; plist = get_next(phead); @@ -1837,7 +1826,7 @@ int rtw_sta_flush(struct adapter *padapter) ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING); } - _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_unlock(&pstapriv->asoc_list_lock); issue_deauth(padapter, bc_addr, WLAN_REASON_DEAUTH_LEAVING); @@ -1935,7 +1924,6 @@ void start_ap_mode(struct adapter *padapter) 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; @@ -1954,7 +1942,7 @@ void stop_ap_mode(struct adapter *padapter) padapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled; /* for ACL */ - _enter_critical_bh(&(pacl_node_q->lock), &irqL); + spin_lock(&pacl_node_q->lock); phead = get_list_head(pacl_node_q); plist = get_next(phead); while ((rtw_end_of_queue_search(phead, plist)) == false) { @@ -1969,7 +1957,7 @@ void stop_ap_mode(struct adapter *padapter) pacl_list->num--; } } - _exit_critical_bh(&(pacl_node_q->lock), &irqL); + spin_unlock(&pacl_node_q->lock); DBG_88E("%s, free acl_node_queue, num =%d\n", __func__, pacl_list->num); @@ -1979,9 +1967,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(&pstapriv->sta_hash_lock); rtw_free_stainfo(padapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + spin_unlock(&pstapriv->sta_hash_lock); rtw_init_bcmc_stainfo(padapter); diff --git a/core/rtw_br_ext.c b/core/rtw_br_ext.c index 11b1808..b852cd0 100644 --- a/core/rtw_br_ext.c +++ b/core/rtw_br_ext.c @@ -331,7 +331,7 @@ static inline int __nat25_network_hash(unsigned char *networkAddr) static inline void __network_hash_link(struct adapter *priv, struct nat25_network_db_entry *ent, int hash) { - /* Caller must _enter_critical_bh already! */ + /* Caller must spin_lock already! */ ent->next_hash = priv->nethash[hash]; if (ent->next_hash != NULL) ent->next_hash->pprev_hash = &ent->next_hash; @@ -341,7 +341,7 @@ static inline void __network_hash_link(struct adapter *priv, static inline void __network_hash_unlink(struct nat25_network_db_entry *ent) { - /* Caller must _enter_critical_bh already! */ + /* Caller must spin_lock already! */ *(ent->pprev_hash) = ent->next_hash; if (ent->next_hash != NULL) ent->next_hash->pprev_hash = ent->pprev_hash; @@ -353,8 +353,8 @@ static int __nat25_db_network_lookup_and_replace(struct adapter *priv, struct sk_buff *skb, unsigned char *networkAddr) { struct nat25_network_db_entry *db; - unsigned long irqL; - _enter_critical_bh(&priv->br_ext_lock, &irqL); + + spin_lock(&priv->br_ext_lock); db = priv->nethash[__nat25_network_hash(networkAddr)]; while (db != NULL) { @@ -390,12 +390,12 @@ static int __nat25_db_network_lookup_and_replace(struct adapter *priv, db->networkAddr[15], db->networkAddr[16]); } - _exit_critical_bh(&priv->br_ext_lock, &irqL); + spin_unlock(&priv->br_ext_lock); return 1; } db = db->next_hash; } - _exit_critical_bh(&priv->br_ext_lock, &irqL); + spin_unlock(&priv->br_ext_lock); return 0; } @@ -404,23 +404,22 @@ static void __nat25_db_network_insert(struct adapter *priv, { struct nat25_network_db_entry *db; int hash; - unsigned long irqL; - _enter_critical_bh(&priv->br_ext_lock, &irqL); + spin_lock(&priv->br_ext_lock); hash = __nat25_network_hash(networkAddr); db = priv->nethash[hash]; while (db != NULL) { if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) { memcpy(db->macAddr, macAddr, ETH_ALEN); db->ageing_timer = jiffies; - _exit_critical_bh(&priv->br_ext_lock, &irqL); + spin_unlock(&priv->br_ext_lock); return; } db = db->next_hash; } db = (struct nat25_network_db_entry *) rtw_malloc(sizeof(*db)); if (db == NULL) { - _exit_critical_bh(&priv->br_ext_lock, &irqL); + spin_unlock(&priv->br_ext_lock); return; } memcpy(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN); @@ -430,7 +429,7 @@ static void __nat25_db_network_insert(struct adapter *priv, __network_hash_link(priv, db, hash); - _exit_critical_bh(&priv->br_ext_lock, &irqL); + spin_unlock(&priv->br_ext_lock); } static void __nat25_db_print(struct adapter *priv) @@ -444,8 +443,8 @@ static void __nat25_db_print(struct adapter *priv) void nat25_db_cleanup(struct adapter *priv) { int i; - unsigned long irqL; - _enter_critical_bh(&priv->br_ext_lock, &irqL); + + spin_lock(&priv->br_ext_lock); for (i = 0; i < NAT25_HASH_SIZE; i++) { struct nat25_network_db_entry *f; @@ -464,14 +463,14 @@ void nat25_db_cleanup(struct adapter *priv) f = g; } } - _exit_critical_bh(&priv->br_ext_lock, &irqL); + spin_unlock(&priv->br_ext_lock); } void nat25_db_expire(struct adapter *priv) { int i; - unsigned long irqL; - _enter_critical_bh(&priv->br_ext_lock, &irqL); + + spin_lock(&priv->br_ext_lock); for (i = 0; i < NAT25_HASH_SIZE; i++) { struct nat25_network_db_entry *f; @@ -495,7 +494,7 @@ void nat25_db_expire(struct adapter *priv) f = g; } } - _exit_critical_bh(&priv->br_ext_lock, &irqL); + spin_unlock(&priv->br_ext_lock); } int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) @@ -1060,8 +1059,7 @@ int nat25_handle_frame(struct adapter *priv, struct sk_buff *skb) } if (!priv->ethBrExtInfo.nat25_disable) { - unsigned long irqL; - _enter_critical_bh(&priv->br_ext_lock, &irqL); + spin_lock(&priv->br_ext_lock); /* * This function look up the destination network address from * the NAT2.5 database. Return value = -1 means that the @@ -1072,9 +1070,9 @@ int nat25_handle_frame(struct adapter *priv, struct sk_buff *skb) !memcmp(priv->scdb_ip, skb->data+ETH_HLEN+16, 4)) { memcpy(skb->data, priv->scdb_mac, ETH_ALEN); - _exit_critical_bh(&priv->br_ext_lock, &irqL); + spin_unlock(&priv->br_ext_lock); } else { - _exit_critical_bh(&priv->br_ext_lock, &irqL); + spin_unlock(&priv->br_ext_lock); retval = nat25_db_handle(priv, skb, NAT25_LOOKUP); } @@ -1178,21 +1176,17 @@ void *scdb_findEntry(struct adapter *priv, unsigned char *macAddr, unsigned char networkAddr[MAX_NETWORK_ADDR_LEN]; struct nat25_network_db_entry *db; int hash; - /* unsigned long irqL; */ - /* _enter_critical_bh(&priv->br_ext_lock, &irqL); */ __nat25_generate_ipv4_network_addr(networkAddr, (unsigned int *)ipAddr); hash = __nat25_network_hash(networkAddr); db = priv->nethash[hash]; while (db != NULL) { if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) { - /* _exit_critical_bh(&priv->br_ext_lock, &irqL); */ return (void *)db; } db = db->next_hash; } - /* _exit_critical_bh(&priv->br_ext_lock, &irqL); */ return NULL; } diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index f45f4ed..8513278 100644 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -146,20 +146,17 @@ ISR/Call-Back functions can't call this sub-function. int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj) { - unsigned long irqL; - + unsigned long flags; _func_enter_; if (obj == NULL) goto exit; - /* _enter_critical_bh(&queue->lock, &irqL); */ - _enter_critical(&queue->lock, &irqL); + spin_lock_irqsave(&queue->lock, flags); rtw_list_insert_tail(&obj->list, &queue->queue); - /* _exit_critical_bh(&queue->lock, &irqL); */ - _exit_critical(&queue->lock, &irqL); + spin_unlock_irqrestore(&queue->lock, flags); exit: @@ -170,13 +167,12 @@ _func_exit_; struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue) { - unsigned long irqL; struct cmd_obj *obj; + unsigned long flags; _func_enter_; - /* _enter_critical_bh(&(queue->lock), &irqL); */ - _enter_critical(&queue->lock, &irqL); + spin_lock_irqsave(&queue->lock, flags); if (rtw_is_list_empty(&(queue->queue))) { obj = NULL; } else { @@ -184,8 +180,7 @@ _func_enter_; rtw_list_delete(&obj->list); } - /* _exit_critical_bh(&(queue->lock), &irqL); */ - _exit_critical(&queue->lock, &irqL); + spin_unlock_irqrestore(&queue->lock, flags); _func_exit_; @@ -2200,15 +2195,14 @@ _func_exit_; } void rtw_disassoc_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) { - unsigned long irqL; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; _func_enter_; if (pcmd->res != H2C_SUCCESS) { - _enter_critical_bh(&pmlmepriv->lock, &irqL); + spin_lock(&pmlmepriv->lock); set_fwstate(pmlmepriv, _FW_LINKED); - _exit_critical_bh(&pmlmepriv->lock, &irqL); + spin_unlock(&pmlmepriv->lock); RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n ***Error: disconnect_cmd_callback Fail ***\n.")); @@ -2246,7 +2240,6 @@ _func_exit_; void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) { - unsigned long irqL; u8 timer_cancelled; struct sta_info *psta = NULL; struct wlan_network *pwlan = NULL; @@ -2263,7 +2256,7 @@ _func_enter_; _cancel_timer(&pmlmepriv->assoc_timer, &timer_cancelled); - _enter_critical_bh(&pmlmepriv->lock, &irqL); + spin_lock(&pmlmepriv->lock); if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { psta = rtw_get_stainfo(&padapter->stapriv, pnetwork->MacAddress); @@ -2277,15 +2270,14 @@ _func_enter_; rtw_indicate_connect(padapter); } else { - unsigned long irqL; pwlan = _rtw_alloc_network(pmlmepriv); - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_lock(&(pmlmepriv->scanned_queue.lock)); if (pwlan == NULL) { pwlan = rtw_get_oldest_wlan_network(&pmlmepriv->scanned_queue); if (pwlan == NULL) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n Error: can't get pwlan in rtw_joinbss_event_callback\n")); - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_unlock(&(pmlmepriv->scanned_queue.lock)); goto createbss_cmd_fail; } pwlan->last_scanned = rtw_get_current_time(); @@ -2300,13 +2292,13 @@ _func_enter_; _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_unlock(&(pmlmepriv->scanned_queue.lock)); /* we will set _FW_LINKED when there is one more sat to join us (rtw_stassoc_event_callback) */ } createbss_cmd_fail: - _exit_critical_bh(&pmlmepriv->lock, &irqL); + spin_unlock(&pmlmepriv->lock); rtw_free_cmd_obj(pcmd); @@ -2332,7 +2324,6 @@ _func_exit_; void rtw_setassocsta_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pcmd) { - unsigned long irqL; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct set_assocsta_parm *passocsta_parm = (struct set_assocsta_parm *)(pcmd->parmbuf); @@ -2349,13 +2340,13 @@ _func_enter_; psta->aid = passocsta_rsp->cam_id; psta->mac_id = passocsta_rsp->cam_id; - _enter_critical_bh(&pmlmepriv->lock, &irqL); + spin_lock(&pmlmepriv->lock); if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) && (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true)) _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); set_fwstate(pmlmepriv, _FW_LINKED); - _exit_critical_bh(&pmlmepriv->lock, &irqL); + spin_unlock(&pmlmepriv->lock); exit: rtw_free_cmd_obj(pcmd); diff --git a/core/rtw_debug.c b/core/rtw_debug.c index 0fe5f5d..1029819 100644 --- a/core/rtw_debug.c +++ b/core/rtw_debug.c @@ -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,7 +847,7 @@ 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(&pstapriv->sta_hash_lock); for (i = 0; i < NUM_STA; i++) { phead = &(pstapriv->sta_hash[i]); @@ -882,7 +881,7 @@ int proc_get_all_sta_info(char *page, char **start, } } } - _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); + spin_unlock(&pstapriv->sta_hash_lock); *eof = 1; return len; diff --git a/core/rtw_ioctl_set.c b/core/rtw_ioctl_set.c index 193f641..8c7687a 100644 --- a/core/rtw_ioctl_set.c +++ b/core/rtw_ioctl_set.c @@ -68,7 +68,6 @@ _func_exit_; u8 rtw_do_join(struct adapter *padapter) { - unsigned long irqL; struct list_head *plist, *phead; u8 *pibss = NULL; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -77,7 +76,7 @@ u8 rtw_do_join(struct adapter *padapter) _func_enter_; - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_lock(&pmlmepriv->scanned_queue.lock); phead = get_list_head(queue); plist = get_next(phead); @@ -92,7 +91,7 @@ _func_enter_; pmlmepriv->to_join = true; if (_rtw_queue_empty(queue)) { - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_unlock(&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 +115,7 @@ _func_enter_; } else { int select_ret; - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_unlock(&pmlmepriv->scanned_queue.lock); select_ret = rtw_select_and_join_from_scanned_queue(pmlmepriv); if (select_ret == _SUCCESS) { pmlmepriv->to_join = false; @@ -178,7 +177,6 @@ _func_exit_; 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; @@ -195,7 +193,7 @@ _func_enter_; goto exit; } - _enter_critical_bh(&pmlmepriv->lock, &irqL); + spin_lock(&pmlmepriv->lock); DBG_88E("Set BSSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv)); @@ -253,7 +251,7 @@ handle_tkip_countermeasure: status = rtw_do_join(padapter); release_mlme_lock: - _exit_critical_bh(&pmlmepriv->lock, &irqL); + spin_unlock(&pmlmepriv->lock); exit: RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, @@ -266,7 +264,6 @@ _func_exit_; 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; @@ -285,7 +282,7 @@ _func_enter_; goto exit; } - _enter_critical_bh(&pmlmepriv->lock, &irqL); + spin_lock(&pmlmepriv->lock); DBG_88E("Set SSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv)); if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) { @@ -367,7 +364,7 @@ handle_tkip_countermeasure: } release_mlme_lock: - _exit_critical_bh(&pmlmepriv->lock, &irqL); + spin_unlock(&pmlmepriv->lock); exit: RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, @@ -379,7 +376,6 @@ _func_exit_; 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); @@ -391,7 +387,7 @@ _func_enter_; *pold_state, networktype, get_fwstate(pmlmepriv))); if (*pold_state != networktype) { - _enter_critical_bh(&pmlmepriv->lock, &irqL); + spin_lock(&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)); */ @@ -439,7 +435,7 @@ _func_enter_; case Ndis802_11InfrastructureMax: break; } - _exit_critical_bh(&pmlmepriv->lock, &irqL); + spin_unlock(&pmlmepriv->lock); } _func_exit_; @@ -450,12 +446,11 @@ _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(&pmlmepriv->lock); if (check_fwstate(pmlmepriv, _FW_LINKED)) { RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, @@ -467,7 +462,7 @@ _func_enter_; rtw_pwr_wakeup(padapter); } - _exit_critical_bh(&pmlmepriv->lock, &irqL); + spin_unlock(&pmlmepriv->lock); _func_exit_; @@ -476,7 +471,6 @@ _func_exit_; 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; @@ -512,11 +506,11 @@ _func_enter_; return _SUCCESS; } - _enter_critical_bh(&pmlmepriv->lock, &irqL); + spin_lock(&pmlmepriv->lock); res = rtw_sitesurvey_cmd(padapter, pssid, ssid_max_num, NULL, 0); - _exit_critical_bh(&pmlmepriv->lock, &irqL); + spin_unlock(&pmlmepriv->lock); } exit: diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index 50e2bc4..08ddf81 100644 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -160,18 +160,16 @@ _func_exit_; int _rtw_enqueue_network(struct __queue *queue, struct wlan_network *pnetwork) { - unsigned long irql; - _func_enter_; if (pnetwork == NULL) goto exit; - _enter_critical_bh(&queue->lock, &irql); + spin_lock(&queue->lock); rtw_list_insert_tail(&pnetwork->list, &queue->queue); - _exit_critical_bh(&queue->lock, &irql); + spin_unlock(&queue->lock); exit: @@ -182,13 +180,11 @@ _func_exit_; struct wlan_network *_rtw_dequeue_network(struct __queue *queue) { - unsigned long irql; - struct wlan_network *pnetwork; _func_enter_; - _enter_critical_bh(&queue->lock, &irql); + spin_lock(&queue->lock); if (_rtw_queue_empty(queue)) { pnetwork = NULL; @@ -198,7 +194,7 @@ _func_enter_; rtw_list_delete(&(pnetwork->list)); } - _exit_critical_bh(&queue->lock, &irql); + spin_unlock(&queue->lock); _func_exit_; @@ -207,14 +203,13 @@ _func_exit_; struct wlan_network *_rtw_alloc_network(struct mlme_priv *pmlmepriv)/* _queue *free_queue) */ { - unsigned long irql; struct wlan_network *pnetwork; struct __queue *free_queue = &pmlmepriv->free_bss_pool; struct list_head *plist = NULL; _func_enter_; - _enter_critical_bh(&free_queue->lock, &irql); + spin_lock(&free_queue->lock); if (_rtw_queue_empty(free_queue) == true) { pnetwork = NULL; @@ -236,7 +231,7 @@ _func_enter_; pmlmepriv->num_of_scanned++; exit: - _exit_critical_bh(&free_queue->lock, &irql); + spin_unlock(&free_queue->lock); _func_exit_; @@ -247,7 +242,6 @@ void _rtw_free_network(struct mlme_priv *pmlmepriv , struct wlan_network *pnetwo { u32 curr_time, delta_time; u32 lifetime = SCANQUEUE_LIFETIME; - unsigned long irql; struct __queue *free_queue = &(pmlmepriv->free_bss_pool); _func_enter_; @@ -266,11 +260,11 @@ _func_enter_; if (delta_time < lifetime)/* unit:sec */ goto exit; } - _enter_critical_bh(&free_queue->lock, &irql); + spin_lock(&free_queue->lock); rtw_list_delete(&(pnetwork->list)); rtw_list_insert_tail(&(pnetwork->list), &(free_queue->queue)); pmlmepriv->num_of_scanned--; - _exit_critical_bh(&free_queue->lock, &irql); + spin_unlock(&free_queue->lock); exit: _func_exit_; @@ -328,7 +322,6 @@ _func_exit_; void _rtw_free_network_queue(struct adapter *padapter, u8 isfreeall) { - unsigned long irql; struct list_head *phead, *plist; struct wlan_network *pnetwork; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -337,7 +330,7 @@ void _rtw_free_network_queue(struct adapter *padapter, u8 isfreeall) _func_enter_; - _enter_critical_bh(&scanned_queue->lock, &irql); + spin_lock(&scanned_queue->lock); phead = get_list_head(scanned_queue); plist = get_next(phead); @@ -349,7 +342,7 @@ _func_enter_; _rtw_free_network(pmlmepriv, pnetwork, isfreeall); } - _exit_critical_bh(&scanned_queue->lock, &irql); + spin_unlock(&scanned_queue->lock); _func_exit_; } @@ -608,7 +601,6 @@ Caller must hold pmlmepriv->lock first. */ void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *target) { - unsigned long irql; struct list_head *plist, *phead; u32 bssid_ex_sz; struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); @@ -621,7 +613,7 @@ void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *t _func_enter_; - _enter_critical_bh(&queue->lock, &irql); + spin_lock(&queue->lock); phead = get_list_head(queue); plist = get_next(phead); @@ -702,7 +694,7 @@ _func_enter_; } exit: - _exit_critical_bh(&queue->lock, &irql); + spin_unlock(&queue->lock); _func_exit_; } @@ -791,7 +783,6 @@ _func_exit_; void rtw_survey_event_callback(struct adapter *adapter, u8 *pbuf) { - unsigned long irql; u32 len; struct wlan_bssid_ex *pnetwork; struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); @@ -807,23 +798,22 @@ _func_enter_; RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("\n****rtw_survey_event_callback: return a wrong bss ***\n")); return; } - _enter_critical_bh(&pmlmepriv->lock, &irql); + spin_lock(&pmlmepriv->lock); /* update IBSS_network 's timestamp */ if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) == true) { if (_rtw_memcmp(&(pmlmepriv->cur_network.network.MacAddress), pnetwork->MacAddress, ETH_ALEN)) { struct wlan_network *ibss_wlan = NULL; - unsigned long irql; memcpy(pmlmepriv->cur_network.network.IEs, pnetwork->IEs, 8); - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_lock(&pmlmepriv->scanned_queue.lock); ibss_wlan = rtw_find_network(&pmlmepriv->scanned_queue, pnetwork->MacAddress); if (ibss_wlan) { memcpy(ibss_wlan->network.IEs , pnetwork->IEs, 8); - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_unlock(&pmlmepriv->scanned_queue.lock); goto exit; } - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_unlock(&(pmlmepriv->scanned_queue.lock)); } } @@ -836,7 +826,7 @@ _func_enter_; exit: - _exit_critical_bh(&pmlmepriv->lock, &irql); + spin_unlock(&pmlmepriv->lock); _func_exit_; @@ -847,13 +837,12 @@ _func_exit_; void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) { - unsigned long irql; struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); struct mlme_ext_priv *pmlmeext; u8 timer_cancelled = 0; _func_enter_; - _enter_critical_bh(&pmlmepriv->lock, &irql); + spin_lock(&pmlmepriv->lock); if (pmlmepriv->wps_probe_req_ie) { pmlmepriv->wps_probe_req_ie_len = 0; @@ -871,12 +860,12 @@ _func_enter_; RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("nic status=%x, survey done event comes too late!\n", get_fwstate(pmlmepriv))); } - _exit_critical_bh(&pmlmepriv->lock, &irql); + spin_unlock(&pmlmepriv->lock); if (timer_cancelled) _cancel_timer(&pmlmepriv->scan_to_timer, &timer_cancelled); - _enter_critical_bh(&pmlmepriv->lock, &irql); + spin_lock(&pmlmepriv->lock); rtw_set_signal_stat_timer(&adapter->recvpriv); if (pmlmepriv->to_join) { @@ -939,7 +928,7 @@ _func_enter_; indicate_wx_scan_complete_event(adapter); - _exit_critical_bh(&pmlmepriv->lock, &irql); + spin_unlock(&pmlmepriv->lock); if (check_fwstate(pmlmepriv, _FW_LINKED) == true) p2p_ps_wk_cmd(adapter, P2P_PS_SCAN_DONE, 0); @@ -960,7 +949,6 @@ void rtw_fwdbg_event_callback(struct adapter *adapter , u8 *pbuf) static void free_scanqueue(struct mlme_priv *pmlmepriv) { - unsigned long irql, irql0; struct __queue *free_queue = &pmlmepriv->free_bss_pool; struct __queue *scan_queue = &pmlmepriv->scanned_queue; struct list_head *plist, *phead, *ptemp; @@ -968,8 +956,8 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv) _func_enter_; RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, ("+free_scanqueue\n")); - _enter_critical_bh(&scan_queue->lock, &irql0); - _enter_critical_bh(&free_queue->lock, &irql); + spin_lock(&scan_queue->lock); + spin_lock(&free_queue->lock); phead = get_list_head(scan_queue); plist = get_next(phead); @@ -982,8 +970,8 @@ _func_enter_; pmlmepriv->num_of_scanned--; } - _exit_critical_bh(&free_queue->lock, &irql); - _exit_critical_bh(&scan_queue->lock, &irql0); + spin_unlock(&free_queue->lock); + spin_unlock(&scan_queue->lock); _func_exit_; } @@ -993,7 +981,6 @@ _func_exit_; */ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue) { - unsigned long irql; struct wlan_network *pwlan = NULL; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct sta_priv *pstapriv = &adapter->stapriv; @@ -1011,9 +998,9 @@ _func_enter_; psta = rtw_get_stainfo(&adapter->stapriv, tgt_network->network.MacAddress); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irql); + spin_lock(&pstapriv->sta_hash_lock); rtw_free_stainfo(adapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irql); + spin_unlock(&pstapriv->sta_hash_lock); } if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE | WIFI_AP_STATE)) { @@ -1022,15 +1009,15 @@ _func_enter_; rtw_free_all_stainfo(adapter); psta = rtw_get_bcmc_stainfo(adapter); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irql); + spin_lock(&pstapriv->sta_hash_lock); rtw_free_stainfo(adapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irql); + spin_unlock(&pstapriv->sta_hash_lock); rtw_init_bcmc_stainfo(adapter); } if (lock_scanned_queue) - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_lock(&pmlmepriv->scanned_queue.lock); pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress); if (pwlan) @@ -1042,7 +1029,7 @@ _func_enter_; rtw_free_network_nolock(pmlmepriv, pwlan); if (lock_scanned_queue) - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_unlock(&pmlmepriv->scanned_queue.lock); pmlmepriv->key_mask = 0; _func_exit_; } @@ -1262,7 +1249,6 @@ static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_net void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf) { - unsigned long irql, irql2; u8 timer_cancelled; struct sta_info *ptarget_sta = NULL, *pcur_sta = NULL; struct sta_priv *pstapriv = &adapter->stapriv; @@ -1292,12 +1278,12 @@ _func_enter_; goto ignore_nolock; } - _enter_critical_bh(&pmlmepriv->lock, &irql); + spin_lock(&pmlmepriv->lock); - RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("\nrtw_joinbss_event_callback!! _enter_critical\n")); + RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("\nrtw_joinbss_event_callback!! spin_lock_init\n")); if (pnetwork->join_res > 0) { - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_lock(&pmlmepriv->scanned_queue.lock); if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) { /* s1. find ptarget_wlan */ if (check_fwstate(pmlmepriv, _FW_LINKED)) { @@ -1310,9 +1296,9 @@ _func_enter_; pcur_sta = rtw_get_stainfo(pstapriv, cur_network->network.MacAddress); if (pcur_sta) { - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irql2); + spin_lock(&pstapriv->sta_hash_lock); rtw_free_stainfo(adapter, pcur_sta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irql2); + spin_unlock(&pstapriv->sta_hash_lock); } ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, pnetwork->network.MacAddress); @@ -1334,7 +1320,7 @@ _func_enter_; rtw_joinbss_update_network(adapter, ptarget_wlan, pnetwork); } else { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("Can't find ptarget_wlan when joinbss_event callback\n")); - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_unlock(&pmlmepriv->scanned_queue.lock); goto ignore_joinbss_callback; } @@ -1344,7 +1330,7 @@ _func_enter_; ptarget_sta = rtw_joinbss_update_stainfo(adapter, pnetwork); if (ptarget_sta == NULL) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("Can't update stainfo when joinbss_event callback\n")); - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_unlock(&pmlmepriv->scanned_queue.lock); goto ignore_joinbss_callback; } } @@ -1365,11 +1351,11 @@ _func_enter_; } else { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("rtw_joinbss_event_callback err: fw_state:%x", get_fwstate(pmlmepriv))); - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_unlock(&pmlmepriv->scanned_queue.lock); goto ignore_joinbss_callback; } - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_unlock(&pmlmepriv->scanned_queue.lock); } else if (pnetwork->join_res == -4) { rtw_reset_securitypriv(adapter); @@ -1385,7 +1371,7 @@ _func_enter_; } ignore_joinbss_callback: - _exit_critical_bh(&pmlmepriv->lock, &irql); + spin_unlock(&pmlmepriv->lock); ignore_nolock: _func_exit_; } @@ -1452,7 +1438,6 @@ void rtw_sta_media_status_rpt(struct adapter *adapter,struct sta_info *psta, void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf) { - unsigned long irql; struct sta_info *psta; struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); struct stassoc_event *pstassoc = (struct stassoc_event *)pbuf; @@ -1494,21 +1479,21 @@ _func_enter_; if (adapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) psta->dot118021XPrivacy = adapter->securitypriv.dot11PrivacyAlgrthm; psta->ieee8021x_blocked = false; - _enter_critical_bh(&pmlmepriv->lock, &irql); + spin_lock(&pmlmepriv->lock); if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) || (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE))) { if (adapter->stapriv.asoc_sta_count == 2) { - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_lock(&pmlmepriv->scanned_queue.lock); ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, cur_network->network.MacAddress); pmlmepriv->cur_network_scanned = ptarget_wlan; if (ptarget_wlan) ptarget_wlan->fixed = true; - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_unlock(&pmlmepriv->scanned_queue.lock); /* a sta + bc/mc_stainfo (not Ibss_stainfo) */ rtw_indicate_connect(adapter); } } - _exit_critical_bh(&pmlmepriv->lock, &irql); + spin_unlock(&pmlmepriv->lock); mlmeext_sta_add_event_callback(adapter, psta); exit: _func_exit_; @@ -1516,7 +1501,6 @@ _func_exit_; void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf) { - unsigned long irql, irql2; int mac_id = -1; struct sta_info *psta; struct wlan_network *pwlan = NULL; @@ -1549,7 +1533,7 @@ _func_enter_; mlmeext_sta_del_event_callback(adapter); - _enter_critical_bh(&pmlmepriv->lock, &irql2); + spin_lock(&pmlmepriv->lock); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { if(adapter->registrypriv.wifi_spec == 1) @@ -1567,31 +1551,31 @@ _func_enter_; rtw_free_assoc_resources(adapter, 1); rtw_indicate_disconnect(adapter); - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_lock(&pmlmepriv->scanned_queue.lock); /* remove the network entry in scanned_queue */ pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress); if (pwlan) { pwlan->fixed = false; rtw_free_network_nolock(pmlmepriv, pwlan); } - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_unlock(&pmlmepriv->scanned_queue.lock); _rtw_roaming(adapter, tgt_network); } if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) || check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irql); + spin_lock(&(pstapriv->sta_hash_lock)); rtw_free_stainfo(adapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irql); + spin_unlock(&pstapriv->sta_hash_lock); if (adapter->stapriv.asoc_sta_count == 1) { /* a sta + bc/mc_stainfo (not Ibss_stainfo) */ - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_lock(&pmlmepriv->scanned_queue.lock); /* free old ibss network */ pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress); if (pwlan) { pwlan->fixed = false; rtw_free_network_nolock(pmlmepriv, pwlan); } - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_unlock(&pmlmepriv->scanned_queue.lock); /* re-create ibss */ pdev_network = &(adapter->registrypriv.dev_network); pibss = adapter->registrypriv.dev_network.MacAddress; @@ -1614,7 +1598,7 @@ _func_enter_; RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("***Error=>stadel_event_callback: rtw_createbss_cmd status FAIL***\n ")); } } - _exit_critical_bh(&pmlmepriv->lock, &irql2); + spin_unlock(&pmlmepriv->lock); _func_exit_; } @@ -1631,7 +1615,6 @@ _func_exit_; */ void _rtw_join_timeout_handler (struct adapter *adapter) { - unsigned long irql; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; int do_join_r; @@ -1643,7 +1626,7 @@ _func_enter_; return; - _enter_critical_bh(&pmlmepriv->lock, &irql); + spin_lock(&pmlmepriv->lock); if (rtw_to_roaming(adapter) > 0) { /* join timeout caused by roaming */ while (1) { @@ -1666,7 +1649,7 @@ _func_enter_; rtw_indicate_disconnect(adapter); free_scanqueue(pmlmepriv);/* */ } - _exit_critical_bh(&pmlmepriv->lock, &irql); + spin_unlock(&pmlmepriv->lock); _func_exit_; } @@ -1676,13 +1659,12 @@ _func_exit_; */ void rtw_scan_timeout_handler (struct adapter *adapter) { - unsigned long irql; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; DBG_88E(FUNC_ADPT_FMT" fw_state=%x\n", FUNC_ADPT_ARG(adapter), get_fwstate(pmlmepriv)); - _enter_critical_bh(&pmlmepriv->lock, &irql); + spin_lock(&pmlmepriv->lock); _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); - _exit_critical_bh(&pmlmepriv->lock, &irql); + spin_unlock(&pmlmepriv->lock); rtw_indicate_scan_done(adapter, true); } @@ -1814,7 +1796,6 @@ pmlmepriv->lock int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv) { - unsigned long irql; int ret; struct list_head *phead; struct adapter *adapter; @@ -1825,7 +1806,7 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv) _func_enter_; - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_lock(&pmlmepriv->scanned_queue.lock); phead = get_list_head(queue); adapter = (struct adapter *)pmlmepriv->nic_hdl; pmlmepriv->pscanned = get_next(phead); @@ -1872,7 +1853,7 @@ _func_enter_; ret = rtw_joinbss_cmd(adapter, candidate); exit: - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); + spin_unlock(&pmlmepriv->scanned_queue.lock); _func_exit_; @@ -2447,12 +2428,11 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr void rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network) { - unsigned long irql; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - _enter_critical_bh(&pmlmepriv->lock, &irql); + spin_lock(&pmlmepriv->lock); _rtw_roaming(padapter, tgt_network); - _exit_critical_bh(&pmlmepriv->lock, &irql); + spin_unlock(&pmlmepriv->lock); } void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network) { diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index afff594..493333a 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -754,7 +754,6 @@ _END_ONBEACON_: unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) { #ifdef CONFIG_88EU_AP_MODE - unsigned long irqL; unsigned int auth_mode, ie_len; u16 seq; unsigned char *sa, *p; @@ -815,24 +814,24 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) pstat->state = WIFI_FW_AUTH_NULL; pstat->auth_seq = 0; } else { - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_lock(&pstapriv->asoc_list_lock); if (!rtw_is_list_empty(&pstat->asoc_list)) { rtw_list_delete(&pstat->asoc_list); pstapriv->asoc_list_cnt--; } - _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_unlock(&pstapriv->asoc_list_lock); if (seq == 1) { /* TODO: STA re_auth and auth timeout */ } } - _enter_critical_bh(&pstapriv->auth_list_lock, &irqL); + spin_lock(&pstapriv->auth_list_lock); if (rtw_is_list_empty(&pstat->auth_list)) { rtw_list_insert_tail(&pstat->auth_list, &pstapriv->auth_list); pstapriv->auth_list_cnt++; } - _exit_critical_bh(&pstapriv->auth_list_lock, &irqL); + spin_unlock(&pstapriv->auth_list_lock); if (pstat->auth_seq == 0) pstat->expire_to = pstapriv->auth_to; @@ -1003,7 +1002,6 @@ authclnt_fail: unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) { #ifdef CONFIG_88EU_AP_MODE - unsigned long irqL; u16 capab_info; struct rtw_ieee802_11_elems elems; struct sta_info *pstat; @@ -1406,20 +1404,20 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) pstat->state &= (~WIFI_FW_ASSOC_STATE); pstat->state |= WIFI_FW_ASSOC_SUCCESS; - _enter_critical_bh(&pstapriv->auth_list_lock, &irqL); + spin_lock(&pstapriv->auth_list_lock); if (!rtw_is_list_empty(&pstat->auth_list)) { rtw_list_delete(&pstat->auth_list); pstapriv->auth_list_cnt--; } - _exit_critical_bh(&pstapriv->auth_list_lock, &irqL); + spin_unlock(&pstapriv->auth_list_lock); - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_lock(&pstapriv->asoc_list_lock); if (rtw_is_list_empty(&pstat->asoc_list)) { pstat->expire_to = pstapriv->expire_to; rtw_list_insert_tail(&pstat->asoc_list, &pstapriv->asoc_list); pstapriv->asoc_list_cnt++; } - _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_unlock(&pstapriv->asoc_list_lock); /* now the station is qualified to join our BSS... */ if (pstat && (pstat->state & WIFI_FW_ASSOC_SUCCESS) && (_STATS_SUCCESSFUL_ == status)) { @@ -1588,7 +1586,6 @@ unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame) #ifdef CONFIG_88EU_AP_MODE if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - unsigned long irqL; struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; @@ -1599,13 +1596,13 @@ unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame) if (psta) { u8 updated = 0; - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_lock(&pstapriv->asoc_list_lock); if (!rtw_is_list_empty(&psta->asoc_list)) { rtw_list_delete(&psta->asoc_list); pstapriv->asoc_list_cnt--; updated = ap_free_sta(padapter, psta, false, reason); } - _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_unlock(&pstapriv->asoc_list_lock); associated_clients_update(padapter, updated); } @@ -1670,14 +1667,9 @@ unsigned int OnDisassoc(struct adapter *padapter, union recv_frame *precv_frame) #ifdef CONFIG_88EU_AP_MODE if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - unsigned long irqL; struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; - /* _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); */ - /* rtw_free_stainfo(padapter, psta); */ - /* _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); */ - DBG_88E_LEVEL(_drv_always_, "ap recv disassoc reason code(%d) sta:%pM\n", reason, GetAddr2Ptr(pframe)); @@ -1685,13 +1677,13 @@ unsigned int OnDisassoc(struct adapter *padapter, union recv_frame *precv_frame) if (psta) { u8 updated = 0; - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_lock(&pstapriv->asoc_list_lock); if (!rtw_is_list_empty(&psta->asoc_list)) { rtw_list_delete(&psta->asoc_list); pstapriv->asoc_list_cnt--; updated = ap_free_sta(padapter, psta, false, reason); } - _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_unlock(&pstapriv->asoc_list_lock); associated_clients_update(padapter, updated); } @@ -4503,9 +4495,6 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) __le16 *fctrl; unsigned int rate_len; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); -#if defined(CONFIG_88EU_AP_MODE) - unsigned long irqL; -#endif /* if defined (CONFIG_88EU_AP_MODE) */ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -4521,7 +4510,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) return; } #if defined (CONFIG_88EU_AP_MODE) - _enter_critical_bh(&pmlmepriv->bcn_update_lock, &irqL); + spin_lock(&pmlmepriv->bcn_update_lock); #endif /* if defined (CONFIG_88EU_AP_MODE) */ /* update attribute */ @@ -4706,7 +4695,7 @@ _issue_bcn: #if defined (CONFIG_88EU_AP_MODE) pmlmepriv->update_bcn = false; - _exit_critical_bh(&pmlmepriv->bcn_update_lock, &irqL); + spin_unlock(&pmlmepriv->bcn_update_lock); #endif /* if defined (CONFIG_88EU_AP_MODE) */ if ((pattrib->pktlen + TXDESC_SIZE) > 512) { @@ -6172,7 +6161,6 @@ void issue_action_BA(struct adapter *padapter, unsigned char *raddr, unsigned ch static void issue_action_BSSCoexistPacket(struct adapter *padapter) { - unsigned long irqL; struct list_head *plist, *phead; unsigned char category, action; struct xmit_frame *pmgntframe; @@ -6247,7 +6235,7 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) if (pmlmepriv->num_sta_no_ht > 0) { int i; - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_lock(&pmlmepriv->scanned_queue.lock); phead = get_list_head(queue); plist = get_next(phead); @@ -6277,7 +6265,7 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) ICS[0][0] = 1; } } - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_unlock(&pmlmepriv->scanned_queue.lock); for (i = 0; i < 8; i++) { if (ICS[i][0] == 1) { @@ -8376,7 +8364,6 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) } #ifdef CONFIG_88EU_AP_MODE else { /* tx bc/mc frames after update TIM */ - unsigned long irqL; struct sta_info *psta_bmc; struct list_head *xmitframe_plist, *xmitframe_phead; struct xmit_frame *pxmitframe = NULL; @@ -8389,7 +8376,7 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) if ((pstapriv->tim_bitmap&BIT(0)) && (psta_bmc->sleepq_len > 0)) { rtw_msleep_os(10);/* 10ms, ATIM(HIQ) Windows */ - _enter_critical_bh(&psta_bmc->sleep_q.lock, &irqL); + spin_lock(&psta_bmc->sleep_q.lock); xmitframe_phead = get_list_head(&psta_bmc->sleep_q); xmitframe_plist = get_next(xmitframe_phead); @@ -8411,12 +8398,12 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) pxmitframe->attrib.qsel = 0x11;/* HIQ */ - _exit_critical_bh(&psta_bmc->sleep_q.lock, &irqL); + spin_unlock(&psta_bmc->sleep_q.lock); if (rtw_hal_xmit(padapter, pxmitframe)) rtw_os_xmit_complete(padapter, pxmitframe); - _enter_critical_bh(&psta_bmc->sleep_q.lock, &irqL); + spin_lock(&psta_bmc->sleep_q.lock); } - _exit_critical_bh(&psta_bmc->sleep_q.lock, &irqL); + spin_unlock(&psta_bmc->sleep_q.lock); } } #endif diff --git a/core/rtw_mp.c b/core/rtw_mp.c index 185ec1f..acdb5be 100644 --- a/core/rtw_mp.c +++ b/core/rtw_mp.c @@ -323,10 +323,7 @@ s32 mp_start_test(struct adapter *padapter) 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; @@ -379,7 +376,7 @@ s32 mp_start_test(struct adapter *padapter) else bssid.Length = length; - _enter_critical_bh(&pmlmepriv->lock, &irqL); + spin_lock(&pmlmepriv->lock); if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) goto end_of_mp_start_test; @@ -420,7 +417,7 @@ s32 mp_start_test(struct adapter *padapter) end_of_mp_start_test: - _exit_critical_bh(&pmlmepriv->lock, &irqL); + spin_unlock(&pmlmepriv->lock); if (res == _SUCCESS) { /* set MSR to WIFI_FW_ADHOC_STATE */ @@ -439,11 +436,9 @@ void mp_stop_test(struct adapter *padapter) 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); + spin_lock(&pmlmepriv->lock); if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == false) goto end_of_mp_stop_test; @@ -465,7 +460,7 @@ void mp_stop_test(struct adapter *padapter) end_of_mp_stop_test: - _exit_critical_bh(&pmlmepriv->lock, &irqL); + spin_unlock(&pmlmepriv->lock); } } diff --git a/core/rtw_p2p.c b/core/rtw_p2p.c index f46cab1..74c991d 100644 --- a/core/rtw_p2p.c +++ b/core/rtw_p2p.c @@ -40,7 +40,6 @@ static int rtw_p2p_is_channel_list_ok(u8 desired_ch, u8 *ch_list, u8 ch_cnt) static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf) { - unsigned long irqL; struct list_head *phead, *plist; u32 len = 0; u16 attr_len = 0; @@ -56,7 +55,7 @@ static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf) pstart = pdata_attr; pcur = pdata_attr; - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_lock(&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list; plist = get_next(phead); @@ -120,7 +119,7 @@ static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf) pstart = pcur; } } - _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_unlock(&pstapriv->asoc_list_lock); if (attr_len > 0) len = rtw_set_p2p_attr_content(pbuf, P2P_ATTR_GROUP_INFO, attr_len, pdata_attr); @@ -977,10 +976,9 @@ u32 process_p2p_devdisc_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint le _rtw_memcmp(pwdinfo->p2p_group_ssid, groupid+ETH_ALEN, pwdinfo->p2p_group_ssid_len)) { attr_contentlen = 0; if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_ID, dev_addr, &attr_contentlen)) { - unsigned long irqL; struct list_head *phead, *plist; - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_lock(&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list; plist = get_next(phead); @@ -1000,7 +998,7 @@ u32 process_p2p_devdisc_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint le status = P2P_STATUS_FAIL_INFO_UNAVAILABLE; } } - _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_unlock(&pstapriv->asoc_list_lock); } else { status = P2P_STATUS_FAIL_INVALID_PARAM; } @@ -1499,7 +1497,6 @@ static void find_phase_handler(struct adapter *padapter) struct wifidirect_info *pwdinfo = &padapter->wdinfo; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct ndis_802_11_ssid ssid; - unsigned long irqL; _func_enter_; @@ -1509,8 +1506,8 @@ _func_enter_; rtw_p2p_set_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH); - _enter_critical_bh(&pmlmepriv->lock, &irqL); - _exit_critical_bh(&pmlmepriv->lock, &irqL); + spin_lock(&pmlmepriv->lock); + spin_unlock(&pmlmepriv->lock); _func_exit_; @@ -1833,13 +1830,12 @@ static void pre_tx_scan_timer_process(void *FunctionContext) { struct adapter *adapter = (struct adapter *)FunctionContext; struct wifidirect_info *pwdinfo = &adapter->wdinfo; - unsigned long irqL; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return; - _enter_critical_bh(&pmlmepriv->lock, &irqL); + spin_lock(&pmlmepriv->lock); if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_PROVISION_DIS_REQ)) { if (pwdinfo->tx_prov_disc_info.benable) { /* the provision discovery request frame is trigger to send or not */ @@ -1857,7 +1853,7 @@ static void pre_tx_scan_timer_process(void *FunctionContext) DBG_88E("[%s] p2p_state is %d, ignore!!\n", __func__, rtw_p2p_state(pwdinfo)); } - _exit_critical_bh(&pmlmepriv->lock, &irqL); + spin_unlock(&pmlmepriv->lock); } static void find_phase_timer_process(void *FunctionContext) diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 17985ba..52576cc 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -181,14 +181,13 @@ _func_exit_; union recv_frame *rtw_alloc_recvframe (struct __queue *pfree_recv_queue) { - unsigned long irqL; union recv_frame *precvframe; - _enter_critical_bh(&pfree_recv_queue->lock, &irqL); + spin_lock(&pfree_recv_queue->lock); precvframe = _rtw_alloc_recvframe(pfree_recv_queue); - _exit_critical_bh(&pfree_recv_queue->lock, &irqL); + spin_unlock(&pfree_recv_queue->lock); return precvframe; } @@ -203,7 +202,6 @@ void rtw_init_recvframe(union recv_frame *precvframe, struct recv_priv *precvpri int rtw_free_recvframe(union recv_frame *precvframe, struct __queue *pfree_recv_queue) { - unsigned long irqL; struct adapter *padapter; struct recv_priv *precvpriv; @@ -217,7 +215,7 @@ _func_enter_; precvframe->u.hdr.pkt = NULL; } - _enter_critical_bh(&pfree_recv_queue->lock, &irqL); + spin_lock(&pfree_recv_queue->lock); rtw_list_delete(&(precvframe->u.hdr.list)); @@ -230,7 +228,7 @@ _func_enter_; precvpriv->free_recvframe_cnt++; } - _exit_critical_bh(&pfree_recv_queue->lock, &irqL); + spin_unlock(&pfree_recv_queue->lock); _func_exit_; @@ -260,11 +258,10 @@ _func_exit_; int rtw_enqueue_recvframe(union recv_frame *precvframe, struct __queue *queue) { int ret; - unsigned long irqL; - _enter_critical_bh(&queue->lock, &irqL); + spin_lock(&queue->lock); ret = _rtw_enqueue_recvframe(precvframe, queue); - _exit_critical_bh(&queue->lock, &irqL); + spin_unlock(&queue->lock); return ret; } @@ -316,37 +313,36 @@ u32 rtw_free_uc_swdec_pending_queue(struct adapter *adapter) int rtw_enqueue_recvbuf_to_head(struct recv_buf *precvbuf, struct __queue *queue) { - unsigned long irqL; - - _enter_critical_bh(&queue->lock, &irqL); + spin_lock(&queue->lock); rtw_list_delete(&precvbuf->list); rtw_list_insert_head(&precvbuf->list, get_list_head(queue)); - _exit_critical_bh(&queue->lock, &irqL); + spin_unlock(&queue->lock); return _SUCCESS; } int rtw_enqueue_recvbuf(struct recv_buf *precvbuf, struct __queue *queue) { - unsigned long irqL; - _enter_critical_ex(&queue->lock, &irqL); + unsigned long flags; + + spin_lock_irqsave(&queue->lock, flags); rtw_list_delete(&precvbuf->list); rtw_list_insert_tail(&precvbuf->list, get_list_head(queue)); - _exit_critical_ex(&queue->lock, &irqL); + spin_unlock_irqrestore(&queue->lock, flags); return _SUCCESS; } struct recv_buf *rtw_dequeue_recvbuf (struct __queue *queue) { - unsigned long irqL; struct recv_buf *precvbuf; struct list_head *plist, *phead; + unsigned long flags; - _enter_critical_ex(&queue->lock, &irqL); + spin_lock_irqsave(&queue->lock, flags); if (_rtw_queue_empty(queue)) { precvbuf = NULL; @@ -360,7 +356,7 @@ struct recv_buf *rtw_dequeue_recvbuf (struct __queue *queue) rtw_list_delete(&precvbuf->list); } - _exit_critical_ex(&queue->lock, &irqL); + spin_unlock_irqrestore(&queue->lock, flags); return precvbuf; } @@ -1112,12 +1108,11 @@ static int validate_recv_ctrl_frame(struct adapter *padapter, } if ((psta->state&WIFI_SLEEP_STATE) && (pstapriv->sta_dz_bitmap&BIT(psta->aid))) { - unsigned long irqL; struct list_head *xmitframe_plist, *xmitframe_phead; struct xmit_frame *pxmitframe = NULL; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - _enter_critical_bh(&pxmitpriv->lock, &irqL); + spin_lock(&pxmitpriv->lock); xmitframe_phead = get_list_head(&psta->sleep_q); xmitframe_plist = get_next(xmitframe_phead); @@ -1166,7 +1161,7 @@ static int validate_recv_ctrl_frame(struct adapter *padapter, update_beacon(padapter, _TIM_IE_, NULL, false); } } - _exit_critical_bh(&pxmitpriv->lock, &irqL); + spin_unlock(&pxmitpriv->lock); } } @@ -1944,7 +1939,6 @@ static int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reor static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *prframe) { - unsigned long irql; int retval = _SUCCESS; struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib; struct recv_reorder_ctrl *preorder_ctrl = prframe->u.hdr.preorder_ctrl; @@ -1985,7 +1979,7 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame * } } - _enter_critical_bh(&ppending_recvframe_queue->lock, &irql); + spin_lock(&ppending_recvframe_queue->lock); RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, ("recv_indicatepkt_reorder: indicate=%d seq=%d\n", @@ -2012,9 +2006,9 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame * /* recv_indicatepkts_in_order(padapter, preorder_ctrl, true); */ if (recv_indicatepkts_in_order(padapter, preorder_ctrl, false)) { _set_timer(&preorder_ctrl->reordering_ctrl_timer, REORDER_WAIT_TIME); - _exit_critical_bh(&ppending_recvframe_queue->lock, &irql); + spin_unlock(&ppending_recvframe_queue->lock); } else { - _exit_critical_bh(&ppending_recvframe_queue->lock, &irql); + spin_unlock(&ppending_recvframe_queue->lock); _cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer); } @@ -2024,14 +2018,13 @@ _success_exit: _err_exit: - _exit_critical_bh(&ppending_recvframe_queue->lock, &irql); + spin_unlock(&ppending_recvframe_queue->lock); return _FAIL; } void rtw_reordering_ctrl_timeout_handler(void *pcontext) { - unsigned long irql; struct recv_reorder_ctrl *preorder_ctrl = (struct recv_reorder_ctrl *)pcontext; struct adapter *padapter = preorder_ctrl->padapter; struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; @@ -2039,12 +2032,12 @@ void rtw_reordering_ctrl_timeout_handler(void *pcontext) if (padapter->bDriverStopped || padapter->bSurpriseRemoved) return; - _enter_critical_bh(&ppending_recvframe_queue->lock, &irql); + spin_lock(&ppending_recvframe_queue->lock); if (recv_indicatepkts_in_order(padapter, preorder_ctrl, true) == true) _set_timer(&preorder_ctrl->reordering_ctrl_timer, REORDER_WAIT_TIME); - _exit_critical_bh(&ppending_recvframe_queue->lock, &irql); + spin_unlock(&ppending_recvframe_queue->lock); } static int process_recv_indicatepkts(struct adapter *padapter, union recv_frame *prframe) diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c index 6bda2df..0dad6e2 100644 --- a/core/rtw_sta_mgt.c +++ b/core/rtw_sta_mgt.c @@ -191,13 +191,12 @@ _func_exit_; void rtw_mfree_all_stainfo(struct sta_priv *pstapriv); 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(&pstapriv->sta_hash_lock); phead = get_list_head(&pstapriv->free_sta_queue); plist = get_next(phead); @@ -209,7 +208,7 @@ _func_enter_; rtw_mfree_stainfo(psta); } - _exit_critical_bh(&pstapriv->sta_hash_lock, &irql); + spin_unlock(&pstapriv->sta_hash_lock); _func_exit_; } @@ -237,7 +236,6 @@ static void rtw_mfree_sta_priv_lock(struct sta_priv *pstapriv) 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; @@ -246,7 +244,7 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) _func_enter_; if (pstapriv) { /* delete all reordering_ctrl_timer */ - _enter_critical_bh(&pstapriv->sta_hash_lock, &irql); + spin_lock(&pstapriv->sta_hash_lock); for (index = 0; index < NUM_STA; index++) { phead = &(pstapriv->sta_hash[index]); plist = get_next(phead); @@ -262,7 +260,7 @@ _func_enter_; } } } - _exit_critical_bh(&pstapriv->sta_hash_lock, &irql); + spin_unlock(&pstapriv->sta_hash_lock); /*===============================*/ rtw_mfree_sta_priv_lock(pstapriv); @@ -277,7 +275,6 @@ _func_exit_; 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; @@ -290,15 +287,15 @@ _func_enter_; pfree_sta_queue = &pstapriv->free_sta_queue; - _enter_critical_bh(&(pfree_sta_queue->lock), &irql); + spin_lock(&pfree_sta_queue->lock); if (_rtw_queue_empty(pfree_sta_queue) == true) { - _exit_critical_bh(&(pfree_sta_queue->lock), &irql); + spin_unlock(&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); + spin_unlock(&pfree_sta_queue->lock); _rtw_init_stainfo(psta); memcpy(psta->hwaddr, hwaddr, ETH_ALEN); index = wifi_mac_hash(hwaddr); @@ -310,13 +307,13 @@ _func_enter_; } phash_list = &(pstapriv->sta_hash[index]); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irql2); + spin_lock(&pstapriv->sta_hash_lock); rtw_list_insert_tail(&psta->hash_list, phash_list); pstapriv->asoc_sta_count++ ; - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irql2); + spin_unlock(&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. */ @@ -368,7 +365,6 @@ _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; @@ -384,7 +380,7 @@ _func_enter_; pstaxmitpriv = &psta->sta_xmitpriv; - _enter_critical_bh(&pxmitpriv->lock, &irql0); + spin_lock(&pxmitpriv->lock); rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q); psta->sleepq_len = 0; @@ -405,7 +401,7 @@ _func_enter_; rtw_list_delete(&(pstaxmitpriv->be_q.tx_pending)); - _exit_critical_bh(&pxmitpriv->lock, &irql0); + spin_unlock(&pxmitpriv->lock); rtw_list_delete(&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])); @@ -419,7 +415,6 @@ _func_enter_; /* for A-MPDU Rx reordering buffer control, cancel reordering_ctrl_timer */ for (i = 0; i < 16 ; i++) { - unsigned long irql; struct list_head *phead, *plist; union recv_frame *prframe; struct __queue *ppending_recvframe_queue; @@ -431,7 +426,7 @@ _func_enter_; ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; - _enter_critical_bh(&ppending_recvframe_queue->lock, &irql); + spin_lock(&ppending_recvframe_queue->lock); phead = get_list_head(ppending_recvframe_queue); plist = get_next(phead); @@ -446,7 +441,7 @@ _func_enter_; rtw_free_recvframe(prframe, pfree_recv_queue); } - _exit_critical_bh(&ppending_recvframe_queue->lock, &irql); + spin_unlock(&ppending_recvframe_queue->lock); } if (!(psta->state & WIFI_AP_STATE)) @@ -454,12 +449,12 @@ _func_enter_; #ifdef CONFIG_88EU_AP_MODE - _enter_critical_bh(&pstapriv->auth_list_lock, &irql0); + spin_lock(&pstapriv->auth_list_lock); if (!rtw_is_list_empty(&psta->auth_list)) { rtw_list_delete(&psta->auth_list); pstapriv->auth_list_cnt--; } - _exit_critical_bh(&pstapriv->auth_list_lock, &irql0); + spin_unlock(&pstapriv->auth_list_lock); psta->expire_to = 0; @@ -485,9 +480,9 @@ _func_enter_; #endif /* CONFIG_88EU_AP_MODE */ - _enter_critical_bh(&(pfree_sta_queue->lock), &irql0); + spin_lock(&pfree_sta_queue->lock); rtw_list_insert_tail(&psta->list, get_list_head(pfree_sta_queue)); - _exit_critical_bh(&(pfree_sta_queue->lock), &irql0); + spin_unlock(&pfree_sta_queue->lock); exit: @@ -499,7 +494,6 @@ _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; @@ -511,7 +505,7 @@ _func_enter_; if (pstapriv->asoc_sta_count == 1) goto exit; - _enter_critical_bh(&pstapriv->sta_hash_lock, &irql); + spin_lock(&pstapriv->sta_hash_lock); for (index = 0; index < NUM_STA; index++) { phead = &(pstapriv->sta_hash[index]); @@ -527,7 +521,7 @@ _func_enter_; } } - _exit_critical_bh(&pstapriv->sta_hash_lock, &irql); + spin_unlock(&pstapriv->sta_hash_lock); exit: @@ -537,7 +531,6 @@ _func_exit_; /* 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; @@ -556,7 +549,7 @@ _func_enter_; index = wifi_mac_hash(addr); - _enter_critical_bh(&pstapriv->sta_hash_lock, &irql); + spin_lock(&pstapriv->sta_hash_lock); phead = &(pstapriv->sta_hash[index]); plist = get_next(phead); @@ -572,7 +565,7 @@ _func_enter_; plist = get_next(plist); } - _exit_critical_bh(&pstapriv->sta_hash_lock, &irql); + spin_unlock(&pstapriv->sta_hash_lock); _func_exit_; return psta; } @@ -617,7 +610,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,7 +617,7 @@ 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(&pacl_node_q->lock); phead = get_list_head(pacl_node_q); plist = get_next(phead); while ((!rtw_end_of_queue_search(phead, plist))) { @@ -639,7 +631,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) } } } - _exit_critical_bh(&(pacl_node_q->lock), &irql); + spin_unlock(&pacl_node_q->lock); if (pacl_list->mode == 1)/* accept unless in deny list */ res = (match) ? false : true; diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index d318f49..c69cd12 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -1266,14 +1266,14 @@ void rtw_count_tx_stats(struct adapter *padapter, struct xmit_frame *pxmitframe, struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv) { - unsigned long irql; struct xmit_buf *pxmitbuf = NULL; struct list_head *plist, *phead; struct __queue *pfree_queue = &pxmitpriv->free_xmit_extbuf_queue; + unsigned long flags; _func_enter_; - _enter_critical(&pfree_queue->lock, &irql); + spin_lock_irqsave(&pfree_queue->lock, flags); if (_rtw_queue_empty(pfree_queue) == true) { pxmitbuf = NULL; @@ -1299,7 +1299,7 @@ _func_enter_; } } - _exit_critical(&pfree_queue->lock, &irql); + spin_unlock_irqrestore(&pfree_queue->lock, flags); _func_exit_; @@ -1308,22 +1308,22 @@ _func_exit_; s32 rtw_free_xmitbuf_ext(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) { - unsigned long irql; struct __queue *pfree_queue = &pxmitpriv->free_xmit_extbuf_queue; + unsigned long flags; _func_enter_; if (pxmitbuf == NULL) return _FAIL; - _enter_critical(&pfree_queue->lock, &irql); + spin_lock_irqsave(&pfree_queue->lock, flags); rtw_list_delete(&pxmitbuf->list); rtw_list_insert_tail(&(pxmitbuf->list), get_list_head(pfree_queue)); pxmitpriv->free_xmit_extbuf_cnt++; - _exit_critical(&pfree_queue->lock, &irql); + spin_unlock_irqrestore(&pfree_queue->lock, flags); _func_exit_; @@ -1332,16 +1332,16 @@ _func_exit_; struct xmit_buf *rtw_alloc_xmitbuf(struct xmit_priv *pxmitpriv) { - unsigned long irql; struct xmit_buf *pxmitbuf = NULL; struct list_head *plist, *phead; struct __queue *pfree_xmitbuf_queue = &pxmitpriv->free_xmitbuf_queue; + unsigned long flags; _func_enter_; /* DBG_88E("+rtw_alloc_xmitbuf\n"); */ - _enter_critical(&pfree_xmitbuf_queue->lock, &irql); + spin_lock_irqsave(&pfree_xmitbuf_queue->lock, flags); if (_rtw_queue_empty(pfree_xmitbuf_queue) == true) { pxmitbuf = NULL; @@ -1363,7 +1363,7 @@ _func_enter_; rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_ALLOC); } } - _exit_critical(&pfree_xmitbuf_queue->lock, &irql); + spin_unlock_irqrestore(&pfree_xmitbuf_queue->lock, flags); _func_exit_; @@ -1372,8 +1372,8 @@ _func_exit_; s32 rtw_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) { - unsigned long irql; struct __queue *pfree_xmitbuf_queue = &pxmitpriv->free_xmitbuf_queue; + unsigned long flags; _func_enter_; if (pxmitbuf == NULL) @@ -1387,14 +1387,14 @@ _func_enter_; if (pxmitbuf->ext_tag) { rtw_free_xmitbuf_ext(pxmitpriv, pxmitbuf); } else { - _enter_critical(&pfree_xmitbuf_queue->lock, &irql); + spin_lock_irqsave(&pfree_xmitbuf_queue->lock, flags); rtw_list_delete(&pxmitbuf->list); rtw_list_insert_tail(&(pxmitbuf->list), get_list_head(pfree_xmitbuf_queue)); pxmitpriv->free_xmitbuf_cnt++; - _exit_critical(&pfree_xmitbuf_queue->lock, &irql); + spin_unlock_irqrestore(&pfree_xmitbuf_queue->lock, flags); } _func_exit_; @@ -1422,14 +1422,13 @@ struct xmit_frame *rtw_alloc_xmitframe(struct xmit_priv *pxmitpriv)/* _queue *pf pfree_xmit_queue */ - unsigned long irql; struct xmit_frame *pxframe = NULL; struct list_head *plist, *phead; struct __queue *pfree_xmit_queue = &pxmitpriv->free_xmit_queue; _func_enter_; - _enter_critical_bh(&pfree_xmit_queue->lock, &irql); + spin_lock(&pfree_xmit_queue->lock); if (_rtw_queue_empty(pfree_xmit_queue) == true) { RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("rtw_alloc_xmitframe:%d\n", pxmitpriv->free_xmitframe_cnt)); @@ -1464,7 +1463,7 @@ _func_enter_; pxframe->ack_report = 0; } - _exit_critical_bh(&pfree_xmit_queue->lock, &irql); + spin_unlock(&pfree_xmit_queue->lock); _func_exit_; @@ -1473,7 +1472,6 @@ _func_exit_; s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitframe) { - unsigned long irql; struct __queue *pfree_xmit_queue = &pxmitpriv->free_xmit_queue; struct adapter *padapter = pxmitpriv->adapter; struct sk_buff *pndis_pkt = NULL; @@ -1485,7 +1483,7 @@ _func_enter_; goto exit; } - _enter_critical_bh(&pfree_xmit_queue->lock, &irql); + spin_lock(&pfree_xmit_queue->lock); rtw_list_delete(&pxmitframe->list); @@ -1499,7 +1497,7 @@ _func_enter_; pxmitpriv->free_xmitframe_cnt++; RT_TRACE(_module_rtl871x_xmit_c_, _drv_debug_, ("rtw_free_xmitframe():free_xmitframe_cnt=%d\n", pxmitpriv->free_xmitframe_cnt)); - _exit_critical_bh(&pfree_xmit_queue->lock, &irql); + spin_unlock(&pfree_xmit_queue->lock); if (pndis_pkt) rtw_os_pkt_complete(padapter, pndis_pkt); @@ -1513,13 +1511,12 @@ _func_exit_; void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, struct __queue *pframequeue) { - unsigned long irql; struct list_head *plist, *phead; struct xmit_frame *pxmitframe; _func_enter_; - _enter_critical_bh(&(pframequeue->lock), &irql); + spin_lock(&pframequeue->lock); phead = get_list_head(pframequeue); plist = get_next(phead); @@ -1531,7 +1528,7 @@ _func_enter_; rtw_free_xmitframe(pxmitpriv, pxmitframe); } - _exit_critical_bh(&(pframequeue->lock), &irql); + spin_unlock(&pframequeue->lock); _func_exit_; } @@ -1570,7 +1567,6 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv, str struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i, int entry) { - unsigned long irql0; struct list_head *sta_plist, *sta_phead; struct hw_xmit *phwxmit; struct tx_servq *ptxservq = NULL; @@ -1591,7 +1587,7 @@ _func_enter_; inx[j] = pxmitpriv->wmm_para_seq[j]; } - _enter_critical_bh(&pxmitpriv->lock, &irql0); + spin_lock(&pxmitpriv->lock); for (i = 0; i < entry; i++) { phwxmit = phwxmit_i + inx[i]; @@ -1619,7 +1615,7 @@ _func_enter_; } } exit: - _exit_critical_bh(&pxmitpriv->lock, &irql0); + spin_unlock(&pxmitpriv->lock); _func_exit_; return pxmitframe; } @@ -1668,7 +1664,6 @@ _func_exit_; */ s32 rtw_xmit_classifier(struct adapter *padapter, struct xmit_frame *pxmitframe) { - /* unsigned long irql0; */ u8 ac_index; struct sta_info *psta; struct tx_servq *ptxservq; @@ -1754,7 +1749,6 @@ _func_exit_; static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) { struct sk_buff *skb = *pskb; - unsigned long irql; int res, is_vlan_tag = 0, i, do_nat25 = 1; unsigned short vlan_hdr = 0; void *br_port = NULL; @@ -1766,7 +1760,7 @@ static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) br_port = rcu_dereference(padapter->pnetdev->br_port); #endif rcu_read_unlock(); - _enter_critical_bh(&padapter->br_ext_lock, &irql); + spin_lock(&padapter->br_ext_lock); if (!(skb->data[0] & 1) && br_port && memcmp(skb->data+MACADDRLEN, padapter->br_mac, MACADDRLEN) && *((__be16 *)(skb->data+MACADDRLEN*2)) != __constant_htons(ETH_P_8021Q) && @@ -1774,7 +1768,7 @@ static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) !memcmp(padapter->scdb_mac, skb->data+MACADDRLEN, MACADDRLEN) && padapter->scdb_entry) { memcpy(skb->data+MACADDRLEN, GET_MY_HWADDR(padapter), MACADDRLEN); padapter->scdb_entry->ageing_timer = jiffies; - _exit_critical_bh(&padapter->br_ext_lock, &irql); + spin_unlock(&padapter->br_ext_lock); } else { if (*((__be16 *)(skb->data+MACADDRLEN*2)) == __constant_htons(ETH_P_8021Q)) { is_vlan_tag = 1; @@ -1807,7 +1801,7 @@ static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) } } } - _exit_critical_bh(&padapter->br_ext_lock, &irql); + spin_unlock(&padapter->br_ext_lock); if (do_nat25) { if (nat25_db_handle(padapter, skb, NAT25_CHECK) == 0) { struct sk_buff *newskb; @@ -1934,9 +1928,6 @@ static void do_queue_select(struct adapter *padapter, struct pkt_attrib *pattrib */ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt) { -#ifdef CONFIG_88EU_AP_MODE - unsigned long irql0; -#endif struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct xmit_frame *pxmitframe = NULL; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -1980,12 +1971,12 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt) do_queue_select(padapter, &pxmitframe->attrib); #ifdef CONFIG_88EU_AP_MODE - _enter_critical_bh(&pxmitpriv->lock, &irql0); + spin_lock(&pxmitpriv->lock); if (xmitframe_enqueue_for_sleeping_sta(padapter, pxmitframe)) { - _exit_critical_bh(&pxmitpriv->lock, &irql0); + spin_unlock(&pxmitpriv->lock); return 1; } - _exit_critical_bh(&pxmitpriv->lock, &irql0); + spin_unlock(&pxmitpriv->lock); #endif if (rtw_hal_xmit(padapter, pxmitframe) == false) @@ -1998,7 +1989,6 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt) int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_frame *pxmitframe) { - unsigned long irql; int ret = false; struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; @@ -2024,7 +2014,7 @@ int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fra } if (bmcst) { - _enter_critical_bh(&psta->sleep_q.lock, &irql); + spin_lock(&psta->sleep_q.lock); if (pstapriv->sta_dz_bitmap) {/* if any one sta is in ps mode */ rtw_list_delete(&pxmitframe->list); @@ -2041,12 +2031,12 @@ int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fra ret = true; } - _exit_critical_bh(&psta->sleep_q.lock, &irql); + spin_unlock(&psta->sleep_q.lock); return ret; } - _enter_critical_bh(&psta->sleep_q.lock, &irql); + spin_lock(&psta->sleep_q.lock); if (psta->state&WIFI_SLEEP_STATE) { u8 wmmps_ac = 0; @@ -2094,7 +2084,7 @@ int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fra } } - _exit_critical_bh(&psta->sleep_q.lock, &irql); + spin_unlock(&psta->sleep_q.lock); return ret; } @@ -2129,7 +2119,6 @@ static void dequeue_xmitframes_to_sleeping_queue(struct adapter *padapter, struc void stop_sta_xmit(struct adapter *padapter, struct sta_info *psta) { - unsigned long irql0; struct sta_info *psta_bmc; struct sta_xmit_priv *pstaxmitpriv; struct sta_priv *pstapriv = &padapter->stapriv; @@ -2140,7 +2129,7 @@ void stop_sta_xmit(struct adapter *padapter, struct sta_info *psta) /* for BC/MC Frames */ psta_bmc = rtw_get_bcmc_stainfo(padapter); - _enter_critical_bh(&pxmitpriv->lock, &irql0); + spin_lock(&pxmitpriv->lock); psta->state |= WIFI_SLEEP_STATE; @@ -2163,19 +2152,18 @@ void stop_sta_xmit(struct adapter *padapter, struct sta_info *psta) dequeue_xmitframes_to_sleeping_queue(padapter, psta_bmc, &pstaxmitpriv->be_q.sta_pending); rtw_list_delete(&(pstaxmitpriv->be_q.tx_pending)); - _exit_critical_bh(&pxmitpriv->lock, &irql0); + spin_unlock(&pxmitpriv->lock); } void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) { - unsigned long irql; u8 update_mask = 0, wmmps_ac = 0; struct sta_info *psta_bmc; struct list_head *xmitframe_plist, *xmitframe_phead; struct xmit_frame *pxmitframe = NULL; struct sta_priv *pstapriv = &padapter->stapriv; - _enter_critical_bh(&psta->sleep_q.lock, &irql); + spin_lock(&psta->sleep_q.lock); xmitframe_phead = get_list_head(&psta->sleep_q); xmitframe_plist = get_next(xmitframe_phead); @@ -2226,10 +2214,10 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) pxmitframe->attrib.triggered = 1; - _exit_critical_bh(&psta->sleep_q.lock, &irql); + spin_unlock(&psta->sleep_q.lock); if (rtw_hal_xmit(padapter, pxmitframe)) rtw_os_xmit_complete(padapter, pxmitframe); - _enter_critical_bh(&psta->sleep_q.lock, &irql); + spin_lock(&psta->sleep_q.lock); } if (psta->sleepq_len == 0) { @@ -2248,7 +2236,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) pstapriv->sta_dz_bitmap &= ~BIT(psta->aid); } - _exit_critical_bh(&psta->sleep_q.lock, &irql); + spin_unlock(&psta->sleep_q.lock); /* for BC/MC Frames */ psta_bmc = rtw_get_bcmc_stainfo(padapter); @@ -2256,7 +2244,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) return; if ((pstapriv->sta_dz_bitmap&0xfffe) == 0x0) { /* no any sta in ps mode */ - _enter_critical_bh(&psta_bmc->sleep_q.lock, &irql); + spin_lock(&psta_bmc->sleep_q.lock); xmitframe_phead = get_list_head(&psta_bmc->sleep_q); xmitframe_plist = get_next(xmitframe_phead); @@ -2276,10 +2264,10 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) pxmitframe->attrib.triggered = 1; - _exit_critical_bh(&psta_bmc->sleep_q.lock, &irql); + spin_unlock(&psta_bmc->sleep_q.lock); if (rtw_hal_xmit(padapter, pxmitframe)) rtw_os_xmit_complete(padapter, pxmitframe); - _enter_critical_bh(&psta_bmc->sleep_q.lock, &irql); + spin_lock(&psta_bmc->sleep_q.lock); } if (psta_bmc->sleepq_len == 0) { @@ -2289,7 +2277,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) update_mask |= BIT(1); } - _exit_critical_bh(&psta_bmc->sleep_q.lock, &irql); + spin_unlock(&psta_bmc->sleep_q.lock); } if (update_mask) @@ -2298,13 +2286,12 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *psta) { - unsigned long irql; u8 wmmps_ac = 0; struct list_head *xmitframe_plist, *xmitframe_phead; struct xmit_frame *pxmitframe = NULL; struct sta_priv *pstapriv = &padapter->stapriv; - _enter_critical_bh(&psta->sleep_q.lock, &irql); + spin_lock(&psta->sleep_q.lock); xmitframe_phead = get_list_head(&psta->sleep_q); xmitframe_plist = get_next(xmitframe_phead); @@ -2363,7 +2350,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst } } - _exit_critical_bh(&psta->sleep_q.lock, &irql); + spin_unlock(&psta->sleep_q.lock); } #endif diff --git a/hal/rtl8188eu_xmit.c b/hal/rtl8188eu_xmit.c index 8f43f49..aaf0391 100644 --- a/hal/rtl8188eu_xmit.c +++ b/hal/rtl8188eu_xmit.c @@ -444,8 +444,6 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitp struct hw_xmit *phwxmit; struct sta_info *psta = NULL; struct tx_servq *ptxservq = NULL; - - unsigned long irql; struct list_head *xmitframe_plist = NULL, *xmitframe_phead = NULL; u32 pbuf; /* next pkt address */ @@ -535,7 +533,7 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitp phwxmit = pxmitpriv->hwxmits + 2; break; } - _enter_critical_bh(&pxmitpriv->lock, &irql); + spin_lock(&pxmitpriv->lock); xmitframe_phead = get_list_head(&ptxservq->sta_pending); xmitframe_plist = get_next(xmitframe_phead); @@ -591,7 +589,7 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitp if (_rtw_queue_empty(&ptxservq->sta_pending) == true) rtw_list_delete(&ptxservq->tx_pending); - _exit_critical_bh(&pxmitpriv->lock, &irql); + spin_unlock(&pxmitpriv->lock); if ((pfirstframe->attrib.ether_type != 0x0806) && (pfirstframe->attrib.ether_type != 0x888e) && (pfirstframe->attrib.ether_type != 0x88b4) && @@ -641,14 +639,13 @@ static s32 xmitframe_direct(struct adapter *adapt, struct xmit_frame *pxmitframe */ static s32 pre_xmitframe(struct adapter *adapt, struct xmit_frame *pxmitframe) { - unsigned long irql; s32 res; struct xmit_buf *pxmitbuf = NULL; struct xmit_priv *pxmitpriv = &adapt->xmitpriv; struct pkt_attrib *pattrib = &pxmitframe->attrib; struct mlme_priv *pmlmepriv = &adapt->mlmepriv; - _enter_critical_bh(&pxmitpriv->lock, &irql); + spin_lock(&pxmitpriv->lock); if (rtw_txframes_sta_ac_pending(adapt, pattrib) > 0) goto enqueue; @@ -660,7 +657,7 @@ static s32 pre_xmitframe(struct adapter *adapt, struct xmit_frame *pxmitframe) if (pxmitbuf == NULL) goto enqueue; - _exit_critical_bh(&pxmitpriv->lock, &irql); + spin_unlock(&pxmitpriv->lock); pxmitframe->pxmitbuf = pxmitbuf; pxmitframe->buf_addr = pxmitbuf->pbuf; @@ -675,7 +672,7 @@ static s32 pre_xmitframe(struct adapter *adapt, struct xmit_frame *pxmitframe) enqueue: res = rtw_xmitframe_enqueue(adapt, pxmitframe); - _exit_critical_bh(&pxmitpriv->lock, &irql); + spin_unlock(&pxmitpriv->lock); if (res != _SUCCESS) { RT_TRACE(_module_xmit_osdep_c_, _drv_err_, ("pre_xmitframe: enqueue xmitframe fail\n")); diff --git a/include/osdep_service.h b/include/osdep_service.h index a9b14d4..46d6782 100644 --- a/include/osdep_service.h +++ b/include/osdep_service.h @@ -80,36 +80,6 @@ static inline struct list_head *get_list_head(struct __queue *queue) ((type *)((char *)(ptr)-(size_t)(&((type *)0)->member))) -static inline void _enter_critical(spinlock_t *plock, unsigned long *pirqL) -{ - spin_lock_irqsave(plock, *pirqL); -} - -static inline void _exit_critical(spinlock_t *plock, unsigned long *pirqL) -{ - spin_unlock_irqrestore(plock, *pirqL); -} - -static inline void _enter_critical_ex(spinlock_t *plock, unsigned long *pirqL) -{ - spin_lock_irqsave(plock, *pirqL); -} - -static inline void _exit_critical_ex(spinlock_t *plock, unsigned long *pirqL) -{ - spin_unlock_irqrestore(plock, *pirqL); -} - -static inline void _enter_critical_bh(spinlock_t *plock, unsigned long *pirqL) -{ - spin_lock_bh(plock); -} - -static inline void _exit_critical_bh(spinlock_t *plock, unsigned long *pirqL) -{ - spin_unlock_bh(plock); -} - static inline int _enter_critical_mutex(struct mutex *pmutex, unsigned long *pirqL) { int ret; diff --git a/include/rtw_mlme.h b/include/rtw_mlme.h index 73c249b..4d0d6bf 100644 --- a/include/rtw_mlme.h +++ b/include/rtw_mlme.h @@ -527,48 +527,38 @@ static inline void _clr_fwstate_(struct mlme_priv *pmlmepriv, int state) */ static inline void clr_fwstate(struct mlme_priv *pmlmepriv, int state) { - unsigned long irql; - - _enter_critical_bh(&pmlmepriv->lock, &irql); + spin_lock(&pmlmepriv->lock); if (check_fwstate(pmlmepriv, state) == true) pmlmepriv->fw_state ^= state; - _exit_critical_bh(&pmlmepriv->lock, &irql); + spin_unlock(&pmlmepriv->lock); } static inline void clr_fwstate_ex(struct mlme_priv *pmlmepriv, int state) { - unsigned long irql; - - _enter_critical_bh(&pmlmepriv->lock, &irql); + spin_lock(&pmlmepriv->lock); _clr_fwstate_(pmlmepriv, state); - _exit_critical_bh(&pmlmepriv->lock, &irql); + spin_unlock(&pmlmepriv->lock); } static inline void up_scanned_network(struct mlme_priv *pmlmepriv) { - unsigned long irql; - - _enter_critical_bh(&pmlmepriv->lock, &irql); + spin_lock(&pmlmepriv->lock); pmlmepriv->num_of_scanned++; - _exit_critical_bh(&pmlmepriv->lock, &irql); + spin_unlock(&pmlmepriv->lock); } static inline void down_scanned_network(struct mlme_priv *pmlmepriv) { - unsigned long irql; - - _enter_critical_bh(&pmlmepriv->lock, &irql); + spin_lock(&pmlmepriv->lock); pmlmepriv->num_of_scanned--; - _exit_critical_bh(&pmlmepriv->lock, &irql); + spin_unlock(&pmlmepriv->lock); } static inline void set_scanned_network_val(struct mlme_priv *pmlmepriv, int val) { - unsigned long irql; - - _enter_critical_bh(&pmlmepriv->lock, &irql); + spin_lock(&pmlmepriv->lock); pmlmepriv->num_of_scanned = val; - _exit_critical_bh(&pmlmepriv->lock, &irql); + spin_unlock(&pmlmepriv->lock); } u16 rtw_get_capability(struct wlan_bssid_ex *bss); diff --git a/os_dep/ioctl_linux.c b/os_dep/ioctl_linux.c index eb05efb..b09ed28 100644 --- a/os_dep/ioctl_linux.c +++ b/os_dep/ioctl_linux.c @@ -1108,7 +1108,6 @@ static int rtw_wx_set_wap(struct net_device *dev, union iwreq_data *awrq, char *extra) { - unsigned long irqL; uint ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct sockaddr *temp = (struct sockaddr *)awrq; @@ -1137,7 +1136,7 @@ static int rtw_wx_set_wap(struct net_device *dev, } authmode = padapter->securitypriv.ndisauthtype; - _enter_critical_bh(&queue->lock, &irqL); + spin_lock(&queue->lock); phead = get_list_head(queue); pmlmepriv->pscanned = get_next(phead); @@ -1156,14 +1155,14 @@ static int rtw_wx_set_wap(struct net_device *dev, if ((!memcmp(dst_bssid, src_bssid, ETH_ALEN))) { if (!rtw_set_802_11_infrastructure_mode(padapter, pnetwork->network.InfrastructureMode)) { ret = -1; - _exit_critical_bh(&queue->lock, &irqL); + spin_unlock(&queue->lock); goto exit; } break; } } - _exit_critical_bh(&queue->lock, &irqL); + spin_unlock(&queue->lock); rtw_set_802_11_authentication_mode(padapter, authmode); /* set_802_11_encryption_mode(padapter, padapter->securitypriv.ndisencryptstatus); */ @@ -1248,7 +1247,6 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct ndis_802_11_ssid ssid[RTW_SSID_SCAN_AMOUNT]; - unsigned long irqL; #ifdef CONFIG_88EU_P2P struct wifidirect_info *pwdinfo = &(padapter->wdinfo); #endif /* CONFIG_88EU_P2P */ @@ -1321,11 +1319,11 @@ _func_enter_; DBG_88E("IW_SCAN_THIS_ESSID, ssid =%s, len =%d\n", req->essid, req->essid_len); - _enter_critical_bh(&pmlmepriv->lock, &irqL); + spin_lock(&pmlmepriv->lock); _status = rtw_sitesurvey_cmd(padapter, ssid, 1, NULL, 0); - _exit_critical_bh(&pmlmepriv->lock, &irqL); + spin_unlock(&pmlmepriv->lock); } else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { DBG_88E("rtw_wx_set_scan, req->scan_type == IW_SCAN_TYPE_PASSIVE\n"); } @@ -1392,7 +1390,6 @@ _func_exit_; static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra) { - unsigned long irqL; struct list_head *plist, *phead; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -1440,7 +1437,7 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, break; } - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_lock(&pmlmepriv->scanned_queue.lock); phead = get_list_head(queue); plist = get_next(phead); @@ -1463,7 +1460,7 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, plist = get_next(plist); } - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_unlock(&pmlmepriv->scanned_queue.lock); wrqu->data.length = ev-extra; wrqu->data.flags = 0; @@ -1482,7 +1479,6 @@ static int rtw_wx_set_essid(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra) { - unsigned long irqL; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct __queue *queue = &pmlmepriv->scanned_queue; @@ -1532,7 +1528,7 @@ static int rtw_wx_set_essid(struct net_device *dev, src_ssid = ndis_ssid.Ssid; RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, ("rtw_wx_set_essid: ssid =[%s]\n", src_ssid)); - _enter_critical_bh(&queue->lock, &irqL); + spin_lock(&queue->lock); phead = get_list_head(queue); pmlmepriv->pscanned = get_next(phead); @@ -1566,14 +1562,14 @@ static int rtw_wx_set_essid(struct net_device *dev, if (!rtw_set_802_11_infrastructure_mode(padapter, pnetwork->network.InfrastructureMode)) { ret = -1; - _exit_critical_bh(&queue->lock, &irqL); + spin_unlock(&queue->lock); goto exit; } break; } } - _exit_critical_bh(&queue->lock, &irqL); + spin_unlock(&queue->lock); RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, ("set ssid: set_802_11_auth. mode =%d\n", authmode)); rtw_set_802_11_authentication_mode(padapter, authmode); @@ -2574,7 +2570,6 @@ static int rtw_get_ap_info(struct net_device *dev, { int ret = 0; u32 cnt = 0, wpa_ielen; - unsigned long irqL; struct list_head *plist, *phead; unsigned char *pbuf; u8 bssid[ETH_ALEN]; @@ -2609,7 +2604,7 @@ static int rtw_get_ap_info(struct net_device *dev, goto exit; } - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_lock(&pmlmepriv->scanned_queue.lock); phead = get_list_head(queue); plist = get_next(phead); @@ -2622,7 +2617,7 @@ static int rtw_get_ap_info(struct net_device *dev, if (hwaddr_aton_i(data, bssid)) { DBG_88E("Invalid BSSID '%s'.\n", (u8 *)data); - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_unlock(&pmlmepriv->scanned_queue.lock); return -EINVAL; } @@ -2646,7 +2641,7 @@ static int rtw_get_ap_info(struct net_device *dev, plist = get_next(plist); } - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_unlock(&pmlmepriv->scanned_queue.lock); if (pdata->length >= 34) { if (copy_to_user(pdata->pointer+32, (u8 *)&pdata->flags, 1)) { @@ -3091,7 +3086,6 @@ static int rtw_p2p_get_wps_configmethod(struct net_device *dev, int jj, kk; u8 peerMACStr[17] = {0x00}; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - unsigned long irqL; struct list_head *plist, *phead; struct __queue *queue = &(pmlmepriv->scanned_queue); struct wlan_network *pnetwork = NULL; @@ -3113,7 +3107,7 @@ static int rtw_p2p_get_wps_configmethod(struct net_device *dev, for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) peerMAC[jj] = key_2char2num(peerMACStr[kk], peerMACStr[kk + 1]); - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_lock(&pmlmepriv->scanned_queue.lock); phead = get_list_head(queue); plist = get_next(phead); @@ -3143,7 +3137,7 @@ static int rtw_p2p_get_wps_configmethod(struct net_device *dev, plist = get_next(plist); } - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_unlock(&pmlmepriv->scanned_queue.lock); if (!blnMatch) sprintf(attr_content_str, "\n\nM = 0000"); @@ -3163,7 +3157,6 @@ static int rtw_p2p_get_go_device_address(struct net_device *dev, int jj, kk; u8 peerMACStr[17] = {0x00}; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - unsigned long irqL; struct list_head *plist, *phead; struct __queue *queue = &(pmlmepriv->scanned_queue); struct wlan_network *pnetwork = NULL; @@ -3186,7 +3179,7 @@ static int rtw_p2p_get_go_device_address(struct net_device *dev, for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) peerMAC[jj] = key_2char2num(peerMACStr[kk], peerMACStr[kk + 1]); - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_lock(&pmlmepriv->scanned_queue.lock); phead = get_list_head(queue); plist = get_next(phead); @@ -3227,7 +3220,7 @@ static int rtw_p2p_get_go_device_address(struct net_device *dev, plist = get_next(plist); } - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_unlock(&pmlmepriv->scanned_queue.lock); if (!blnMatch) sprintf(go_devadd_str, "\n\ndev_add = NULL"); @@ -3250,7 +3243,6 @@ static int rtw_p2p_get_device_type(struct net_device *dev, int jj, kk; u8 peerMACStr[17] = {0x00}; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - unsigned long irqL; struct list_head *plist, *phead; struct __queue *queue = &(pmlmepriv->scanned_queue); struct wlan_network *pnetwork = NULL; @@ -3271,7 +3263,7 @@ static int rtw_p2p_get_device_type(struct net_device *dev, for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) peerMAC[jj] = key_2char2num(peerMACStr[kk], peerMACStr[kk + 1]); - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_lock(&pmlmepriv->scanned_queue.lock); phead = get_list_head(queue); plist = get_next(phead); @@ -3308,7 +3300,7 @@ static int rtw_p2p_get_device_type(struct net_device *dev, plist = get_next(plist); } - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_unlock(&pmlmepriv->scanned_queue.lock); if (!blnMatch) sprintf(dev_type_str, "\n\nN = 00"); @@ -3330,7 +3322,6 @@ static int rtw_p2p_get_device_name(struct net_device *dev, int jj, kk; u8 peerMACStr[17] = {0x00}; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - unsigned long irqL; struct list_head *plist, *phead; struct __queue *queue = &(pmlmepriv->scanned_queue); struct wlan_network *pnetwork = NULL; @@ -3351,7 +3342,7 @@ static int rtw_p2p_get_device_name(struct net_device *dev, for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) peerMAC[jj] = key_2char2num(peerMACStr[kk], peerMACStr[kk + 1]); - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_lock(&pmlmepriv->scanned_queue.lock); phead = get_list_head(queue); plist = get_next(phead); @@ -3380,7 +3371,7 @@ static int rtw_p2p_get_device_name(struct net_device *dev, plist = get_next(plist); } - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_unlock(&pmlmepriv->scanned_queue.lock); if (!blnMatch) sprintf(dev_name_str, "\n\nN = 0000"); @@ -3400,7 +3391,6 @@ static int rtw_p2p_get_invitation_procedure(struct net_device *dev, int jj, kk; u8 peerMACStr[17] = {0x00}; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - unsigned long irqL; struct list_head *plist, *phead; struct __queue *queue = &(pmlmepriv->scanned_queue); struct wlan_network *pnetwork = NULL; @@ -3423,7 +3413,7 @@ static int rtw_p2p_get_invitation_procedure(struct net_device *dev, for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) peerMAC[jj] = key_2char2num(peerMACStr[kk], peerMACStr[kk + 1]); - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_lock(&pmlmepriv->scanned_queue.lock); phead = get_list_head(queue); plist = get_next(phead); @@ -3455,7 +3445,7 @@ static int rtw_p2p_get_invitation_procedure(struct net_device *dev, plist = get_next(plist); } - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_unlock(&pmlmepriv->scanned_queue.lock); if (!blnMatch) { sprintf(inv_proc_str, "\nIP =-1"); @@ -3480,7 +3470,6 @@ static int rtw_p2p_connect(struct net_device *dev, u8 peerMAC[ETH_ALEN] = {0x00}; int jj, kk; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - unsigned long irqL; struct list_head *plist, *phead; struct __queue *queue = &(pmlmepriv->scanned_queue); struct wlan_network *pnetwork = NULL; @@ -3506,7 +3495,7 @@ static int rtw_p2p_connect(struct net_device *dev, for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) peerMAC[jj] = key_2char2num(extra[kk], extra[kk + 1]); - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_lock(&pmlmepriv->scanned_queue.lock); phead = get_list_head(queue); plist = get_next(phead); @@ -3524,7 +3513,7 @@ static int rtw_p2p_connect(struct net_device *dev, plist = get_next(plist); } - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_unlock(&pmlmepriv->scanned_queue.lock); if (uintPeerChannel) { _rtw_memset(&pwdinfo->nego_req_info, 0x00, sizeof(struct tx_nego_req_info)); @@ -3569,7 +3558,6 @@ static int rtw_p2p_invite_req(struct net_device *dev, u8 attr_content[50] = {0x00}; u8 *p2pie; uint p2pielen = 0, attr_contentlen = 0; - unsigned long irqL; struct tx_invite_req_info *pinvite_req_info = &pwdinfo->invitereq_info; /* The input data contains two informations. */ @@ -3602,7 +3590,7 @@ static int rtw_p2p_invite_req(struct net_device *dev, for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) pinvite_req_info->peer_macaddr[jj] = key_2char2num(extra[kk], extra[kk + 1]); - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_lock(&pmlmepriv->scanned_queue.lock); phead = get_list_head(queue); plist = get_next(phead); @@ -3639,7 +3627,7 @@ static int rtw_p2p_invite_req(struct net_device *dev, plist = get_next(plist); } - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_unlock(&pmlmepriv->scanned_queue.lock); if (uintPeerChannel) { /* Store the GO's bssid */ @@ -3712,7 +3700,6 @@ static int rtw_p2p_prov_disc(struct net_device *dev, u8 attr_content[100] = {0x00}; u8 *p2pie; uint p2pielen = 0, attr_contentlen = 0; - unsigned long irqL; /* The input data contains two informations. */ /* 1. First information is the MAC address which wants to issue the provisioning discovery request frame. */ @@ -3753,7 +3740,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev, return ret; } - _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_lock(&pmlmepriv->scanned_queue.lock); phead = get_list_head(queue); plist = get_next(phead); @@ -3799,7 +3786,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev, plist = get_next(plist); } - _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); + spin_unlock(&pmlmepriv->scanned_queue.lock); if (uintPeerChannel) { DBG_88E("[%s] peer channel: %d!\n", __func__, uintPeerChannel); @@ -4132,7 +4119,6 @@ static int rtw_dbg_port(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - unsigned long irqL; int ret = 0; u8 major_cmd, minor_cmd; u16 arg; @@ -4448,7 +4434,7 @@ static int rtw_dbg_port(struct net_device *dev, #ifdef CONFIG_88EU_AP_MODE DBG_88E("sta_dz_bitmap = 0x%x, tim_bitmap = 0x%x\n", pstapriv->sta_dz_bitmap, pstapriv->tim_bitmap); #endif - _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); + spin_lock(&pstapriv->sta_hash_lock); for (i = 0; i < NUM_STA; i++) { phead = &(pstapriv->sta_hash[i]); @@ -4486,7 +4472,7 @@ static int rtw_dbg_port(struct net_device *dev, } } } - _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); + spin_unlock(&pstapriv->sta_hash_lock); } break; case 0x0c:/* dump rx/tx packet */ @@ -5251,7 +5237,6 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) static int rtw_del_sta(struct net_device *dev, struct ieee_param *param) { - unsigned long irqL; int ret = 0; struct sta_info *psta = NULL; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); @@ -5271,13 +5256,13 @@ static int rtw_del_sta(struct net_device *dev, struct ieee_param *param) psta = rtw_get_stainfo(pstapriv, param->sta_addr); if (psta) { - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + spin_lock(&pstapriv->asoc_list_lock); if (!rtw_is_list_empty(&psta->asoc_list)) { rtw_list_delete(&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(&pstapriv->asoc_list_lock); associated_clients_update(padapter, updated); psta = NULL; } else { diff --git a/os_dep/os_intfs.c b/os_dep/os_intfs.c index 59f10e7..3518046 100644 --- a/os_dep/os_intfs.c +++ b/os_dep/os_intfs.c @@ -866,6 +866,7 @@ u8 rtw_reset_drv_sw(struct adapter *padapter) u8 rtw_init_drv_sw(struct adapter *padapter) { u8 ret8 = _SUCCESS; + unsigned long flags; _func_enter_; diff --git a/os_dep/usb_ops_linux.c b/os_dep/usb_ops_linux.c index 4c71e3b..93fc5ee 100644 --- a/os_dep/usb_ops_linux.c +++ b/os_dep/usb_ops_linux.c @@ -186,7 +186,7 @@ _func_enter_; goto exit; } - _enter_critical(&pxmitpriv->lock, &irqL); + spin_lock_irqsave(&pxmitpriv->lock, irqL); switch (addr) { case VO_QUEUE_INX: @@ -213,7 +213,7 @@ _func_enter_; break; } - _exit_critical(&pxmitpriv->lock, &irqL); + spin_unlock_irqrestore(&pxmitpriv->lock, irqL); purb = pxmitbuf->pxmit_urb[0]; diff --git a/os_dep/xmit_linux.c b/os_dep/xmit_linux.c index 2e586c0..432e5f8 100644 --- a/os_dep/xmit_linux.c +++ b/os_dep/xmit_linux.c @@ -156,7 +156,6 @@ void rtw_os_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe) void rtw_os_xmit_schedule(struct adapter *padapter) { - unsigned long irql; struct xmit_priv *pxmitpriv; if (!padapter) @@ -164,12 +163,12 @@ void rtw_os_xmit_schedule(struct adapter *padapter) pxmitpriv = &padapter->xmitpriv; - _enter_critical_bh(&pxmitpriv->lock, &irql); + spin_lock(&pxmitpriv->lock); if (rtw_txframes_pending(padapter)) tasklet_hi_schedule(&pxmitpriv->xmit_tasklet); - _exit_critical_bh(&pxmitpriv->lock, &irql); + spin_unlock(&pxmitpriv->lock); } static void rtw_check_xmit_resource(struct adapter *padapter, struct sk_buff *pkt) @@ -194,13 +193,12 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb) { struct sta_priv *pstapriv = &padapter->stapriv; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - unsigned long irql; struct list_head *phead, *plist; struct sk_buff *newskb; struct sta_info *psta = NULL; s32 res; - _enter_critical_bh(&pstapriv->asoc_list_lock, &irql); + spin_lock(&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list; plist = get_next(phead); @@ -230,12 +228,12 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb) DBG_88E("%s-%d: skb_copy() failed!\n", __func__, __LINE__); pxmitpriv->tx_drop++; - _exit_critical_bh(&pstapriv->asoc_list_lock, &irql); + spin_unlock(&pstapriv->asoc_list_lock); return false; /* Caller shall tx this multicast frame via normal way. */ } } - _exit_critical_bh(&pstapriv->asoc_list_lock, &irql); + spin_unlock(&pstapriv->asoc_list_lock); dev_kfree_skb_any(skb); return true; }