From 6926fe7f636ce229dc8d2b03eecddea07c163539 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Tue, 24 Oct 2017 14:32:15 +0200 Subject: [PATCH 01/22] Some fixes and tweaks --- os_dep/linux/ioctl_cfg80211.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index b86f26d..759b38d 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -648,8 +648,10 @@ void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter) return ; } } else { - if (scanned == NULL) + if (scanned == NULL) { rtw_warn_on(1); + return; + } if (_rtw_memcmp(&(scanned->network.Ssid), &(pnetwork->Ssid), sizeof(NDIS_802_11_SSID)) == _TRUE && _rtw_memcmp(scanned->network.MacAddress, pnetwork->MacAddress, sizeof(NDIS_802_11_MAC_ADDRESS)) == _TRUE @@ -907,7 +909,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { if (param->u.crypt.idx >= WEP_KEYS #ifdef CONFIG_IEEE80211W - && param->u.crypt.idx > BIP_MAX_KEYID + || param->u.crypt.idx >= BIP_MAX_KEYID #endif /* CONFIG_IEEE80211W */ ) { ret = -EINVAL; @@ -1166,7 +1168,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { if (param->u.crypt.idx >= WEP_KEYS #ifdef CONFIG_IEEE80211W - && param->u.crypt.idx > BIP_MAX_KEYID + || param->u.crypt.idx >= BIP_MAX_KEYID #endif /* CONFIG_IEEE80211W */ ) { ret = -EINVAL; @@ -3478,8 +3480,10 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_de RTW_INFO(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - if (skb) - rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize); + if (!skb) + goto fail; + + rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize); if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header))) goto fail; From 87b296ddbf1e524bf609e599386cc4208c19fb1e Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Tue, 24 Oct 2017 14:41:03 +0200 Subject: [PATCH 02/22] Removed some spacing --- hal/HalPwrSeqCmd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hal/HalPwrSeqCmd.c b/hal/HalPwrSeqCmd.c index de709b1..a4fd21a 100644 --- a/hal/HalPwrSeqCmd.c +++ b/hal/HalPwrSeqCmd.c @@ -35,7 +35,6 @@ Major Change History: --*/ #include - /* * Description: * This routine deal with the Power Configuration CMDs parsing for RTL8723/RTL8188E Series IC. @@ -63,7 +62,6 @@ u8 HalPwrSeqCmdParsing( do { PwrCfgCmd = PwrSeqCmd[AryIdx]; - /* 2 Only Handle the command whose FAB, CUT, and Interface are matched */ if ((GET_PWR_CFG_FAB_MASK(PwrCfgCmd) & FabVersion) && (GET_PWR_CFG_CUT_MASK(PwrCfgCmd) & CutVersion) && From 650a632c96409c3bd9d4344d893409400292d076 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Tue, 24 Oct 2017 14:42:28 +0200 Subject: [PATCH 03/22] Removed some spacing --- hal/hal_dm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hal/hal_dm.c b/hal/hal_dm.c index 870685f..e152da3 100644 --- a/hal/hal_dm.c +++ b/hal/hal_dm.c @@ -99,7 +99,6 @@ void Init_ODM_ComInfo(_adapter *adapter) ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_BWIFI_TEST, adapter->registrypriv.wifi_spec); - if (pHalData->rf_type == RF_1T1R) ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_1T1R); else if (pHalData->rf_type == RF_1T2R) @@ -121,7 +120,6 @@ void Init_ODM_ComInfo(_adapter *adapter) else ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_XTXR); - { /* 1 ======= BoardType: ODM_CMNINFO_BOARD_TYPE ======= */ u8 odm_board_type = ODM_BOARD_DEFAULT; From 8c6bb817671cface7ce7f3c8b439008c288323c9 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Tue, 24 Oct 2017 14:48:00 +0200 Subject: [PATCH 04/22] Removed some spacing --- hal/hal_mp.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/hal/hal_mp.c b/hal/hal_mp.c index bf6b4c2..4f53504 100644 --- a/hal/hal_mp.c +++ b/hal/hal_mp.c @@ -52,7 +52,6 @@ #endif #endif /* !RTW_HALMAC */ - u8 MgntQuery_NssTxRate(u16 Rate) { u8 NssNum = RF_TX_NUM_NONIMPLEMENT; @@ -112,7 +111,6 @@ s32 hal_mpt_SetPowerTracking(PADAPTER padapter, u8 enable) HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); - if (!netif_running(padapter->pnetdev)) { return _FAIL; } @@ -137,7 +135,6 @@ void hal_mpt_GetPowerTracking(PADAPTER padapter, u8 *enable) *enable = pDM_Odm->RFCalibrateInfo.TxPowerTrackControl; } - void hal_mpt_CCKTxPowerAdjust(PADAPTER Adapter, BOOLEAN bInCH14) { u32 TempVal = 0, TempVal2 = 0, TempVal3 = 0; @@ -1299,7 +1296,6 @@ void mpt_SetRFPath_8723D(PADAPTER pAdapter) PHY_SetRFReg(pAdapter, ODM_RF_PATH_A, 0x51, bRFRegOffsetMask, 0x6B04E); - for (i = 0; i < 3; ++i) { /* <20130603, Kordan> Because BB suppors only 1T1R, we restore IQC to S1 instead of S0.*/ @@ -1468,7 +1464,6 @@ VOID mpt_SetRFPath_819X(PADAPTER pAdapter) break; } - if (chgTx && chgRx) { switch (pHalData->rf_chip) { case RF_8225: @@ -1493,7 +1488,6 @@ VOID mpt_SetRFPath_819X(PADAPTER pAdapter) } } /* MPT_ProSetRFPath */ - void hal_mpt_SetAntenna(PADAPTER pAdapter) { @@ -1560,12 +1554,10 @@ s32 hal_mpt_SetThermalMeter(PADAPTER pAdapter, u8 target_ther) return _FAIL; } - if (check_fwstate(&pAdapter->mlmepriv, WIFI_MP_STATE) == _FALSE) { return _FAIL; } - target_ther &= 0xff; if (target_ther < 0x07) target_ther = 0x07; @@ -1577,14 +1569,12 @@ s32 hal_mpt_SetThermalMeter(PADAPTER pAdapter, u8 target_ther) return _SUCCESS; } - void hal_mpt_TriggerRFThermalMeter(PADAPTER pAdapter) { PHY_SetRFReg(pAdapter, ODM_RF_PATH_A, 0x42, BIT17 | BIT16, 0x03); } - u8 hal_mpt_ReadRFThermalMeter(PADAPTER pAdapter) { @@ -1595,7 +1585,6 @@ u8 hal_mpt_ReadRFThermalMeter(PADAPTER pAdapter) } - void hal_mpt_GetThermalMeter(PADAPTER pAdapter, u8 *value) { #if 0 @@ -1611,7 +1600,6 @@ void hal_mpt_GetThermalMeter(PADAPTER pAdapter, u8 *value) } - void hal_mpt_SetSingleCarrierTx(PADAPTER pAdapter, u8 bStart) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); @@ -1656,7 +1644,6 @@ void hal_mpt_SetSingleCarrierTx(PADAPTER pAdapter, u8 bStart) } } - void hal_mpt_SetSingleToneTx(PADAPTER pAdapter, u8 bStart) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); @@ -2071,7 +2058,6 @@ static VOID mpt_StopCckContTx( } /* mpt_StopCckContTx */ - static VOID mpt_StopOfdmContTx( PADAPTER pAdapter ) From eeb846691940771d2fa49a3512668fcdd52498fb Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Tue, 24 Oct 2017 14:56:21 +0200 Subject: [PATCH 05/22] Use endian macros from kernel --- include/ieee80211_ext.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/ieee80211_ext.h b/include/ieee80211_ext.h index 03cc330..6ac3b76 100644 --- a/include/ieee80211_ext.h +++ b/include/ieee80211_ext.h @@ -63,7 +63,7 @@ struct rsn_ie_hdr { } __attribute__((packed)); struct wme_ac_parameter { -#if defined(CONFIG_LITTLE_ENDIAN) +#if defined(__LITTLE_ENDIAN) /* byte 1 */ u8 aifsn:4, acm:1, @@ -73,7 +73,7 @@ struct wme_ac_parameter { /* byte 2 */ u8 eCWmin:4, eCWmax:4; -#elif defined(CONFIG_BIG_ENDIAN) +#else /* byte 1 */ u8 reserved:1, aci:2, @@ -83,8 +83,6 @@ struct wme_ac_parameter { /* byte 2 */ u8 eCWmax:4, eCWmin:4; -#else -#error "Please fix " #endif /* bytes 3 & 4 */ From b21933b78e1a57a48b891c49f35f292595f348d2 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Tue, 24 Oct 2017 14:58:25 +0200 Subject: [PATCH 06/22] Use endian macros from kernel --- hal/phydm/phydm_types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hal/phydm/phydm_types.h b/hal/phydm/phydm_types.h index a5382fb..90be597 100644 --- a/hal/phydm/phydm_types.h +++ b/hal/phydm/phydm_types.h @@ -217,9 +217,9 @@ typedef enum _RT_SPINLOCK_TYPE{ #endif - #if defined(CONFIG_LITTLE_ENDIAN) + #if defined(__LITTLE_ENDIAN) #define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE - #elif defined (CONFIG_BIG_ENDIAN) + #else #define ODM_ENDIAN_TYPE ODM_ENDIAN_BIG #endif From 88030586b4fffe14bf8475151ac144fe4473ac71 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Tue, 24 Oct 2017 14:59:58 +0200 Subject: [PATCH 07/22] Use endian macros from kernel --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index b689e06..f848e2a 100755 --- a/Makefile +++ b/Makefile @@ -1055,7 +1055,6 @@ endif EXTRA_CFLAGS += -DDM_ODM_SUPPORT_TYPE=0x04 ifeq ($(CONFIG_PLATFORM_I386_PC), y) -EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT SUBARCH := $(shell uname -m | sed -e s/i.86/i386/) ARCH ?= $(SUBARCH) From d2300a27905c9c02f9b2fae857a532d276b44494 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Tue, 24 Oct 2017 15:03:25 +0200 Subject: [PATCH 08/22] Use endian macros from kernel --- include/rtw_byteorder.h | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/include/rtw_byteorder.h b/include/rtw_byteorder.h index 70482d2..0755d52 100644 --- a/include/rtw_byteorder.h +++ b/include/rtw_byteorder.h @@ -21,18 +21,10 @@ #define _RTL871X_BYTEORDER_H_ -#if defined(CONFIG_LITTLE_ENDIAN) && defined (CONFIG_BIG_ENDIAN) - #error "Shall be CONFIG_LITTLE_ENDIAN or CONFIG_BIG_ENDIAN, but not both!\n" -#endif - -#if defined(CONFIG_LITTLE_ENDIAN) - #ifndef CONFIG_PLATFORM_MSTAR389 - #include - #endif -#elif defined (CONFIG_BIG_ENDIAN) - #include +#if defined(__LITTLE_ENDIAN) +#include #else - # error "Must be LITTLE/BIG Endian Host" +#include #endif #endif /* _RTL871X_BYTEORDER_H_ */ From 5a09d2cbce284a5cf5541b99a3cbd13dcb3994d8 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Tue, 24 Oct 2017 15:05:17 +0200 Subject: [PATCH 09/22] Use endian macros from kernel --- include/rtw_io.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/rtw_io.h b/include/rtw_io.h index 44a1749..1cfd44d 100644 --- a/include/rtw_io.h +++ b/include/rtw_io.h @@ -197,7 +197,7 @@ struct intf_hdl { struct reg_protocol_rd { -#ifdef CONFIG_LITTLE_ENDIAN +#ifdef __LITTLE_ENDIAN /* DW1 */ u32 NumOfTrans:4; @@ -255,7 +255,7 @@ struct reg_protocol_rd { struct reg_protocol_wt { -#ifdef CONFIG_LITTLE_ENDIAN +#ifdef __LITTLE_ENDIAN /* DW1 */ u32 NumOfTrans:4; From c7f1aeb25780b6188726c178635543b5765ac948 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Tue, 24 Oct 2017 15:07:24 +0200 Subject: [PATCH 10/22] Use endian macros from kernel --- include/rtw_mlme_ext.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/include/rtw_mlme_ext.h b/include/rtw_mlme_ext.h index 850eccb..0ef5f8c 100644 --- a/include/rtw_mlme_ext.h +++ b/include/rtw_mlme_ext.h @@ -1153,21 +1153,17 @@ struct cmd_hdl wlancmds[] = { struct C2HEvent_Header { -#ifdef CONFIG_LITTLE_ENDIAN +#ifdef __LITTLE_ENDIAN unsigned int len:16; unsigned int ID:8; unsigned int seq:8; -#elif defined(CONFIG_BIG_ENDIAN) - - unsigned int seq:8; - unsigned int ID:8; - unsigned int len:16; - #else -# error "Must be LITTLE or BIG Endian" + unsigned int seq:8; + unsigned int ID:8; + unsigned int len:16; #endif From 4615068c7671d22ab562620641608fb36202decd Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Tue, 24 Oct 2017 15:10:27 +0200 Subject: [PATCH 11/22] Use endian macros from kernel + removed spaces --- include/rtw_security.h | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/include/rtw_security.h b/include/rtw_security.h index ae651e0..2defb2d 100644 --- a/include/rtw_security.h +++ b/include/rtw_security.h @@ -20,7 +20,6 @@ #ifndef __RTW_SECURITY_H_ #define __RTW_SECURITY_H_ - #define _NO_PRIVACY_ 0x0 #define _WEP40_ 0x1 #define _TKIP_ 0x2 @@ -63,7 +62,6 @@ typedef enum { ENCRYP_PROTOCOL_MAX } ENCRYP_PROTOCOL_E; - #ifndef Ndis802_11AuthModeWPA2 #define Ndis802_11AuthModeWPA2 (Ndis802_11AuthModeWPANone + 1) #endif @@ -76,7 +74,7 @@ union pn48 { u64 val; -#ifdef CONFIG_LITTLE_ENDIAN +#ifdef __LITTLE_ENDIAN struct { u8 TSC0; @@ -89,7 +87,7 @@ struct { u8 TSC7; } _byte_; -#elif defined(CONFIG_BIG_ENDIAN) +#else struct { u8 TSC7; @@ -111,7 +109,6 @@ union Keytype { u32 lkey[4]; }; - typedef struct _RT_PMKID_LIST { u8 bUsed; u8 Bssid[6]; @@ -121,7 +118,6 @@ typedef struct _RT_PMKID_LIST { u16 ssid_length; } RT_PMKID_LIST, *PRT_PMKID_LIST; - struct security_priv { u32 dot11AuthAlgrthm; /* 802.11 auth, could be open, shared, 8021x and authswitch */ u32 dot11PrivacyAlgrthm; /* This specify the privacy for shared auth. algorithm. */ @@ -162,7 +158,6 @@ struct security_priv { u8 wps_ie[MAX_WPS_IE_LEN];/* added in assoc req */ int wps_ie_len; - u8 binstallGrpkey; #ifdef CONFIG_GTK_OL u8 binstallKCK_KEK; @@ -182,7 +177,6 @@ struct security_priv { s32 hw_decrypted;/* if the rx packets is hw_decrypted==_FALSE, it means the hw has not been ready. */ - /* keeps the auth_type & enc_status from upper layer ioctl(wpa_supplicant or wzc) */ u32 ndisauthtype; /* NDIS_802_11_AUTHENTICATION_MODE */ u32 ndisencryptstatus; /* NDIS_802_11_ENCRYPTION_STATUS */ @@ -198,7 +192,6 @@ struct security_priv { u8 authenticator_ie[256]; /* store ap security information element */ u8 supplicant_ie[256]; /* store sta security information element */ - /* for tkip countermeasure */ u32 last_mic_err_time; u8 btkip_countermeasure; @@ -297,7 +290,6 @@ struct sha256_state { } \ } while (0) - #define GET_TKIP_PN(iv, dot11txpn)\ do {\ dot11txpn._byte_.TSC0 = iv[2];\ @@ -308,7 +300,6 @@ struct sha256_state { dot11txpn._byte_.TSC5 = iv[7];\ } while (0) - #define ROL32(A, n) (((A) << (n)) | (((A)>>(32-(n))) & ((1UL << (n)) - 1))) #define ROR32(A, n) ROL32((A), 32-(n)) @@ -425,7 +416,6 @@ static const unsigned long K[64] = { 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL }; - /* Various logical functions */ #define RORc(x, y) \ (((((unsigned long) (x) & 0xFFFFFFFFUL) >> (unsigned long) ((y) & 31)) | \ From efc08fe29585447d00fcdca937045c7c28c62a10 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Tue, 24 Oct 2017 15:24:01 +0200 Subject: [PATCH 12/22] Use endian macros from kernel + spacing --- os_dep/linux/ioctl_linux.c | 78 ++------------------------------------ 1 file changed, 3 insertions(+), 75 deletions(-) diff --git a/os_dep/linux/ioctl_linux.c b/os_dep/linux/ioctl_linux.c index 0827a08..c1adefb 100644 --- a/os_dep/linux/ioctl_linux.c +++ b/os_dep/linux/ioctl_linux.c @@ -33,7 +33,6 @@ extern int rtw_ht_enable; #endif - #define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV+30) #define SCAN_ITEM_SIZE 768 @@ -57,7 +56,6 @@ extern int ui_pid[3]; #define WEXT_CSCAN_HOME_DWELL_SECTION 'H' #define WEXT_CSCAN_TYPE_SECTION 'T' - extern u8 key_2char2num(u8 hch, u8 lch); extern u8 str_2char2num(u8 hch, u8 lch); extern void macstr2num(u8 *dst, u8 *src); @@ -148,7 +146,6 @@ static void indicate_wx_custom_event(_adapter *padapter, char *msg) } - static void request_wps_pbc_event(_adapter *padapter) { u8 *buff, *p; @@ -219,7 +216,6 @@ void indicate_wx_scan_complete_event(_adapter *padapter) #endif } - void rtw_indicate_wx_assoc_event(_adapter *padapter) { union iwreq_data wrqu; @@ -586,7 +582,6 @@ static inline char *iwe_stream_wpa_wpa2_process(_adapter *padapter, u8 *p; sint out_len = 0; - if (pbuf) { p = pbuf; @@ -694,7 +689,6 @@ static inline char *iwe_stream_wapi_process(_adapter *padapter, RTW_INFO("rtw_wx_get_scan: %s ", pnetwork->network.Ssid.Ssid); RTW_INFO("rtw_wx_get_scan: ssid = %d ", wapi_len); - if (wapi_len > 0) { p = buf_wapi; /* _rtw_memset(buf_wapi, 0, MAX_WAPI_IE_LEN*2); */ @@ -746,7 +740,6 @@ static inline char *iwe_stream_rssi_process(_adapter *padapter, sq = pnetwork->network.PhyInfo.SignalQuality; } - #ifdef CONFIG_SIGNAL_DISPLAY_DBM iwe->u.qual.level = (u8) translate_percentage_to_dbm(ss); /* dbm */ #else @@ -1103,7 +1096,6 @@ static char *translate_scan(_adapter *padapter, RTW_INFO("rtw_wx_get_scan: %s ", pnetwork->network.Ssid.Ssid); RTW_INFO("rtw_wx_get_scan: ssid = %d ", wapi_len); - if (wapi_len > 0) { p = buf_wapi; _rtw_memset(buf_wapi, 0, MAX_WAPI_IE_LEN * 2); @@ -1150,7 +1142,6 @@ static char *translate_scan(_adapter *padapter, sq = pnetwork->network.PhyInfo.SignalQuality; } - #ifdef CONFIG_SIGNAL_DISPLAY_DBM iwe.u.qual.level = (u8) translate_percentage_to_dbm(ss); /* dbm */ #else @@ -1262,7 +1253,6 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, struct wifidirect_info *pwdinfo = &padapter->wdinfo; #endif /* CONFIG_P2P */ - param->u.crypt.err = 0; param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; @@ -1484,7 +1474,6 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, exit: - return ret; } @@ -1645,7 +1634,6 @@ static int rtw_set_wpa_ie(_adapter *padapter, char *pie, unsigned short ielen) * || check_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS) == _TRUE) */ rtw_hal_set_hwreg(padapter, HW_VAR_OFF_RCR_AM, null_addr); - exit: if (buf) @@ -1667,8 +1655,6 @@ static int rtw_wx_get_name(struct net_device *dev, WLAN_BSSID_EX *pcur_bss = &pmlmepriv->cur_network.network; NDIS_802_11_RATES_EX *prates = NULL; - - if (check_fwstate(pmlmepriv, _FW_LINKED | WIFI_ADHOC_MASTER_STATE) == _TRUE) { /* parsing HT_CAP_IE */ p = rtw_get_ie(&pcur_bss->IEs[12], _HT_CAPABILITY_IE_, &ht_ielen, pcur_bss->IELength - 12); @@ -1718,7 +1704,6 @@ static int rtw_wx_get_name(struct net_device *dev, snprintf(wrqu->name, IFNAMSIZ, "unassociated"); } - return 0; } @@ -1733,8 +1718,6 @@ static int rtw_wx_set_freq(struct net_device *dev, struct wlan_network *cur_network = &(pmlmepriv->cur_network); int exp = 1, freq = 0, div = 0; - - if (wrqu->freq.m <= 1000) { if (wrqu->freq.flags == IW_FREQ_AUTO) { if (rtw_ch_set_search_ch(padapter->mlmeextpriv.channel_set, wrqu->freq.m) > 0) { @@ -1778,7 +1761,6 @@ static int rtw_wx_set_freq(struct net_device *dev, set_channel_bwmode(padapter, padapter->mlmeextpriv.cur_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20); - return 0; } @@ -1891,7 +1873,6 @@ static int rtw_wx_set_mode(struct net_device *dev, struct iw_request_info *a, exit: - return ret; } @@ -1902,8 +1883,6 @@ static int rtw_wx_get_mode(struct net_device *dev, struct iw_request_info *a, _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) wrqu->mode = IW_MODE_INFRA; else if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE) || @@ -1922,7 +1901,6 @@ static int rtw_wx_get_mode(struct net_device *dev, struct iw_request_info *a, } - static int rtw_wx_set_pmkid(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra) @@ -2043,8 +2021,6 @@ static int rtw_wx_get_range(struct net_device *dev, u16 val; int i; - - wrqu->data.length = sizeof(*range); _rtw_memset(range, 0, sizeof(*range)); @@ -2182,8 +2158,6 @@ static int rtw_wx_get_range(struct net_device *dev, IW_SCAN_CAPA_CHANNEL | IW_SCAN_CAPA_MODE | IW_SCAN_CAPA_RATE; #endif - - return 0; } @@ -2318,8 +2292,6 @@ static int rtw_wx_get_wap(struct net_device *dev, _rtw_memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); - - if (((check_fwstate(pmlmepriv, _FW_LINKED)) == _TRUE) || ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) == _TRUE) || ((check_fwstate(pmlmepriv, WIFI_AP_STATE)) == _TRUE)) @@ -2328,7 +2300,6 @@ static int rtw_wx_get_wap(struct net_device *dev, else _rtw_memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); - return 0; } @@ -2351,7 +2322,6 @@ static int rtw_wx_set_mlme(struct net_device *dev, _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); struct iw_mlme *mlme = (struct iw_mlme *) extra; - if (mlme == NULL) return -1; @@ -2359,10 +2329,8 @@ static int rtw_wx_set_mlme(struct net_device *dev, reason = cpu_to_le16(mlme->reason_code); - RTW_INFO("%s, cmd=%d, reason=%d\n", __FUNCTION__, mlme->cmd, reason); - switch (mlme->cmd) { case IW_MLME_DEAUTH: if (!rtw_set_802_11_disassociate(padapter)) @@ -2395,7 +2363,6 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, struct wifidirect_info *pwdinfo = &(padapter->wdinfo); #endif /* CONFIG_P2P */ - #ifdef DBG_IOCTL RTW_INFO("DBG_IOCTL %s:%d\n", __FUNCTION__, __LINE__); #endif @@ -2522,7 +2489,6 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, len -= sec_len; break; - case WEXT_CSCAN_CHANNEL_SECTION: /* RTW_INFO("WEXT_CSCAN_CHANNEL_SECTION\n"); */ pos += 1; @@ -2603,7 +2569,6 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, struct wifidirect_info *pwdinfo = &padapter->wdinfo; #endif /* CONFIG_P2P */ - #ifdef DBG_IOCTL RTW_INFO("DBG_IOCTL %s:%d\n", __FUNCTION__, __LINE__); #endif @@ -2683,7 +2648,6 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, exit: - #ifdef DBG_IOCTL RTW_INFO("DBG_IOCTL %s:%d return %d\n", __FUNCTION__, __LINE__, ret); #endif @@ -2732,8 +2696,6 @@ static int rtw_wx_set_essid(struct net_device *dev, goto exit; } - - rtw_ps_deny(padapter, PS_DENY_JOIN); if (_FAIL == rtw_pwr_wakeup(padapter)) { ret = -1; @@ -2845,7 +2807,6 @@ exit: RTW_INFO("DBG_IOCTL %s:%d return %d\n", __FUNCTION__, __LINE__, ret); #endif - return ret; } @@ -2858,8 +2819,6 @@ static int rtw_wx_get_essid(struct net_device *dev, struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); WLAN_BSSID_EX *pcur_bss = &pmlmepriv->cur_network.network; - - if ((check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) || (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE)) { len = pcur_bss->Ssid.SsidLength; @@ -2876,7 +2835,6 @@ static int rtw_wx_get_essid(struct net_device *dev, exit: - return ret; } @@ -2893,8 +2851,6 @@ static int rtw_wx_set_rate(struct net_device *dev, u32 ratevalue = 0; u8 mpdatarate[NumRates] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0xff}; - - if (target_rate == -1) { ratevalue = 11; goto set_rate; @@ -2959,7 +2915,6 @@ set_rate: ret = -1; } - return ret; } @@ -3051,7 +3006,6 @@ static int rtw_wx_get_frag(struct net_device *dev, { _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); - RTW_INFO("%s, frag_len=%d\n", __func__, padapter->xmitpriv.frag_len); wrqu->frag.value = padapter->xmitpriv.frag_len; @@ -3068,7 +3022,6 @@ static int rtw_wx_get_retry(struct net_device *dev, { /* _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); */ - wrqu->retry.value = 7; wrqu->retry.fixed = 0; /* no auto select */ wrqu->retry.disabled = 1; @@ -3118,7 +3071,6 @@ static int rtw_wx_set_enc(struct net_device *dev, key = erq->flags & IW_ENCODE_INDEX; - if (erq->flags & IW_ENCODE_DISABLED) { RTW_INFO("EncryptionDisabled\n"); padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; @@ -3225,7 +3177,6 @@ static int rtw_wx_set_enc(struct net_device *dev, exit: - return ret; } @@ -3248,7 +3199,6 @@ static int rtw_wx_get_enc(struct net_device *dev, } } - key = erq->flags & IW_ENCODE_INDEX; if (key) { @@ -3310,7 +3260,6 @@ static int rtw_wx_get_enc(struct net_device *dev, } - return ret; } @@ -3448,7 +3397,6 @@ static int rtw_wx_set_auth(struct net_device *dev, } #endif - ret = wpa_set_auth_algs(dev, (u32)param->value); break; @@ -3509,7 +3457,6 @@ static int rtw_wx_set_enc_ext(struct net_device *dev, param->cmd = IEEE_CMD_SET_ENCRYPTION; _rtw_memset(param->sta_addr, 0xff, ETH_ALEN); - switch (pext->alg) { case IW_ENCODE_ALG_NONE: /* todo: remove key */ @@ -3593,7 +3540,6 @@ exit: return ret; } - static int rtw_wx_get_nick(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -3636,7 +3582,6 @@ static int rtw_wx_get_nick(struct net_device *dev, RTW_INFO("dbg(0x664)=0x%x\n", rtw_read32(padapter, 0x664)); - RTW_INFO("\n"); RTW_INFO("dbg(0x430)=0x%x\n", rtw_read32(padapter, 0x430)); @@ -3672,7 +3617,6 @@ static int rtw_wx_read32(struct net_device *dev, u8 *ptmp; int ret; - ret = 0; padapter = (PADAPTER)rtw_netdev_priv(dev); p = &wrqu->data; @@ -3778,7 +3722,6 @@ static int rtw_wx_read_rf(struct net_device *dev, _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); u32 path, addr, data32; - path = *(u32 *)extra; addr = *((u32 *)extra + 1); data32 = rtw_hal_read_rfreg(padapter, path, addr, 0xFFFFF); @@ -3917,7 +3860,6 @@ static int rtw_drvext_hdl(struct net_device *dev, struct iw_request_info *info, goto _rtw_drvext_hdl_exit; } - bset = (u8)(p->flags & 0xFFFF); len = p->length; pparmbuf = (u8 *)rtw_malloc(len); @@ -3936,25 +3878,20 @@ static int rtw_drvext_hdl(struct net_device *dev, struct iw_request_info *info, } - /* */ poidparam = (struct drvext_oidparam *)pparmbuf; - - /* check subcode */ if (poidparam->subcode >= MAX_DRVEXT_HANDLERS) { ret = -EINVAL; goto _rtw_drvext_hdl_exit; } - if (poidparam->subcode >= MAX_DRVEXT_OID_SUBCODES) { ret = -EINVAL; goto _rtw_drvext_hdl_exit; } - phandler = drvextoidhandlers + poidparam->subcode; if (poidparam->len != phandler->parmsize) { @@ -3962,7 +3899,6 @@ static int rtw_drvext_hdl(struct net_device *dev, struct iw_request_info *info, goto _rtw_drvext_hdl_exit; } - res = phandler->handler(&padapter->drvextpriv, bset, poidparam->data); if (res == 0) { @@ -3976,7 +3912,6 @@ static int rtw_drvext_hdl(struct net_device *dev, struct iw_request_info *info, } else ret = -EFAULT; - _rtw_drvext_hdl_exit: return ret; @@ -4224,7 +4159,6 @@ static int rtw_get_ap_info(struct net_device *dev, break; } - /* pdata->length = 0; */ /* ? */ pdata->flags = 0; if (pdata->length >= 32) { @@ -4246,7 +4180,6 @@ static int rtw_get_ap_info(struct net_device *dev, if (rtw_end_of_queue_search(phead, plist) == _TRUE) break; - pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); /* if(hwaddr_aton_i(pdata->pointer, bssid)) */ @@ -4256,7 +4189,6 @@ static int rtw_get_ap_info(struct net_device *dev, return -EINVAL; } - if (_rtw_memcmp(bssid, pnetwork->network.MacAddress, ETH_ALEN) == _TRUE) { /* BSSID match, then check if supporting wpa/wpa2 */ RTW_INFO("BSSID:" MAC_FMT "\n", MAC_ARG(bssid)); @@ -4450,7 +4382,6 @@ static int rtw_p2p_set_go_nego_ssid(struct net_device *dev, } - static int rtw_p2p_set_intent(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -4526,7 +4457,6 @@ static int rtw_p2p_set_op_ch(struct net_device *dev, } - static int rtw_p2p_profilefound(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -11938,7 +11868,6 @@ static void freeloopbackpkt(PADAPTER padapter, struct xmit_frame *pframe) struct xmit_priv *pxmitpriv; struct xmit_buf *pxmitbuf; - pxmitpriv = &padapter->xmitpriv; pxmitbuf = pframe->pxmitbuf; @@ -11950,7 +11879,6 @@ static void printdata(u8 *pbuf, u32 len) { u32 i, val; - for (i = 0; (i + 4) <= len; i += 4) { printk("%08X", *(u32 *)(pbuf + i)); if ((i + 4) & 0x1F) @@ -11960,10 +11888,10 @@ static void printdata(u8 *pbuf, u32 len) } if (i < len) { -#ifdef CONFIG_BIG_ENDIAN +#ifdef __BIG_ENDIAN for (; i < len, i++) printk("%02X", pbuf + i); -#else /* CONFIG_LITTLE_ENDIAN */ +#else /* __LITTLE_ENDIAN */ #if 0 val = 0; _rtw_memcpy(&val, pbuf + i, len - i); @@ -11978,7 +11906,7 @@ static void printdata(u8 *pbuf, u32 len) n = (4 - n) * 2; printk("%8s", str + n); #endif -#endif /* CONFIG_LITTLE_ENDIAN */ +#endif /* __LITTLE_ENDIAN */ } printk("\n"); } From 0402e2a32bda7e5680f4e8b98be22aa6ba1a9ca8 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Tue, 24 Oct 2017 16:29:48 +0200 Subject: [PATCH 13/22] adopt upstream: net: Fix inconsistent teardown net: Fix inconsistent teardown and release of private netdev state. commit id cf124db566e6b036b8bcbe8decbed740bdfac8c6 --- os_dep/linux/ioctl_cfg80211.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 759b38d..99ac279 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -749,7 +749,7 @@ check_bss: struct ieee80211_channel *notify_channel; u32 freq; u16 channel = cur_network->network.Configuration.DSConfig; - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)) + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) struct cfg80211_roam_info roam_info = {}; #endif @@ -758,7 +758,7 @@ check_bss: #endif RTW_INFO(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter)); - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)) + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) roam_info.channel = notify_channel; roam_info.bssid = cur_network->network.MacAddress; roam_info.req_ie = @@ -3670,6 +3670,11 @@ static int rtw_cfg80211_add_monitor_if(_adapter *padapter, char *name, struct ne mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP; strncpy(mon_ndev->name, name, IFNAMSIZ); mon_ndev->name[IFNAMSIZ - 1] = 0; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12 ,0)) + mon_ndev->needs_free_netdev = true; +#else + mon_ndev->destructor = rtw_ndev_destructor; +#endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 9)) mon_ndev->needs_free_netdev = false; mon_ndev->priv_destructor = rtw_ndev_destructor; @@ -6446,7 +6451,7 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) #endif #if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) - #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0)) + #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12 ,0)) wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; #else // kernel >= 4.12 wiphy->max_sched_scan_reqs = 1; From 32f5d184046510109a8f31dd604ad2770f979948 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Tue, 24 Oct 2017 16:33:57 +0200 Subject: [PATCH 14/22] Small cleanup in rf_types.h --- include/rtw_rf.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/rtw_rf.h b/include/rtw_rf.h index 6b30b87..ebbb4e3 100644 --- a/include/rtw_rf.h +++ b/include/rtw_rf.h @@ -116,7 +116,6 @@ enum _REG_PREAMBLE_MODE { PREAMBLE_SHORT = 3, }; - enum _RTL8712_RF_MIMO_CONFIG_ { RTL8712_RFCONFIG_1T = 0x10, RTL8712_RFCONFIG_2T = 0x20, @@ -203,7 +202,7 @@ typedef enum _PROTECTION_MODE { PROTECTION_MODE_FORCE_DISABLE = 2, } PROTECTION_MODE, *PPROTECTION_MODE; -typedef enum _RT_RF_TYPE_DEFINITION { +enum rt_rf_types { RF_1T2R = 0, RF_2T4R = 1, RF_2T2R = 2, @@ -215,7 +214,7 @@ typedef enum _RT_RF_TYPE_DEFINITION { RF_4T4R = 8, RF_MAX_TYPE = 0xF, /* u1Byte */ -} RT_RF_TYPE_DEF_E; +}; int rtw_ch2freq(int chan); int rtw_freq2ch(int freq); From 3406bc04c7d108847c323068abb4124677af2203 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Tue, 24 Oct 2017 16:43:55 +0200 Subject: [PATCH 15/22] Some cleaning around SUPER_SPEED --- hal/rtl8814a/usb/usb_halinit.c | 39 +--------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/hal/rtl8814a/usb/usb_halinit.c b/hal/rtl8814a/usb/usb_halinit.c index eadea84..f3caf31 100644 --- a/hal/rtl8814a/usb/usb_halinit.c +++ b/hal/rtl8814a/usb/usb_halinit.c @@ -28,7 +28,6 @@ #endif - static void _dbg_dump_macreg(_adapter *padapter) { u32 offset = 0; @@ -50,7 +49,6 @@ _ConfigChipOutEP_8814( { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - pHalData->OutEpQueueSel = 0; pHalData->OutEpNumber = 0; @@ -114,17 +112,11 @@ void rtl8814au_interface_configure(_adapter *padapter) struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); if (IS_SUPER_SPEED_USB(padapter)) - { pHalData->UsbBulkOutSize = USB_SUPER_SPEED_BULK_SIZE;//1024 bytes - } else if (IS_HIGH_SPEED_USB(padapter)) - { pHalData->UsbBulkOutSize = USB_HIGH_SPEED_BULK_SIZE;//512 bytes - } else - { pHalData->UsbBulkOutSize = USB_FULL_SPEED_BULK_SIZE;//64 bytes - } pHalData->interfaceIndex = pdvobjpriv->InterfaceNumber; @@ -234,7 +226,6 @@ _InitBurstPktLen(IN PADAPTER Adapter) } } - VOID _InitQueueReservedPage_8814AUsb( IN PADAPTER Adapter @@ -273,7 +264,6 @@ _InitQueueReservedPage_8814AUsb( RTW_INFO("<===_InitQueueReservedPage_8814AUsb()\n"); } - static u32 _InitPowerOn_8814AU(_adapter *padapter) { int status = _SUCCESS; @@ -286,7 +276,6 @@ static u32 _InitPowerOn_8814AU(_adapter *padapter) if(!HalPwrSeqCmdParsing(padapter, ~PWR_CUT_TESTCHIP_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, Rtl8814A_NIC_ENABLE_FLOW)) return _FAIL; - // Enable MAC DMA/WMAC/SCHEDULE/SEC block // Set CR bit10 to enable 32k calibration. Suggested by SD1 Gimmy. Added by tynli. 2011.08.31. rtw_write16(padapter, REG_CR_8814A, 0x00); //suggseted by zhouzhou, by page, 20111230 @@ -299,10 +288,6 @@ static u32 _InitPowerOn_8814AU(_adapter *padapter) return status; } - - - - //--------------------------------------------------------------- // // MAC init functions @@ -340,7 +325,6 @@ _InitPageBoundary_8814AUsb( } - static VOID _InitNormalChipRegPriority_8814AUsb( IN PADAPTER Adapter, @@ -370,7 +354,6 @@ _InitNormalChipTwoOutEpPriority_8814AUsb( struct registry_priv *pregistrypriv = &Adapter->registrypriv; u16 beQ,bkQ,viQ,voQ,mgtQ,hiQ; - u16 valueHi = 0; u16 valueLow = 0; @@ -463,8 +446,6 @@ _InitQueuePriority_8814AUsb( } } - - static VOID _InitHardwareDropIncorrectBulkOut_8814A( IN PADAPTER Adapter @@ -691,7 +672,6 @@ _InitEDCA_8814AUsb( //rtw_write8(Adapter, REG_USTIME_EDCA, 0x50); } - static VOID _InitBeaconMaxError_8814A( IN PADAPTER Adapter, @@ -705,7 +685,6 @@ _InitBeaconMaxError_8814A( #endif } - #ifdef CONFIG_LED static void _InitHWLed(PADAPTER Adapter) { @@ -787,7 +766,6 @@ usb_AggSettingTxUpdate_8814A( #endif //CONFIG_USB_TX_AGGREGATION } // usb_AggSettingTxUpdate - /*----------------------------------------------------------------------------- * Function: usb_AggSettingRxUpdate() * @@ -893,8 +871,7 @@ USB_AggModeSwitch( { return; // Inf not support. } - - + if (pMgntInfo->LinkDetectInfo.bHigherBusyRxTraffic == _TRUE && pHalData->UsbRxHighSpeedMode == _FALSE) { @@ -912,7 +889,6 @@ USB_AggModeSwitch( return; } - #if USB_RX_AGGREGATION_92C if (pHalData->UsbRxHighSpeedMode == _TRUE) { @@ -977,7 +953,6 @@ _InitOperationMode_8814A( u8 regBwOpMode = 0; u32 regRATR = 0, regRRSR = 0; - //1 This part need to modified according to the rate set we filtered!! // // Set RRSR, RATR, and REG_BWOPMODE registers @@ -1176,7 +1151,6 @@ void _ps_close_RF(_adapter *padapter){ //phy_SsPwrSwitch92CU(padapter, rf_off, 1); } - /* A lightweight deinit function */ static void rtl8814au_hw_reset(_adapter *Adapter) { @@ -1237,7 +1211,6 @@ u32 rtl8814au_hal_init(PADAPTER Adapter) u32 init_start_time = rtw_get_current_time(); - #ifdef DBG_HAL_INIT_PROFILING enum HAL_INIT_STAGES { @@ -1365,8 +1338,6 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BEGIN); */ rtl8814au_hw_reset(Adapter); //todo - - HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_PW_ON); status = _InitPowerOn_8814AU(Adapter); if(status == _FAIL){ @@ -1479,7 +1450,6 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC02); #endif // CONFIG_TX_MCAST2UNI #endif // CONFIG_CONCURRENT_MODE || CONFIG_TX_MCAST2UNI - #ifdef CONFIG_LED _InitHWLed(Adapter); #endif //CONFIG_LED @@ -1617,15 +1587,12 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_PW_TRACK); //ODM_TXPowerTrackingCheck(&pHalData->odmpriv ); - HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_LCK); //PHY_LCCalibrate_8812A(Adapter); } - HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC21); - //HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_PABIAS); // _InitPABias(Adapter); #if (MP_DRIVER == 1) @@ -1699,7 +1666,6 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_END); } #endif - return status; } @@ -1786,7 +1752,6 @@ u32 rtl8814au_hal_deinit(PADAPTER Adapter) return _SUCCESS; } - unsigned int rtl8814au_inirp_init(PADAPTER Adapter) { u8 i; @@ -1936,7 +1901,6 @@ hal_CustomizedBehavior_8814AU( { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct led_priv *pledpriv = &(Adapter->ledpriv); - // Led mode switch(pHalData->CustomerID) @@ -2414,4 +2378,3 @@ void rtl8814au_set_hal_ops(_adapter * padapter) rtl8814_set_hal_ops(pHalFunc); } - From d74b406b1790f6cfade4af8e49b4b064d7817f05 Mon Sep 17 00:00:00 2001 From: evilphish Date: Tue, 24 Oct 2017 23:51:08 +0200 Subject: [PATCH 16/22] fix USB3 mode switch for 8814 --- hal/rtl8814a/usb/usb_halinit.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hal/rtl8814a/usb/usb_halinit.c b/hal/rtl8814a/usb/usb_halinit.c index f3caf31..0a40392 100644 --- a/hal/rtl8814a/usb/usb_halinit.c +++ b/hal/rtl8814a/usb/usb_halinit.c @@ -1974,16 +1974,24 @@ hal_ReadUsbModeSwitch_8814AU( IN BOOLEAN AutoloadFail ) { -#if 0 - if(AutoloadFail) + + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + if (AutoloadFail) + pHalData->EEPROMUsbSwitch = _FALSE; + else + /* check efuse 0x08 bit2 */ + pHalData->EEPROMUsbSwitch = (PROMContent[EEPROM_USB_MODE_8814A] & BIT1) >> 1; + + /* if(AutoloadFail) { UsbModeSwitch_SetUsbModeMechOn(Adapter, _FALSE); } else { UsbModeSwitch_SetUsbModeMechOn(Adapter, ((PROMContent[8]&BIT1)>>1)); - } -#endif + }*/ + } static VOID From 6334f182c16efaac9093f835d08e1804acbcbc94 Mon Sep 17 00:00:00 2001 From: evilphish Date: Wed, 25 Oct 2017 22:21:57 +0200 Subject: [PATCH 17/22] Small beauty cleanup for the 8814 usb fix. --- hal/rtl8814a/usb/usb_halinit.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/hal/rtl8814a/usb/usb_halinit.c b/hal/rtl8814a/usb/usb_halinit.c index 0a40392..b134d5a 100644 --- a/hal/rtl8814a/usb/usb_halinit.c +++ b/hal/rtl8814a/usb/usb_halinit.c @@ -1974,24 +1974,13 @@ hal_ReadUsbModeSwitch_8814AU( IN BOOLEAN AutoloadFail ) { - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); if (AutoloadFail) pHalData->EEPROMUsbSwitch = _FALSE; else - /* check efuse 0x08 bit2 */ + /* check efuse 0x0E bit2 */ pHalData->EEPROMUsbSwitch = (PROMContent[EEPROM_USB_MODE_8814A] & BIT1) >> 1; - - /* if(AutoloadFail) - { - UsbModeSwitch_SetUsbModeMechOn(Adapter, _FALSE); - } - else - { - UsbModeSwitch_SetUsbModeMechOn(Adapter, ((PROMContent[8]&BIT1)>>1)); - }*/ - } static VOID From b5d683e6bab854010806842582b2dc947f29686c Mon Sep 17 00:00:00 2001 From: evilphish Date: Fri, 27 Oct 2017 00:31:13 +0200 Subject: [PATCH 18/22] First change for more iw link output (incomplete but working) --- os_dep/linux/ioctl_cfg80211.c | 61 ++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 99ac279..75635ab 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -27,9 +27,23 @@ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) #define STATION_INFO_SIGNAL BIT(NL80211_STA_INFO_SIGNAL) #define STATION_INFO_TX_BITRATE BIT(NL80211_STA_INFO_TX_BITRATE) +#define STATION_INFO_TX_BITRATE_BW_5 BIT(RATE_INFO_BW_5) +#define STATION_INFO_TX_BITRATE_BW_10 BIT(RATE_INFO_BW_10) +#define STATION_INFO_TX_BITRATE_BW_20 BIT(RATE_INFO_BW_20) +#define STATION_INFO_TX_BITRATE_BW_40 BIT(RATE_INFO_BW_40) +#define STATION_INFO_TX_BITRATE_BW_80 BIT(RATE_INFO_BW_80) +#define STATION_INFO_TX_BITRATE_BW_160 BIT(RATE_INFO_BW_160) #define STATION_INFO_RX_PACKETS BIT(NL80211_STA_INFO_RX_PACKETS) #define STATION_INFO_TX_PACKETS BIT(NL80211_STA_INFO_TX_PACKETS) +#define STATION_INFO_RX_BYTES BIT(NL80211_STA_INFO_RX_BYTES) +#define STATION_INFO_TX_BYTES BIT(NL80211_STA_INFO_TX_BYTES) #define STATION_INFO_ASSOC_REQ_IES 0 +#define STATION_INFO_BSS_PARAM BIT(NL80211_STA_INFO_BSS_PARAM) +#define STATION_INFO_BSS_PARAM_CTS_PROT BIT(NL80211_STA_BSS_PARAM_CTS_PROT) +#define STATION_INFO_BSS_PARAM_SHORT_PREAMBLE BIT(NL80211_STA_BSS_PARAM_SHORT_PREAMBLE) +#define STATION_INFO_BSS_PARAM_SHORT_SLOT_TIME BIT(NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME) +#define STATION_INFO_BSS_PARAM_DTIM_PERIOD BIT(NL80211_STA_BSS_PARAM_DTIM_PERIOD) +#define STATION_INFO_BSS_PARAM_BEACON_INTERVAL BIT(NL80211_STA_BSS_PARAM_BEACON_INTERVAL) #endif /* Linux kernel >= 4.0.0 */ #include @@ -1690,7 +1704,8 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy, && check_fwstate(pmlmepriv, _FW_LINKED) ) { struct wlan_network *cur_network = &(pmlmepriv->cur_network); - + struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); + if (_rtw_memcmp((u8 *)mac, cur_network->network.MacAddress, ETH_ALEN) == _FALSE) { RTW_INFO("%s, mismatch bssid="MAC_FMT"\n", __func__, MAC_ARG(cur_network->network.MacAddress)); ret = -ENOENT; @@ -1703,12 +1718,56 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy, sinfo->filled |= STATION_INFO_TX_BITRATE; sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter); + /* to-do set the txrate flags */ + // for example something like: + //sinfo->txrate.flags |= NL80211_RATE_INFO_VHT_NSS; + //sinfo->txrate.nss = rtw_vht_mcsmap_to_nss(psta->vhtpriv.vht_mcs_map); + + + /* bw_mode is more delicate + sinfo->txrate.bw is flagged + psta->bw_mode */ + + /* + sinfo->txrate.bw = psta->bw_mode; + sinfo->txrate.flags |= psta->bw_mode; + printk("rtw_get_current_tx_sgi: %i", rtw_get_current_tx_sgi(padapter, mac)); + printk("NSS: %i", rtw_vht_mcsmap_to_nss(psta->vhtpriv.vht_mcs_map)); + printk("BW MODE: %i", psta->bw_mode); + printk("5 10 20 40 80 160: %i %i %i %i %i %i", STATION_INFO_TX_BITRATE_BW_5, STATION_INFO_TX_BITRATE_BW_10, STATION_INFO_TX_BITRATE_BW_20, STATION_INFO_TX_BITRATE_BW_40, STATION_INFO_TX_BITRATE_BW_80, STATION_INFO_TX_BITRATE_BW_160); + printk("5 10 20 40 80 160: %i %i %i %i %i %i", RATE_INFO_BW_5, RATE_INFO_BW_10, RATE_INFO_BW_20, RATE_INFO_BW_40, RATE_INFO_BW_80, RATE_INFO_BW_160); + */ + + sinfo->filled |= STATION_INFO_RX_BYTES; + sinfo->rx_bytes = psta->sta_stats.rx_bytes; + + sinfo->filled |= STATION_INFO_TX_BYTES; + sinfo->tx_bytes = psta->sta_stats.tx_bytes; + sinfo->filled |= STATION_INFO_RX_PACKETS; sinfo->rx_packets = sta_rx_data_pkts(psta); sinfo->filled |= STATION_INFO_TX_PACKETS; sinfo->tx_packets = psta->sta_stats.tx_pkts; + sinfo->filled |= STATION_INFO_BSS_PARAM; + + if (!psta->no_short_preamble_set) + sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_SHORT_PREAMBLE; + + if (!psta->no_short_slot_time_set) + sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_SHORT_SLOT_TIME; + + /* no idea how to check this yet */ + if (0) + sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_CTS_PROT; + + /* is this actually the dtim_period? */ + sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_DTIM_PERIOD; + sinfo->bss_param.dtim_period = pwrctl->dtim; + + sinfo->bss_param.beacon_interval = get_beacon_interval(&cur_network->network); + } /* for Ad-Hoc/AP mode */ From d7093963055f1b54523e3caa5013b5e96fde41c7 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Fri, 27 Oct 2017 08:11:11 +0200 Subject: [PATCH 19/22] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index b01c8db..60c3e70 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ ## TODO These are the problems that needs attention, any help would be appreciated. ``` +* "Associate", "Disassocate" & "Deauthenticate" support is missing. + These should be added in order to get some functions working, like "deauth" attacks. + Check issue report @ https://github.com/aircrack-ng/rtl8812au/issues/35 + * txpower control has been added, but some issues remain. Check issue reports for more information. From 047b718dbf04783a34e0f98ac61a1fe5215ceda2 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Fri, 27 Oct 2017 08:13:17 +0200 Subject: [PATCH 20/22] Small spacing cleanup --- platform/platform_sprd_sdio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/platform/platform_sprd_sdio.c b/platform/platform_sprd_sdio.c index c5ffd14..1a64842 100644 --- a/platform/platform_sprd_sdio.c +++ b/platform/platform_sprd_sdio.c @@ -33,7 +33,6 @@ int platform_wifi_power_on(void) { int ret = 0; - #ifdef CONFIG_RTL8188E rtw_wifi_gpio_wlan_ctrl(WLAN_POWER_ON); #endif /* CONFIG_RTL8188E */ From 510a57b7c3d88a7fa8b077050d9a8dd823e153c0 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Fri, 27 Oct 2017 08:22:36 +0200 Subject: [PATCH 21/22] small spacing cleanup --- hal/led/hal_usb_led.c | 57 ------------------------------------------- 1 file changed, 57 deletions(-) diff --git a/hal/led/hal_usb_led.c b/hal/led/hal_usb_led.c index 114f322..117bc93 100644 --- a/hal/led/hal_usb_led.c +++ b/hal/led/hal_usb_led.c @@ -66,7 +66,6 @@ SwLedBlink( bStopBlinking = _TRUE; break; - default: bStopBlinking = _TRUE; break; @@ -142,7 +141,6 @@ SwLedBlink1( SwLedOff(padapter, pLed); } - if (pHalData->CustomerID == RT_CID_DEFAULT) { if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) { if (!pLed1->bSWLedCtrl) { @@ -453,7 +451,6 @@ SwLedBlink3( if (pLed->bLedOn) SwLedOff(padapter, pLed); - } pLed->bLedBlinkInProgress = _FALSE; } else { @@ -497,14 +494,12 @@ SwLedBlink3( } break; - default: break; } } - void SwLedBlink4( PLED_USB pLed @@ -688,9 +683,6 @@ SwLedBlink4( default: break; } - - - } void @@ -742,7 +734,6 @@ SwLedBlink5( } break; - case LED_BLINK_TXRX: pLed->BlinkTimes--; if (pLed->BlinkTimes == 0) @@ -778,9 +769,6 @@ SwLedBlink5( default: break; } - - - } void @@ -798,7 +786,6 @@ SwLedBlink6( } else { SwLedOff(padapter, pLed); } - } void @@ -886,8 +873,6 @@ SwLedBlink7( default: break; } - - } void @@ -903,8 +888,6 @@ SwLedBlink8( } else { SwLedOff(Adapter, pLed); } - - } /* page added for Belkin AC950. 20120813 */ @@ -925,7 +908,6 @@ SwLedBlink9( } /* RTW_INFO("%s, pLed->CurrLedState=%d, pLed->BlinkingLedState=%d\n", __FUNCTION__, pLed->CurrLedState, pLed->BlinkingLedState); */ - switch (pLed->CurrLedState) { case RTW_LED_ON: SwLedOn(Adapter, pLed); @@ -1140,7 +1122,6 @@ SwLedBlink9( default: break; } - } /* page added for Netgear A6200V2. 20120827 */ @@ -1160,7 +1141,6 @@ SwLedBlink10( SwLedOff(Adapter, pLed); } - switch (pLed->CurrLedState) { case RTW_LED_ON: SwLedOn(Adapter, pLed); @@ -1341,7 +1321,6 @@ SwLedBlink10( break; } - } void @@ -1478,9 +1457,6 @@ SwLedBlink12( default: break; } - - - } VOID @@ -1540,8 +1516,6 @@ SwLedBlink13( LinkBlinkCnt = 0; break; } - - } VOID @@ -1598,7 +1572,6 @@ SwLedBlink14( LinkBlinkCnt = 0; break; } - } VOID @@ -1726,7 +1699,6 @@ SwLedBlink15( LinkBlinkCnt = 0; break; } - } /* @@ -1974,7 +1946,6 @@ SwLedControlMode0( break; } - } /* ALPHA, added by chiyoko, 20090106 */ @@ -2132,7 +2103,6 @@ SwLedControlMode1( } break; - case LED_CTL_STOP_WPS: if (pLed->bLedNoLinkBlinkInProgress == _TRUE) { _cancel_timer_ex(&(pLed->BlinkTimer)); @@ -2211,7 +2181,6 @@ SwLedControlMode1( break; } - } /* Arcadyan/Sitecom , added by chiyoko, 20090216 */ @@ -2350,7 +2319,6 @@ SwLedControlMode2( break; } - } /* COREGA, added by chiyoko, 20090316 */ @@ -2504,7 +2472,6 @@ SwLedControlMode3( break; } - } @@ -2808,11 +2775,8 @@ SwLedControlMode4( break; } - } - - /* Sercomm-Belkin, added by chiyoko, 20090415 */ static void SwLedControlMode5( @@ -2889,7 +2853,6 @@ SwLedControlMode5( break; } - } /* WNC-Corega, added by chiyoko, 20090902 */ @@ -2920,7 +2883,6 @@ SwLedControlMode6( default: break; } - } /* Netgear, added by sinda, 2011/11/11 */ @@ -3014,7 +2976,6 @@ SwLedControlMode7( break; - case LED_CTL_STOP_WPS_FAIL: case LED_CTL_STOP_WPS_FAIL_OVERLAP: /* WPS session overlap */ if (pLed->bLedWPSBlinkInProgress) { @@ -3060,7 +3021,6 @@ SwLedControlMode7( break; } - } void @@ -3095,8 +3055,6 @@ SwLedControlMode8( default: break; } - - } /* page added for Belkin AC950, 20120813 */ @@ -3287,7 +3245,6 @@ SwLedControlMode9( if (pLed1->bLedOn) _set_timer(&(pLed1->BlinkTimer), 0); - break; case LED_CTL_STOP_WPS_FAIL: /* WPS authentication fail */ @@ -3374,7 +3331,6 @@ SwLedControlMode9( pLed1->bLedWPSBlinkInProgress = _FALSE; } - pLed1->BlinkingLedState = LED_UNKNOWN; SwLedOff(Adapter, pLed); SwLedOff(Adapter, pLed1); @@ -3398,7 +3354,6 @@ SwLedControlMode9( break; } - } /* page added for Netgear A6200V2, 20120827 */ @@ -3537,7 +3492,6 @@ SwLedControlMode10( _set_timer(&(pLed1->BlinkTimer), LED_BLINK_NORMAL_INTERVAL + LED_BLINK_LINK_INTERVAL_NETGEAR); } - break; case LED_CTL_STOP_WPS: /* WPS connect success */ @@ -3591,12 +3545,10 @@ SwLedControlMode10( break; - default: break; } - } /* Edimax-ASUS, added by Page, 20121221 */ @@ -3651,7 +3603,6 @@ SwLedControlMode11( break; - case LED_CTL_STOP_WPS: case LED_CTL_STOP_WPS_FAIL: if (pLed->bLedBlinkInProgress == _TRUE) { @@ -3694,7 +3645,6 @@ SwLedControlMode11( break; } - } /* page added for NEC */ @@ -3775,7 +3725,6 @@ SwLedControlMode12( break; } - } /* Maddest add for NETGEAR R6100 */ @@ -3795,7 +3744,6 @@ SwLedControlMode13( if (pLed->bLedWPSBlinkInProgress) return; - pLed->CurrLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON; if (pLed->bLedBlinkInProgress) { @@ -3850,7 +3798,6 @@ SwLedControlMode13( break; - case LED_CTL_STOP_WPS_FAIL: case LED_CTL_STOP_WPS_FAIL_OVERLAP: /* WPS session overlap */ if (pLed->bLedWPSBlinkInProgress) { @@ -3920,8 +3867,6 @@ SwLedControlMode13( break; } - - } /* Maddest add for DNI Buffalo */ @@ -4244,7 +4189,6 @@ LedControlUSB( default: break; } - } /* @@ -4289,7 +4233,6 @@ InitLed( _init_workitem(&(pLed->BlinkWorkItem), BlinkWorkItemCallback, pLed); } - /* * Description: * DeInitialize an LED_871x object. From f24a0d0723ba95fa30ef128cbf557aeb80e775fb Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Fri, 27 Oct 2017 10:24:32 +0200 Subject: [PATCH 22/22] indention and spacing cleanup --- core/rtw_cmd.c | 104 +------------------------------------------------ 1 file changed, 1 insertion(+), 103 deletions(-) diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index 8bff0d0..1dc8d31 100644 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -35,12 +35,10 @@ sint _rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) { sint res = _SUCCESS; - _rtw_init_sema(&(pcmdpriv->cmd_queue_sema), 0); /* _rtw_init_sema(&(pcmdpriv->cmd_done_sema), 0); */ _rtw_init_sema(&(pcmdpriv->terminate_cmdthread_sema), 0); - _rtw_init_queue(&(pcmdpriv->cmd_queue)); /* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */ @@ -70,7 +68,6 @@ sint _rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) _rtw_mutex_init(&pcmdpriv->sctx_mutex); exit: - return res; } @@ -82,7 +79,6 @@ sint _rtw_init_evt_priv(struct evt_priv *pevtpriv) { sint res = _SUCCESS; - #ifdef CONFIG_H2CLBK _rtw_init_sema(&(pevtpriv->lbkevt_done), 0); pevtpriv->lbkevt_limit = 0; @@ -106,7 +102,6 @@ sint _rtw_init_evt_priv(struct evt_priv *pevtpriv) } pevtpriv->evt_buf = pevtpriv->evt_allocated_buf + 4 - ((unsigned int)(pevtpriv->evt_allocated_buf) & 3); - #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) pevtpriv->allocated_c2h_mem = rtw_zmalloc(C2H_MEM_SZ + 4); @@ -140,19 +135,16 @@ exit: pevtpriv->c2h_queue = rtw_cbuf_alloc(C2H_QUEUE_MAX_LEN + 1); #endif - return res; } void _rtw_free_evt_priv(struct evt_priv *pevtpriv) { - #ifdef CONFIG_EVENT_THREAD_MODE _rtw_free_sema(&(pevtpriv->evt_notify)); _rtw_free_sema(&(pevtpriv->terminate_evtthread_sema)); - if (pevtpriv->evt_allocated_buf) rtw_mfree(pevtpriv->evt_allocated_buf, MAX_EVTSZ + 4); #endif @@ -171,8 +163,6 @@ void _rtw_free_evt_priv(struct evt_priv *pevtpriv) rtw_cbuf_free(pevtpriv->c2h_queue); #endif - - } void _rtw_free_cmd_priv(struct cmd_priv *pcmdpriv) @@ -211,7 +201,6 @@ sint _rtw_enqueue_cmd(_queue *queue, struct cmd_obj *obj, bool to_head) { _irqL irqL; - if (obj == NULL) goto exit; @@ -264,7 +253,6 @@ sint _rtw_enqueue_cmd(_queue *queue, struct cmd_obj *obj, bool to_head) exit: - return _SUCCESS; } @@ -273,7 +261,6 @@ struct cmd_obj *_rtw_dequeue_cmd(_queue *queue) _irqL irqL; struct cmd_obj *obj; - /* _enter_critical_bh(&(queue->lock), &irqL); */ _enter_critical(&queue->lock, &irqL); @@ -284,7 +271,6 @@ struct cmd_obj *_rtw_dequeue_cmd(_queue *queue) } #endif /* DBG_CMD_QUEUE */ - if (rtw_is_list_empty(&(queue->queue))) obj = NULL; else { @@ -324,7 +310,6 @@ struct cmd_obj *_rtw_dequeue_cmd(_queue *queue) /* _exit_critical_bh(&(queue->lock), &irqL); */ _exit_critical(&queue->lock, &irqL); - return obj; } @@ -401,14 +386,11 @@ int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) return _SUCCESS; } - - u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) { int res = _FAIL; PADAPTER padapter = pcmdpriv->padapter; - if (cmd_obj == NULL) goto exit; @@ -444,7 +426,6 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) exit: - return res; } @@ -452,7 +433,6 @@ struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv) { struct cmd_obj *cmd_obj; - cmd_obj = _rtw_dequeue_cmd(&pcmdpriv->cmd_queue); return cmd_obj; @@ -484,7 +464,6 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd) } - void rtw_stop_cmd_thread(_adapter *adapter) { if (adapter->cmdThread && @@ -519,7 +498,6 @@ thread_return rtw_cmd_thread(thread_context context) ATOMIC_SET(&(pcmdpriv->cmdthd_running), _TRUE); _rtw_up_sema(&pcmdpriv->terminate_cmdthread_sema); - while (1) { if (_rtw_down_sema(&pcmdpriv->cmd_queue_sema) == _FAIL) { RTW_PRINT(FUNC_ADPT_FMT" _rtw_down_sema(&pcmdpriv->cmd_queue_sema) return _FAIL, break\n", FUNC_ADPT_ARG(padapter)); @@ -703,7 +681,6 @@ post_process: } - #ifdef CONFIG_EVENT_THREAD_MODE u32 rtw_enqueue_evt(struct evt_priv *pevtpriv, struct evt_obj *obj) { @@ -711,7 +688,6 @@ u32 rtw_enqueue_evt(struct evt_priv *pevtpriv, struct evt_obj *obj) int res; _queue *queue = &pevtpriv->evt_queue; - res = _SUCCESS; if (obj == NULL) { @@ -729,7 +705,6 @@ u32 rtw_enqueue_evt(struct evt_priv *pevtpriv, struct evt_obj *obj) exit: - return res; } @@ -738,7 +713,6 @@ struct evt_obj *rtw_dequeue_evt(_queue *queue) _irqL irqL; struct evt_obj *pevtobj; - _enter_critical_bh(&queue->lock, &irqL); if (rtw_is_list_empty(&(queue->queue))) @@ -750,7 +724,6 @@ struct evt_obj *rtw_dequeue_evt(_queue *queue) _exit_critical_bh(&queue->lock, &irqL); - return pevtobj; } @@ -771,7 +744,6 @@ void rtw_evt_notify_isr(struct evt_priv *pevtpriv) } #endif - /* u8 rtw_setstandby_cmd(unsigned char *adapter) */ @@ -783,7 +755,6 @@ u8 rtw_setstandby_cmd(_adapter *padapter, uint action) u8 ret = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { ret = _FAIL; @@ -805,7 +776,6 @@ u8 rtw_setstandby_cmd(_adapter *padapter, uint action) exit: - return ret; } @@ -826,7 +796,6 @@ u8 rtw_sitesurvey_cmd(_adapter *padapter, NDIS_802_11_SSID *ssid, int ssid_num, struct wifidirect_info *pwdinfo = &(padapter->wdinfo); #endif /* CONFIG_P2P */ - #ifdef CONFIG_LPS if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1); @@ -849,7 +818,6 @@ u8 rtw_sitesurvey_cmd(_adapter *padapter, NDIS_802_11_SSID *ssid, int ssid_num, rtw_free_network_queue(padapter, _FALSE); - init_h2fwcmd_w_parm_no_rsp(ph2c, psurveyPara, GEN_CMD_CODE(_SiteSurvey)); /* psurveyPara->bsslimit = 48; */ @@ -906,7 +874,6 @@ u8 rtw_sitesurvey_cmd(_adapter *padapter, NDIS_802_11_SSID *ssid, int ssid_num, } else _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); - return res; } @@ -917,7 +884,6 @@ u8 rtw_setdatarate_cmd(_adapter *padapter, u8 *rateset) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { res = _FAIL; @@ -942,7 +908,6 @@ u8 rtw_setdatarate_cmd(_adapter *padapter, u8 *rateset) res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: - return res; } @@ -953,7 +918,6 @@ u8 rtw_setbasicrate_cmd(_adapter *padapter, u8 *rateset) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { res = _FAIL; @@ -974,11 +938,9 @@ u8 rtw_setbasicrate_cmd(_adapter *padapter, u8 *rateset) res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: - return res; } - /* unsigned char rtw_setphy_cmd(unsigned char *adapter) @@ -995,7 +957,6 @@ u8 rtw_setphy_cmd(_adapter *padapter, u8 modem, u8 ch) * struct registry_priv* pregistry_priv = &padapter->registrypriv; */ u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { res = _FAIL; @@ -1011,7 +972,6 @@ u8 rtw_setphy_cmd(_adapter *padapter, u8 modem, u8 ch) init_h2fwcmd_w_parm_no_rsp(ph2c, psetphypara, _SetPhy_CMD_); - psetphypara->modem = modem; psetphypara->rfchannel = ch; @@ -1155,7 +1115,6 @@ u8 rtw_getrfreg_cmd(_adapter *padapter, u8 offset, u8 *pval) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { res = _FAIL; @@ -1182,7 +1141,6 @@ u8 rtw_getrfreg_cmd(_adapter *padapter, u8 offset, u8 *pval) exit: - return res; } @@ -1382,7 +1340,6 @@ u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network *pnetwork) res = _FAIL; - goto exit; } @@ -1409,7 +1366,6 @@ u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network *pnetwork) psecnetwork->IELength = rtw_restruct_sec_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0], pnetwork->network.IELength); - pqospriv->qos_option = 0; if (pregistrypriv->wmm_enable) { @@ -1500,7 +1456,6 @@ u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network *pnetwork) exit: - return res; } @@ -1511,8 +1466,6 @@ u8 rtw_disassoc_cmd(_adapter *padapter, u32 deauth_timeout_ms, bool enqueue) /* struct cmd_priv *cmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - - /* prepare cmd parameter */ param = (struct disconnect_parm *)rtw_zmalloc(sizeof(*param)); if (param == NULL) { @@ -1540,7 +1493,6 @@ u8 rtw_disassoc_cmd(_adapter *padapter, u32 deauth_timeout_ms, bool enqueue) /* exit: - return res; } @@ -1576,7 +1528,6 @@ u8 rtw_setopmode_cmd(_adapter *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE net } exit: - return res; } @@ -1591,7 +1542,6 @@ u8 rtw_setstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 key_type, bool struct security_priv *psecuritypriv = &padapter->securitypriv; u8 res = _SUCCESS; - psetstakey_para = (struct set_stakey_parm *)rtw_zmalloc(sizeof(struct set_stakey_parm)); if (psetstakey_para == NULL) { res = _FAIL; @@ -1645,7 +1595,6 @@ u8 rtw_setstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 key_type, bool } exit: - return res; } @@ -1660,7 +1609,6 @@ u8 rtw_clearstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 enqueue) s16 cam_id = 0; u8 res = _SUCCESS; - if (!enqueue) { while ((cam_id = rtw_camid_search(padapter, sta->hwaddr, -1, -1)) >= 0) { RTW_PRINT("clear key for addr:"MAC_FMT", camid:%d\n", MAC_ARG(sta->hwaddr), cam_id); @@ -1703,7 +1651,6 @@ u8 rtw_clearstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 enqueue) exit: - return res; } @@ -1783,7 +1730,6 @@ u8 rtw_setassocsta_cmd(_adapter *padapter, u8 *mac_addr) u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { res = _FAIL; @@ -1814,7 +1760,6 @@ u8 rtw_setassocsta_cmd(_adapter *padapter, u8 *mac_addr) exit: - return res; } @@ -1826,7 +1771,6 @@ u8 rtw_addbareq_cmd(_adapter *padapter, u8 tid, u8 *addr) u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { res = _FAIL; @@ -1852,7 +1796,6 @@ u8 rtw_addbareq_cmd(_adapter *padapter, u8 tid, u8 *addr) exit: - return res; } @@ -1863,7 +1806,6 @@ u8 rtw_addbarsp_cmd(_adapter *padapter, u8 *addr, u16 tid, u8 status, u8 size, u struct addBaRsp_parm *paddBaRsp_parm; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { res = _FAIL; @@ -1890,7 +1832,6 @@ u8 rtw_addbarsp_cmd(_adapter *padapter, u8 *addr, u16 tid, u8 status, u8 size, u exit: - return res; } /* add for CONFIG_IEEE80211W, none 11w can use it */ @@ -1901,7 +1842,6 @@ u8 rtw_reset_securitypriv_cmd(_adapter *padapter) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { res = _FAIL; @@ -1922,13 +1862,11 @@ u8 rtw_reset_securitypriv_cmd(_adapter *padapter) init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); - /* rtw_enqueue_cmd(pcmdpriv, ph2c); */ res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: - return res; } @@ -1940,7 +1878,6 @@ u8 rtw_free_assoc_resources_cmd(_adapter *padapter) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { res = _FAIL; @@ -1961,13 +1898,11 @@ u8 rtw_free_assoc_resources_cmd(_adapter *padapter) init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); - /* rtw_enqueue_cmd(pcmdpriv, ph2c); */ res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: - return res; } @@ -1979,7 +1914,6 @@ u8 rtw_dynamic_chk_wk_cmd(_adapter *padapter) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - /* only primary padapter does this cmd */ ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); @@ -2001,13 +1935,11 @@ u8 rtw_dynamic_chk_wk_cmd(_adapter *padapter) pdrvextra_cmd_parm->pbuf = NULL; init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); - /* rtw_enqueue_cmd(pcmdpriv, ph2c); */ res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: - return res; } @@ -2020,7 +1952,6 @@ u8 rtw_set_ch_cmd(_adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 enqueue) u8 res = _SUCCESS; - RTW_INFO(FUNC_NDEV_FMT" ch:%u, bw:%u, ch_offset:%u\n", FUNC_NDEV_ARG(padapter->pnetdev), ch, bw, ch_offset); @@ -2074,7 +2005,6 @@ u8 _rtw_set_chplan_cmd(_adapter *adapter, int flags, u8 chplan, const struct cou struct submit_ctx sctx; u8 res = _SUCCESS; - /* check if allow software config */ if (swconfig && rtw_hal_is_disable_sw_channel_plan(adapter) == _TRUE) { res = _FAIL; @@ -2134,7 +2064,6 @@ u8 _rtw_set_chplan_cmd(_adapter *adapter, int flags, u8 chplan, const struct cou exit: - return res; } @@ -2174,8 +2103,6 @@ u8 rtw_led_blink_cmd(_adapter *padapter, PVOID pLed) u8 res = _SUCCESS; - - pcmdobj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (pcmdobj == NULL) { res = _FAIL; @@ -2196,7 +2123,6 @@ u8 rtw_led_blink_cmd(_adapter *padapter, PVOID pLed) exit: - return res; } @@ -2209,8 +2135,6 @@ u8 rtw_set_csa_cmd(_adapter *padapter, u8 new_ch_no) u8 res = _SUCCESS; - - pcmdobj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (pcmdobj == NULL) { res = _FAIL; @@ -2231,7 +2155,6 @@ u8 rtw_set_csa_cmd(_adapter *padapter, u8 new_ch_no) exit: - return res; } @@ -2244,10 +2167,8 @@ u8 rtw_tdls_cmd(_adapter *padapter, u8 *addr, u8 option) u8 res = _SUCCESS; - #ifdef CONFIG_TDLS - pcmdobj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (pcmdobj == NULL) { res = _FAIL; @@ -2273,8 +2194,6 @@ u8 rtw_tdls_cmd(_adapter *padapter, u8 *addr, u8 option) exit: - - return res; } @@ -2285,7 +2204,6 @@ u8 rtw_enable_hw_update_tsf_cmd(_adapter *padapter) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { res = _FAIL; @@ -2343,7 +2261,6 @@ u8 traffic_status_watchdog(_adapter *padapter, u8 from_timer) } BusyThreshold = BusyThresholdHigh; - /* */ /* Determine if our traffic is busy now */ /* */ @@ -2527,7 +2444,6 @@ u8 traffic_status_watchdog(_adapter *padapter, u8 from_timer) } - /* for 11n Logo 4.2.31/4.2.32 */ static void dynamic_update_bcn_check(_adapter *padapter) { @@ -2561,7 +2477,7 @@ static void dynamic_update_bcn_check(_adapter *padapter) if (_FALSE != ATOMIC_READ(&pmlmepriv->olbc) && _FALSE != ATOMIC_READ(&pmlmepriv->olbc_ht)) { - + if (rtw_ht_operation_update(padapter) > 0) { update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE); update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _TRUE); @@ -2647,7 +2563,6 @@ void lps_ctrl_wk_hdl(_adapter *padapter, u8 lps_ctrl_type) struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); u8 mstatus; - if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE) || (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE)) return; @@ -2726,7 +2641,6 @@ u8 rtw_lps_ctrl_wk_cmd(_adapter *padapter, u8 lps_ctrl_type, u8 enqueue) /* struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); */ u8 res = _SUCCESS; - /* if(!pwrctrlpriv->bLeisurePs) */ /* return res; */ @@ -2757,7 +2671,6 @@ u8 rtw_lps_ctrl_wk_cmd(_adapter *padapter, u8 lps_ctrl_type, u8 enqueue) exit: - return res; } @@ -2774,7 +2687,6 @@ u8 rtw_dm_in_lps_wk_cmd(_adapter *padapter) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { res = _FAIL; @@ -2919,7 +2831,6 @@ u8 rtw_rpt_timer_cfg_cmd(_adapter *padapter, u16 minRptTime) res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: - return res; } @@ -2976,7 +2887,6 @@ u8 rtw_antenna_select_cmd(_adapter *padapter, u8 antenna, u8 enqueue) antenna_select_wk_hdl(padapter, antenna); exit: - return res; } @@ -3049,7 +2959,6 @@ u8 p2p_protocol_wk_cmd(_adapter *padapter, int intCmdType) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return res; @@ -3077,7 +2986,6 @@ u8 p2p_protocol_wk_cmd(_adapter *padapter, int intCmdType) exit: - return res; } @@ -3119,7 +3027,6 @@ u8 rtw_ps_cmd(_adapter *padapter) exit: - return res; } @@ -3783,7 +3690,6 @@ u8 rtw_run_in_thread_cmd(PADAPTER padapter, void (*func)(void *), void *context) res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: - return res; } @@ -4300,11 +4206,9 @@ exit: return; } - void rtw_getmacreg_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd) { - rtw_free_cmd_obj(pcmd); } @@ -4313,7 +4217,6 @@ void rtw_joinbss_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - if (pcmd->res == H2C_DROPPED) { /* TODO: cancel timer and do timeout handler directly... */ /* need to make timeout handlerOS independent */ @@ -4380,8 +4283,6 @@ exit: return; } - - void rtw_setstaKey_cmdrsp_callback(_adapter *padapter , struct cmd_obj *pcmd) { @@ -4389,7 +4290,6 @@ void rtw_setstaKey_cmdrsp_callback(_adapter *padapter , struct cmd_obj *pcmd) struct set_stakey_rsp *psetstakey_rsp = (struct set_stakey_rsp *)(pcmd->rsp); struct sta_info *psta = rtw_get_stainfo(pstapriv, psetstakey_rsp->addr); - if (psta == NULL) { goto exit; } @@ -4411,7 +4311,6 @@ void rtw_setassocsta_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd) struct set_assocsta_rsp *passocsta_rsp = (struct set_assocsta_rsp *)(pcmd->rsp); struct sta_info *psta = rtw_get_stainfo(pstapriv, passocsta_parm->addr); - if (psta == NULL) { goto exit; } @@ -4441,5 +4340,4 @@ void rtw_getrttbl_cmd_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd) padapter->mppriv.workparam.bcompleted = _TRUE; #endif - }