From dabd563f86acbd722951e460a413d5ccc6e9dfef Mon Sep 17 00:00:00 2001 From: kimocoder Date: Mon, 6 Aug 2018 21:21:49 +0200 Subject: [PATCH 1/2] Fix compile warnings introduced with DEBUG commit --- dkms.conf | 2 +- hal/phydm/halrf/halphyrf_ce.c | 3 ++- hal/phydm/halrf/halrf.c | 10 +++++---- hal/phydm/halrf/halrf_kfree.c | 25 ++++++++++++----------- hal/phydm/halrf/rtl8812a/halrf_8812a_ce.c | 3 ++- hal/phydm/phydm_beamforming.c | 10 +++++---- hal/phydm/phydm_debug.c | 13 ++++++------ hal/phydm/txbf/haltxbfjaguar.c | 3 ++- 8 files changed, 39 insertions(+), 30 deletions(-) diff --git a/dkms.conf b/dkms.conf index df9bc7e..a091c22 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,5 +1,5 @@ PACKAGE_NAME="realtek-rtl88xxau" -PACKAGE_VERSION="5.2.20.2~20180805" +PACKAGE_VERSION="5.2.20.2~20180806" CLEAN="'make' clean" BUILT_MODULE_NAME[0]=88XXau PROCS_NUM=`nproc` diff --git a/hal/phydm/halrf/halphyrf_ce.c b/hal/phydm/halrf/halphyrf_ce.c index f9c031f..da9efda 100644 --- a/hal/phydm/halrf/halphyrf_ce.c +++ b/hal/phydm/halrf/halphyrf_ce.c @@ -301,8 +301,9 @@ odm_txpowertracking_callback_thermal_meter( /*4 3. Initialize ThermalValues of rf_calibrate_info*/ - if (p_rf_calibrate_info->is_reloadtxpowerindex) + if (p_rf_calibrate_info->is_reloadtxpowerindex) { ODM_RT_TRACE(p_dm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("reload ofdm index for band switch\n")); + } /*4 4. Calculate average thermal meter*/ diff --git a/hal/phydm/halrf/halrf.c b/hal/phydm/halrf/halrf.c index 068d483..8830cfa 100644 --- a/hal/phydm/halrf/halrf.c +++ b/hal/phydm/halrf/halrf.c @@ -809,8 +809,9 @@ halrf_segment_iqk_trigger( odm_acquire_spin_lock(p_dm, RT_IQK_SPINLOCK); p_dm->rf_calibrate_info.is_iqk_in_progress = false; odm_release_spin_lock(p_dm, RT_IQK_SPINLOCK); - } else + } else { ODM_RT_TRACE(p_dm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("== Return the IQK CMD, because RFKs in Progress ==\n")); + } } @@ -1331,12 +1332,12 @@ halrf_iqk_trigger( odm_acquire_spin_lock(p_dm, RT_IQK_SPINLOCK); p_dm->rf_calibrate_info.is_iqk_in_progress = false; odm_release_spin_lock(p_dm, RT_IQK_SPINLOCK); - } else + } else { ODM_RT_TRACE(p_dm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("== Return the IQK CMD, because RFKs in Progress ==\n")); + } } - void halrf_lck_trigger( void *p_dm_void @@ -1457,8 +1458,9 @@ halrf_lck_trigger( odm_acquire_spin_lock(p_dm, RT_IQK_SPINLOCK); p_dm->rf_calibrate_info.is_lck_in_progress = false; odm_release_spin_lock(p_dm, RT_IQK_SPINLOCK); - }else + } else { ODM_RT_TRACE(p_dm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("== Return the LCK CMD, because RFK is in Progress ==\n")); + } } void diff --git a/hal/phydm/halrf/halrf_kfree.c b/hal/phydm/halrf/halrf_kfree.c index 5501325..f01c8a7 100644 --- a/hal/phydm/halrf/halrf_kfree.c +++ b/hal/phydm/halrf/halrf_kfree.c @@ -108,9 +108,9 @@ phydm_set_kfree_to_rf_8814a( /*that means Kfree offset is negative, we need to record it.*/ p_rf_calibrate_info->kfree_offset[e_rf_path] = (-1) * p_rf_calibrate_info->kfree_offset[e_rf_path]; ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("phy_ConfigKFree8814A(): kfree_offset = %d\n", p_rf_calibrate_info->kfree_offset[e_rf_path])); - } else + } else { ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("phy_ConfigKFree8814A(): kfree_offset = %d\n", p_rf_calibrate_info->kfree_offset[e_rf_path])); - + } } @@ -142,8 +142,9 @@ phydm_get_thermal_trim_offset_8821c( ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8821c thermal trim flag:0x%02x\n", p_power_trim_info->flag)); - if (p_power_trim_info->flag & KFREE_FLAG_THERMAL_K_ON) + if (p_power_trim_info->flag & KFREE_FLAG_THERMAL_K_ON) { ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8821c thermal:%d\n", p_power_trim_info->thermal)); + } } @@ -298,8 +299,9 @@ phydm_get_thermal_trim_offset_8822b( ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8822b thermal trim flag:0x%02x\n", p_power_trim_info->flag)); - if (p_power_trim_info->flag & KFREE_FLAG_THERMAL_K_ON) + if (p_power_trim_info->flag & KFREE_FLAG_THERMAL_K_ON) { ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8822b thermal:%d\n", p_power_trim_info->thermal)); + } #if 0 } else return; @@ -493,9 +495,9 @@ phydm_get_pa_bias_offset_8822b( for (e_rf_path = RF_PATH_A; e_rf_path < 2; e_rf_path++) phydm_set_pa_bias_to_rf_8822b(p_dm, e_rf_path, tx_pa_bias[e_rf_path]); - } - else + } else { ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8822b 2g tx pa bias no pg\n")); + } } @@ -581,9 +583,9 @@ void *p_dm_void) ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8710b thermal trim flag:0x%02x\n", p_power_trim_info->flag)); - if (p_power_trim_info->flag & KFREE_FLAG_THERMAL_K_ON) + if (p_power_trim_info->flag & KFREE_FLAG_THERMAL_K_ON) { ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8710b thermal:%d\n", p_power_trim_info->thermal)); - + } } void @@ -611,10 +613,9 @@ phydm_get_power_trim_offset_8710b( ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8710b power trim flag:0x%02x\n", p_power_trim_info->flag)); - if (p_power_trim_info->flag & KFREE_FLAG_ON) - - ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8710b power_trim_data->bb_gain[0][0]=0x%X\n", p_power_trim_info->bb_gain[0][0])); - + if (p_power_trim_info->flag & KFREE_FLAG_ON) { + ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8710b power_trim_data->bb_gain[0][0]=0x%X\n", p_power_trim_info->bb_gain[0][0])); + } } void phydm_set_kfree_to_rf_8710b( diff --git a/hal/phydm/halrf/rtl8812a/halrf_8812a_ce.c b/hal/phydm/halrf/rtl8812a/halrf_8812a_ce.c index 29a553f..bfc7da1 100644 --- a/hal/phydm/halrf/rtl8812a/halrf_8812a_ce.c +++ b/hal/phydm/halrf/rtl8812a/halrf_8812a_ce.c @@ -1366,8 +1366,9 @@ phy_iq_calibrate_8812a( if (p_dm->fw_offload_ability & PHYDM_RF_IQK_OFFLOAD) { _phy_iq_calibrate_by_fw_8812a(p_dm); phydm_iqk_wait(p_dm, 500); - if (p_dm->rf_calibrate_info.is_iqk_in_progress) + if (p_dm->rf_calibrate_info.is_iqk_in_progress) { ODM_RT_TRACE(p_dm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("== FW IQK TIMEOUT (Still in progress after 500ms) ==\n")); + } } else _phy_iq_calibrate_8812a(p_dm, *p_dm->p_channel); } diff --git a/hal/phydm/phydm_beamforming.c b/hal/phydm/phydm_beamforming.c index c2a9af5..0e77691 100644 --- a/hal/phydm/phydm_beamforming.c +++ b/hal/phydm/phydm_beamforming.c @@ -1069,8 +1069,9 @@ phydm_beamforming_notify( /*if (p_sound_info->sound_mode == SOUNDING_SW_VHT_TIMER || p_sound_info->sound_mode == SOUNDING_SW_HT_TIMER) odm_set_timer(p_dm, &p_beam_info->beamforming_timer, p_sound_info->sound_period);*/ odm_set_timer(p_dm, &p_beam_info->beamforming_timer, 1000); /*Do MU sounding every 1sec*/ - } else + } else { PHYDM_DBG(p_dm, DBG_TXBF, ("%s: Less or larger than 2 MU STAs, not to set timer\n", __func__)); + } break; case BEAMFORMEE_NOTIFY_DELETE_MU: @@ -1188,8 +1189,9 @@ beamforming_init_entry( if (p_beamformer_entry == NULL) { p_beamformer_entry = beamforming_add_bfer_entry(p_dm, p_sta, beamform_cap, num_of_sounding_dim, &bfer_idx); - if (p_beamformer_entry == NULL) + if (p_beamformer_entry == NULL) { PHYDM_DBG(p_dm, DBG_TXBF, ("[%s]Not enough BFer entry!!!!!\n", __func__)); + } } } @@ -1594,9 +1596,9 @@ beamforming_timer_callback( #endif if (ret) ret = beamforming_start_sw(p_dm, p_sound_info->sound_idx, p_sound_info->sound_mode, p_sound_info->sound_bw); - else + else { PHYDM_DBG(p_dm, DBG_TXBF, ("%s, Error value return from BeamformingStart_V2\n", __func__)); - + } if ((p_beam_info->beamformee_su_cnt != 0) || (p_beam_info->beamformee_mu_cnt > 1)) { if (p_sound_info->sound_mode == SOUNDING_SW_VHT_TIMER || p_sound_info->sound_mode == SOUNDING_SW_HT_TIMER) odm_set_timer(p_dm, &p_beam_info->beamforming_timer, p_sound_info->sound_period); diff --git a/hal/phydm/phydm_debug.c b/hal/phydm/phydm_debug.c index fc6f1eb..33bb55d 100644 --- a/hal/phydm/phydm_debug.c +++ b/hal/phydm/phydm_debug.c @@ -1283,9 +1283,9 @@ phydm_basic_dbg_message if (p_dm->support_ic_type & ODM_IC_PHY_STATUE_NEW_TYPE) PHYDM_DBG(p_dm, ODM_COMP_COMMON, ("Coding: LDPC=((%s)), STBC=((%s))\n", (p_dm->phy_dbg_info.is_ldpc_pkt) ? "Y" : "N", (p_dm->phy_dbg_info.is_stbc_pkt) ? "Y" : "N")); #endif - } else + } else { PHYDM_DBG(p_dm, ODM_COMP_COMMON, ("No Link !!!\n")); - + } PHYDM_DBG(p_dm, ODM_COMP_COMMON, ("[CCA Cnt] {CCK, OFDM, Total} = {%d, %d, %d}\n", false_alm_cnt->cnt_cck_cca, false_alm_cnt->cnt_ofdm_cca, false_alm_cnt->cnt_cca_all)); @@ -1567,9 +1567,10 @@ phydm_fw_trace_en_h2c( PHYDM_DBG(p_dm, DBG_FW_TRACE, ("---->\n")); if (monitor_mode == 0) PHYDM_DBG(p_dm, DBG_FW_TRACE, ("[H2C] FW_debug_en: (( %d ))\n", enable)); - else + else { PHYDM_DBG(p_dm, DBG_FW_TRACE, ("[H2C] FW_debug_en: (( %d )), mode: (( %d )), macid: (( %d ))\n", enable, monitor_mode, macid)); - odm_fill_h2c_cmd(p_dm, PHYDM_H2C_FW_TRACE_EN, cmd_length, h2c_parameter); + odm_fill_h2c_cmd(p_dm, PHYDM_H2C_FW_TRACE_EN, cmd_length, h2c_parameter); + } } void @@ -3146,9 +3147,9 @@ phydm_fw_trace_handler_code( u16 content_3 = (((u16)buffer[9]) << 8) | ((u16)buffer[8]); u16 content_4 = (((u16)buffer[11]) << 8) | ((u16)buffer[10]); - if (cmd_len > 12) + if (cmd_len > 12) { PHYDM_DBG(p_dm, DBG_FW_TRACE, ("[FW Msg] Invalid cmd length (( %d )) >12\n", cmd_len)); - + } /* PHYDM_DBG(p_dm, DBG_FW_TRACE,("[FW Msg] Func=((%d)), num=((%d)), ct_0=((%d)), ct_1=((%d)), ct_2=((%d)), ct_3=((%d)), ct_4=((%d))\n", */ /* function, dbg_num, content_0, content_1, content_2, content_3, content_4)); */ diff --git a/hal/phydm/txbf/haltxbfjaguar.c b/hal/phydm/txbf/haltxbfjaguar.c index 0386837..18634ae 100644 --- a/hal/phydm/txbf/haltxbfjaguar.c +++ b/hal/phydm/txbf/haltxbfjaguar.c @@ -147,8 +147,9 @@ hal_txbf_jaguar_download_ndpa( dl_bcn_count++; } while (!(bcn_valid_reg & BIT(0)) && dl_bcn_count < 5); - if (!(bcn_valid_reg & BIT(0))) + if (!(bcn_valid_reg & BIT(0))) { PHYDM_DBG(p_dm, DBG_TXBF, ("%s Download RSVD page failed!\n", __func__)); + } /*TDECTRL[15:8] 0x209[7:0] = 0xF6 Beacon Head for TXDMA*/ odm_write_1byte(p_dm, REG_TDECTRL_8812A + 1, tx_page_bndy); From 88301eb45a2daef777878eedeb9d79ca23ff34c3 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Wed, 8 Aug 2018 19:03:15 +0200 Subject: [PATCH 2/2] Allow build for kernels with backported cfg80211 API --- Makefile | 2 +- Realtek_Changelog.txt | 4 +- dkms.conf | 2 +- os_dep/linux/api_level.h | 12 ++ os_dep/linux/ioctl_cfg80211.c | 249 +++++++++++++++++----------------- os_dep/linux/rtw_cfgvendor.c | 5 +- 6 files changed, 144 insertions(+), 130 deletions(-) create mode 100644 os_dep/linux/api_level.h 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);