diff --git a/Makefile b/Makefile index fc167d8..0612dd7 100755 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ EXTRA_CFLAGS += -Wno-type-limits GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc ) ifeq ($(GCC_VER_49),1) -EXTRA_CFLAGS += -Wno-date-time # Fix compile error && warning on gcc 4.9 and later +EXTRA_CFLAGS += -Wno-date-time -Wno-error=date-time # Fix compile error && warning on gcc 4.9 and later endif EXTRA_CFLAGS += -I$(src)/include diff --git a/Realtek_Changelog.txt b/Realtek_Changelog.txt index 7f7672f..866c2ff 100644 --- a/Realtek_Changelog.txt +++ b/Realtek_Changelog.txt @@ -5,11 +5,11 @@ Release History: v5.2.20.2_28373.20180619 - Update phydm to improve TP stability + Update phydm to improve TP stability v5.2.20.1_27761.20180508 - Support WiFi-HAL for Android 8 + Support WiFi-HAL for Android 8 v5.2.20_25672.20171213 diff --git a/dkms.conf b/dkms.conf index a091c22..c632225 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,5 +1,5 @@ PACKAGE_NAME="realtek-rtl88xxau" -PACKAGE_VERSION="5.2.20.2~20180806" +PACKAGE_VERSION="5.2.20.2~20180808" CLEAN="'make' clean" BUILT_MODULE_NAME[0]=88XXau PROCS_NUM=`nproc` diff --git a/os_dep/linux/api_level.h b/os_dep/linux/api_level.h new file mode 100644 index 0000000..d63cdb7 --- /dev/null +++ b/os_dep/linux/api_level.h @@ -0,0 +1,12 @@ +#ifndef _API_LEVEL_H_ +#define _API_LEVEL_H_ +/* +* Use CFG80211_API_LEVEL instead of LINUX_VERSION_CODE to adopt API changes. +* Some older kernels may have backported cfg80211/nl80211 API. +*/ + +#ifndef CFG80211_API_LEVEL +#define CFG80211_API_LEVEL LINUX_VERSION_CODE +#endif /* CFG80211_API_LEVEL */ +#endif + diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 461f7b9..806b0d8 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -18,8 +18,9 @@ #include #ifdef CONFIG_IOCTL_CFG80211 +#include "api_level.h" -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) +#if (CFG80211_API_LEVEL >= 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) @@ -116,7 +117,7 @@ static const u32 rtw_cipher_suites[] = { .max_power = 30, \ } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 0, 0)) /* if wowlan is not supported, kernel generate a disconnect at each suspend * cf: /net/wireless/sysfs.c, so register a stub wowlan. * Moreover wowlan has to be enabled via a the nl80211_set_wowlan callback. @@ -127,7 +128,7 @@ static const struct wiphy_wowlan_support wowlan_stub = { .n_patterns = 0, .pattern_max_len = 0, .pattern_min_len = 0, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 10, 0)) .max_pkt_offset = 0, #endif }; @@ -525,7 +526,7 @@ void rtw_spt_band_free(struct ieee80211_supported_band *spt_band) rtw_mfree((u8 *)spt_band, size); } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) static const struct ieee80211_txrx_stypes rtw_cfg80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = { [NL80211_IFTYPE_ADHOC] = { @@ -761,7 +762,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net goto exit; } -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38)) +#if (CFG80211_API_LEVEL < KERNEL_VERSION(2, 6, 38)) #ifndef COMPAT_KERNEL_RELEASE /* patch for cfg80211, update beacon ies to information_elements */ if (pnetwork->network.Reserved[0] == BSS_TYPE_BCN) { /* WIFI_BEACON */ @@ -772,7 +773,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net } } #endif /* COMPAT_KERNEL_RELEASE */ -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38) */ +#endif /* CFG80211_API_LEVEL < KERNEL_VERSION(2, 6, 38) */ #if 0 { @@ -785,7 +786,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net } } #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) +#if CFG80211_API_LEVEL >= KERNEL_VERSION(3, 9, 0) cfg80211_put_bss(wiphy, bss); #else cfg80211_put_bss(bss); @@ -826,7 +827,7 @@ int rtw_cfg80211_check_bss(_adapter *padapter) pnetwork->InfrastructureMode == Ndis802_11Infrastructure?WLAN_CAPABILITY_ESS:WLAN_CAPABILITY_IBSS, pnetwork->InfrastructureMode == Ndis802_11Infrastructure?WLAN_CAPABILITY_ESS:WLAN_CAPABILITY_IBSS); #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) +#if CFG80211_API_LEVEL >= KERNEL_VERSION(3, 9, 0) cfg80211_put_bss(padapter->rtw_wdev->wiphy, bss); #else cfg80211_put_bss(bss); @@ -897,7 +898,7 @@ void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter) RTW_PRINT(FUNC_ADPT_FMT" BSS not found !!\n", FUNC_ADPT_ARG(padapter)); } /* notify cfg80211 that device joined an IBSS */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 15, 0)) notify_channel = ieee80211_get_channel(wiphy, freq); cfg80211_ibss_joined(padapter->pnetdev, cur_network->network.MacAddress, notify_channel, GFP_ATOMIC); #else @@ -923,7 +924,7 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter) RTW_INFO(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); if (pwdev->iftype != NL80211_IFTYPE_STATION - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) && pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT #endif ) @@ -980,7 +981,7 @@ check_bss: _enter_critical_bh(&pwdev_priv->connect_req_lock, &irqL); if (rtw_to_roam(padapter) > 0) { - #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE) + #if CFG80211_API_LEVEL > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE) struct wiphy *wiphy = pwdev->wiphy; struct ieee80211_channel *notify_channel; u32 freq; @@ -1000,7 +1001,7 @@ check_bss: cfg80211_roamed(padapter->pnetdev, &roam_info, GFP_ATOMIC); #else cfg80211_roamed(padapter->pnetdev - #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE) + #if CFG80211_API_LEVEL > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE) , notify_channel #endif , cur_network->network.MacAddress @@ -1018,7 +1019,7 @@ check_bss: rtw_set_ft_status(padapter, RTW_FT_ASSOCIATED_STA); #endif } else { - #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) + #if CFG80211_API_LEVEL < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state); #endif @@ -1029,7 +1030,7 @@ check_bss: , pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6 , pmlmepriv->assoc_rsp_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 6 , WLAN_STATUS_SUCCESS, GFP_ATOMIC); - #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) + #if CFG80211_API_LEVEL < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) RTW_INFO("pwdev->sme_state(a)=%d\n", pwdev->sme_state); #endif } @@ -1056,7 +1057,7 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally reason = 0; if (pwdev->iftype != NL80211_IFTYPE_STATION - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) && pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT #endif ) @@ -1071,7 +1072,7 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); #if RTW_P2P_GROUP_INTERFACE - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) if (pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT) #endif #endif @@ -1085,7 +1086,7 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally _enter_critical_bh(&pwdev_priv->connect_req_lock, &irqL); if (padapter->ndev_unregistering || !rtw_wdev_not_indic_disco(pwdev_priv)) { - #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) + #if CFG80211_API_LEVEL < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state); if (pwdev->sme_state == CFG80211_SME_CONNECTING) { @@ -1633,11 +1634,11 @@ exit: } static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) u8 key_index, bool pairwise, const u8 *mac_addr, -#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) */ +#else /* (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) */ u8 key_index, const u8 *mac_addr, -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) */ +#endif /* (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) */ struct key_params *params) { char *alg_name; @@ -1656,9 +1657,9 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, RTW_INFO("key_len=0x%x\n", params->key_len); RTW_INFO("seq_len=0x%x\n", params->seq_len); RTW_INFO("key_index=%d\n", key_index); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) RTW_INFO("pairwise=%d\n", pairwise); -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) */ +#endif /* (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) */ param_len = sizeof(struct ieee_param) + params->key_len; param = (struct ieee_param *)rtw_malloc(param_len); @@ -1770,11 +1771,11 @@ addkey_end: } static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) u8 key_index, bool pairwise, const u8 *mac_addr, -#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) */ +#else /* (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) */ u8 key_index, const u8 *mac_addr, -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) */ +#endif /* (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) */ void *cookie, void (*callback)(void *cookie, struct key_params *)) { @@ -1802,11 +1803,11 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev, } static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) u8 key_index, bool pairwise, const u8 *mac_addr) -#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) */ +#else /* (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) */ u8 key_index, const u8 *mac_addr) -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) */ +#endif /* (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) */ { _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); struct security_priv *psecuritypriv = &padapter->securitypriv; @@ -1823,7 +1824,7 @@ static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, struct net_device *ndev, u8 key_index - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE) , bool unicast, bool multicast #endif ) @@ -1833,7 +1834,7 @@ static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, #define SET_DEF_KEY_PARAM_FMT " key_index=%d" #define SET_DEF_KEY_PARAM_ARG , key_index -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE) #define SET_DEF_KEY_PARAM_FMT_2_6_38 ", unicast=%d, multicast=%d" #define SET_DEF_KEY_PARAM_ARG_2_6_38 , unicast, multicast #else @@ -1867,7 +1868,7 @@ static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, return 0; } -#if defined(CONFIG_GTK_OL) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)) +#if defined(CONFIG_GTK_OL) && (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 1, 0)) static int cfg80211_rtw_set_rekey_data(struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_gtk_rekey_data *data) @@ -1904,7 +1905,7 @@ static int cfg80211_rtw_set_rekey_data(struct wiphy *wiphy, #endif /*CONFIG_GTK_OL*/ static int cfg80211_rtw_get_station(struct wiphy *wiphy, struct net_device *ndev, -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)) +#if (CFG80211_API_LEVEL < KERNEL_VERSION(3, 16, 0)) u8 *mac, #else const u8 *mac, @@ -2114,7 +2115,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, networkType = Ndis802_11IBSS; break; - #if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)) + #if defined(CONFIG_P2P) && ((CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)) case NL80211_IFTYPE_P2P_CLIENT: is_p2p = _TRUE; #endif @@ -2139,7 +2140,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, break; - #if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)) + #if defined(CONFIG_P2P) && ((CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)) case NL80211_IFTYPE_P2P_GO: is_p2p = _TRUE; #endif @@ -2279,7 +2280,7 @@ void rtw_cfg80211_unlink_bss(_adapter *padapter, struct wlan_network *pnetwork) if (bss) { cfg80211_unlink_bss(wiphy, bss); RTW_INFO("%s(): cfg80211_unlink %s!!\n", __func__, select_network.Ssid.Ssid); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) +#if CFG80211_API_LEVEL >= KERNEL_VERSION(3, 9, 0) cfg80211_put_bss(padapter->rtw_wdev->wiphy, bss); #else cfg80211_put_bss(bss); @@ -2567,7 +2568,7 @@ void rtw_cfg80211_indicate_scan_done_for_buddy(_adapter *padapter, bool bscan_ab #endif /* CONFIG_CONCURRENT_MODE */ static int cfg80211_rtw_scan(struct wiphy *wiphy - #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)) + #if (CFG80211_API_LEVEL < KERNEL_VERSION(3, 6, 0)) , struct net_device *ndev #endif , struct cfg80211_scan_request *request) @@ -3238,16 +3239,16 @@ static int cfg80211_rtw_join_ibss(struct wiphy *wiphy, struct net_device *ndev, struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX *)(&(pmlmeinfo->network)); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 8, 0)) struct cfg80211_chan_def *pch_def; #endif struct ieee80211_channel *pch; int ret = 0; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 8, 0)) pch_def = (struct cfg80211_chan_def *)(¶ms->chandef); pch = (struct ieee80211_channel *) pch_def->chan; -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)) +#elif (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 31)) pch = (struct ieee80211_channel *)(params->channel); #endif @@ -3631,10 +3632,10 @@ static int cfg80211_rtw_disconnect(struct wiphy *wiphy, struct net_device *ndev, } static int cfg80211_rtw_set_txpower(struct wiphy *wiphy, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 8, 0)) struct wireless_dev *wdev, #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 36)) || defined(COMPAT_KERNEL_RELEASE) enum nl80211_tx_power_setting type, int mbm) #else enum tx_power_setting type, int dbm) @@ -3643,7 +3644,7 @@ static int cfg80211_rtw_set_txpower(struct wiphy *wiphy, _adapter *padapter = wiphy_to_adapter(wiphy); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); int value; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2,6,36)) || defined(COMPAT_KERNEL_RELEASE) value = mbm/100; #else value = dbm; @@ -3691,7 +3692,7 @@ if(type == NL80211_TX_POWER_FIXED) { } static int cfg80211_rtw_get_txpower(struct wiphy *wiphy, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 8, 0)) struct wireless_dev *wdev, #endif int *dbm) @@ -3865,7 +3866,7 @@ void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint f #ifdef COMPAT_KERNEL_RELEASE rtw_cfg80211_rx_mgmt(pwdev, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); - #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER) + #elif (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER) rtw_cfg80211_rx_mgmt(pwdev, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); #else /* COMPAT_KERNEL_RELEASE */ { @@ -3928,7 +3929,7 @@ void rtw_cfg80211_indicate_sta_disassoc(_adapter *padapter, unsigned char *da, u #ifdef COMPAT_KERNEL_RELEASE rtw_cfg80211_rx_mgmt(wdev, freq, 0, mgmt_buf, frame_len, GFP_ATOMIC); - #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER) + #elif (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER) rtw_cfg80211_rx_mgmt(wdev, freq, 0, mgmt_buf, frame_len, GFP_ATOMIC); #else /* COMPAT_KERNEL_RELEASE */ cfg80211_send_disassoc(padapter->pnetdev, mgmt_buf, frame_len); @@ -4119,7 +4120,7 @@ static int rtw_cfg80211_monitor_if_set_mac_address(struct net_device *ndev, void return ret; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 29)) static const struct net_device_ops rtw_cfg80211_monitor_if_ops = { .ndo_open = rtw_cfg80211_monitor_if_open, .ndo_stop = rtw_cfg80211_monitor_if_close, @@ -4462,7 +4463,7 @@ static int rtw_add_beacon(_adapter *adapter, const u8 *head, size_t head_len, co return ret; } -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)) && !defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL < KERNEL_VERSION(3, 4, 0)) && !defined(COMPAT_KERNEL_RELEASE) static int cfg80211_rtw_add_beacon(struct wiphy *wiphy, struct net_device *ndev, struct beacon_parameters *info) { @@ -4553,9 +4554,9 @@ static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev) return 0; } -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)) */ +#endif /* (CFG80211_API_LEVEL < KERNEL_VERSION(3, 4, 0)) */ -#if CONFIG_RTW_MACADDR_ACL && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) +#if CONFIG_RTW_MACADDR_ACL && (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 9, 0)) static int cfg80211_rtw_set_mac_acl(struct wiphy *wiphy, struct net_device *ndev, const struct cfg80211_acl_data *params) { @@ -4597,7 +4598,7 @@ exit: #endif /* CONFIG_RTW_MACADDR_ACL && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) */ static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev, -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)) +#if (CFG80211_API_LEVEL < KERNEL_VERSION(3, 16, 0)) u8 *mac, #else const u8 *mac, @@ -4629,9 +4630,9 @@ exit: } static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev, -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)) +#if (CFG80211_API_LEVEL < KERNEL_VERSION(3, 16, 0)) u8 *mac -#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)) +#elif (CFG80211_API_LEVEL < KERNEL_VERSION(3, 19, 0)) const u8 *mac #else struct station_del_parameters *params @@ -4651,7 +4652,7 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev RTW_INFO("+"FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)) +#if (CFG80211_API_LEVEL < KERNEL_VERSION(3, 19, 0)) target_mac = mac; #else target_mac = params->mac; @@ -4730,7 +4731,7 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev } static int cfg80211_rtw_change_station(struct wiphy *wiphy, struct net_device *ndev, -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)) +#if (CFG80211_API_LEVEL < KERNEL_VERSION(3, 16, 0)) u8 *mac, #else const u8 *mac, @@ -4922,7 +4923,7 @@ static int cfg80211_rtw_get_channel(struct wiphy *wiphy, struct wireless_dev *wd } static int cfg80211_rtw_set_channel(struct wiphy *wiphy - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 35)) , struct net_device *ndev #endif , struct ieee80211_channel *chan, enum nl80211_channel_type channel_type) @@ -4936,7 +4937,7 @@ static int cfg80211_rtw_set_channel(struct wiphy *wiphy int chan_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; int chan_width = CHANNEL_WIDTH_20; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 35)) RTW_INFO(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); #endif @@ -4969,7 +4970,7 @@ static int cfg80211_rtw_set_channel(struct wiphy *wiphy } static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 8, 0)) , struct cfg80211_chan_def *chandef #else , struct ieee80211_channel *chan @@ -4977,7 +4978,7 @@ static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy #endif ) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 8, 0)) struct ieee80211_channel *chan = chandef->chan; #endif @@ -4986,7 +4987,7 @@ static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy int target_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; int target_width = CHANNEL_WIDTH_20; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 8, 0)) #ifdef CONFIG_DEBUG_CFG80211 RTW_INFO("center_freq %u Mhz ch %u width %u freq1 %u freq2 %u\n" , chan->center_freq @@ -5022,7 +5023,7 @@ static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy target_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; break; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 11, 0)) case NL80211_CHAN_WIDTH_5: case NL80211_CHAN_WIDTH_10: #endif @@ -5033,7 +5034,7 @@ static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy } #else #ifdef CONFIG_DEBUG_CFG80211 - RTW_INFO("center_freq %u Mhz ch %u channel_type %u\n" + RTW_INFO("center_freq %u MHz ch %u channel_type %u\n" , chan->center_freq , chan->hw_value , channel_type); @@ -5100,7 +5101,7 @@ void rtw_cfg80211_rx_probe_request(_adapter *adapter, union recv_frame *rframe) RTW_INFO("RTW_Rx: probe request, ch=%d(%d)\n", ch, sch); #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) rtw_cfg80211_rx_mgmt(wdev, freq, 0, frame, frame_len, GFP_ATOMIC); #else cfg80211_rx_action(adapter->pnetdev, freq, frame, frame_len, GFP_ATOMIC); @@ -5131,7 +5132,7 @@ void rtw_cfg80211_rx_action_p2p(_adapter *adapter, union recv_frame *rframe) indicate: -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) rtw_cfg80211_rx_mgmt(wdev, freq, 0, frame, frame_len, GFP_ATOMIC); #else cfg80211_rx_action(adapter->pnetdev, freq, frame, frame_len, GFP_ATOMIC); @@ -5199,7 +5200,7 @@ indicate: RTW_INFO("redirect to pd_wdev:%p\n", wdev); #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) rtw_cfg80211_rx_mgmt(wdev, freq, 0, frame, frame_len, GFP_ATOMIC); #else cfg80211_rx_action(adapter->pnetdev, freq, frame, frame_len, GFP_ATOMIC); @@ -5226,7 +5227,7 @@ void rtw_cfg80211_rx_action(_adapter *adapter, union recv_frame *rframe, const c rtw_mi_scan_abort(adapter, _FALSE); /*rtw_scan_abort_no_wait*/ } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) rtw_cfg80211_rx_mgmt(wdev, freq, 0, frame, frame_len, GFP_ATOMIC); #else cfg80211_rx_action(adapter->pnetdev, freq, frame, frame_len, GFP_ATOMIC); @@ -5518,13 +5519,13 @@ inline bool rtw_cfg80211_get_is_roch(_adapter *adapter) } static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 6, 0)) struct wireless_dev *wdev, #else struct net_device *ndev, #endif struct ieee80211_channel *channel, -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) +#if (CFG80211_API_LEVEL < KERNEL_VERSION(3, 8, 0)) enum nl80211_channel_type channel_type, #endif unsigned int duration, u64 *cookie) @@ -5539,7 +5540,7 @@ static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy, struct cfg80211_wifidirect_info *pcfg80211_wdinfo; u8 is_p2p_find = _FALSE; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 6, 0)) #if defined(RTW_DEDICATED_P2P_DEVICE) if (wdev == wiphy_to_pd_wdev(wiphy)) padapter = wiphy_to_adapter(wiphy); @@ -5649,7 +5650,7 @@ static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy, pcfg80211_wdinfo->remain_on_ch_cookie = *cookie; pcfg80211_wdinfo->last_ro_ch_time = rtw_get_current_time(); _rtw_memcpy(&pcfg80211_wdinfo->remain_on_ch_channel, channel, sizeof(struct ieee80211_channel)); - #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) + #if (CFG80211_API_LEVEL < KERNEL_VERSION(3, 8, 0)) pcfg80211_wdinfo->remain_on_ch_type = channel_type; #endif pcfg80211_wdinfo->restore_channel = rtw_get_oper_ch(padapter); @@ -5663,7 +5664,7 @@ exit: } static s32 cfg80211_rtw_cancel_remain_on_channel(struct wiphy *wiphy, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 6, 0)) struct wireless_dev *wdev, #else struct net_device *ndev, @@ -6087,30 +6088,30 @@ u8 rtw_mgnt_tx_handler(_adapter *adapter, u8 *buf) } static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 6, 0)) struct wireless_dev *wdev, #else struct net_device *ndev, #endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL < KERNEL_VERSION(3, 14, 0)) || defined(COMPAT_KERNEL_RELEASE) struct ieee80211_channel *chan, - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE) bool offchan, #endif - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 34)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) enum nl80211_channel_type channel_type, #endif - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 36)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) bool channel_type_valid, #endif - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE) unsigned int wait, #endif const u8 *buf, size_t len, - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 2, 0)) bool no_cck, #endif - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 3, 0)) bool dont_wait_for_ack, #endif #else @@ -6118,7 +6119,7 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy, #endif u64 *cookie) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 14, 0)) || defined(COMPAT_KERNEL_RELEASE) struct ieee80211_channel *chan = params->chan; bool offchan = params->offchan; unsigned int wait = params->wait; @@ -6183,27 +6184,27 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy, #ifdef CONFIG_DEBUG_CFG80211 RTW_INFO(FUNC_ADPT_FMT"%s len=%zu, ch=%d" - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 34)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) ", ch_type=%d" #endif - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 36)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) ", channel_type_valid=%d" #endif "\n", FUNC_ADPT_ARG(padapter), wdev == wiphy_to_pd_wdev(wiphy) ? " PD" : "" , len, tx_ch - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 34)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) , channel_type #endif - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 34)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) , channel_type_valid #endif ); #endif /* CONFIG_DEBUG_CFG80211 */ /* indicate ack before issue frame to avoid racing with rsp frame */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) rtw_cfg80211_mgmt_tx_status(wdev, *cookie, buf, len, ack, GFP_KERNEL); -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) && LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 36)) +#elif (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 34) && LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 36)) cfg80211_action_tx_status(ndev, *cookie, buf, len, ack, GFP_KERNEL); #endif @@ -6316,14 +6317,14 @@ exit: } static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 6, 0)) struct wireless_dev *wdev, #else struct net_device *ndev, #endif u16 frame_type, bool reg) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 6, 0)) struct net_device *ndev = wdev_to_ndev(wdev); #endif _adapter *adapter; @@ -6359,10 +6360,10 @@ exit: return; } -#if defined(CONFIG_TDLS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)) +#if defined(CONFIG_TDLS) && (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 2, 0)) static int cfg80211_rtw_tdls_mgmt(struct wiphy *wiphy, struct net_device *ndev, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 16, 0)) const u8 *peer, #else u8 *peer, @@ -6370,10 +6371,10 @@ static int cfg80211_rtw_tdls_mgmt(struct wiphy *wiphy, u8 action_code, u8 dialog_token, u16 status_code, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 15, 0)) u32 peer_capability, #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 17, 0)) bool initiator, #endif const u8 *buf, @@ -6458,7 +6459,7 @@ discard: static int cfg80211_rtw_tdls_oper(struct wiphy *wiphy, struct net_device *ndev, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 16, 0)) const u8 *peer, #else u8 *peer, @@ -6544,7 +6545,7 @@ static int cfg80211_rtw_tdls_oper(struct wiphy *wiphy, } #endif /* CONFIG_TDLS */ -#if defined(CONFIG_PNO_SUPPORT) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) +#if defined(CONFIG_PNO_SUPPORT) && (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 0, 0)) static int cfg80211_rtw_sched_scan_start(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_sched_scan_request *request) @@ -6818,7 +6819,7 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu /* printk("config_method in wpsie of probe_resp = 0x%x\n", be16_to_cpu(*puconfig_method)); */ #endif - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) /* for WIFI-DIRECT LOGO 4.2.2, AUTO GO can't set PUSH_BUTTON flags */ if (wdev->iftype == NL80211_IFTYPE_P2P_GO) { uconfig_method = WPS_CM_PUSH_BUTTON; @@ -7378,12 +7379,12 @@ void rtw_cfg80211_init_wiphy(_adapter *padapter) } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 0, 0)) struct ieee80211_iface_limit rtw_limits[] = { { .max = 2, .types = BIT(NL80211_IFTYPE_STATION) - #if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)) + #if defined(CONFIG_P2P) && ((CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)) | BIT(NL80211_IFTYPE_P2P_CLIENT) #endif }, @@ -7391,7 +7392,7 @@ struct ieee80211_iface_limit rtw_limits[] = { { .max = 1, .types = BIT(NL80211_IFTYPE_AP) - #if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)) + #if defined(CONFIG_P2P) && ((CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)) | BIT(NL80211_IFTYPE_P2P_GO) #endif }, @@ -7416,7 +7417,7 @@ struct ieee80211_iface_combination rtw_combinations[] = { .num_different_channels = 1, }, }; -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) */ +#endif /* (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 0, 0)) */ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) { @@ -7429,11 +7430,11 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) wiphy->max_scan_ie_len = RTW_SCAN_IE_LEN_MAX; wiphy->max_num_pmkids = RTW_MAX_NUM_PMKIDS; -#if CONFIG_RTW_MACADDR_ACL && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) +#if CONFIG_RTW_MACADDR_ACL && (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 9, 0)) wiphy->max_acl_mac_addrs = NUM_ACL; #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE) wiphy->max_remain_on_channel_duration = RTW_MAX_REMAIN_ON_CHANNEL_DURATION; #endif @@ -7445,7 +7446,7 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) | BIT(NL80211_IFTYPE_MONITOR) #endif #endif -#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)) +#if defined(CONFIG_P2P) && ((CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)) | BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO) #if defined(RTW_DEDICATED_P2P_DEVICE) @@ -7454,19 +7455,19 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) #endif ; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) #ifdef CONFIG_AP_MODE wiphy->mgmt_stypes = rtw_cfg80211_default_mgmt_stypes; #endif /* CONFIG_AP_MODE */ #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 0, 0)) #ifdef CONFIG_WIFI_MONITOR wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR); #endif #endif -#if defined(RTW_SINGLE_WIPHY) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) +#if defined(RTW_SINGLE_WIPHY) && (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 0, 0)) wiphy->iface_combinations = rtw_combinations; wiphy->n_iface_combinations = ARRAY_SIZE(rtw_combinations); #endif @@ -7482,40 +7483,40 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) wiphy->bands[NL80211_BAND_5GHZ] = rtw_spt_band_alloc(NL80211_BAND_5GHZ); #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 38) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)) #if defined(CONFIG_NET_NS) wiphy->flags |= WIPHY_FLAG_NETNS_OK; #endif //CONFIG_NET_NS wiphy->flags |= WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS; #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 3, 0)) wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME; /* remove WIPHY_FLAG_OFFCHAN_TX, because we not support this feature */ /* wiphy->flags |= WIPHY_FLAG_OFFCHAN_TX | WIPHY_FLAG_HAVE_AP_SME; */ #endif -#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) && \ - LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) +#if defined(CONFIG_PM) && (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 0, 0) && \ + CFG80211_API_LEVEL < KERNEL_VERSION(4, 12, 0)) wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; #ifdef CONFIG_PNO_SUPPORT wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) +#if CFG80211_API_LEVEL >= KERNEL_VERSION(3, 2, 0) wiphy->max_match_sets = MAX_PNO_LIST_COUNT; #endif #endif #endif -#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)) +#if defined(CONFIG_PM) && (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 0, 0)) +#if (CFG80211_API_LEVEL < KERNEL_VERSION(3, 11, 0)) wiphy->wowlan = wowlan_stub; #else wiphy->wowlan = &wowlan_stub; #endif #endif -#if defined(CONFIG_TDLS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)) +#if defined(CONFIG_TDLS) && (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 2, 0)) wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; #ifndef CONFIG_TDLS_DRIVER_SETUP wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP; /* Driver handles key exchange */ @@ -7710,7 +7711,7 @@ static struct cfg80211_ops rtw_cfg80211_ops = { .get_key = cfg80211_rtw_get_key, .del_key = cfg80211_rtw_del_key, .set_default_key = cfg80211_rtw_set_default_key, -#if defined(CONFIG_GTK_OL) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)) +#if defined(CONFIG_GTK_OL) && (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 1, 0)) .set_rekey_data = cfg80211_rtw_set_rekey_data, #endif /*CONFIG_GTK_OL*/ .get_station = cfg80211_rtw_get_station, @@ -7731,7 +7732,7 @@ static struct cfg80211_ops rtw_cfg80211_ops = { .add_virtual_intf = cfg80211_rtw_add_virtual_intf, .del_virtual_intf = cfg80211_rtw_del_virtual_intf, -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)) && !defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL < KERNEL_VERSION(3, 4, 0)) && !defined(COMPAT_KERNEL_RELEASE) .add_beacon = cfg80211_rtw_add_beacon, .set_beacon = cfg80211_rtw_set_beacon, .del_beacon = cfg80211_rtw_del_beacon, @@ -7741,7 +7742,7 @@ static struct cfg80211_ops rtw_cfg80211_ops = { .stop_ap = cfg80211_rtw_stop_ap, #endif -#if CONFIG_RTW_MACADDR_ACL && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) +#if CONFIG_RTW_MACADDR_ACL && (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 9, 0)) .set_mac_acl = cfg80211_rtw_set_mac_acl, #endif @@ -7750,14 +7751,14 @@ static struct cfg80211_ops rtw_cfg80211_ops = { .change_station = cfg80211_rtw_change_station, .dump_station = cfg80211_rtw_dump_station, .change_bss = cfg80211_rtw_change_bss, -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)) +#if (CFG80211_API_LEVEL < KERNEL_VERSION(3, 6, 0)) .set_channel = cfg80211_rtw_set_channel, #endif /* .auth = cfg80211_rtw_auth, */ /* .assoc = cfg80211_rtw_assoc, */ #endif /* CONFIG_AP_MODE */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 6, 0)) .set_monitor_channel = cfg80211_rtw_set_monitor_channel, #endif @@ -7774,19 +7775,19 @@ static struct cfg80211_ops rtw_cfg80211_ops = { .update_ft_ies = cfg80211_rtw_update_ft_ies, #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) .mgmt_tx = cfg80211_rtw_mgmt_tx, .mgmt_frame_register = cfg80211_rtw_mgmt_frame_register, -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) && LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) +#elif (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 34) && CFG80211_API_LEVEL <= KERNEL_VERSION(2, 6, 35)) .action = cfg80211_rtw_mgmt_tx, #endif -#if defined(CONFIG_TDLS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)) +#if defined(CONFIG_TDLS) && (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 2, 0)) .tdls_mgmt = cfg80211_rtw_tdls_mgmt, .tdls_oper = cfg80211_rtw_tdls_oper, #endif /* CONFIG_TDLS */ -#if defined(CONFIG_PNO_SUPPORT) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) +#if defined(CONFIG_PNO_SUPPORT) && (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 0, 0)) .sched_scan_start = cfg80211_rtw_sched_scan_start, .sched_scan_stop = cfg80211_rtw_sched_scan_stop, .suspend = cfg80211_rtw_suspend, @@ -7852,7 +7853,7 @@ int rtw_wiphy_register(struct wiphy *wiphy) { RTW_INFO(FUNC_WIPHY_FMT"\n", FUNC_WIPHY_ARG(wiphy)); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(RTW_VENDOR_EXT_SUPPORT) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 14, 0)) || defined(RTW_VENDOR_EXT_SUPPORT) rtw_cfgvendor_attach(wiphy); #endif @@ -7863,7 +7864,7 @@ void rtw_wiphy_unregister(struct wiphy *wiphy) { RTW_INFO(FUNC_WIPHY_FMT"\n", FUNC_WIPHY_ARG(wiphy)); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(RTW_VENDOR_EXT_SUPPORT) +#if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 14, 0)) || defined(RTW_VENDOR_EXT_SUPPORT) rtw_cfgvendor_detach(wiphy); #endif @@ -7979,7 +7980,7 @@ void rtw_wdev_unregister(struct wireless_dev *wdev) rtw_cfg80211_indicate_scan_done(adapter, _TRUE); - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) || defined(COMPAT_KERNEL_RELEASE) + #if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 11, 0)) || defined(COMPAT_KERNEL_RELEASE) if (wdev->current_bss) { RTW_INFO(FUNC_ADPT_FMT" clear current_bss by cfg80211_disconnected\n", FUNC_ADPT_ARG(adapter)); rtw_cfg80211_indicate_disconnect(adapter, 0, 1); diff --git a/os_dep/linux/rtw_cfgvendor.c b/os_dep/linux/rtw_cfgvendor.c index c8ff983..d3ab844 100644 --- a/os_dep/linux/rtw_cfgvendor.c +++ b/os_dep/linux/rtw_cfgvendor.c @@ -16,6 +16,7 @@ #include #ifdef CONFIG_IOCTL_CFG80211 +#include "api_level.h" #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(RTW_VENDOR_EXT_SUPPORT) @@ -45,7 +46,7 @@ struct sk_buff *dbg_rtw_cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct struct sk_buff *skb; unsigned int truesize = 0; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)) +#if (CFG80211_API_LEVEL < KERNEL_VERSION(4, 1, 0)) skb = cfg80211_vendor_event_alloc(wiphy, len, event_id, gfp); #else skb = cfg80211_vendor_event_alloc(wiphy, wdev, len, event_id, gfp); @@ -144,7 +145,7 @@ struct sk_buff *rtw_cfg80211_vendor_event_alloc( { struct sk_buff *skb; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)) +#if (CFG80211_API_LEVEL < KERNEL_VERSION(4, 1, 0)) skb = cfg80211_vendor_event_alloc(wiphy, len, event_id, gfp); #else skb = cfg80211_vendor_event_alloc(wiphy, wdev, len, event_id, gfp);