OSDN Git Service

Remove more duplicated ieee80211 definitions
[android-x86/external-modules-rtl8723au.git] / os_dep / ioctl_cfg80211.c
index 267cbbf..148b1e7 100644 (file)
@@ -24,7 +24,6 @@
 #include <drv_types.h>
 #include <rtw_ioctl.h>
 #include <rtw_ioctl_set.h>
-#include <rtw_ioctl_query.h>
 #include <xmit_osdep.h>
 
 #ifdef CONFIG_IOCTL_CFG80211
@@ -661,7 +660,7 @@ static int set_group_key(_adapter *padapter, u8 *key, u8 alg, int keyid)
                goto exit;
        }
 
-       _rtw_memset(psetkeyparm, 0, sizeof(struct setkey_parm));
+       memset(psetkeyparm, 0, sizeof(struct setkey_parm));
 
        psetkeyparm->keyid=(u8)keyid;
        if (is_wep_enc(alg))
@@ -1207,8 +1206,8 @@ _func_enter_;
                if(param->u.crypt.set_tx == 1)
                {
                        list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
-                               if(_rtw_memcmp(pWapiSta->PeerMacAddr,param->sta_addr,6))
-                               {
+                               if (!memcmp(pWapiSta->PeerMacAddr,
+                                           param->sta_addr, 6)) {
                                        memcpy(pWapiSta->lastTxUnicastPN,WapiASUEPNInitialValueSrc,16);
 
                                        pWapiSta->wapiUsk.bSet = true;
@@ -1236,8 +1235,8 @@ _func_enter_;
                else
                {
                        list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
-                               if(_rtw_memcmp(pWapiSta->PeerMacAddr,get_bssid(pmlmepriv),6))
-                               {
+                               if (!memcmp(pWapiSta->PeerMacAddr,
+                                           get_bssid(pmlmepriv), 6)) {
                                        pWapiSta->wapiMsk.bSet = true;
                                        memcpy(pWapiSta->wapiMsk.dataKey,param->u.crypt.key,16);
                                        memcpy(pWapiSta->wapiMsk.micKey,param->u.crypt.key+16,16);
@@ -1301,10 +1300,10 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
        if (param == NULL)
                return -1;
 
-       _rtw_memset(param, 0, param_len);
+       memset(param, 0, param_len);
 
        param->cmd = IEEE_CMD_SET_ENCRYPTION;
-       _rtw_memset(param->sta_addr, 0xff, ETH_ALEN);
+       memset(param->sta_addr, 0xff, ETH_ALEN);
 
        switch (params->cipher) {
        case IW_AUTH_CIPHER_NONE:
@@ -1529,7 +1528,7 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy,
        {
                struct wlan_network  *cur_network = &(pmlmepriv->cur_network);
 
-               if (_rtw_memcmp(mac, cur_network->network.MacAddress, ETH_ALEN) == _FALSE) {
+               if (memcmp(mac, cur_network->network.MacAddress, ETH_ALEN)) {
                        DBG_8723A("%s, mismatch bssid="MAC_FMT"\n", __func__, MAC_ARG(cur_network->network.MacAddress));
                        ret = -ENOENT;
                        goto exit;
@@ -1697,7 +1696,7 @@ void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv, bool abor
 {
        _irqL   irqL;
 
-       _enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
+       spin_lock_bh(&pwdev_priv->scan_req_lock);
        if(pwdev_priv->scan_request != NULL)
        {
                //struct cfg80211_scan_request *scan_request = pwdev_priv->scan_request;
@@ -1724,7 +1723,7 @@ void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv, bool abor
                DBG_8723A("%s without scan req\n", __FUNCTION__);
                #endif
        }
-       _exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
+       spin_unlock_bh(&pwdev_priv->scan_req_lock);
 }
 
 void rtw_cfg80211_surveydone_event_callback(_adapter *padapter)
@@ -1736,7 +1735,7 @@ void rtw_cfg80211_surveydone_event_callback(_adapter *padapter)
        struct  wlan_network    *pnetwork = NULL;
        u32 cnt=0;
        u32 wait_for_surveydone;
-       sint wait_status;
+       int wait_status;
 #ifdef CONFIG_P2P
        struct  wifidirect_info*        pwdinfo = &padapter->wdinfo;
 #endif //CONFIG_P2P
@@ -1747,7 +1746,7 @@ void rtw_cfg80211_surveydone_event_callback(_adapter *padapter)
        DBG_8723A("%s\n", __func__);
 #endif
 
-       _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
+       spin_lock_bh(&(pmlmepriv->scanned_queue.lock));
 
        phead = get_list_head(queue);
        plist = get_next(phead);
@@ -1774,7 +1773,7 @@ void rtw_cfg80211_surveydone_event_callback(_adapter *padapter)
 
        }
 
-       _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
+       spin_unlock_bh(&(pmlmepriv->scanned_queue.lock));
 
        //call this after other things have been done
        rtw_cfg80211_indicate_scan_done(wdev_to_priv(padapter->rtw_wdev), _FALSE);
@@ -1929,9 +1928,9 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
        }
 #endif //CONFIG_CONCURRENT_MODE
 
-       _enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
+       spin_lock_bh(&pwdev_priv->scan_req_lock);
        pwdev_priv->scan_request = request;
-       _exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
+       spin_unlock_bh(&pwdev_priv->scan_req_lock);
 
        if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
        {
@@ -1949,11 +1948,9 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
        }
 
        #ifdef CONFIG_P2P
-       if(ssids->ssid != NULL
-               && _rtw_memcmp(ssids->ssid, "DIRECT-", 7)
-               && rtw_get_p2p_ie((u8 *)request->ie, request->ie_len, NULL, NULL)
-       )
-       {
+       if (ssids->ssid != NULL &&
+           !memcmp(ssids->ssid, "DIRECT-", 7) &&
+           rtw_get_p2p_ie((u8 *)request->ie, request->ie_len, NULL, NULL)) {
                if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
                {
                        rtw_p2p_enable(padapter, P2P_ROLE_DEVICE);
@@ -2044,7 +2041,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
 #endif //CONFIG_P2P
 
 
-       _rtw_memset(ssid, 0, sizeof(NDIS_802_11_SSID)*RTW_SSID_SCAN_AMOUNT);
+       memset(ssid, 0, sizeof(NDIS_802_11_SSID)*RTW_SSID_SCAN_AMOUNT);
        //parsing request ssids, n_ssids
        for (i = 0; i < request->n_ssids && i < RTW_SSID_SCAN_AMOUNT; i++) {
                #ifdef CONFIG_DEBUG_CFG80211
@@ -2056,7 +2053,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
 
 
        /* parsing channels, n_channels */
-       _rtw_memset(ch, 0, sizeof(struct rtw_ieee80211_channel)*RTW_CHANNEL_SCAN_AMOUNT);
+       memset(ch, 0, sizeof(struct rtw_ieee80211_channel)*RTW_CHANNEL_SCAN_AMOUNT);
        if (request->n_channels == 1)
        for (i=0;i<request->n_channels && i<RTW_CHANNEL_SCAN_AMOUNT;i++) {
                #ifdef CONFIG_DEBUG_CFG80211
@@ -2066,7 +2063,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
                ch[i].flags = request->channels[i]->flags;
        }
 
-       _enter_critical_bh(&pmlmepriv->lock, &irqL);
+       spin_lock_bh(&pmlmepriv->lock);
        if (request->n_channels == 1) {
                memcpy(&ch[1], &ch[0], sizeof(struct rtw_ieee80211_channel));
                memcpy(&ch[2], &ch[0], sizeof(struct rtw_ieee80211_channel));
@@ -2074,7 +2071,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
        } else {
                _status = rtw_sitesurvey_cmd(padapter, ssid, RTW_SSID_SCAN_AMOUNT, NULL, 0);
        }
-       _exit_critical_bh(&pmlmepriv->lock, &irqL);
+       spin_unlock_bh(&pmlmepriv->lock);
 
 
        if(_status == _FALSE)
@@ -2618,7 +2615,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
        }
 
 
-       _rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID));
+       memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID));
        ndis_ssid.SsidLength = sme->ssid_len;
        memcpy(ndis_ssid.Ssid, sme->ssid, sme->ssid_len);
 
@@ -2638,7 +2635,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
                rtw_scan_abort(padapter);
        }
 
-       _enter_critical_bh(&queue->lock, &irqL);
+       spin_lock_bh(&queue->lock);
 
        phead = get_list_head(queue);
        pmlmepriv->pscanned = get_next(phead);
@@ -2657,14 +2654,15 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
                dst_bssid = pnetwork->network.MacAddress;
 
                if(sme->bssid)  {
-                       if(_rtw_memcmp(pnetwork->network.MacAddress, sme->bssid, ETH_ALEN) == _FALSE)
+                       if (memcmp(pnetwork->network.MacAddress,
+                                  sme->bssid, ETH_ALEN))
                                continue;
                }
 
                if(sme->ssid && sme->ssid_len) {
-                       if(     pnetwork->network.Ssid.SsidLength != sme->ssid_len
-                               || _rtw_memcmp(pnetwork->network.Ssid.Ssid, sme->ssid, sme->ssid_len) == _FALSE
-                       )
+                       if (pnetwork->network.Ssid.SsidLength != sme->ssid_len||
+                            memcmp(pnetwork->network.Ssid.Ssid, sme->ssid,
+                                   sme->ssid_len))
                                continue;
                }
 
@@ -2673,7 +2671,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
                {
                        src_bssid = sme->bssid;
 
-                       if ((_rtw_memcmp(dst_bssid, src_bssid, ETH_ALEN)) == _TRUE)
+                       if ((!memcmp(dst_bssid, src_bssid, ETH_ALEN)))
                        {
                                DBG_8723A("matched by bssid\n");
 
@@ -2689,7 +2687,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
                {
                        src_ssid = ndis_ssid.Ssid;
 
-                       if ((_rtw_memcmp(dst_ssid, src_ssid, ndis_ssid.SsidLength) == _TRUE) &&
+                       if ((!memcmp(dst_ssid, src_ssid, ndis_ssid.SsidLength)) &&
                                (pnetwork->network.Ssid.SsidLength==ndis_ssid.SsidLength))
                        {
                                DBG_8723A("matched by ssid\n");
@@ -2700,7 +2698,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
 
        }
 
-       _exit_critical_bh(&queue->lock, &irqL);
+       spin_unlock_bh(&queue->lock);
 
        if((matched == _FALSE) || (pnetwork== NULL))
        {
@@ -2791,7 +2789,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
                                goto exit;
                        }
 
-                       _rtw_memset(pwep, 0, wep_total_len);
+                       memset(pwep, 0, wep_total_len);
 
                        pwep->KeyLength = wep_key_len;
                        pwep->Length = wep_total_len;
@@ -2983,7 +2981,7 @@ static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy,
 
        DBG_8723A(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(netdev));
 
-       if ( _rtw_memcmp( pmksa->bssid, strZeroMacAddress, ETH_ALEN ) == _TRUE )
+       if (!memcmp(pmksa->bssid, strZeroMacAddress, ETH_ALEN))
        {
                return -EINVAL;
        }
@@ -2993,8 +2991,9 @@ static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy,
        //overwrite PMKID
        for(index=0 ; index<NUM_PMKID_CACHE; index++)
        {
-               if( _rtw_memcmp( psecuritypriv->PMKIDList[index].Bssid, pmksa->bssid, ETH_ALEN) ==_TRUE )
-               { // BSSID is matched, the same AP => rewrite with new PMKID.
+               if (!memcmp(psecuritypriv->PMKIDList[index].Bssid,
+                          pmksa->bssid, ETH_ALEN)) {
+                       /* BSSID is matched, the same AP => rewrite with new PMKID. */
                        DBG_8723A(FUNC_NDEV_FMT" BSSID exists in the PMKList.\n", FUNC_NDEV_ARG(netdev));
 
                        memcpy(psecuritypriv->PMKIDList[index].PMKID, pmksa->pmkid, WLAN_PMKID_LEN);
@@ -3037,10 +3036,11 @@ static int cfg80211_rtw_del_pmksa(struct wiphy *wiphy,
 
        for(index=0 ; index<NUM_PMKID_CACHE; index++)
        {
-               if( _rtw_memcmp( psecuritypriv->PMKIDList[index].Bssid, pmksa->bssid, ETH_ALEN) ==_TRUE )
-               { // BSSID is matched, the same AP => Remove this PMKID information and reset it.
-                       _rtw_memset( psecuritypriv->PMKIDList[index].Bssid, 0x00, ETH_ALEN );
-                       _rtw_memset( psecuritypriv->PMKIDList[index].PMKID, 0x00, WLAN_PMKID_LEN );
+               if (!memcmp(psecuritypriv->PMKIDList[index].Bssid,
+                           pmksa->bssid, ETH_ALEN)) {
+                       /* BSSID is matched, the same AP => Remove this PMKID information and reset it. */
+                       memset(psecuritypriv->PMKIDList[index].Bssid, 0x00, ETH_ALEN);
+                       memset(psecuritypriv->PMKIDList[index].PMKID, 0x00, WLAN_PMKID_LEN);
                        psecuritypriv->PMKIDList[index].bUsed = _FALSE;
                        bMatched = _TRUE;
                        break;
@@ -3065,7 +3065,7 @@ static int cfg80211_rtw_flush_pmksa(struct wiphy *wiphy,
 
        DBG_8723A(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(netdev));
 
-       _rtw_memset( &psecuritypriv->PMKIDList[ 0 ], 0x00, sizeof( RT_PMKID_LIST ) * NUM_PMKID_CACHE );
+       memset(&psecuritypriv->PMKIDList[0], 0x00, sizeof(RT_PMKID_LIST) * NUM_PMKID_CACHE);
        psecuritypriv->PMKIDIndex = 0;
 
        return 0;
@@ -3313,7 +3313,7 @@ dump:
                update_mgntframe_attrib(padapter, pattrib);
                pattrib->retry_ctrl = _FALSE;
 
-               _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
+               memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
 
                pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
 
@@ -3805,7 +3805,7 @@ static int        cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev
        }
 
 
-       _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+       spin_lock_bh(&pstapriv->asoc_list_lock);
 
        phead = &pstapriv->asoc_list;
        plist = get_next(phead);
@@ -3817,7 +3817,7 @@ static int        cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev
 
                plist = get_next(plist);
 
-               if(_rtw_memcmp(mac, psta->hwaddr, ETH_ALEN))
+               if (!memcmp(mac, psta->hwaddr, ETH_ALEN))
                {
                        if(psta->dot8021xalg == 1 && psta->bpairwise_key_installed == _FALSE)
                        {
@@ -3830,9 +3830,9 @@ static int        cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev
                                rtw_list_delete(&psta->asoc_list);
                                pstapriv->asoc_list_cnt--;
 
-                               //_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+                               //spin_unlock_bh(&pstapriv->asoc_list_lock);
                                updated = ap_free_sta(padapter, psta, _TRUE, WLAN_REASON_DEAUTH_LEAVING);
-                               //_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+                               //spin_lock_bh(&pstapriv->asoc_list_lock);
 
                                psta = NULL;
 
@@ -3843,7 +3843,7 @@ static int        cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev
 
        }
 
-       _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+       spin_unlock_bh(&pstapriv->asoc_list_lock);
 
        associated_clients_update(padapter, updated);
 
@@ -4107,8 +4107,8 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf,
 
 
        //start to build provision_request frame
-       _rtw_memset(wpsie, 0, sizeof(wpsie));
-       _rtw_memset(p2p_ie, 0, sizeof(p2p_ie));
+       memset(wpsie, 0, sizeof(wpsie));
+       memset(p2p_ie, 0, sizeof(p2p_ie));
        p2p_ielen = 0;
 
        if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
@@ -4121,7 +4121,7 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf,
        pattrib = &pmgntframe->attrib;
        update_mgntframe_attrib(padapter, pattrib);
 
-       _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
+       memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
 
        pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
        pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
@@ -4450,7 +4450,7 @@ static s32 cfg80211_rtw_cancel_remain_on_channel(struct wiphy *wiphy,
                        _cancel_timer_ex( &pwdinfo->pre_tx_scan_timer);
 
                        rtw_p2p_set_state(pwdinfo, P2P_STATE_NONE);
-                       _rtw_memset(pwdinfo, 0x00, sizeof(struct wifidirect_info));
+                       memset(pwdinfo, 0x00, sizeof(struct wifidirect_info));
                }
        }
        else
@@ -4556,7 +4556,7 @@ static int _cfg80211_rtw_mgmt_tx(_adapter *padapter, u8 tx_ch, const u8 *buf, si
        update_mgntframe_attrib(padapter, pattrib);
        pattrib->retry_ctrl = _FALSE;
 
-       _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
+       memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
 
        pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
 
@@ -5167,8 +5167,8 @@ static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum
        ht_cap->ht_supported = _TRUE;
 
        ht_cap->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
-                                       IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20 |
-                                       IEEE80211_HT_CAP_DSSSCCK40 | IEEE80211_HT_CAP_MAX_AMSDU;
+               IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20 |
+               IEEE80211_HT_CAP_DSSSCCK40 | IEEE80211_HT_CAP_MAX_AMSDU;
 
        /*
         *Maximum length of AMPDU that the STA can receive.
@@ -5373,7 +5373,7 @@ int rtw_wdev_alloc(_adapter *padapter, struct device *dev)
        pwdev_priv->ifname_mon[0] = '\0';
        pwdev_priv->padapter = padapter;
        pwdev_priv->scan_request = NULL;
-       _rtw_spinlock_init(&pwdev_priv->scan_req_lock);
+       spin_lock_init(&pwdev_priv->scan_req_lock);
 
        pwdev_priv->p2p_enabled = _FALSE;
        pwdev_priv->provdisc_req_issued = _FALSE;