1
0
mirror of https://github.com/aircrack-ng/rtl8812au.git synced 2024-11-10 16:17:03 +00:00

Merge pull request #6 from kimocoder/v5.2.20

Allow build for kernels with backported cfg80211 API
This commit is contained in:
fariouche 2018-08-08 20:24:25 +02:00 committed by GitHub
commit 07369e5900
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 144 additions and 130 deletions

View File

@ -23,7 +23,7 @@ EXTRA_CFLAGS += -Wno-type-limits
GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc ) GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc )
ifeq ($(GCC_VER_49),1) 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 endif
EXTRA_CFLAGS += -I$(src)/include EXTRA_CFLAGS += -I$(src)/include

View File

@ -1,5 +1,5 @@
PACKAGE_NAME="realtek-rtl88xxau" PACKAGE_NAME="realtek-rtl88xxau"
PACKAGE_VERSION="5.2.20.2~20180806" PACKAGE_VERSION="5.2.20.2~20180808"
CLEAN="'make' clean" CLEAN="'make' clean"
BUILT_MODULE_NAME[0]=88XXau BUILT_MODULE_NAME[0]=88XXau
PROCS_NUM=`nproc` PROCS_NUM=`nproc`

12
os_dep/linux/api_level.h Normal file
View File

@ -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

View File

