diff --git a/Makefile b/Makefile index 9037a40..1ef9c68 100644 --- a/Makefile +++ b/Makefile @@ -57,6 +57,7 @@ CONFIG_PNO_SET_DEBUG = n CONFIG_AP_WOWLAN = n ###################### Platform Related ####################### CONFIG_PLATFORM_I386_PC = y +CONFIG_PLATFORM_FS_MX61 = n ############################################################### CONFIG_DRVEXT_MODULE = n @@ -265,6 +266,16 @@ MODDESTDIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/kernel/drivers/net/wireles INSTALL_PREFIX := endif +ifeq ($(CONFIG_PLATFORM_FS_MX61), y) +EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 +EXTRA_CFLAGS += -DRTW_USE_CFG80211_STA_EVENT # only enable when kernel >= 3.2 +EXTRA_CFLAGS += -DCONFIG_P2P_IPS +EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -Wno-error=date-time +ARCH := arm +KSRC ?= $(KERNEL_SRC) +MODDESTDIR := kernel/drivers/net/wireless/ +LICENSE = "GPLv2" +endif ifneq ($(USER_MODULE_NAME),) MODULE_NAME := $(USER_MODULE_NAME) @@ -312,12 +323,10 @@ $(MODULE_NAME)-y += $(_HAL_INTFS_FILES) $(MODULE_NAME)-y += $(_OUTSRC_FILES) $(MODULE_NAME)-y += $(_PLATFORM_FILES) -obj-$(CONFIG_RTL8723BU) := $(MODULE_NAME).o +obj-m := $(MODULE_NAME).o else -export CONFIG_RTL8723BU = m - all: modules modules: @@ -328,13 +337,12 @@ strip: install: install -p -m 644 -D $(MODULE_NAME).ko $(MODDESTDIR)$(MODULE_NAME).ko -ifeq ($(INSTALL_MOD_PATH),) - $(DEPMOD) -a ${KVER} -else - $(DEPMOD) -b "$(INSTALL_MOD_PATH)" -a ${KVER} -endif + $(DEPMOD) -a ${KVER} install rtl8723b_fw.bin -D $(FW_DIR)/rtl8723b_fw.bin +modules_install: + $(MAKE) INSTALL_MOD_DIR=$(MODDESTDIR) -C $(KSRC) M=$(shell pwd) modules_install + uninstall: rm -f $(MODDESTDIR)$(MODULE_NAME).ko $(DEPMOD) -a ${KVER} @@ -354,6 +362,6 @@ clean: cd platform ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko rm -fr Module.symvers ; rm -fr Module.markers ; rm -fr modules.order rm -fr *.mod.c *.mod *.o .*.cmd *.ko *~ - rm -fr .tmp_versions + rm -fr .tmp_versions .cache.mk endif diff --git a/README.md b/README.md index 061c80e..ce6d85c 100644 --- a/README.md +++ b/README.md @@ -2,35 +2,59 @@ Driver for Realtek RTL8723BU Wireless Adapter with Hardware ID `0bda:b720` # How to use? -## a. Concurrent Mode -If you want to operate the hardware as a station AND as an access point *simultaneously*, follow these instructions. This will show two devices when you run the `iwconfig` command. - -Run the following commands in the Linux terminal. - +## Get the source first. +Get it from Github repository with the following command in the Linux terminal. ``` git clone https://github.com/lwfinger/rtl8723bu.git cd rtl8723bu -make -sudo make install -sudo modprobe -v 8723bu - ``` +Or get it as zip archive. Note: If you use the zip format, you will need to download the entire source EVERY time it is changed. By contrast, +a 'git pull' will get only the changed part. In addition, the git version will be able to access all branches, whereas the zip version only +handles one branch. +``` +wget https://github.com/lwfinger/rtl8723bu/archive/master.zip +unzip master.zip && rm master.zip +cd rtl8723bu-master +... +Note: The code in branch v4.3.16 is better than that in master. Get that with +git clone https://github.com/lwfinger/rtl8723bu.git -b v4.3.16 +``` +## Concurrent or Non-Concurrent Mode +By default driver operates the hardware as a station AND as an access point *simultaneously*. This will show two devices when you run the `iwconfig` command. -## b. Non Concurrent Mode -If you do not want two devices (station and an access point) separately, then follow these instructions. +If you do not want two devices (station and an access point) *simultaneously*, then follow these instructions. -Step - 1: Run the following commands in the Linux terminal. +- Step 1: Run the following command in the Linux terminal. ``` -git clone https://github.com/lwfinger/rtl8723bu.git -cd rtl8723bu nano Makefile ``` -Step - 2: Find the line that contains `EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE` and insert a `#` symbol at the beginning of that line. This comments that line and disables concurrent mode. +- Step 2: Find the line that contains `EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE` and insert a `#` symbol at the beginning of that line. This comments that line and disables concurrent mode. -Step - 3: Now, run the following commands in the same Linux terminal. + +## Manual install +Run the following commands in the Linux terminal. ``` make sudo make install sudo modprobe -v 8723bu +``` +This driver can not work with the standard driver rtl8xxxu, thus you need to blacklist it. Run the following command +... +sudo nano /etc/modprobe.d/50-rtl8xxxu.conf +... +Add a single line: blacklist rtl8xxxu +... +## Automatic install using DKMS +If you don't want to worry about building/installing driver after kernel update, use this scenario. For Ubuntu/Debian install DKMS package using command `sudo apt install dkms`. + +Then run following commands in terminal +``` +source dkms.conf +sudo mkdir /usr/src/$PACKAGE_NAME-$PACKAGE_VERSION +sudo cp -r core hal include os_dep platform dkms.conf Makefile rtl8723b_fw.bin /usr/src/$PACKAGE_NAME-$PACKAGE_VERSION +sudo dkms add $PACKAGE_NAME/$PACKAGE_VERSION +sudo dkms autoinstall $PACKAGE_NAME/$PACKAGE_VERSION +``` + diff --git a/core/rtw_ap.c b/core/rtw_ap.c index 44a6111..66d771c 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -195,7 +195,7 @@ void rtw_add_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *d u8 bmatch = _FALSE; u8 *pie = pnetwork->IEs; u8 *p=NULL, *dst_ie=NULL, *premainder_ie=NULL, *pbackup_remainder_ie=NULL; - u32 i, offset, ielen, ie_offset, remainder_ielen = 0; + u32 i, offset, ielen = 0, ie_offset, remainder_ielen = 0; for (i = sizeof(NDIS_802_11_FIXED_IEs); i < pnetwork->IELength;) { diff --git a/core/rtw_btcoex.c b/core/rtw_btcoex.c index 0bea847..1bce49e 100644 --- a/core/rtw_btcoex.c +++ b/core/rtw_btcoex.c @@ -173,7 +173,7 @@ u8 rtw_btcoex_IsBtDisabled(PADAPTER padapter) void rtw_btcoex_Handler(PADAPTER padapter) { #if defined(CONFIG_CONCURRENT_MODE) - if (padapter->adapter_type != PRIMARY_ADAPTER) + if (padapter->adapter_type != PRIMARYadapter) return; #endif diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index 321497a..d37f249 100644 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -334,7 +334,7 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) #ifdef CONFIG_CONCURRENT_MODE //change pcmdpriv to primary's pcmdpriv - if (padapter->adapter_type != PRIMARY_ADAPTER && padapter->pbuddy_adapter) + if (padapter->adapter_type != PRIMARYadapter && padapter->pbuddy_adapter) pcmdpriv = &(padapter->pbuddy_adapter->cmdpriv); #endif @@ -1900,7 +1900,7 @@ u8 rtw_dynamic_chk_wk_cmd(_adapter*padapter) //only primary padapter does this cmd /* #ifdef CONFIG_CONCURRENT_MODE - if (padapter->adapter_type != PRIMARY_ADAPTER && padapter->pbuddy_adapter) + if (padapter->adapter_type != PRIMARYadapter && padapter->pbuddy_adapter) pcmdpriv = &(padapter->pbuddy_adapter->cmdpriv); #endif */ @@ -2178,7 +2178,7 @@ static void collect_traffic_statistics(_adapter *padapter) struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); #ifdef CONFIG_CONCURRENT_MODE - if (padapter->adapter_type != PRIMARY_ADAPTER) + if (padapter->adapter_type != PRIMARYadapter) return; #endif @@ -2939,7 +2939,7 @@ u8 rtw_ps_cmd(_adapter*padapter) #ifdef CONFIG_CONCURRENT_MODE - if (padapter->adapter_type != PRIMARY_ADAPTER) + if (padapter->adapter_type != PRIMARYadapter) goto exit; #endif diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index 03266ce..1b7a9a3 100644 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -1623,7 +1623,11 @@ inline void rtw_indicate_scan_done( _adapter *padapter, bool aborted) #ifdef CONFIG_IPS_CHECK_IN_WD _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 1); #else // !CONFIG_IPS_CHECK_IN_WD +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) _rtw_set_pwr_state_check_timer(pwrpriv, 1); +#else + _rtw_set_pwr_state_check_timer(padapter, 1); +#endif #endif // !CONFIG_IPS_CHECK_IN_WD } #endif // CONFIG_IPS @@ -3663,8 +3667,8 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui if (stbc_rx_enable) ht_capie.cap_info |= cpu_to_le16(IEEE80211_HT_CAP_RX_STBC_1R);//RX STBC One spatial stream - set_mcs_rate_by_mask(ht_capie.supp_mcs_set, MCS_RATE_1R); - break; + set_mcs_rate_by_mask(ht_capie.supp_mcs_set, MCS_RATE_1R); + break; case RF_2T2R: case RF_1T2R: diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index b904317..c2b0935 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -749,7 +749,7 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame) ptable->func = &OnAuth; else ptable->func = &OnAuthClient; - //pass through + __attribute__ ((__fallthrough__));/* FALL THRU */ case WIFI_ASSOCREQ: case WIFI_REASSOCREQ: _mgt_dispatcher(padapter, ptable, precv_frame); diff --git a/core/rtw_p2p.c b/core/rtw_p2p.c index 725d03e..3f6ab5d 100644 --- a/core/rtw_p2p.c +++ b/core/rtw_p2p.c @@ -3598,9 +3598,17 @@ static void ro_ch_handler(_adapter *padapter) } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) static void ro_ch_timer_process (void *FunctionContext) +#else +static void ro_ch_timer_process (struct timer_list *t) +#endif { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) _adapter *adapter = (_adapter *)FunctionContext; +#else + _adapter *adapter = from_timer(adapter, t, cfg80211_wdinfo.remain_on_ch_timer); +#endif struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter); //printk("%s \n", __FUNCTION__); @@ -4371,7 +4379,11 @@ void rtw_init_cfg80211_wifidirect_info( _adapter* padapter) _rtw_memset(pcfg80211_wdinfo, 0x00, sizeof(struct cfg80211_wifidirect_info) ); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) _init_timer( &pcfg80211_wdinfo->remain_on_ch_timer, padapter->pnetdev, ro_ch_timer_process, padapter ); +#else + timer_setup(&pcfg80211_wdinfo->remain_on_ch_timer, ro_ch_timer_process, 0); +#endif } #endif //CONFIG_IOCTL_CFG80211 @@ -4692,9 +4704,17 @@ u8 p2p_ps_wk_cmd(_adapter*padapter, u8 p2p_ps_state, u8 enqueue) } #endif // CONFIG_P2P_PS +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void reset_ch_sitesurvey_timer_process(struct timer_list *t) +#else static void reset_ch_sitesurvey_timer_process (void *FunctionContext) +#endif { - _adapter *adapter = (_adapter *)FunctionContext; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + struct adapter *adapter = from_timer(adapter, t, wdinfo.reset_ch_sitesurvey); +#else + struct adapter *adapter = (struct adapter *)FunctionContext; +#endif struct wifidirect_info *pwdinfo = &adapter->wdinfo; if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -4711,9 +4731,17 @@ static void reset_ch_sitesurvey_timer_process (void *FunctionContext) pwdinfo->rx_invitereq_info.scan_op_ch_only = 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void reset_ch_sitesurvey_timer_process2(struct timer_list *t) +#else static void reset_ch_sitesurvey_timer_process2 (void *FunctionContext) +#endif { - _adapter *adapter = (_adapter *)FunctionContext; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + struct adapter *adapter = from_timer(adapter, t, wdinfo.reset_ch_sitesurvey2); +#else + struct adapter *adapter = (struct adapter *)FunctionContext; +#endif struct wifidirect_info *pwdinfo = &adapter->wdinfo; if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -4730,9 +4758,17 @@ static void reset_ch_sitesurvey_timer_process2 (void *FunctionContext) pwdinfo->p2p_info.scan_op_ch_only = 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void restore_p2p_state_timer_process(struct timer_list *t) +#else static void restore_p2p_state_timer_process (void *FunctionContext) +#endif { - _adapter *adapter = (_adapter *)FunctionContext; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + struct adapter *adapter = from_timer(adapter, t, wdinfo.restore_p2p_state_timer); +#else + struct adapter *adapter = (struct adapter *)FunctionContext; +#endif struct wifidirect_info *pwdinfo = &adapter->wdinfo; if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -4741,13 +4777,21 @@ static void restore_p2p_state_timer_process (void *FunctionContext) p2p_protocol_wk_cmd( adapter, P2P_RESTORE_STATE_WK ); } -static void pre_tx_scan_timer_process (void *FunctionContext) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void pre_tx_scan_timer_process(struct timer_list *t) +#else +static void pre_tx_scan_timer_process(void *FunctionContext) +#endif { - _adapter *adapter = (_adapter *) FunctionContext; - struct wifidirect_info *pwdinfo = &adapter->wdinfo; - _irqL irqL; - struct mlme_priv *pmlmepriv = &adapter->mlmepriv; - u8 _status = 0; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + struct adapter *padapter = from_timer(padapter, t, wdinfo.pre_tx_scan_timer); +#else + struct adapter *padapter = (struct adapter *)FunctionContext; +#endif + struct wifidirect_info *pwdinfo = &padapter->wdinfo; + _irqL irqL; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + u8 _status = 0; if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return; @@ -4759,36 +4803,34 @@ static void pre_tx_scan_timer_process (void *FunctionContext) { if ( _TRUE == pwdinfo->tx_prov_disc_info.benable ) // the provision discovery request frame is trigger to send or not { - p2p_protocol_wk_cmd( adapter, P2P_PRE_TX_PROVDISC_PROCESS_WK ); - //issue_probereq_p2p(adapter, NULL); + p2p_protocol_wk_cmd(padapter, P2P_PRE_TX_PROVDISC_PROCESS_WK ); + //issue_probereq_p2p(padapter, NULL); //_set_timer( &pwdinfo->pre_tx_scan_timer, P2P_TX_PRESCAN_TIMEOUT ); } - } - else if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING)) - { + } else if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING)) { if ( _TRUE == pwdinfo->nego_req_info.benable ) - { - p2p_protocol_wk_cmd( adapter, P2P_PRE_TX_NEGOREQ_PROCESS_WK ); - } - } - else if ( rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_INVITE_REQ ) ) - { + p2p_protocol_wk_cmd(padapter, P2P_PRE_TX_NEGOREQ_PROCESS_WK ); + } else if ( rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_INVITE_REQ ) ) { if ( _TRUE == pwdinfo->invitereq_info.benable ) - { - p2p_protocol_wk_cmd( adapter, P2P_PRE_TX_INVITEREQ_PROCESS_WK ); - } - } - else - { + p2p_protocol_wk_cmd(padapter, P2P_PRE_TX_INVITEREQ_PROCESS_WK ); + } else { DBG_8192C( "[%s] p2p_state is %d, ignore!!\n", __FUNCTION__, rtw_p2p_state(pwdinfo) ); } SPIN_UNLOCK_BH(pmlmepriv->lock, &irqL); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) static void find_phase_timer_process (void *FunctionContext) +#else +static void find_phase_timer_process(struct timer_list *t) +#endif { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) _adapter *adapter = (_adapter *)FunctionContext; +#else + _adapter *adapter = from_timer(adapter, t, wdinfo.find_phase_timer); +#endif struct wifidirect_info *pwdinfo = &adapter->wdinfo; if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -4800,9 +4842,17 @@ static void find_phase_timer_process (void *FunctionContext) } #ifdef CONFIG_CONCURRENT_MODE +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void ap_p2p_switch_timer_process(struct timer_list *t) +#else void ap_p2p_switch_timer_process (void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *adapter = from_timer(adapter, t, wdinfo.ap_p2p_switch_timer); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif struct wifidirect_info *pwdinfo = &adapter->wdinfo; #ifdef CONFIG_IOCTL_CFG80211 struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter); @@ -4859,6 +4909,7 @@ void rtw_init_wifidirect_timers(_adapter* padapter) { struct wifidirect_info *pwdinfo = &padapter->wdinfo; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) _init_timer( &pwdinfo->find_phase_timer, padapter->pnetdev, find_phase_timer_process, padapter ); _init_timer( &pwdinfo->restore_p2p_state_timer, padapter->pnetdev, restore_p2p_state_timer_process, padapter ); _init_timer( &pwdinfo->pre_tx_scan_timer, padapter->pnetdev, pre_tx_scan_timer_process, padapter ); @@ -4867,6 +4918,16 @@ void rtw_init_wifidirect_timers(_adapter* padapter) #ifdef CONFIG_CONCURRENT_MODE _init_timer( &pwdinfo->ap_p2p_switch_timer, padapter->pnetdev, ap_p2p_switch_timer_process, padapter ); #endif +#else + timer_setup(&pwdinfo->find_phase_timer, find_phase_timer_process, 0); + timer_setup(&pwdinfo->restore_p2p_state_timer, restore_p2p_state_timer_process, 0); + timer_setup(&pwdinfo->pre_tx_scan_timer, pre_tx_scan_timer_process, 0); + timer_setup(&pwdinfo->reset_ch_sitesurvey, reset_ch_sitesurvey_timer_process, 0); + timer_setup(&pwdinfo->reset_ch_sitesurvey2, reset_ch_sitesurvey_timer_process2, 0); +#ifdef CONFIG_CONCURRENT_MODE + timer_setup(&pwdinfo->ap_p2p_switch_timer, ap_p2p_switch_timer_process, 0); +#endif +#endif } void rtw_init_wifidirect_addrs(_adapter* padapter, u8 *dev_addr, u8 *iface_addr) @@ -5247,8 +5308,13 @@ int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role) _cancel_timer_ex( &pwdinfo->pre_tx_scan_timer); _cancel_timer_ex( &pwdinfo->reset_ch_sitesurvey); _cancel_timer_ex( &pwdinfo->reset_ch_sitesurvey2); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + reset_ch_sitesurvey_timer_process(&pwdinfo->reset_ch_sitesurvey); + reset_ch_sitesurvey_timer_process2(&pwdinfo->reset_ch_sitesurvey2); +#else reset_ch_sitesurvey_timer_process( padapter ); reset_ch_sitesurvey_timer_process2( padapter ); +#endif #ifdef CONFIG_CONCURRENT_MODE _cancel_timer_ex( &pwdinfo->ap_p2p_switch_timer); #endif diff --git a/core/rtw_pwrctrl.c b/core/rtw_pwrctrl.c index a82bf09..c7ffe2f 100644 --- a/core/rtw_pwrctrl.c +++ b/core/rtw_pwrctrl.c @@ -408,14 +408,26 @@ void rtw_ps_processor(_adapter*padapter) } exit: #ifndef CONFIG_IPS_CHECK_IN_WD +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) rtw_set_pwr_state_check_timer(pwrpriv); +#else + rtw_set_pwr_state_check_timer(padapter); +#endif #endif pwrpriv->ps_processing = _FALSE; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) void pwr_state_check_handler(RTW_TIMER_HDL_ARGS) +#else +void pwr_state_check_handler(struct timer_list *t) +#endif { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) _adapter *padapter = (_adapter *)FunctionContext; +#else + _adapter *padapter = from_timer(padapter, t, pwr_state_check_timer); +#endif rtw_ps_cmd(padapter); } @@ -1056,7 +1068,7 @@ void LPS_Leave(PADAPTER padapter, const char *msg) void LeaveAllPowerSaveModeDirect(PADAPTER Adapter) { - PADAPTER pri_padapter = GET_PRIMARY_ADAPTER(Adapter); + PADAPTER pri_padapter = GET_PRIMARYadapter(Adapter); struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv); struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(Adapter); struct dvobj_priv *psdpriv = Adapter->dvobj; @@ -1929,7 +1941,7 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter) struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); #if defined(CONFIG_CONCURRENT_MODE) - if (padapter->adapter_type != PRIMARY_ADAPTER) + if (padapter->adapter_type != PRIMARYadapter) return; #endif @@ -1945,7 +1957,11 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter) pwrctrlpriv->ips_mode = padapter->registrypriv.ips_mode; pwrctrlpriv->ips_mode_req = padapter->registrypriv.ips_mode; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) pwrctrlpriv->pwr_state_check_interval = RTW_PWR_STATE_CHK_INTERVAL; +#else + padapter->pwr_state_check_interval = RTW_PWR_STATE_CHK_INTERVAL; +#endif pwrctrlpriv->pwr_state_check_cnts = 0; pwrctrlpriv->bInternalAutoSuspend = _FALSE; pwrctrlpriv->bInSuspend = _FALSE; @@ -1989,8 +2005,11 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter) #endif // CONFIG_LPS_RPWM_TIMER #endif // CONFIG_LPS_LCLK +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) rtw_init_timer(&pwrctrlpriv->pwr_state_check_timer, padapter, pwr_state_check_handler); - +#else + timer_setup(&padapter->pwr_state_check_timer, pwr_state_check_handler, 0); +#endif pwrctrlpriv->wowlan_mode = _FALSE; pwrctrlpriv->wowlan_ap_mode = _FALSE; @@ -2022,7 +2041,7 @@ void rtw_free_pwrctrl_priv(PADAPTER adapter) struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(adapter); #if defined(CONFIG_CONCURRENT_MODE) - if (adapter->adapter_type != PRIMARY_ADAPTER) + if (adapter->adapter_type != PRIMARYadapter) return; #endif @@ -2238,7 +2257,7 @@ int _rtw_pwr_wakeup(_adapter *padapter, u32 ips_deffer_ms, const char *caller) LeaveAllPowerSaveMode(padapter); /* IPS still bound with primary adapter */ - padapter = GET_PRIMARY_ADAPTER(padapter); + padapter = GET_PRIMARYadapter(padapter); pmlmepriv = &padapter->mlmepriv; if (pwrpriv->ips_deny_time < rtw_get_current_time() + rtw_ms_to_systime(ips_deffer_ms)) diff --git a/core/rtw_recv.c b/core/rtw_recv.c index c980b72..ce8f663 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -103,7 +103,11 @@ sint _rtw_init_recv_priv(struct recv_priv *precvpriv, _adapter *padapter) res = rtw_hal_init_recv_priv(padapter); #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&precvpriv->signal_stat_timer, rtw_signal_stat_timer_hdl, 0); +#else rtw_init_timer(&precvpriv->signal_stat_timer, padapter, RTW_TIMER_HDL_NAME(signal_stat)); +#endif precvpriv->signal_stat_sampling_interval = 2000; //ms //precvpriv->signal_stat_converging_constant = 5000; //ms @@ -131,10 +135,6 @@ void rtw_mfree_recv_priv_lock(struct recv_priv *precvpriv) _rtw_spinlock_free(&precvpriv->recv_pending_queue.lock); _rtw_spinlock_free(&precvpriv->free_recv_buf_queue.lock); - -#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX - _rtw_spinlock_free(&precvpriv->recv_buf_pending_queue.lock); -#endif // CONFIG_USE_USB_BUFFER_ALLOC_RX } void _rtw_free_recv_priv (struct recv_priv *precvpriv) @@ -226,7 +226,7 @@ int rtw_free_recvframe(union recv_frame *precvframe, _queue *pfree_recv_queue) #ifdef CONFIG_CONCURRENT_MODE - if(padapter->adapter_type > PRIMARY_ADAPTER) + if(padapter->adapter_type > PRIMARYadapter) { padapter = padapter->pbuddy_adapter;//get primary_padapter precvpriv = &padapter->recvpriv; @@ -3632,8 +3632,17 @@ s32 rtw_recv_entry(union recv_frame *precvframe) } #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS -void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS){ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void rtw_signal_stat_timer_hdl(struct timer_list *t) +#else +void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS) +#endif +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *adapter = from_timer(adapter, t, recvpriv.signal_stat_timer); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif struct recv_priv *recvpriv = &adapter->recvpriv; u32 tmp_s, tmp_q; diff --git a/core/rtw_security.c b/core/rtw_security.c index fda9b5b..07f021d 100644 --- a/core/rtw_security.c +++ b/core/rtw_security.c @@ -2195,7 +2195,7 @@ u32 rtw_BIP_verify(_adapter *padapter, u8 *precvframe) #endif //CONFIG_IEEE80211W /* compress 512-bits */ -static int sha256_compress(struct sha256_state *md, unsigned char *buf) +static int sha256_compress(struct rtw_sha256_state *md, unsigned char *buf) { u32 S[8], W[64], t0, t1; u32 t; @@ -2237,7 +2237,7 @@ static int sha256_compress(struct sha256_state *md, unsigned char *buf) } /* Initialize the hash state */ -static void sha256_init(struct sha256_state *md) +static void sha256_init(struct rtw_sha256_state *md) { md->curlen = 0; md->length = 0; @@ -2258,7 +2258,7 @@ static void sha256_init(struct sha256_state *md) @param inlen The length of the data (octets) @return CRYPT_OK if successful */ -static int sha256_process(struct sha256_state *md, unsigned char *in, +static int sha256_process(struct rtw_sha256_state *md, unsigned char *in, unsigned long inlen) { unsigned long n; @@ -2299,7 +2299,7 @@ static int sha256_process(struct sha256_state *md, unsigned char *in, @param out [out] The destination of the hash (32 bytes) @return CRYPT_OK if successful */ -static int sha256_done(struct sha256_state *md, unsigned char *out) +static int sha256_done(struct rtw_sha256_state *md, unsigned char *out) { int i; @@ -2351,7 +2351,7 @@ static int sha256_done(struct sha256_state *md, unsigned char *out) static int sha256_vector(size_t num_elem, u8 *addr[], size_t *len, u8 *mac) { - struct sha256_state ctx; + struct rtw_sha256_state ctx; size_t i; sha256_init(&ctx); diff --git a/dkms.conf b/dkms.conf new file mode 100644 index 0000000..e27d934 --- /dev/null +++ b/dkms.conf @@ -0,0 +1,6 @@ +PACKAGE_NAME="rtl8723bu" +PACKAGE_VERSION="4.3.6.11_12942.20141204_BTCOEX20140507-4E40" +BUILT_MODULE_NAME[0]="8723bu" +DEST_MODULE_NAME[0]="rtl8723bu" +DEST_MODULE_LOCATION[0]="/kernel/drivers/net/wireless" +AUTOINSTALL="yes" diff --git a/hal/hal_intf.c b/hal/hal_intf.c index da575a3..776de4c 100644 --- a/hal/hal_intf.c +++ b/hal/hal_intf.c @@ -486,7 +486,7 @@ void rtw_hal_get_tx_power_level(_adapter *padapter, s32 *powerlevel) void rtw_hal_dm_watchdog(_adapter *padapter) { #if defined(CONFIG_CONCURRENT_MODE) - if (padapter->adapter_type != PRIMARY_ADAPTER) + if (padapter->adapter_type != PRIMARYadapter) return; #endif @@ -549,7 +549,7 @@ void rtw_hal_sreset_init(_adapter *padapter) } void rtw_hal_sreset_reset(_adapter *padapter) { - padapter = GET_PRIMARY_ADAPTER(padapter); + padapter = GET_PRIMARYadapter(padapter); if(padapter->HalFunc.silentreset) padapter->HalFunc.silentreset(padapter); @@ -589,7 +589,7 @@ bool rtw_hal_sreset_inprogress(_adapter *padapter) { bool inprogress = _FALSE; - padapter = GET_PRIMARY_ADAPTER(padapter); + padapter = GET_PRIMARYadapter(padapter); if(padapter->HalFunc.sreset_inprogress) inprogress = padapter->HalFunc.sreset_inprogress(padapter); diff --git a/hal/hal_usb_led.c b/hal/hal_usb_led.c index cc0935b..81fdcf0 100644 --- a/hal/hal_usb_led.c +++ b/hal/hal_usb_led.c @@ -2339,9 +2339,17 @@ void BlinkHandler(PLED_USB pLed) // Callback function of LED BlinkTimer, // it just schedules to corresponding BlinkWorkItem/led_blink_hdl // +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void BlinkTimerCallback(struct timer_list *t) +#else void BlinkTimerCallback(void *data) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + PLED_USB pLed = from_timer(pLed, t, BlinkTimer); +#else PLED_USB pLed = (PLED_USB)data; +#endif _adapter *padapter = pLed->padapter; //DBG_871X("%s\n", __FUNCTION__); @@ -4924,8 +4932,8 @@ LedControlUSB( // return; #ifdef CONFIG_CONCURRENT_MODE - // Only do led action for PRIMARY_ADAPTER - if (padapter->adapter_type != PRIMARY_ADAPTER) + // Only do led action for PRIMARYadapter + if (padapter->adapter_type != PRIMARYadapter) return; #endif @@ -5051,8 +5059,11 @@ InitLed( ResetLedStatus(pLed); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&pLed->BlinkTimer, BlinkTimerCallback, 0); +#else _init_timer(&(pLed->BlinkTimer), padapter->pnetdev, BlinkTimerCallback, pLed); - +#endif _init_workitem(&(pLed->BlinkWorkItem), BlinkWorkItemCallback, pLed); } diff --git a/hal/odm_interface.c b/hal/odm_interface.c index b9fe4d0..eedd14d 100644 --- a/hal/odm_interface.c +++ b/hal/odm_interface.c @@ -337,6 +337,7 @@ ODM_SetTimer( _set_timer(pTimer,msDelay ); //ms } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) VOID ODM_InitializeTimer( IN PDM_ODM_T pDM_Odm, @@ -349,6 +350,7 @@ ODM_InitializeTimer( PADAPTER Adapter = pDM_Odm->Adapter; _init_timer(pTimer,Adapter->pnetdev,CallBackFunc,pDM_Odm); } +#endif VOID ODM_CancelTimer( diff --git a/hal/rtl8723b_cmd.c b/hal/rtl8723b_cmd.c index eeee425..77fe2e9 100644 --- a/hal/rtl8723b_cmd.c +++ b/hal/rtl8723b_cmd.c @@ -74,7 +74,7 @@ s32 FillH2CCmd8723B(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer) struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; __le32 le_tmp; - padapter = GET_PRIMARY_ADAPTER(padapter); + padapter = GET_PRIMARYadapter(padapter); pHalData = GET_HAL_DATA(padapter); #ifdef DBG_CHECK_FW_PS_STATE #ifdef DBG_CHECK_FW_PS_STATE_H2C diff --git a/hal/rtl8723b_hal_init.c b/hal/rtl8723b_hal_init.c index 2c0dbc6..2863f0c 100644 --- a/hal/rtl8723b_hal_init.c +++ b/hal/rtl8723b_hal_init.c @@ -4030,7 +4030,7 @@ static void rtl8723b_fill_default_txdesc( DBG_8192C("%s set spe_rpt\n", __func__); #endif SET_TX_DESC_SPE_RPT_8723B(pbuf, 1); - SET_TX_DESC_SW_DEFINE_8723B(pbuf, (u8)(GET_PRIMARY_ADAPTER(padapter)->xmitpriv.seq_no)); + SET_TX_DESC_SW_DEFINE_8723B(pbuf, (u8)(GET_PRIMARYadapter(padapter)->xmitpriv.seq_no)); } #endif // CONFIG_XMIT_ACK } @@ -4462,7 +4462,7 @@ static void hw_var_set_macaddr(PADAPTER padapter, u8 variable, u8 *val) for (idx = 0 ; idx < 6; idx++) { - rtw_write8(GET_PRIMARY_ADAPTER(padapter), (reg_macid+idx), val[idx]); + rtw_write8(GET_PRIMARYadapter(padapter), (reg_macid+idx), val[idx]); } } diff --git a/hal/rtl8723bu_xmit.c b/hal/rtl8723bu_xmit.c index af0c8aa..ad1483a 100644 --- a/hal/rtl8723bu_xmit.c +++ b/hal/rtl8723bu_xmit.c @@ -91,7 +91,6 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bag _adapter *padapter = pxmitframe->padapter; struct tx_desc *ptxdesc = (struct tx_desc *)pmem; -#ifndef CONFIG_USE_USB_BUFFER_ALLOC_TX if((_FALSE == bagg_pkt) && (urb_zero_packet_chk(padapter, sz)==0)) { ptxdesc = (struct tx_desc *)(pmem+PACKET_OFFSET_SZ); @@ -99,7 +98,6 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bag pxmitframe->pkt_offset --; } -#endif // CONFIG_USE_USB_BUFFER_ALLOC_TX _rtw_memset(ptxdesc, 0, sizeof(struct tx_desc)); @@ -502,7 +500,6 @@ s32 rtl8723bu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv rtw_issue_addbareq_cmd(padapter, pfirstframe); } -#ifndef CONFIG_USE_USB_BUFFER_ALLOC_TX //3 3. update first frame txdesc if ((pbuf_tail % bulkSize) == 0) { // remove pkt_offset @@ -510,7 +507,6 @@ s32 rtl8723bu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv pfirstframe->buf_addr += PACKET_OFFSET_SZ; pfirstframe->pkt_offset = 0; } -#endif // CONFIG_USE_USB_BUFFER_ALLOC_TX update_txdesc(pfirstframe, pfirstframe->buf_addr, pfirstframe->attrib.last_txcmdsz, _TRUE); //3 4. write xmit buffer to USB FIFO diff --git a/hal/usb_ops.c b/hal/usb_ops.c index 9fe7fd6..63b995b 100644 --- a/hal/usb_ops.c +++ b/hal/usb_ops.c @@ -443,13 +443,7 @@ static void rtl8723bu_c2h_packet_handler(PADAPTER padapter, u8 *pbuf, u16 length #endif -static int recvbuf2recvframe(_adapter *padapter, u8 *tmpbuf, -#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX -struct recv_buf *precvbuf -#else -_pkt *pskb -#endif -) +static int recvbuf2recvframe(_adapter *padapter, u8 *tmpbuf, _pkt *pskb) { u8 *pbuf; u8 pkt_cnt = 0; @@ -462,13 +456,8 @@ _pkt *pskb struct recv_priv *precvpriv = &padapter->recvpriv; _queue *pfree_recv_queue = &precvpriv->free_recv_queue; -#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX - transfer_len = (s32)precvbuf->transfer_len; - pbuf = precvbuf->pbuf; -#else transfer_len = (s32)pskb->len; pbuf = pskb->data; -#endif//CONFIG_USE_USB_BUFFER_ALLOC_RX #ifdef CONFIG_USB_RX_AGGREGATION pkt_cnt = GET_RX_STATUS_DESC_USB_AGG_PKTNUM_8723B(pbuf); @@ -517,11 +506,7 @@ _pkt *pskb if (rtw_os_alloc_recvframe(padapter, precvframe, (pbuf+pattrib->shift_sz + pattrib->drvinfo_sz + RXDESC_SIZE), -#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX - NULL -#else pskb -#endif ) == _FAIL) { rtw_free_recvframe(precvframe, pfree_recv_queue); @@ -603,168 +588,6 @@ _pkt *pskb return _SUCCESS; } - -#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX -void rtl8723bu_recv_tasklet(void *priv) -{ - struct recv_buf *precvbuf = NULL; - _adapter *padapter = (_adapter*)priv; - struct recv_priv *precvpriv = &padapter->recvpriv; - u8 *tmpbuf = NULL; - - while (NULL != (precvbuf = rtw_dequeue_recvbuf(&precvpriv->recv_buf_pending_queue))) { - if ((padapter->bDriverStopped == _TRUE) || - (padapter->bSurpriseRemoved== _TRUE)) { - DBG_8192C("recv_tasklet => bDriverStopped or bSurpriseRemoved \n"); - - break; - } - - recvbuf2recvframe(padapter, tmpbuf, precvbuf); - - rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, - (unsigned char *)precvbuf); - } - kfree(tmpbuf); -} - -static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) -{ - struct recv_buf *precvbuf = (struct recv_buf *)purb->context; - _adapter *padapter =(_adapter *)precvbuf->adapter; - struct recv_priv *precvpriv = &padapter->recvpriv; - - RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_read_port_complete!!!\n")); - - precvpriv->rx_pending_cnt --; - - if (RTW_CANNOT_RX(padapter)) { - RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_read_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)\n", - padapter->bDriverStopped, - padapter->bSurpriseRemoved)); - return; - } - - if (purb->status==0) { //SUCCESS - if ((purb->actual_length > MAX_RECVBUF_SZ) || - (purb->actual_length < RXDESC_SIZE)) { - RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_read_port_complete: (purb->actual_length > MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE)\n")); - - rtw_read_port(padapter, precvpriv->ff_hwaddr, - 0, (unsigned char *)precvbuf); - } else { - rtw_reset_continual_io_error(adapter_to_dvobj(padapter)); - - precvbuf->transfer_len = purb->actual_length; - - //rtw_enqueue_rx_transfer_buffer(precvpriv, rx_transfer_buf); - rtw_enqueue_recvbuf(precvbuf, - &precvpriv->recv_buf_pending_queue); - - tasklet_schedule(&precvpriv->recv_tasklet); - } - } else { - RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_read_port_complete : purb->status(%d) != 0 \n", - purb->status)); - - DBG_8192C("###=> usb_read_port_complete => urb status(%d)\n", - purb->status); - - if (rtw_inc_and_chk_continual_io_error(adapter_to_dvobj(padapter)) == _TRUE ){ - padapter->bSurpriseRemoved = _TRUE; - } - - switch(purb->status) { - case -EINVAL: - case -EPIPE: - case -ENODEV: - case -ESHUTDOWN: - //padapter->bSurpriseRemoved=_TRUE; - //RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bSurpriseRemoved=TRUE\n")); - case -ENOENT: - padapter->bDriverStopped=_TRUE; - RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_read_port_complete:bDriverStopped=TRUE\n")); - break; - case -EPROTO: - case -EILSEQ: - case -ETIME: - case -ECOMM: - case -EOVERFLOW: -#ifdef DBG_CONFIG_ERROR_DETECT - { - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - pHalData->srestpriv.Wifi_Error_Status = - USB_READ_PORT_FAIL; - } -#endif - rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, - (unsigned char *)precvbuf); - break; - case -EINPROGRESS: - DBG_8192C("ERROR: URB IS IN PROGRESS!/n"); - break; - default: - break; - } - } -} - -static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) -{ - int err; - unsigned int pipe; - u32 ret = _SUCCESS; - PURB purb = NULL; - struct recv_buf *precvbuf = (struct recv_buf *)rmem; - _adapter *adapter = pintfhdl->padapter; - struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter); - struct pwrctrl_priv *pwrctl = dvobj_to_pwrctl(pdvobj); - struct recv_priv *precvpriv = &adapter->recvpriv; - struct usb_device *pusbd = pdvobj->pusbdev; - - if (RTW_CANNOT_RX(adapter) || (precvbuf == NULL)) { - RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("usb_read_port:( RTW_CANNOT_RX ) || precvbuf == NULL!!!\n")); - return _FAIL; - } - - rtl8723bu_init_recvbuf(adapter, precvbuf); - - if (precvbuf->pbuf) { - precvpriv->rx_pending_cnt++; - - purb = precvbuf->purb; - - //translate DMA FIFO addr to pipehandle - pipe = ffaddr2pipehdl(pdvobj, addr); - - usb_fill_bulk_urb(purb, pusbd, pipe, precvbuf->pbuf, - MAX_RECVBUF_SZ, usb_read_port_complete, - precvbuf);//context is precvbuf - - purb->transfer_dma = precvbuf->dma_transfer_addr; - purb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - - err = usb_submit_urb(purb, GFP_ATOMIC); - if (err && err != (-EPERM)) { - RT_TRACE(_module_hci_ops_os_c_, _drv_err_, - ("cannot submit rx in-token(err=0x%.8x), URB_STATUS =0x%.8x", - err, purb->status)); - DBG_8192C("cannot submit rx in-token(err = 0x%08x),urb_status = %d\n", - err, purb->status); - ret = _FAIL; - } - } - - return ret; -} -#else // CONFIG_USE_USB_BUFFER_ALLOC_RX - void rtl8723bu_recv_tasklet(void *priv) { _pkt *pskb; @@ -1021,8 +844,6 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) return ret; } -#endif // CONFIG_USE_USB_BUFFER_ALLOC_RX - void rtl8723bu_xmit_tasklet(void *priv) { diff --git a/include/autoconf.h b/include/autoconf.h index d5556af..5b48c54 100644 --- a/include/autoconf.h +++ b/include/autoconf.h @@ -216,17 +216,6 @@ //#define CONFIG_REDUCE_USB_TX_INT 1 // Trade-off: Improve performance, but may cause TX URBs blocked by USB Host/Bus driver on few platforms. //#define CONFIG_EASY_REPLACEMENT 1 -/* - * CONFIG_USE_USB_BUFFER_ALLOC_XX uses Linux USB Buffer alloc API and is for Linux platform only now! - */ -//#define CONFIG_USE_USB_BUFFER_ALLOC_TX 1 // Trade-off: For TX path, improve stability on some platforms, but may cause performance degrade on other platforms. -#define CONFIG_USE_USB_BUFFER_ALLOC_RX 1 // For RX path - -#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX -#undef CONFIG_PREALLOC_RECV_SKB -#endif - - /* * USB VENDOR REQ BUFFER ALLOCATION METHOD * if not set we'll use function local variable (stack memory) diff --git a/include/drv_types.h b/include/drv_types.h index b4faf00..5225beb 100644 --- a/include/drv_types.h +++ b/include/drv_types.h @@ -49,7 +49,7 @@ enum _NIC_VERSION { }; -typedef struct _ADAPTER _adapter, ADAPTER,*PADAPTER; +typedef struct adapter _adapter, ADAPTER,*PADAPTER; #include #include @@ -339,19 +339,19 @@ struct registry_priv #define BSSID_SZ(field) sizeof(((PWLAN_BSSID_EX) 0)->field) #ifdef CONFIG_CONCURRENT_MODE -#define is_primary_adapter(adapter) (adapter->adapter_type == PRIMARY_ADAPTER) +#define is_primary_adapter(adapter) (adapter->adapter_type == PRIMARYadapter) #define get_iface_type(adapter) (adapter->iface_type) #else #define is_primary_adapter(adapter) (1) #define get_iface_type(adapter) (IFACE_PORT0) #endif -#define GET_PRIMARY_ADAPTER(padapter) (((_adapter *)padapter)->dvobj->if1) +#define GET_PRIMARYadapter(padapter) (((_adapter *)padapter)->dvobj->if1) #define GET_IFACE_NUMS(padapter) (((_adapter *)padapter)->dvobj->iface_nums) -#define GET_ADAPTER(padapter, iface_id) (((_adapter *)padapter)->dvobj->padapters[iface_id]) +#define GETadapter(padapter, iface_id) (((_adapter *)padapter)->dvobj->padapters[iface_id]) enum _IFACE_ID { - IFACE_ID0, //maping to PRIMARY_ADAPTER - IFACE_ID1, //maping to SECONDARY_ADAPTER + IFACE_ID0, //maping to PRIMARYadapter + IFACE_ID1, //maping to SECONDARYadapter IFACE_ID2, IFACE_ID3, IFACE_ID_MAX, @@ -560,8 +560,8 @@ struct cam_entry_cache { struct dvobj_priv { /*-------- below is common data --------*/ - _adapter *if1; //PRIMARY_ADAPTER - _adapter *if2; //SECONDARY_ADAPTER + _adapter *if1; //PRIMARYadapter + _adapter *if2; //SECONDARYadapter s32 processing_dev_remove; @@ -659,10 +659,10 @@ enum _IFACE_TYPE { MAX_IFACE_PORT, }; -enum _ADAPTER_TYPE { - PRIMARY_ADAPTER, - SECONDARY_ADAPTER, - MAX_ADAPTER = 0xFF, +enum adapter_TYPE { + PRIMARYadapter, + SECONDARYadapter, + MAXadapter = 0xFF, }; typedef enum _DRIVER_STATE{ @@ -700,7 +700,11 @@ typedef struct loopbackdata }LOOPBACKDATA, *PLOOPBACKDATA; #endif -struct _ADAPTER{ +struct adapter{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _timer pwr_state_check_timer; + int pwr_state_check_interval; +#endif int DriverState;// for disable driver using module, use dongle to replace module. int pid[3];//process id from UI, 0:wps, 1:hostapd, 2:dhcpcd int bDongle;//build-in module or external dongle @@ -831,26 +835,26 @@ struct _ADAPTER{ #endif //pbuddy_adapter is used only in two inteface case, (iface_nums=2 in struct dvobj_priv) - //PRIMARY_ADAPTER's buddy is SECONDARY_ADAPTER - //SECONDARY_ADAPTER's buddy is PRIMARY_ADAPTER - //for iface_id > SECONDARY_ADAPTER(IFACE_ID1), refer to padapters[iface_id] in struct dvobj_priv - //and their pbuddy_adapter is PRIMARY_ADAPTER. - //for PRIMARY_ADAPTER(IFACE_ID0) can directly refer to if1 in struct dvobj_priv + //PRIMARYadapter's buddy is SECONDARYadapter + //SECONDARYadapter's buddy is PRIMARYadapter + //for iface_id > SECONDARYadapter(IFACE_ID1), refer to padapters[iface_id] in struct dvobj_priv + //and their pbuddy_adapter is PRIMARYadapter. + //for PRIMARYadapter(IFACE_ID0) can directly refer to if1 in struct dvobj_priv _adapter *pbuddy_adapter; #if defined(CONFIG_CONCURRENT_MODE) u8 isprimary; //is primary adapter or not //notes: - // if isprimary is true, the adapter_type value is 0, iface_id is IFACE_ID0 for PRIMARY_ADAPTER - // if isprimary is false, the adapter_type value is 1, iface_id is IFACE_ID1 for SECONDARY_ADAPTER + // if isprimary is true, the adapter_type value is 0, iface_id is IFACE_ID0 for PRIMARYadapter + // if isprimary is false, the adapter_type value is 1, iface_id is IFACE_ID1 for SECONDARYadapter // refer to iface_id if iface_nums>2 and isprimary is false and the adapter_type value is 0xff. - u8 adapter_type;//used only in two inteface case(PRIMARY_ADAPTER and SECONDARY_ADAPTER) . + u8 adapter_type;//used only in two inteface case(PRIMARYadapter and SECONDARYadapter) . u8 iface_type; //interface port type, it depends on HW port #endif //CONFIG_CONCURRENT_MODE //extend to support multi interface - //IFACE_ID0 is equals to PRIMARY_ADAPTER - //IFACE_ID1 is equals to SECONDARY_ADAPTER + //IFACE_ID0 is equals to PRIMARYadapter + //IFACE_ID1 is equals to SECONDARYadapter u8 iface_id; #ifdef CONFIG_BR_EXT diff --git a/include/hal_com_led.h b/include/hal_com_led.h index de6e09f..e3153ab 100644 --- a/include/hal_com_led.h +++ b/include/hal_com_led.h @@ -258,7 +258,11 @@ struct led_priv{ (adapter)->ledpriv.SwLedOff((adapter), (pLed)); \ } while(0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void BlinkTimerCallback(struct timer_list *t); +#else void BlinkTimerCallback(void *data); +#endif void BlinkWorkItemCallback(_workitem *work); void ResetLedStatus(PLED_DATA pLed); diff --git a/include/osdep_service.h b/include/osdep_service.h index e44ff19..1fba3f6 100644 --- a/include/osdep_service.h +++ b/include/osdep_service.h @@ -39,7 +39,11 @@ #endif #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void rtw_signal_stat_timer_hdl(struct timer_list *t); +#else void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS); +#endif #define RTW_TIMER_HDL_NAME(name) rtw_##name##_timer_hdl #define RTW_DECLARE_TIMER_HDL(name) void RTW_TIMER_HDL_NAME(name)(RTW_TIMER_HDL_ARGS) @@ -248,8 +252,9 @@ extern void rtw_udelay_os(int us); extern void rtw_yield_os(void); -extern void rtw_init_timer(_timer *ptimer, void *padapter, void *pfunc); - +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) +void rtw_init_timer(_timer *ptimer, void *padapter, void *pfunc); +#endif __inline static unsigned char _cancel_timer_ex(_timer *ptimer) { diff --git a/include/osdep_service_linux.h b/include/osdep_service_linux.h index 89feb33..c0e08fd 100644 --- a/include/osdep_service_linux.h +++ b/include/osdep_service_linux.h @@ -239,6 +239,7 @@ __inline static void rtw_list_delete(_list *plist) #define RTW_TIMER_HDL_ARGS void *FunctionContext +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) __inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,void* cntx) { //setup_timer(ptimer, pfunc,(u32)cntx); @@ -246,6 +247,7 @@ __inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,voi ptimer->data = (unsigned long)cntx; init_timer(ptimer); } +#endif __inline static void _set_timer(_timer *ptimer,u32 delay_time) { diff --git a/include/rtw_ioctl.h b/include/rtw_ioctl.h index c83fed4..2560b2d 100644 --- a/include/rtw_ioctl.h +++ b/include/rtw_ioctl.h @@ -41,7 +41,7 @@ #define NDIS_STATUS_CLOSING ((NDIS_STATUS)0xC0010002L) #define NDIS_STATUS_BAD_VERSION ((NDIS_STATUS)0xC0010004L) #define NDIS_STATUS_BAD_CHARACTERISTICS ((NDIS_STATUS)0xC0010005L) -#define NDIS_STATUS_ADAPTER_NOT_FOUND ((NDIS_STATUS)0xC0010006L) +#define NDIS_STATUSadapter_NOT_FOUND ((NDIS_STATUS)0xC0010006L) #define NDIS_STATUS_OPEN_FAILED ((NDIS_STATUS)0xC0010007L) #define NDIS_STATUS_DEVICE_FAILED ((NDIS_STATUS)0xC0010008L) #define NDIS_STATUS_MULTICAST_FULL ((NDIS_STATUS)0xC0010009L) @@ -53,14 +53,14 @@ #define NDIS_STATUS_NOT_SUPPORTED ((NDIS_STATUS)STATUS_NOT_SUPPORTED) #define NDIS_STATUS_INVALID_PACKET ((NDIS_STATUS)0xC001000FL) #define NDIS_STATUS_OPEN_LIST_FULL ((NDIS_STATUS)0xC0010010L) -#define NDIS_STATUS_ADAPTER_NOT_READY ((NDIS_STATUS)0xC0010011L) -#define NDIS_STATUS_ADAPTER_NOT_OPEN ((NDIS_STATUS)0xC0010012L) +#define NDIS_STATUSadapter_NOT_READY ((NDIS_STATUS)0xC0010011L) +#define NDIS_STATUSadapter_NOT_OPEN ((NDIS_STATUS)0xC0010012L) #define NDIS_STATUS_NOT_INDICATING ((NDIS_STATUS)0xC0010013L) #define NDIS_STATUS_INVALID_LENGTH ((NDIS_STATUS)0xC0010014L) #define NDIS_STATUS_INVALID_DATA ((NDIS_STATUS)0xC0010015L) #define NDIS_STATUS_BUFFER_TOO_SHORT ((NDIS_STATUS)0xC0010016L) #define NDIS_STATUS_INVALID_OID ((NDIS_STATUS)0xC0010017L) -#define NDIS_STATUS_ADAPTER_REMOVED ((NDIS_STATUS)0xC0010018L) +#define NDIS_STATUSadapter_REMOVED ((NDIS_STATUS)0xC0010018L) #define NDIS_STATUS_UNSUPPORTED_MEDIA ((NDIS_STATUS)0xC0010019L) #define NDIS_STATUS_GROUP_ADDRESS_IN_USE ((NDIS_STATUS)0xC001001AL) #define NDIS_STATUS_FILE_NOT_FOUND ((NDIS_STATUS)0xC001001BL) diff --git a/include/rtw_mlme.h b/include/rtw_mlme.h index 1ddc96a..1bda194 100644 --- a/include/rtw_mlme.h +++ b/include/rtw_mlme.h @@ -661,8 +661,13 @@ extern void rtw_atimdone_event_callback(_adapter *adapter, u8 *pbuf); extern void rtw_cpwm_event_callback(_adapter *adapter, u8 *pbuf); extern void rtw_wmm_event_callback(PADAPTER padapter, u8 *pbuf); -extern void rtw_join_timeout_handler(RTW_TIMER_HDL_ARGS); -extern void _rtw_scan_timeout_handler(RTW_TIMER_HDL_ARGS); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void rtw_join_timeout_handler(struct timer_list *t); +void _rtw_scan_timeout_handler(struct timer_list *t); +#else +void rtw_join_timeout_handler (void *FunctionContext); +void _rtw_scan_timeout_handler(RTW_TIMER_HDL_ARGS); +#endif thread_return event_thread(thread_context context); diff --git a/include/rtw_mlme_ext.h b/include/rtw_mlme_ext.h index 13c9c3d..519cb31 100644 --- a/include/rtw_mlme_ext.h +++ b/include/rtw_mlme_ext.h @@ -870,7 +870,7 @@ int rtw_get_ch_setting_union(_adapter *adapter, u8 *ch, u8 *bw, u8 *offset); struct cmd_hdl { uint parmsize; - u8 (*h2cfuns)(struct _ADAPTER *padapter, u8 *pbuf); + u8 (*h2cfuns)(struct adapter *padapter, u8 *pbuf); }; diff --git a/include/rtw_pwrctrl.h b/include/rtw_pwrctrl.h index b3e2d42..cb99833 100644 --- a/include/rtw_pwrctrl.h +++ b/include/rtw_pwrctrl.h @@ -332,8 +332,10 @@ struct pwrctrl_priv u32 wowlan_pattern_context[8][5]; u64 wowlan_fw_iv; #endif // CONFIG_WOWLAN +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) _timer pwr_state_check_timer; int pwr_state_check_interval; +#endif u8 pwr_state_check_cnts; int ps_flag; /* used by autosuspend */ diff --git a/include/rtw_security.h b/include/rtw_security.h index b5ed558..637dff1 100644 --- a/include/rtw_security.h +++ b/include/rtw_security.h @@ -232,7 +232,7 @@ struct security_priv #endif /* DBG_SW_SEC_CNT */ }; -struct sha256_state { +struct rtw_sha256_state { u64 length; u32 state[8], curlen; u8 buf[64]; diff --git a/include/wifi.h b/include/wifi.h index 815f723..5dc32eb 100644 --- a/include/wifi.h +++ b/include/wifi.h @@ -828,7 +828,9 @@ typedef enum _HT_CAP_AMPDU_FACTOR { * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2) */ #define IEEE80211_MIN_AMPDU_BUF 0x8 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0) #define IEEE80211_MAX_AMPDU_BUF 0x40 +#endif /* Spatial Multiplexing Power Save Modes */ diff --git a/os_dep/ioctl_cfg80211.c b/os_dep/ioctl_cfg80211.c index a77a11c..21cb6f0 100644 --- a/os_dep/ioctl_cfg80211.c +++ b/os_dep/ioctl_cfg80211.c @@ -353,7 +353,11 @@ static int rtw_ieee80211_channel_to_frequency(int chan, int band) static u64 rtw_get_systime_us(void) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)) + ktime_t ts; + ts = ktime_get_boottime(); + return do_div(ts, 1000); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) struct timespec ts; get_monotonic_boottime(&ts); return ((u64)ts.tv_sec*1000000) + ts.tv_nsec / 1000; @@ -839,6 +843,9 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter) #else cfg80211_disconnected(padapter->pnetdev, 0, NULL, 0, GFP_ATOMIC); #endif + else + cfg80211_connect_result(padapter->pnetdev, NULL, NULL, 0, NULL, 0, + WLAN_STATUS_UNSPECIFIED_FAILURE, GFP_ATOMIC); #endif // kernel >= 3.11 } } @@ -1734,7 +1741,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, } #ifdef CONFIG_CONCURRENT_MODE - if(padapter->adapter_type == SECONDARY_ADAPTER) + if(padapter->adapter_type == SECONDARYadapter) { DBG_871X(FUNC_NDEV_FMT" call netdev_if2_open\n", FUNC_NDEV_ARG(ndev)); if(netdev_if2_open(ndev) != 0) { @@ -1743,7 +1750,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, goto exit; } } - else if(padapter->adapter_type == PRIMARY_ADAPTER) + else if(padapter->adapter_type == PRIMARYadapter) #endif //CONFIG_CONCURRENT_MODE { DBG_871X(FUNC_NDEV_FMT" call netdev_open\n", FUNC_NDEV_ARG(ndev)); @@ -1811,6 +1818,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, #endif //CONFIG_P2P break; default: + pr_info("%s - type %d\n", __func__, type); ret = -EOPNOTSUPP; goto exit; } @@ -3042,6 +3050,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, if(rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL) { + pr_info("%s - rtw_set_802_11_add_wep() failed\n", __func__); ret = -EOPNOTSUPP ; } @@ -3298,7 +3307,7 @@ void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint f else // WIFI_REASSOCREQ ie_offset = _REASOCREQ_IE_OFFSET_; - sinfo.filled = 0; + memset(&sinfo, 0, sizeof(sinfo)); sinfo.filled = STATION_INFO_ASSOC_REQ_IES; sinfo.assoc_req_ies = pmgmt_frame + WLAN_HDR_A3_LEN + ie_offset; sinfo.assoc_req_ies_len = frame_len - WLAN_HDR_A3_LEN - ie_offset; @@ -5107,12 +5116,20 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy, #else struct net_device *ndev, #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) + struct mgmt_frame_regs *upd) +#else u16 frame_type, bool reg) +#endif { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) struct net_device *ndev = wdev_to_ndev(wdev); #endif _adapter *adapter; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) + u16 frame_type = BIT(upd->global_stypes << 4); + bool reg = false; +#endif if (ndev == NULL) goto exit; @@ -5918,11 +5935,16 @@ static struct cfg80211_ops rtw_cfg80211_ops = { #if (LINUX_VERSION_CODE >= 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)) .action = cfg80211_rtw_mgmt_tx, #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) + .update_mgmt_frame_registrations = cfg80211_rtw_mgmt_frame_register, +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + .mgmt_frame_register = cfg80211_rtw_mgmt_frame_register, +#endif + #if defined(CONFIG_TDLS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) .tdls_mgmt = cfg80211_rtw_tdls_mgmt, .tdls_oper = cfg80211_rtw_tdls_oper, diff --git a/os_dep/ioctl_linux.c b/os_dep/ioctl_linux.c index 566b3d5..ba736fb 100644 --- a/os_dep/ioctl_linux.c +++ b/os_dep/ioctl_linux.c @@ -946,6 +946,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, if(rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL) { + pr_info("%s - rtw_set_802_11_add_wep() failed\n", __func__); ret = -EOPNOTSUPP ; } } @@ -957,6 +958,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, //"psecuritypriv->dot11PrivacyKeyIndex=keyid", but can rtw_set_key to fw/cam if (wep_key_idx >= WEP_KEYS) { + pr_info("%s - wep_key_idx of %d too large\n", __func__, wep_key_idx); ret = -EOPNOTSUPP ; goto exit; } @@ -1957,6 +1959,7 @@ static int rtw_wx_set_mlme(struct net_device *dev, ret = -1; break; default: + pr_info("%s - mlme->cmd %d not supported\n", __func__, mlme->cmd); return -EOPNOTSUPP; } @@ -2811,6 +2814,7 @@ static int rtw_wx_set_enc(struct net_device *dev, if (rtw_set_802_11_add_wep(padapter, &wep) == _FALSE) { if(rf_on == pwrpriv->rf_pwrstate ) + pr_info("%s - rtw_set_802_11_add_wep() failed with rf on\n", __func__); ret = -EOPNOTSUPP; goto exit; } @@ -3066,6 +3070,7 @@ static int rtw_wx_set_auth(struct net_device *dev, #endif default: + pr_info("%s - param->flags %d\n", __func__, param->flags); return -EOPNOTSUPP; } @@ -7203,6 +7208,7 @@ static int wpa_set_param(struct net_device *dev, u8 name, u32 value) */ break; default: + pr_info("%s - name %d\n", __func__, name); ret = -EOPNOTSUPP; break; @@ -7232,6 +7238,7 @@ static int wpa_mlme(struct net_device *dev, u32 command, u32 reason) break; default: + pr_info("%s - command %d\n", __func__, command); ret = -EOPNOTSUPP; break; } diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 98ec2a6..9e36c1e 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -1814,6 +1814,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, break; default: ret = -EOPNOTSUPP; + pr_info("%s - Operation of type %d not supported\n", __func__, type); goto exit; } @@ -3037,6 +3038,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, if(rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL) { + pr_info("%s - rtw_set_802_11_add_wep() failed\n", __func__); ret = -EOPNOTSUPP ; } diff --git a/os_dep/mlme_linux.c b/os_dep/mlme_linux.c index 2854a4c..902a1a0 100644 --- a/os_dep/mlme_linux.c +++ b/os_dep/mlme_linux.c @@ -74,23 +74,47 @@ void sitesurvey_ctrl_handler(void *FunctionContext) } */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void rtw_join_timeout_handler(struct timer_list *t) +#else void rtw_join_timeout_handler (void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *adapter = from_timer(adapter, t, mlmepriv.assoc_timer); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif _rtw_join_timeout_handler(adapter); } -void _rtw_scan_timeout_handler (void *FunctionContext) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void _rtw_scan_timeout_handler(struct timer_list *t) +#else +void _rtw_scan_timeout_handler(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *adapter = from_timer(adapter, t, mlmepriv.scan_to_timer); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif rtw_scan_timeout_handler(adapter); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void _dynamic_check_timer_handlder(struct timer_list *t) +#else static void _dynamic_check_timer_handlder (void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *adapter = from_timer(adapter, t, mlmepriv.dynamic_chk_timer); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif #if (MP_DRIVER == 1) if (adapter->registrypriv.mp_mode == 1 && adapter->mppriv.mp_dm ==0) //for MP ODM dynamic Tx power tracking @@ -112,9 +136,17 @@ static void _dynamic_check_timer_handlder (void *FunctionContext) } #ifdef CONFIG_SET_SCAN_DENY_TIMER +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void _rtw_set_scan_deny_timer_hdl(struct timer_list *t) +#else static void _rtw_set_scan_deny_timer_hdl(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *adapter = from_timer(adapter, t, mlmepriv.set_scan_deny_timer); +#else _adapter *adapter = (_adapter *)FunctionContext; +#endif rtw_set_scan_deny_timer_hdl(adapter); } #endif @@ -124,8 +156,17 @@ void rtw_init_mlme_timer(_adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&pmlmepriv->assoc_timer, rtw_join_timeout_handler, 0); + timer_setup(&pmlmepriv->scan_to_timer, _rtw_scan_timeout_handler, 0); + + timer_setup(&pmlmepriv->dynamic_chk_timer, _dynamic_check_timer_handlder, 0); + + #ifdef CONFIG_SET_SCAN_DENY_TIMER + timer_setup(&pmlmepriv->set_scan_deny_timer, _rtw_set_scan_deny_timer_hdl, 0); + #endif +#else _init_timer(&(pmlmepriv->assoc_timer), padapter->pnetdev, rtw_join_timeout_handler, padapter); - //_init_timer(&(pmlmepriv->sitesurveyctrl.sitesurvey_ctrl_timer), padapter->pnetdev, sitesurvey_ctrl_handler, padapter); _init_timer(&(pmlmepriv->scan_to_timer), padapter->pnetdev, _rtw_scan_timeout_handler, padapter); _init_timer(&(pmlmepriv->dynamic_chk_timer), padapter->pnetdev, _dynamic_check_timer_handlder, padapter); @@ -133,6 +174,7 @@ void rtw_init_mlme_timer(_adapter *padapter) #ifdef CONFIG_SET_SCAN_DENY_TIMER _init_timer(&(pmlmepriv->set_scan_deny_timer), padapter->pnetdev, _rtw_set_scan_deny_timer_hdl, padapter); #endif +#endif #ifdef RTK_DMP_PLATFORM _init_workitem(&(pmlmepriv->Linkup_workitem), Linkup_workitem_callback, padapter); @@ -315,29 +357,61 @@ void rtw_report_sec_ie(_adapter *adapter,u8 authmode,u8 *sec_ie) } } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void _survey_timer_hdl(struct timer_list *t) +#else static void _survey_timer_hdl (void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *padapter = from_timer(padapter, t, mlmeextpriv.survey_timer); +#else _adapter *padapter = (_adapter *)FunctionContext; +#endif survey_timer_hdl(padapter); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void _link_timer_hdl(struct timer_list *t) +#else static void _link_timer_hdl (void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *padapter = from_timer(padapter, t, mlmeextpriv.link_timer); +#else _adapter *padapter = (_adapter *)FunctionContext; +#endif link_timer_hdl(padapter); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void _addba_timer_hdl(struct timer_list *t) +#else static void _addba_timer_hdl(void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + struct sta_info *psta = from_timer(psta, t, addba_retry_timer); +#else struct sta_info *psta = (struct sta_info *)FunctionContext; +#endif addba_timer_hdl(psta); } #ifdef CONFIG_IEEE80211W +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +void _sa_query_timer_hdl(struct timer_list *t) +#else void _sa_query_timer_hdl (void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + _adapter *padapter = from_timer(padapter, t, mlmeextpriv.sa_query_timer); +#else _adapter *padapter = (_adapter *)FunctionContext; +#endif sa_query_timer_hdl(padapter); } #endif //CONFIG_IEEE80211W @@ -345,7 +419,11 @@ void _sa_query_timer_hdl (void *FunctionContext) void init_addba_retry_timer(_adapter *padapter, struct sta_info *psta) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&psta->addba_retry_timer, _addba_timer_hdl, 0); +#else _init_timer(&psta->addba_retry_timer, padapter->pnetdev, _addba_timer_hdl, psta); +#endif } /* @@ -366,15 +444,19 @@ void init_mlme_ext_timer(_adapter *padapter) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&pmlmeext->survey_timer, _survey_timer_hdl, 0); + timer_setup(&pmlmeext->link_timer, _link_timer_hdl, 0); +#ifdef CONFIG_IEEE80211W + timer_setup(&pmlmeext->sa_query_timer, _sa_query_timer_hdl, 0); +#endif //CONFIG_IEEE80211W +#else _init_timer(&pmlmeext->survey_timer, padapter->pnetdev, _survey_timer_hdl, padapter); _init_timer(&pmlmeext->link_timer, padapter->pnetdev, _link_timer_hdl, padapter); #ifdef CONFIG_IEEE80211W _init_timer(&pmlmeext->sa_query_timer, padapter->pnetdev, _sa_query_timer_hdl, padapter); #endif //CONFIG_IEEE80211W - //_init_timer(&pmlmeext->ADDBA_timer, padapter->pnetdev, _addba_timer_hdl, padapter); - - //_init_timer(&pmlmeext->reauth_timer, padapter->pnetdev, _reauth_timer_hdl, padapter); - //_init_timer(&pmlmeext->reassoc_timer, padapter->pnetdev, _reassoc_timer_hdl, padapter); +#endif } #ifdef CONFIG_AP_MODE diff --git a/os_dep/os_intfs.c b/os_dep/os_intfs.c index 5bb3ecc..8747133 100644 --- a/os_dep/os_intfs.c +++ b/os_dep/os_intfs.c @@ -581,12 +581,17 @@ static unsigned int rtw_classify8021d(struct sk_buff *skb) } static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0)) + ,struct net_device *sb_dev +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) + ,struct net_device *sb_dev + ,select_queue_fallback_t fallback +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) + ,void *unused + ,select_queue_fallback_t fallback +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) , void *accel_priv -#endif // kernle >= 3.13 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - , select_queue_fallback_t fallback -#endif // kernel >= 3.14 +#endif ) { _adapter *padapter = rtw_netdev_priv(dev); @@ -1250,7 +1255,11 @@ void rtw_cancel_all_timer(_adapter *padapter) rtw_hal_sw_led_deinit(padapter); RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel DeInitSwLeds! \n")); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) _cancel_timer_ex(&(adapter_to_pwrctl(padapter)->pwr_state_check_timer)); +#else + _cancel_timer_ex(&padapter->pwr_state_check_timer); +#endif #ifdef CONFIG_IOCTL_CFG80211 #ifdef CONFIG_P2P @@ -1368,7 +1377,7 @@ u8 rtw_free_drv_sw(_adapter *padapter) int _netdev_vir_if_open(struct net_device *pnetdev) { _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); - _adapter *primary_padapter = GET_PRIMARY_ADAPTER(padapter); + _adapter *primary_padapter = GET_PRIMARYadapter(padapter); DBG_871X(FUNC_NDEV_FMT" enter\n", FUNC_NDEV_ARG(pnetdev)); @@ -1528,7 +1537,7 @@ _adapter *rtw_drv_add_vir_if(_adapter *primary_padapter, //set adapter_type/iface type padapter->isprimary = _FALSE; - padapter->adapter_type = MAX_ADAPTER; + padapter->adapter_type = MAXadapter; padapter->pbuddy_adapter = primary_padapter; //extended virtual interfaces always are set to port0 padapter->iface_type = IFACE_PORT0; @@ -1887,7 +1896,7 @@ _adapter *rtw_drv_if2_init(_adapter *primary_padapter, //set adapter_type/iface type padapter->isprimary = _FALSE; - padapter->adapter_type = SECONDARY_ADAPTER; + padapter->adapter_type = SECONDARYadapter; padapter->pbuddy_adapter = primary_padapter; padapter->iface_id = IFACE_ID1; #ifndef CONFIG_HWPORT_SWAP //Port0 -> Pri , Port1 -> Sec @@ -2211,7 +2220,11 @@ int _netdev_open(struct net_device *pnetdev) _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); #ifndef CONFIG_IPS_CHECK_IN_WD +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) rtw_set_pwr_state_check_timer(pwrctrlpriv); +#else + rtw_set_pwr_state_check_timer(padapter); +#endif #endif //netif_carrier_on(pnetdev);//call this func when rtw_joinbss_event_callback return success @@ -2300,7 +2313,11 @@ static int ips_netdrv_open(_adapter *padapter) } #ifndef CONFIG_IPS_CHECK_IN_WD +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) rtw_set_pwr_state_check_timer(adapter_to_pwrctl(padapter)); +#else + rtw_set_pwr_state_check_timer(padapter); +#endif #endif _set_timer(&padapter->mlmepriv.dynamic_chk_timer,2000); diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index e0c36a9..403ceef 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -242,12 +242,14 @@ void rtw_list_insert_tail(_list *plist, _list *phead) list_add_tail(plist, phead); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) void rtw_init_timer(_timer *ptimer, void *padapter, void *pfunc) { _adapter *adapter = (_adapter *)padapter; _init_timer(ptimer, adapter->pnetdev, pfunc, adapter); } +#endif /* Caller must check if the list is empty before calling rtw_list_delete @@ -715,7 +717,9 @@ static int isFileReadable(char *path) { struct file *fp; int ret = 0; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) mm_segment_t oldfs; +#endif char buf; fp=filp_open(path, O_RDONLY, 0); @@ -723,12 +727,16 @@ static int isFileReadable(char *path) ret = PTR_ERR(fp); } else { - oldfs = get_fs(); set_fs(get_ds()); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) + oldfs = get_fs(); set_fs(KERNEL_DS); +#endif if(1!=readFile(fp, &buf, 1)) ret = PTR_ERR(fp); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) set_fs(oldfs); +#endif filp_close(fp,NULL); } return ret; @@ -744,16 +752,22 @@ static int isFileReadable(char *path) static int retriveFromFile(char *path, u8* buf, u32 sz) { int ret =-1; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) mm_segment_t oldfs; +#endif struct file *fp; if(path && buf) { if( 0 == (ret=openFile(&fp,path, O_RDONLY, 0)) ){ DBG_871X("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp); - oldfs = get_fs(); set_fs(get_ds()); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) + oldfs = get_fs(); set_fs(KERNEL_DS); +#endif ret=readFile(fp, buf, sz); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) set_fs(oldfs); +#endif closeFile(fp); DBG_871X("%s readFile, ret:%d\n",__FUNCTION__, ret); @@ -778,16 +792,22 @@ static int retriveFromFile(char *path, u8* buf, u32 sz) static int storeToFile(char *path, u8* buf, u32 sz) { int ret =0; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) mm_segment_t oldfs; +#endif struct file *fp; if(path && buf) { if( 0 == (ret=openFile(&fp, path, O_CREAT|O_WRONLY, 0666)) ) { DBG_871X("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp); - oldfs = get_fs(); set_fs(get_ds()); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) + oldfs = get_fs(); set_fs(KERNEL_DS); +#endif ret=writeFile(fp, buf, sz); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) set_fs(oldfs); +#endif closeFile(fp); DBG_871X("%s writeFile, ret:%d\n",__FUNCTION__, ret); diff --git a/os_dep/recv_linux.c b/os_dep/recv_linux.c index 131c4b2..e8ea7ba 100644 --- a/os_dep/recv_linux.c +++ b/os_dep/recv_linux.c @@ -75,16 +75,6 @@ int rtw_os_alloc_recvframe(_adapter *padapter, union recv_frame *precvframe, u8 } else { -#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX - DBG_871X("%s:can not allocate memory for skb copy\n", __FUNCTION__); - - precvframe->u.hdr.pkt = NULL; - - //rtw_free_recvframe(precvframe, pfree_recv_queue); - //goto _exit_recvbuf2recvframe; - - res = _FAIL; -#else if((pattrib->mfrag == 1)&&(pattrib->frag_num == 0)) { DBG_871X("%s: alloc_skb fail , drop frag frame \n", __FUNCTION__); @@ -112,7 +102,6 @@ int rtw_os_alloc_recvframe(_adapter *padapter, union recv_frame *precvframe, u8 //goto _exit_recvbuf2recvframe; res = _FAIL; } -#endif } exit_rtw_os_recv_resource_alloc: @@ -192,13 +181,6 @@ int rtw_os_recvbuf_resource_alloc(_adapter *padapter, struct recv_buf *precvbuf) precvbuf->len = 0; - #ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX - precvbuf->pallocated_buf = rtw_usb_buffer_alloc(pusbd, (size_t)precvbuf->alloc_sz, &precvbuf->dma_transfer_addr); - precvbuf->pbuf = precvbuf->pallocated_buf; - if(precvbuf->pallocated_buf == NULL) - return _FAIL; - #endif //CONFIG_USE_USB_BUFFER_ALLOC_RX - return res; } @@ -206,15 +188,6 @@ int rtw_os_recvbuf_resource_alloc(_adapter *padapter, struct recv_buf *precvbuf) int rtw_os_recvbuf_resource_free(_adapter *padapter, struct recv_buf *precvbuf) { int ret = _SUCCESS; -#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX - struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); - struct usb_device *pusbd = pdvobjpriv->pusbdev; - - rtw_usb_buffer_free(pusbd, (size_t)precvbuf->alloc_sz, precvbuf->pallocated_buf, precvbuf->dma_transfer_addr); - precvbuf->pallocated_buf = NULL; - precvbuf->dma_transfer_addr = 0; - -#endif //CONFIG_USE_USB_BUFFER_ALLOC_RX if(precvbuf->purb) { @@ -223,12 +196,7 @@ int rtw_os_recvbuf_resource_free(_adapter *padapter, struct recv_buf *precvbuf) } if(precvbuf->pskb) - { -#ifdef CONFIG_PREALLOC_RX_SKB_BUFFER - if(rtw_free_skb_premem(precvbuf->pskb)!=0) -#endif rtw_skb_free(precvbuf->pskb); - } return ret; } @@ -633,9 +601,17 @@ void rtw_os_read_port(_adapter *padapter, struct recv_buf *precvbuf) } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) +static void _rtw_reordering_ctrl_timeout_handler(struct timer_list *t) +#else static void _rtw_reordering_ctrl_timeout_handler (void *FunctionContext) +#endif { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + struct recv_reorder_ctrl *preorder_ctrl = from_timer(preorder_ctrl, t, reordering_ctrl_timer); +#else struct recv_reorder_ctrl *preorder_ctrl = (struct recv_reorder_ctrl *)FunctionContext; +#endif rtw_reordering_ctrl_timeout_handler(preorder_ctrl); } @@ -643,6 +619,9 @@ void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl) { _adapter *padapter = preorder_ctrl->padapter; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + timer_setup(&preorder_ctrl->reordering_ctrl_timer, _rtw_reordering_ctrl_timeout_handler, 0); +#else _init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, _rtw_reordering_ctrl_timeout_handler, preorder_ctrl); - +#endif } diff --git a/os_dep/rtw_android.c b/os_dep/rtw_android.c index cbadd42..0a181c5 100644 --- a/os_dep/rtw_android.c +++ b/os_dep/rtw_android.c @@ -602,7 +602,11 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) goto exit; } - if (!access_ok(VERIFY_READ, priv_cmd.buf, priv_cmd.total_len)){ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) + if (!access_ok(priv_cmd.buf, priv_cmd.total_len)) { +#else + if (!access_ok(VERIFY_READ, priv_cmd.buf, priv_cmd.total_len)) { +#endif DBG_871X("%s: failed to access memory\n", __FUNCTION__); ret = -EFAULT; goto exit; @@ -953,6 +957,7 @@ int wifi_get_mac_addr(unsigned char *buf) if (wifi_control_data && wifi_control_data->get_mac_addr) { return wifi_control_data->get_mac_addr(buf); } + pr_info("%s - failed\n", __func__); return -EOPNOTSUPP; } #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) */ diff --git a/os_dep/rtw_proc.c b/os_dep/rtw_proc.c index 53c1e54..6d4159a 100644 --- a/os_dep/rtw_proc.c +++ b/os_dep/rtw_proc.c @@ -63,8 +63,14 @@ inline struct proc_dir_entry *rtw_proc_create_dir(const char *name, struct proc_ return entry; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) +#define struct_proc_ops proc_ops +#else +#define struct_proc_ops file_operations +#endif + inline struct proc_dir_entry *rtw_proc_create_entry(const char *name, struct proc_dir_entry *parent, - const struct file_operations *fops, void * data) + const struct struct_proc_ops *fops, void * data) { struct proc_dir_entry *entry; @@ -153,6 +159,14 @@ static ssize_t rtw_drv_proc_write(struct file *file, const char __user *buffer, return -EROFS; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) +static const struct proc_ops rtw_drv_proc_fops = { + .proc_open = rtw_drv_proc_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = single_release, + .proc_write = rtw_drv_proc_write, +#else static const struct file_operations rtw_drv_proc_fops = { .owner = THIS_MODULE, .open = rtw_drv_proc_open, @@ -160,6 +174,7 @@ static const struct file_operations rtw_drv_proc_fops = { .llseek = seq_lseek, .release = single_release, .write = rtw_drv_proc_write, +#endif }; int rtw_drv_proc_init(void) @@ -525,6 +540,14 @@ static ssize_t rtw_adapter_proc_write(struct file *file, const char __user *buff return -EROFS; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) +static const struct proc_ops rtw_adapter_proc_fops = { + .proc_open = rtw_adapter_proc_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = single_release, + .proc_write = rtw_adapter_proc_write, +#else static const struct file_operations rtw_adapter_proc_fops = { .owner = THIS_MODULE, .open = rtw_adapter_proc_open, @@ -532,6 +555,7 @@ static const struct file_operations rtw_adapter_proc_fops = { .llseek = seq_lseek, .release = single_release, .write = rtw_adapter_proc_write, +#endif }; int proc_get_odm_dbg_comp(struct seq_file *m, void *v) @@ -708,6 +732,14 @@ static ssize_t rtw_odm_proc_write(struct file *file, const char __user *buffer, return -EROFS; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) +static const struct proc_ops rtw_odm_proc_fops = { + .proc_open = rtw_odm_proc_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = single_release, + .proc_write = rtw_odm_proc_write, +#else static const struct file_operations rtw_odm_proc_fops = { .owner = THIS_MODULE, .open = rtw_odm_proc_open, @@ -715,6 +747,7 @@ static const struct file_operations rtw_odm_proc_fops = { .llseek = seq_lseek, .release = single_release, .write = rtw_odm_proc_write, +#endif }; static struct proc_dir_entry *rtw_odm_proc_init(struct net_device *dev) diff --git a/os_dep/usb_intf.c b/os_dep/usb_intf.c index a8c668b..33a9701 100644 --- a/os_dep/usb_intf.c +++ b/os_dep/usb_intf.c @@ -976,7 +976,7 @@ static _adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, #if defined(CONFIG_CONCURRENT_MODE) //set adapter_type/iface type for primary padapter padapter->isprimary = _TRUE; - padapter->adapter_type = PRIMARY_ADAPTER; + padapter->adapter_type = PRIMARYadapter; #ifndef CONFIG_HWPORT_SWAP padapter->iface_type = IFACE_PORT0; #else diff --git a/os_dep/usb_ops_linux.c b/os_dep/usb_ops_linux.c index a87a739..7c674cd 100644 --- a/os_dep/usb_ops_linux.c +++ b/os_dep/usb_ops_linux.c @@ -43,7 +43,7 @@ int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u16 inde #endif #ifdef CONFIG_CONCURRENT_MODE - if(padapter->adapter_type > PRIMARY_ADAPTER) + if(padapter->adapter_type > PRIMARYadapter) { padapter = padapter->pbuddy_adapter; pdvobjpriv = adapter_to_dvobj(padapter); @@ -573,12 +573,6 @@ u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem) usb_write_port_complete, pxmitbuf);//context is pxmitbuf -#ifdef CONFIG_USE_USB_BUFFER_ALLOC_TX - purb->transfer_dma = pxmitbuf->dma_transfer_addr; - purb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - purb->transfer_flags |= URB_ZERO_PACKET; -#endif // CONFIG_USE_USB_BUFFER_ALLOC_TX - #ifdef USB_PACKET_OFFSET_SZ #if (USB_PACKET_OFFSET_SZ == 0) purb->transfer_flags |= URB_ZERO_PACKET; diff --git a/os_dep/xmit_linux.c b/os_dep/xmit_linux.c index e5a7895..713e7e5 100644 --- a/os_dep/xmit_linux.c +++ b/os_dep/xmit_linux.c @@ -113,16 +113,6 @@ void rtw_set_tx_chksum_offload(_pkt *pkt, struct pkt_attrib *pattrib) int rtw_os_xmit_resource_alloc(_adapter *padapter, struct xmit_buf *pxmitbuf, u32 alloc_sz, u8 flag) { if (alloc_sz > 0) { -#ifdef CONFIG_USE_USB_BUFFER_ALLOC_TX - struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); - struct usb_device *pusbd = pdvobjpriv->pusbdev; - - pxmitbuf->pallocated_buf = rtw_usb_buffer_alloc(pusbd, (size_t)alloc_sz, &pxmitbuf->dma_transfer_addr); - pxmitbuf->pbuf = pxmitbuf->pallocated_buf; - if(pxmitbuf->pallocated_buf == NULL) - return _FAIL; -#else // CONFIG_USE_USB_BUFFER_ALLOC_TX - pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz); if (pxmitbuf->pallocated_buf == NULL) { @@ -130,8 +120,6 @@ int rtw_os_xmit_resource_alloc(_adapter *padapter, struct xmit_buf *pxmitbuf, u3 } pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ); - -#endif // CONFIG_USE_USB_BUFFER_ALLOC_TX } if (flag) { @@ -165,17 +153,8 @@ void rtw_os_xmit_resource_free(_adapter *padapter, struct xmit_buf *pxmitbuf,u32 } if (free_sz > 0 ) { -#ifdef CONFIG_USE_USB_BUFFER_ALLOC_TX - struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); - struct usb_device *pusbd = pdvobjpriv->pusbdev; - - rtw_usb_buffer_free(pusbd, (size_t)free_sz, pxmitbuf->pallocated_buf, pxmitbuf->dma_transfer_addr); - pxmitbuf->pallocated_buf = NULL; - pxmitbuf->dma_transfer_addr = 0; -#else // CONFIG_USE_USB_BUFFER_ALLOC_TX if(pxmitbuf->pallocated_buf) rtw_mfree(pxmitbuf->pallocated_buf, free_sz); -#endif // CONFIG_USE_USB_BUFFER_ALLOC_TX } } diff --git a/rtl8723BU_WiFi_linux_v4.3.9.3_13200.20150106_BTCOEX20140929-5443.tar.gz b/rtl8723BU_WiFi_linux_v4.3.9.3_13200.20150106_BTCOEX20140929-5443.tar.gz new file mode 100644 index 0000000..7670877 Binary files /dev/null and b/rtl8723BU_WiFi_linux_v4.3.9.3_13200.20150106_BTCOEX20140929-5443.tar.gz differ