@ -18,8 +18,9 @@
#include <hal_data.h> #include <hal_data.h>
#ifdef CONFIG_IOCTL_CFG80211 #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_SIGNAL BIT(NL80211_STA_INFO_SIGNAL)
#define STATION_INFO_TX_BITRATE BIT(NL80211_STA_INFO_TX_BITRATE) #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_5 BIT(RATE_INFO_BW_5)
@ -116,7 +117,7 @@ static const u32 rtw_cipher_suites[] = {
.max_power = 30, \ .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 /* if wowlan is not supported, kernel generate a disconnect at each suspend
* cf: /net/wireless/sysfs.c, so register a stub wowlan. * cf: /net/wireless/sysfs.c, so register a stub wowlan.
* Moreover wowlan has to be enabled via a the nl80211_set_wowlan callback. * 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, .n_patterns = 0,
.pattern_max_len = 0, .pattern_max_len = 0,
.pattern_min_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, .max_pkt_offset = 0,
#endif #endif
}; };
@ -525,7 +526,7 @@ void rtw_spt_band_free(struct ieee80211_supported_band *spt_band)
rtw_mfree((u8 *)spt_band, size); 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 static const struct ieee80211_txrx_stypes
rtw_cfg80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = { rtw_cfg80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
[NL80211_IFTYPE_ADHOC] = { [NL80211_IFTYPE_ADHOC] = {
@ -761,7 +762,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net
goto exit; goto exit;
} }
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38)) #if (CFG80211_API_LEVEL < KERNEL_VERSION(2, 6, 38))
#ifndef COMPAT_KERNEL_RELEASE #ifndef COMPAT_KERNEL_RELEASE
/* patch for cfg80211, update beacon ies to information_elements */ /* patch for cfg80211, update beacon ies to information_elements */
if (pnetwork->network.Reserved[0] == BSS_TYPE_BCN) { /* WIFI_BEACON */ 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 /* COMPAT_KERNEL_RELEASE */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38) */ #endif /* CFG80211_API_LEVEL < KERNEL_VERSION(2, 6, 38) */
#if 0 #if 0
{ {
@ -785,7 +786,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net
} }
} }
#endif #endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) #if CFG80211_API_LEVEL >= KERNEL_VERSION(3, 9, 0)
cfg80211_put_bss(wiphy, bss); cfg80211_put_bss(wiphy, bss);
#else #else
cfg80211_put_bss(bss); 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); pnetwork->InfrastructureMode == Ndis802_11Infrastructure?WLAN_CAPABILITY_ESS:WLAN_CAPABILITY_IBSS, pnetwork->InfrastructureMode == Ndis802_11Infrastructure?WLAN_CAPABILITY_ESS:WLAN_CAPABILITY_IBSS);
#endif #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); cfg80211_put_bss(padapter->rtw_wdev->wiphy, bss);
#else #else
cfg80211_put_bss(bss); 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)); RTW_PRINT(FUNC_ADPT_FMT" BSS not found !!\n", FUNC_ADPT_ARG(padapter));
} }
/* notify cfg80211 that device joined an IBSS */ /* 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); notify_channel = ieee80211_get_channel(wiphy, freq);
cfg80211_ibss_joined(padapter->pnetdev, cur_network->network.MacAddress, notify_channel, GFP_ATOMIC); cfg80211_ibss_joined(padapter->pnetdev, cur_network->network.MacAddress, notify_channel, GFP_ATOMIC);
#else #else
@ -923,7 +924,7 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter)
RTW_INFO(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); RTW_INFO(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
if (pwdev->iftype != NL80211_IFTYPE_STATION 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 && pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT
#endif #endif
) )
@ -980,7 +981,7 @@ check_bss:
_enter_critical_bh(&pwdev_priv->connect_req_lock, &irqL); _enter_critical_bh(&pwdev_priv->connect_req_lock, &irqL);
if (rtw_to_roam(padapter) > 0) { 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 wiphy *wiphy = pwdev->wiphy;
struct ieee80211_channel *notify_channel; struct ieee80211_channel *notify_channel;
u32 freq; u32 freq;
@ -1000,7 +1001,7 @@ check_bss:
cfg80211_roamed(padapter->pnetdev, &roam_info, GFP_ATOMIC); cfg80211_roamed(padapter->pnetdev, &roam_info, GFP_ATOMIC);
#else #else
cfg80211_roamed(padapter->pnetdev 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 , notify_channel
#endif #endif
, cur_network->network.MacAddress , cur_network->network.MacAddress
@ -1018,7 +1019,7 @@ check_bss:
rtw_set_ft_status(padapter, RTW_FT_ASSOCIATED_STA); rtw_set_ft_status(padapter, RTW_FT_ASSOCIATED_STA);
#endif #endif
} else { } 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); RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state);
#endif #endif
@ -1029,7 +1030,7 @@ check_bss:
, pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6 , pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6
, pmlmepriv->assoc_rsp_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 6 , pmlmepriv->assoc_rsp_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 6
, WLAN_STATUS_SUCCESS, GFP_ATOMIC); , 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); RTW_INFO("pwdev->sme_state(a)=%d\n", pwdev->sme_state);
#endif #endif
} }
@ -1056,7 +1057,7 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally
reason = 0; reason = 0;
if (pwdev->iftype != NL80211_IFTYPE_STATION 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 && pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT
#endif #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)); rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo));
#if RTW_P2P_GROUP_INTERFACE #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) if (pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
#endif #endif
#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); _enter_critical_bh(&pwdev_priv->connect_req_lock, &irqL);
if (padapter->ndev_unregistering || !rtw_wdev_not_indic_disco(pwdev_priv)) { 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); RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state);
if (pwdev->sme_state == CFG80211_SME_CONNECTING) { 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, 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, 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, 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) struct key_params *params)
{ {
char *alg_name; 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("key_len=0x%x\n", params->key_len);
RTW_INFO("seq_len=0x%x\n", params->seq_len); RTW_INFO("seq_len=0x%x\n", params->seq_len);
RTW_INFO("key_index=%d\n", key_index); 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); 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_len = sizeof(struct ieee_param) + params->key_len;
param = (struct ieee_param *)rtw_malloc(param_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, 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, 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, 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 *cookie,
void (*callback)(void *cookie, struct key_params *)) 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, 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) 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) 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); _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
struct security_priv *psecuritypriv = &padapter->securitypriv; 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, static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
struct net_device *ndev, u8 key_index 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 , bool unicast, bool multicast
#endif #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_FMT " key_index=%d"
#define SET_DEF_KEY_PARAM_ARG , key_index #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_FMT_2_6_38 ", unicast=%d, multicast=%d"
#define SET_DEF_KEY_PARAM_ARG_2_6_38 , unicast, multicast #define SET_DEF_KEY_PARAM_ARG_2_6_38 , unicast, multicast
#else #else
@ -1867,7 +1868,7 @@ static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
return 0; 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, static int cfg80211_rtw_set_rekey_data(struct wiphy *wiphy,
struct net_device *ndev, struct net_device *ndev,
struct cfg80211_gtk_rekey_data *data) struct cfg80211_gtk_rekey_data *data)
@ -1904,7 +1905,7 @@ static int cfg80211_rtw_set_rekey_data(struct wiphy *wiphy,
#endif /*CONFIG_GTK_OL*/ #endif /*CONFIG_GTK_OL*/
static int cfg80211_rtw_get_station(struct wiphy *wiphy, static int cfg80211_rtw_get_station(struct wiphy *wiphy,
struct net_device *ndev, struct net_device *ndev,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)) #if (CFG80211_API_LEVEL < KERNEL_VERSION(3, 16, 0))
u8 *mac, u8 *mac,
#else #else
const u8 *mac, const u8 *mac,
@ -2114,7 +2115,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
networkType = Ndis802_11IBSS; networkType = Ndis802_11IBSS;
break; 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: case NL80211_IFTYPE_P2P_CLIENT:
is_p2p = _TRUE; is_p2p = _TRUE;
#endif #endif
@ -2139,7 +2140,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
break; 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: case NL80211_IFTYPE_P2P_GO:
is_p2p = _TRUE; is_p2p = _TRUE;
#endif #endif
@ -2279,7 +2280,7 @@ void rtw_cfg80211_unlink_bss(_adapter *padapter, struct wlan_network *pnetwork)
if (bss) { if (bss) {
cfg80211_unlink_bss(wiphy, bss); cfg80211_unlink_bss(wiphy, bss);
RTW_INFO("%s(): cfg80211_unlink %s!!\n", __func__, select_network.Ssid.Ssid); 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); cfg80211_put_bss(padapter->rtw_wdev->wiphy, bss);
#else #else
cfg80211_put_bss(bss); 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 */ #endif /* CONFIG_CONCURRENT_MODE */
static int cfg80211_rtw_scan(struct wiphy *wiphy 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 , struct net_device *ndev
#endif #endif
, struct cfg80211_scan_request *request) , 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_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX *)(&(pmlmeinfo->network)); 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; struct cfg80211_chan_def *pch_def;
#endif #endif
struct ieee80211_channel *pch; struct ieee80211_channel *pch;
int ret = 0; 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 *)(&params->chandef); pch_def = (struct cfg80211_chan_def *)(&params->chandef);
pch = (struct ieee80211_channel *) pch_def->chan; 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); pch = (struct ieee80211_channel *)(params->channel);
#endif #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, 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, struct wireless_dev *wdev,
#endif #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) enum nl80211_tx_power_setting type, int mbm)
#else #else
enum tx_power_setting type, int dbm) 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); _adapter *padapter = wiphy_to_adapter(wiphy);
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
int value; 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; value = mbm/100;
#else #else
value = dbm; value = dbm;
@ -3691,7 +3692,7 @@ if(type == NL80211_TX_POWER_FIXED) {
} }
static int cfg80211_rtw_get_txpower(struct wiphy *wiphy, 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, struct wireless_dev *wdev,
#endif #endif
int *dbm) int *dbm)
@ -3865,7 +3866,7 @@ void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint f
#ifdef COMPAT_KERNEL_RELEASE #ifdef COMPAT_KERNEL_RELEASE
rtw_cfg80211_rx_mgmt(pwdev, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); 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); rtw_cfg80211_rx_mgmt(pwdev, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC);
#else /* COMPAT_KERNEL_RELEASE */ #else /* COMPAT_KERNEL_RELEASE */
{ {
@ -3928,7 +3929,7 @@ void rtw_cfg80211_indicate_sta_disassoc(_adapter *padapter, unsigned char *da, u
#ifdef COMPAT_KERNEL_RELEASE #ifdef COMPAT_KERNEL_RELEASE
rtw_cfg80211_rx_mgmt(wdev, freq, 0, mgmt_buf, frame_len, GFP_ATOMIC); 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); rtw_cfg80211_rx_mgmt(wdev, freq, 0, mgmt_buf, frame_len, GFP_ATOMIC);
#else /* COMPAT_KERNEL_RELEASE */ #else /* COMPAT_KERNEL_RELEASE */
cfg80211_send_disassoc(padapter->pnetdev, mgmt_buf, frame_len); 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; 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 = { static const struct net_device_ops rtw_cfg80211_monitor_if_ops = {
.ndo_open = rtw_cfg80211_monitor_if_open, .ndo_open = rtw_cfg80211_monitor_if_open,
.ndo_stop = rtw_cfg80211_monitor_if_close, .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; 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, static int cfg80211_rtw_add_beacon(struct wiphy *wiphy, struct net_device *ndev,
struct beacon_parameters *info) struct beacon_parameters *info)
{ {
@ -4553,9 +4554,9 @@ static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
return 0; 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, static int cfg80211_rtw_set_mac_acl(struct wiphy *wiphy, struct net_device *ndev,
const struct cfg80211_acl_data *params) const struct cfg80211_acl_data *params)
{ {
@ -4597,7 +4598,7 @@ exit:
#endif /* CONFIG_RTW_MACADDR_ACL && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) */ #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, 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, u8 *mac,
#else #else
const u8 *mac, const u8 *mac,
@ -4629,9 +4630,9 @@ exit:
} }
static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev, 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 u8 *mac
#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)) #elif (CFG80211_API_LEVEL < KERNEL_VERSION(3, 19, 0))
const u8 *mac const u8 *mac
#else #else
struct station_del_parameters *params 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)); 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; target_mac = mac;
#else #else
target_mac = params->mac; 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, 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, u8 *mac,
#else #else
const u8 *mac, 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 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 , struct net_device *ndev
#endif #endif
, struct ieee80211_channel *chan, enum nl80211_channel_type channel_type) , 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_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
int chan_width = CHANNEL_WIDTH_20; 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)); RTW_INFO(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
#endif #endif
@ -4969,7 +4970,7 @@ static int cfg80211_rtw_set_channel(struct wiphy *wiphy
} }
static int cfg80211_rtw_set_monitor_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 , struct cfg80211_chan_def *chandef
#else #else
, struct ieee80211_channel *chan , struct ieee80211_channel *chan
@ -4977,7 +4978,7 @@ static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy
#endif #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; struct ieee80211_channel *chan = chandef->chan;
#endif #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_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
int target_width = CHANNEL_WIDTH_20; 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 #ifdef CONFIG_DEBUG_CFG80211
RTW_INFO("center_freq %u Mhz ch %u width %u freq1 %u freq2 %u\n" RTW_INFO("center_freq %u Mhz ch %u width %u freq1 %u freq2 %u\n"
, chan->center_freq , 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; target_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
break; 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_5:
case NL80211_CHAN_WIDTH_10: case NL80211_CHAN_WIDTH_10:
#endif #endif
@ -5033,7 +5034,7 @@ static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy
} }
#else #else
#ifdef CONFIG_DEBUG_CFG80211 #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->center_freq
, chan->hw_value , chan->hw_value
, channel_type); , 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); RTW_INFO("RTW_Rx: probe request, ch=%d(%d)\n", ch, sch);
#endif #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); rtw_cfg80211_rx_mgmt(wdev, freq, 0, frame, frame_len, GFP_ATOMIC);
#else #else
cfg80211_rx_action(adapter->pnetdev, freq, frame, frame_len, GFP_ATOMIC); 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: 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); rtw_cfg80211_rx_mgmt(wdev, freq, 0, frame, frame_len, GFP_ATOMIC);
#else #else
cfg80211_rx_action(adapter->pnetdev, freq, frame, frame_len, GFP_ATOMIC); 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); RTW_INFO("redirect to pd_wdev:%p\n", wdev);
#endif #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); rtw_cfg80211_rx_mgmt(wdev, freq, 0, frame, frame_len, GFP_ATOMIC);
#else #else
cfg80211_rx_action(adapter->pnetdev, freq, frame, frame_len, GFP_ATOMIC); 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*/ 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); rtw_cfg80211_rx_mgmt(wdev, freq, 0, frame, frame_len, GFP_ATOMIC);
#else #else
cfg80211_rx_action(adapter->pnetdev, freq, frame, frame_len, GFP_ATOMIC); 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, 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, struct wireless_dev *wdev,
#else #else
struct net_device *ndev, struct net_device *ndev,
#endif #endif
struct ieee80211_channel *channel, 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, enum nl80211_channel_type channel_type,
#endif #endif
unsigned int duration, u64 *cookie) 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; struct cfg80211_wifidirect_info *pcfg80211_wdinfo;
u8 is_p2p_find = _FALSE; 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 defined(RTW_DEDICATED_P2P_DEVICE)
if (wdev == wiphy_to_pd_wdev(wiphy)) if (wdev == wiphy_to_pd_wdev(wiphy))
padapter = wiphy_to_adapter(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->remain_on_ch_cookie = *cookie;
pcfg80211_wdinfo->last_ro_ch_time = rtw_get_current_time(); pcfg80211_wdinfo->last_ro_ch_time = rtw_get_current_time();
_rtw_memcpy(&pcfg80211_wdinfo->remain_on_ch_channel, channel, sizeof(struct ieee80211_channel)); _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; pcfg80211_wdinfo->remain_on_ch_type = channel_type;
#endif #endif
pcfg80211_wdinfo->restore_channel = rtw_get_oper_ch(padapter); 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, 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, struct wireless_dev *wdev,
#else #else
struct net_device *ndev, 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, 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, struct wireless_dev *wdev,
#else #else
struct net_device *ndev, struct net_device *ndev,
#endif #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, 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, bool offchan,
#endif #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, enum nl80211_channel_type channel_type,
#endif #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, bool channel_type_valid,
#endif #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, unsigned int wait,
#endif #endif
const u8 *buf, size_t len, 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, bool no_cck,
#endif #endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) #if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 3, 0))
bool dont_wait_for_ack, bool dont_wait_for_ack,
#endif #endif
#else #else
@ -6118,7 +6119,7 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy,
#endif #endif
u64 *cookie) 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; struct ieee80211_channel *chan = params->chan;
bool offchan = params->offchan; bool offchan = params->offchan;
unsigned int wait = params->wait; unsigned int wait = params->wait;
@ -6183,27 +6184,27 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy,
#ifdef CONFIG_DEBUG_CFG80211 #ifdef CONFIG_DEBUG_CFG80211
RTW_INFO(FUNC_ADPT_FMT"%s len=%zu, ch=%d" 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" ", ch_type=%d"
#endif #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" ", channel_type_valid=%d"
#endif #endif
"\n", FUNC_ADPT_ARG(padapter), wdev == wiphy_to_pd_wdev(wiphy) ? " PD" : "" "\n", FUNC_ADPT_ARG(padapter), wdev == wiphy_to_pd_wdev(wiphy) ? " PD" : ""
, len, tx_ch , 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 , channel_type
#endif #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 , channel_type_valid
#endif #endif
); );
#endif /* CONFIG_DEBUG_CFG80211 */ #endif /* CONFIG_DEBUG_CFG80211 */
/* indicate ack before issue frame to avoid racing with rsp frame */ /* 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); 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); cfg80211_action_tx_status(ndev, *cookie, buf, len, ack, GFP_KERNEL);
#endif #endif
@ -6316,14 +6317,14 @@ exit:
} }
static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy, 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, struct wireless_dev *wdev,
#else #else
struct net_device *ndev, struct net_device *ndev,
#endif #endif
u16 frame_type, bool reg) 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); struct net_device *ndev = wdev_to_ndev(wdev);
#endif #endif
_adapter *adapter; _adapter *adapter;
@ -6359,10 +6360,10 @@ exit:
return; 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, static int cfg80211_rtw_tdls_mgmt(struct wiphy *wiphy,
struct net_device *ndev, 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, const u8 *peer,
#else #else
u8 *peer, u8 *peer,
@ -6370,10 +6371,10 @@ static int cfg80211_rtw_tdls_mgmt(struct wiphy *wiphy,
u8 action_code, u8 action_code,
u8 dialog_token, u8 dialog_token,
u16 status_code, u16 status_code,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) #if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 15, 0))
u32 peer_capability, u32 peer_capability,
#endif #endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) #if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 17, 0))
bool initiator, bool initiator,
#endif #endif
const u8 *buf, const u8 *buf,
@ -6458,7 +6459,7 @@ discard:
static int cfg80211_rtw_tdls_oper(struct wiphy *wiphy, static int cfg80211_rtw_tdls_oper(struct wiphy *wiphy,
struct net_device *ndev, 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, const u8 *peer,
#else #else
u8 *peer, u8 *peer,
@ -6544,7 +6545,7 @@ static int cfg80211_rtw_tdls_oper(struct wiphy *wiphy,
} }
#endif /* CONFIG_TDLS */ #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, static int cfg80211_rtw_sched_scan_start(struct wiphy *wiphy,
struct net_device *dev, struct net_device *dev,
struct cfg80211_sched_scan_request *request) 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)); */ /* printk("config_method in wpsie of probe_resp = 0x%x\n", be16_to_cpu(*puconfig_method)); */
#endif #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 */ /* for WIFI-DIRECT LOGO 4.2.2, AUTO GO can't set PUSH_BUTTON flags */
if (wdev->iftype == NL80211_IFTYPE_P2P_GO) { if (wdev->iftype == NL80211_IFTYPE_P2P_GO) {
uconfig_method = WPS_CM_PUSH_BUTTON; 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[] = { struct ieee80211_iface_limit rtw_limits[] = {
{ {
.max = 2, .max = 2,
.types = BIT(NL80211_IFTYPE_STATION) .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) | BIT(NL80211_IFTYPE_P2P_CLIENT)
#endif #endif
}, },
@ -7391,7 +7392,7 @@ struct ieee80211_iface_limit rtw_limits[] = {
{ {
.max = 1, .max = 1,
.types = BIT(NL80211_IFTYPE_AP) .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) | BIT(NL80211_IFTYPE_P2P_GO)
#endif #endif
}, },
@ -7416,7 +7417,7 @@ struct ieee80211_iface_combination rtw_combinations[] = {
.num_different_channels = 1, .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) 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_scan_ie_len = RTW_SCAN_IE_LEN_MAX;
wiphy->max_num_pmkids = RTW_MAX_NUM_PMKIDS; 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; wiphy->max_acl_mac_addrs = NUM_ACL;
#endif #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; wiphy->max_remain_on_channel_duration = RTW_MAX_REMAIN_ON_CHANNEL_DURATION;
#endif #endif
@ -7445,7 +7446,7 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy)
| BIT(NL80211_IFTYPE_MONITOR) | BIT(NL80211_IFTYPE_MONITOR)
#endif #endif
#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_CLIENT)
| BIT(NL80211_IFTYPE_P2P_GO) | BIT(NL80211_IFTYPE_P2P_GO)
#if defined(RTW_DEDICATED_P2P_DEVICE) #if defined(RTW_DEDICATED_P2P_DEVICE)
@ -7454,19 +7455,19 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy)
#endif #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 #ifdef CONFIG_AP_MODE
wiphy->mgmt_stypes = rtw_cfg80211_default_mgmt_stypes; wiphy->mgmt_stypes = rtw_cfg80211_default_mgmt_stypes;
#endif /* CONFIG_AP_MODE */ #endif /* CONFIG_AP_MODE */
#endif #endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) #if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 0, 0))
#ifdef CONFIG_WIFI_MONITOR #ifdef CONFIG_WIFI_MONITOR
wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR); wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR);
#endif #endif
#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->iface_combinations = rtw_combinations;
wiphy->n_iface_combinations = ARRAY_SIZE(rtw_combinations); wiphy->n_iface_combinations = ARRAY_SIZE(rtw_combinations);
#endif #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); wiphy->bands[NL80211_BAND_5GHZ] = rtw_spt_band_alloc(NL80211_BAND_5GHZ);
#endif #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) #if defined(CONFIG_NET_NS)
wiphy->flags |= WIPHY_FLAG_NETNS_OK; wiphy->flags |= WIPHY_FLAG_NETNS_OK;
#endif //CONFIG_NET_NS #endif //CONFIG_NET_NS
wiphy->flags |= WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS; wiphy->flags |= WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS;
#endif #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_HAS_REMAIN_ON_CHANNEL;
wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME; wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME;
/* remove WIPHY_FLAG_OFFCHAN_TX, because we not support this feature */ /* remove WIPHY_FLAG_OFFCHAN_TX, because we not support this feature */
/* wiphy->flags |= WIPHY_FLAG_OFFCHAN_TX | WIPHY_FLAG_HAVE_AP_SME; */ /* wiphy->flags |= WIPHY_FLAG_OFFCHAN_TX | WIPHY_FLAG_HAVE_AP_SME; */
#endif #endif
#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) && \ #if defined(CONFIG_PM) && (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 0, 0) && \
LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) CFG80211_API_LEVEL < KERNEL_VERSION(4, 12, 0))
wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
#ifdef CONFIG_PNO_SUPPORT #ifdef CONFIG_PNO_SUPPORT
wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT; 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; wiphy->max_match_sets = MAX_PNO_LIST_COUNT;
#endif #endif
#endif #endif
#endif #endif
#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) #if defined(CONFIG_PM) && (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 0, 0))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)) #if (CFG80211_API_LEVEL < KERNEL_VERSION(3, 11, 0))
wiphy->wowlan = wowlan_stub; wiphy->wowlan = wowlan_stub;
#else #else
wiphy->wowlan = &wowlan_stub; wiphy->wowlan = &wowlan_stub;
#endif #endif
#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; wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS;
#ifndef CONFIG_TDLS_DRIVER_SETUP #ifndef CONFIG_TDLS_DRIVER_SETUP
wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP; /* Driver handles key exchange */ 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, .get_key = cfg80211_rtw_get_key,
.del_key = cfg80211_rtw_del_key, .del_key = cfg80211_rtw_del_key,
.set_default_key = cfg80211_rtw_set_default_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, .set_rekey_data = cfg80211_rtw_set_rekey_data,
#endif /*CONFIG_GTK_OL*/ #endif /*CONFIG_GTK_OL*/
.get_station = cfg80211_rtw_get_station, .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, .add_virtual_intf = cfg80211_rtw_add_virtual_intf,
.del_virtual_intf = cfg80211_rtw_del_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, .add_beacon = cfg80211_rtw_add_beacon,
.set_beacon = cfg80211_rtw_set_beacon, .set_beacon = cfg80211_rtw_set_beacon,
.del_beacon = cfg80211_rtw_del_beacon, .del_beacon = cfg80211_rtw_del_beacon,
@ -7741,7 +7742,7 @@ static struct cfg80211_ops rtw_cfg80211_ops = {
.stop_ap = cfg80211_rtw_stop_ap, .stop_ap = cfg80211_rtw_stop_ap,
#endif #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, .set_mac_acl = cfg80211_rtw_set_mac_acl,
#endif #endif
@ -7750,14 +7751,14 @@ static struct cfg80211_ops rtw_cfg80211_ops = {
.change_station = cfg80211_rtw_change_station, .change_station = cfg80211_rtw_change_station,
.dump_station = cfg80211_rtw_dump_station, .dump_station = cfg80211_rtw_dump_station,
.change_bss = cfg80211_rtw_change_bss, .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, .set_channel = cfg80211_rtw_set_channel,
#endif #endif
/* .auth = cfg80211_rtw_auth, */ /* .auth = cfg80211_rtw_auth, */
/* .assoc = cfg80211_rtw_assoc, */ /* .assoc = cfg80211_rtw_assoc, */
#endif /* CONFIG_AP_MODE */ #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, .set_monitor_channel = cfg80211_rtw_set_monitor_channel,
#endif #endif
@ -7774,19 +7775,19 @@ static struct cfg80211_ops rtw_cfg80211_ops = {
.update_ft_ies = cfg80211_rtw_update_ft_ies, .update_ft_ies = cfg80211_rtw_update_ft_ies,
#endif #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_tx = cfg80211_rtw_mgmt_tx,
.mgmt_frame_register = cfg80211_rtw_mgmt_frame_register, .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, .action = cfg80211_rtw_mgmt_tx,
#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))
.tdls_mgmt = cfg80211_rtw_tdls_mgmt, .tdls_mgmt = cfg80211_rtw_tdls_mgmt,
.tdls_oper = cfg80211_rtw_tdls_oper, .tdls_oper = cfg80211_rtw_tdls_oper,
#endif /* CONFIG_TDLS */ #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_start = cfg80211_rtw_sched_scan_start,
.sched_scan_stop = cfg80211_rtw_sched_scan_stop, .sched_scan_stop = cfg80211_rtw_sched_scan_stop,
.suspend = cfg80211_rtw_suspend, .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)); 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); rtw_cfgvendor_attach(wiphy);
#endif #endif
@ -7863,7 +7864,7 @@ void rtw_wiphy_unregister(struct wiphy *wiphy)
{ {
RTW_INFO(FUNC_WIPHY_FMT"\n", FUNC_WIPHY_ARG(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); rtw_cfgvendor_detach(wiphy);
#endif #endif
@ -7979,7 +7980,7 @@ void rtw_wdev_unregister(struct wireless_dev *wdev)
rtw_cfg80211_indicate_scan_done(adapter, _TRUE); 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) { if (wdev->current_bss) {
RTW_INFO(FUNC_ADPT_FMT" clear current_bss by cfg80211_disconnected\n", FUNC_ADPT_ARG(adapter)); RTW_INFO(FUNC_ADPT_FMT" clear current_bss by cfg80211_disconnected\n", FUNC_ADPT_ARG(adapter));
rtw_cfg80211_indicate_disconnect(adapter, 0, 1); rtw_cfg80211_indicate_disconnect(adapter, 0, 1);

View File

@ -16,6 +16,7 @@
#include <drv_types.h> #include <drv_types.h>
#ifdef CONFIG_IOCTL_CFG80211 #ifdef CONFIG_IOCTL_CFG80211
#include "api_level.h"
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(RTW_VENDOR_EXT_SUPPORT) #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; struct sk_buff *skb;
unsigned int truesize = 0; 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); skb = cfg80211_vendor_event_alloc(wiphy, len, event_id, gfp);
#else #else
skb = cfg80211_vendor_event_alloc(wiphy, wdev, len, event_id, gfp); 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; 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); skb = cfg80211_vendor_event_alloc(wiphy, len, event_id, gfp);
#else #else
skb = cfg80211_vendor_event_alloc(wiphy, wdev, len, event_id, gfp); skb = cfg80211_vendor_event_alloc(wiphy, wdev, len, event_id, gfp);