Update to 5.8.7.1

This commit is contained in:
Rin Cat 2020-08-02 05:12:24 -04:00
parent 314b662331
commit e3b09b28f7
No known key found for this signature in database
GPG Key ID: 7E93675C2BDBB222
449 changed files with 106089 additions and 83748 deletions

186
Makefile
View File

@ -8,11 +8,11 @@ EXTRA_CFLAGS += -O1
#EXTRA_CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes #EXTRA_CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
EXTRA_CFLAGS += -Wno-unused-variable EXTRA_CFLAGS += -Wno-unused-variable
EXTRA_CFLAGS += -Wno-unused-value #EXTRA_CFLAGS += -Wno-unused-value
EXTRA_CFLAGS += -Wno-unused-label #EXTRA_CFLAGS += -Wno-unused-label
EXTRA_CFLAGS += -Wno-unused-parameter #EXTRA_CFLAGS += -Wno-unused-parameter
EXTRA_CFLAGS += -Wno-unused-function #EXTRA_CFLAGS += -Wno-unused-function
EXTRA_CFLAGS += -Wno-unused #EXTRA_CFLAGS += -Wno-unused
#EXTRA_CFLAGS += -Wno-uninitialized #EXTRA_CFLAGS += -Wno-uninitialized
GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc ) GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc )
@ -42,6 +42,8 @@ CONFIG_RTL8723D = n
CONFIG_RTL8821C = n CONFIG_RTL8821C = n
CONFIG_RTL8710B = n CONFIG_RTL8710B = n
CONFIG_RTL8192F = n CONFIG_RTL8192F = n
CONFIG_RTL8822C = n
CONFIG_RTL8814B = n
######################### Interface ########################### ######################### Interface ###########################
CONFIG_USB_HCI = y CONFIG_USB_HCI = y
CONFIG_PCI_HCI = n CONFIG_PCI_HCI = n
@ -50,16 +52,19 @@ CONFIG_GSPI_HCI = n
########################## Features ########################### ########################## Features ###########################
CONFIG_MP_INCLUDED = y CONFIG_MP_INCLUDED = y
CONFIG_POWER_SAVING = y CONFIG_POWER_SAVING = y
CONFIG_IPS_MODE = default
CONFIG_LPS_MODE = default
CONFIG_USB_AUTOSUSPEND = n CONFIG_USB_AUTOSUSPEND = n
CONFIG_HW_PWRP_DETECTION = n CONFIG_HW_PWRP_DETECTION = n
CONFIG_BT_COEXIST = y CONFIG_BT_COEXIST = y
CONFIG_INTEL_WIDI = n
CONFIG_WAPI_SUPPORT = n CONFIG_WAPI_SUPPORT = n
CONFIG_EFUSE_CONFIG_FILE = y CONFIG_EFUSE_CONFIG_FILE = y
CONFIG_EXT_CLK = n CONFIG_EXT_CLK = n
CONFIG_TRAFFIC_PROTECT = n CONFIG_TRAFFIC_PROTECT = n
CONFIG_LOAD_PHY_PARA_FROM_FILE = y CONFIG_LOAD_PHY_PARA_FROM_FILE = y
CONFIG_TXPWR_BY_RATE = y
CONFIG_TXPWR_BY_RATE_EN = y CONFIG_TXPWR_BY_RATE_EN = y
CONFIG_TXPWR_LIMIT = y
CONFIG_TXPWR_LIMIT_EN = n CONFIG_TXPWR_LIMIT_EN = n
CONFIG_RTW_CHPLAN = 0xFF CONFIG_RTW_CHPLAN = 0xFF
CONFIG_RTW_ADAPTIVITY_EN = disable CONFIG_RTW_ADAPTIVITY_EN = disable
@ -75,21 +80,30 @@ CONFIG_APPEND_VENDOR_IE_ENABLE = n
CONFIG_RTW_NAPI = y CONFIG_RTW_NAPI = y
CONFIG_RTW_GRO = y CONFIG_RTW_GRO = y
CONFIG_RTW_NETIF_SG = y CONFIG_RTW_NETIF_SG = y
CONFIG_TX_CSUM_OFFLOAD = n
CONFIG_RTW_IPCAM_APPLICATION = n CONFIG_RTW_IPCAM_APPLICATION = n
CONFIG_RTW_REPEATER_SON = n CONFIG_RTW_REPEATER_SON = n
CONFIG_RTW_WIFI_HAL = n CONFIG_RTW_WIFI_HAL = n
CONFIG_ICMP_VOQ = n CONFIG_ICMP_VOQ = n
CONFIG_IP_R_MONITOR = n #arp VOQ and high rate CONFIG_IP_R_MONITOR = n #arp VOQ and high rate
# user priority mapping rule : tos, dscp
CONFIG_RTW_UP_MAPPING_RULE = tos
# Enable VHT rate on 2.4G channel or not
CONFIG_RTW_VHT_2G4 = y
########################## Debug ########################### ########################## Debug ###########################
CONFIG_RTW_DEBUG = y CONFIG_RTW_DEBUG = y
# default log level is _DRV_INFO_ = 4, # default log level is _DRV_INFO_ = 4,
# please refer to "How_to_set_driver_debug_log_level.doc" to set the available level. # please refer to "How_to_set_driver_debug_log_level.doc" to set the available level.
CONFIG_RTW_LOG_LEVEL = 3 CONFIG_RTW_LOG_LEVEL = 4
# enable /proc/net/rtlxxxx/ debug interfaces
CONFIG_PROC_DEBUG = y
######################## Wake On Lan ########################## ######################## Wake On Lan ##########################
CONFIG_WOWLAN = n CONFIG_WOWLAN = n
#bit2: deauth, bit1: unicast, bit0: magic pkt. #bit2: deauth, bit1: unicast, bit0: magic pkt.
CONFIG_WAKEUP_TYPE = 0x7 CONFIG_WAKEUP_TYPE = 0x7
CONFIG_WOW_LPS_MODE = default
#bit0: disBBRF off, #bit1: Wireless remote controller (WRC) #bit0: disBBRF off, #bit1: Wireless remote controller (WRC)
CONFIG_SUSPEND_TYPE = 0 CONFIG_SUSPEND_TYPE = 0
CONFIG_WOW_STA_MIX = n CONFIG_WOW_STA_MIX = n
@ -133,6 +147,7 @@ CONFIG_PLATFORM_ARM_TCC8930_JB42 = n
CONFIG_PLATFORM_ARM_RK2818 = n CONFIG_PLATFORM_ARM_RK2818 = n
CONFIG_PLATFORM_ARM_RK3066 = n CONFIG_PLATFORM_ARM_RK3066 = n
CONFIG_PLATFORM_ARM_RK3188 = n CONFIG_PLATFORM_ARM_RK3188 = n
CONFIG_PLATFORM_ARM_RK3399 = n
CONFIG_PLATFORM_ARM_URBETTER = n CONFIG_PLATFORM_ARM_URBETTER = n
CONFIG_PLATFORM_ARM_TI_PANDA = n CONFIG_PLATFORM_ARM_TI_PANDA = n
CONFIG_PLATFORM_MIPS_JZ4760 = n CONFIG_PLATFORM_MIPS_JZ4760 = n
@ -585,6 +600,9 @@ ifeq ($(CONFIG_PCI_HCI), y)
_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8814A_PCIE.o _HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8814A_PCIE.o
endif endif
ifeq ($(CONFIG_BT_COEXIST), y)
_BTC_FILES += hal/btc/halbtc8814a2ant.o
endif
endif endif
########### HAL_RTL8723C ################################# ########### HAL_RTL8723C #################################
@ -806,7 +824,7 @@ ifeq ($(CONFIG_USB_HCI), y)
ifeq ($(CONFIG_BT_COEXIST), n) ifeq ($(CONFIG_BT_COEXIST), n)
MODULE_NAME = 8812bu MODULE_NAME = 8812bu
else else
MODULE_NAME = 88x2bu MODULE_NAME = DWA-181
endif endif
endif endif
ifeq ($(CONFIG_PCI_HCI), y) ifeq ($(CONFIG_PCI_HCI), y)
@ -928,7 +946,44 @@ ifeq ($(CONFIG_PCI_HCI), y)
_HAL_INTFS_FILES += hal/efuse/$(RTL871X)/HalEfuseMask8192F_PCIE.o _HAL_INTFS_FILES += hal/efuse/$(RTL871X)/HalEfuseMask8192F_PCIE.o
endif endif
ifeq ($(CONFIG_BT_COEXIST), y)
_BTC_FILES += hal/btc/halbtccommon.o \
hal/btc/halbtc8192f.o
endif endif
endif
########### HAL_RTL8822C #################################
ifeq ($(CONFIG_RTL8822C), y)
RTL871X := rtl8822c
ifeq ($(CONFIG_USB_HCI), y)
ifeq ($(CONFIG_BT_COEXIST), n)
MODULE_NAME = 8812cu
else
MODULE_NAME = 88x2cu
endif
endif
ifeq ($(CONFIG_PCI_HCI), y)
MODULE_NAME = 88x2ce
endif
ifeq ($(CONFIG_SDIO_HCI), y)
MODULE_NAME = 88x2cs
endif
endif
########### HAL_RTL8814B #################################
ifeq ($(CONFIG_RTL8814B), y)
RTL871X := rtl8814b
ifeq ($(CONFIG_USB_HCI), y)
MODULE_NAME = 8814bu
endif
ifeq ($(CONFIG_PCI_HCI), y)
MODULE_NAME = 8814be
endif
endif
########### AUTO_CFG ################################# ########### AUTO_CFG #################################
ifeq ($(CONFIG_AUTOCFG_CP), y) ifeq ($(CONFIG_AUTOCFG_CP), y)
@ -963,6 +1018,15 @@ EXTRA_CFLAGS += -DCONFIG_MP_INCLUDED
endif endif
ifeq ($(CONFIG_POWER_SAVING), y) ifeq ($(CONFIG_POWER_SAVING), y)
ifneq ($(CONFIG_IPS_MODE), default)
EXTRA_CFLAGS += -DRTW_IPS_MODE=$(CONFIG_IPS_MODE)
endif
ifneq ($(CONFIG_LPS_MODE), default)
EXTRA_CFLAGS += -DRTW_LPS_MODE=$(CONFIG_LPS_MODE)
endif
ifneq ($(CONFIG_WOW_LPS_MODE), default)
EXTRA_CFLAGS += -DRTW_WOW_LPS_MODE=$(CONFIG_WOW_LPS_MODE)
endif
EXTRA_CFLAGS += -DCONFIG_POWER_SAVING EXTRA_CFLAGS += -DCONFIG_POWER_SAVING
endif endif
@ -974,10 +1038,6 @@ ifeq ($(CONFIG_BT_COEXIST), y)
EXTRA_CFLAGS += -DCONFIG_BT_COEXIST EXTRA_CFLAGS += -DCONFIG_BT_COEXIST
endif endif
ifeq ($(CONFIG_INTEL_WIDI), y)
EXTRA_CFLAGS += -DCONFIG_INTEL_WIDI
endif
ifeq ($(CONFIG_WAPI_SUPPORT), y) ifeq ($(CONFIG_WAPI_SUPPORT), y)
EXTRA_CFLAGS += -DCONFIG_WAPI_SUPPORT EXTRA_CFLAGS += -DCONFIG_WAPI_SUPPORT
endif endif
@ -1022,6 +1082,11 @@ EXTRA_CFLAGS += -DCONFIG_LOAD_PHY_PARA_FROM_FILE
EXTRA_CFLAGS += -DREALTEK_CONFIG_PATH=\"/lib/firmware/\" EXTRA_CFLAGS += -DREALTEK_CONFIG_PATH=\"/lib/firmware/\"
endif endif
ifeq ($(CONFIG_TXPWR_BY_RATE), n)
EXTRA_CFLAGS += -DCONFIG_TXPWR_BY_RATE=0
else ifeq ($(CONFIG_TXPWR_BY_RATE), y)
EXTRA_CFLAGS += -DCONFIG_TXPWR_BY_RATE=1
endif
ifeq ($(CONFIG_TXPWR_BY_RATE_EN), n) ifeq ($(CONFIG_TXPWR_BY_RATE_EN), n)
EXTRA_CFLAGS += -DCONFIG_TXPWR_BY_RATE_EN=0 EXTRA_CFLAGS += -DCONFIG_TXPWR_BY_RATE_EN=0
else ifeq ($(CONFIG_TXPWR_BY_RATE_EN), y) else ifeq ($(CONFIG_TXPWR_BY_RATE_EN), y)
@ -1030,6 +1095,11 @@ else ifeq ($(CONFIG_TXPWR_BY_RATE_EN), auto)
EXTRA_CFLAGS += -DCONFIG_TXPWR_BY_RATE_EN=2 EXTRA_CFLAGS += -DCONFIG_TXPWR_BY_RATE_EN=2
endif endif
ifeq ($(CONFIG_TXPWR_LIMIT), n)
EXTRA_CFLAGS += -DCONFIG_TXPWR_LIMIT=0
else ifeq ($(CONFIG_TXPWR_LIMIT), y)
EXTRA_CFLAGS += -DCONFIG_TXPWR_LIMIT=1
endif
ifeq ($(CONFIG_TXPWR_LIMIT_EN), n) ifeq ($(CONFIG_TXPWR_LIMIT_EN), n)
EXTRA_CFLAGS += -DCONFIG_TXPWR_LIMIT_EN=0 EXTRA_CFLAGS += -DCONFIG_TXPWR_LIMIT_EN=0
else ifeq ($(CONFIG_TXPWR_LIMIT_EN), y) else ifeq ($(CONFIG_TXPWR_LIMIT_EN), y)
@ -1169,10 +1239,6 @@ ifeq ($(CONFIG_RTW_NETIF_SG), y)
EXTRA_CFLAGS += -DCONFIG_RTW_NETIF_SG EXTRA_CFLAGS += -DCONFIG_RTW_NETIF_SG
endif endif
ifeq ($(CONFIG_TX_CSUM_OFFLOAD), y)
EXTRA_CFLAGS += -DCONFIG_TX_CSUM_OFFLOAD
endif
ifeq ($(CONFIG_ICMP_VOQ), y) ifeq ($(CONFIG_ICMP_VOQ), y)
EXTRA_CFLAGS += -DCONFIG_ICMP_VOQ EXTRA_CFLAGS += -DCONFIG_ICMP_VOQ
endif endif
@ -1210,8 +1276,24 @@ EXTRA_CFLAGS += -DCONFIG_RTW_DEBUG
EXTRA_CFLAGS += -DRTW_LOG_LEVEL=$(CONFIG_RTW_LOG_LEVEL) EXTRA_CFLAGS += -DRTW_LOG_LEVEL=$(CONFIG_RTW_LOG_LEVEL)
endif endif
ifeq ($(CONFIG_PROC_DEBUG), y)
EXTRA_CFLAGS += -DCONFIG_PROC_DEBUG
endif
ifeq ($(CONFIG_RTW_UP_MAPPING_RULE), dscp)
EXTRA_CFLAGS += -DCONFIG_RTW_UP_MAPPING_RULE=1
else
EXTRA_CFLAGS += -DCONFIG_RTW_UP_MAPPING_RULE=0
endif
EXTRA_CFLAGS += -DDM_ODM_SUPPORT_TYPE=0x04 EXTRA_CFLAGS += -DDM_ODM_SUPPORT_TYPE=0x04
ifeq ($(CONFIG_RTW_VHT_2G4), y)
EXTRA_CFLAGS += -DRTW_VHT_2G4=1
else
EXTRA_CFLAGS += -DRTW_VHT_2G4=0
endif
ifeq ($(CONFIG_PLATFORM_I386_PC), y) ifeq ($(CONFIG_PLATFORM_I386_PC), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
@ -1609,6 +1691,37 @@ KSRC := /home/android_sdk/Rockchip/Rk3066sdk/kernel
MODULE_NAME :=wlan MODULE_NAME :=wlan
endif endif
ifeq ($(CONFIG_PLATFORM_ARM_RK3399), y)
EXTRA_CFLAGS += -DCONFIG_PLATFORM_ROCKCHIPS
EXTRA_CFLAGS += -DCONFIG_PLATFORM_ROCKCHIPS_RK3399
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
EXTRA_CFLAGS += -Wno-error=date-time
# default setting for Android
EXTRA_CFLAGS += -DCONFIG_PLATFORM_ANDROID
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
# default setting for Android 5.0 and later
EXTRA_CFLAGS += -DCONFIG_RADIO_WORK
# default setting for Special function
EXTRA_CFLAGS += -DCONFIG_P2P_IPS
EXTRA_CFLAGS += -DCONFIG_RESUME_IN_WORKQUEUE
ARCH ?= arm64
CROSS_COMPILE ?= /rk3328_box_android_8.0_pro/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
KSRC ?= /rk3328_box_android_8.0_pro/kernel
ifeq ($(CONFIG_SDIO_HCI), y)
EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
_PLATFORM_FILES += platform/platform_rockchips_sdio.o
ifeq ($(CONFIG_RTL8822B), y)
USER_MODULE_NAME := 8822bs
endif
endif
endif
ifeq ($(CONFIG_PLATFORM_ARM_URBETTER), y) ifeq ($(CONFIG_PLATFORM_ARM_URBETTER), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN #-DCONFIG_MINIMAL_MEMORY_USAGE EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN #-DCONFIG_MINIMAL_MEMORY_USAGE
ARCH := arm ARCH := arm
@ -1859,6 +1972,9 @@ EXTRA_CFLAGS += -DRTW_USE_CFG80211_STA_EVENT
# default setting for Android 5.x and later # default setting for Android 5.x and later
#EXTRA_CFLAGS += -DCONFIG_RADIO_WORK #EXTRA_CFLAGS += -DCONFIG_RADIO_WORK
# Change active scan time in each channel, unit is ms
#EXTRA_CFLAGS += -DSURVEY_TO_ACTIVE=50
# If system could power on and recognize Wi-Fi SDIO automatically, # If system could power on and recognize Wi-Fi SDIO automatically,
# platfrom operations are not necessary. # platfrom operations are not necessary.
#ifeq ($(CONFIG_SDIO_HCI), y) #ifeq ($(CONFIG_SDIO_HCI), y)
@ -2076,6 +2192,9 @@ EXTRA_CFLAGS += -DRTW_USE_CFG80211_STA_EVENT
# default setting for Android 5.x and later # default setting for Android 5.x and later
EXTRA_CFLAGS += -DCONFIG_RADIO_WORK EXTRA_CFLAGS += -DCONFIG_RADIO_WORK
# Change active scan time in each channel, unit is ms
#EXTRA_CFLAGS += -DSURVEY_TO_ACTIVE=50
ifeq ($(CONFIG_SDIO_HCI), y) ifeq ($(CONFIG_SDIO_HCI), y)
EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
_PLATFORM_FILES += platform/platform_aml_s905_sdio.o _PLATFORM_FILES += platform/platform_aml_s905_sdio.o
@ -2174,6 +2293,16 @@ ifeq ($(CONFIG_RTL8821C), y)
include $(src)/rtl8821c.mk include $(src)/rtl8821c.mk
endif endif
########### HAL_RTL8822C #################################
ifeq ($(CONFIG_RTL8822C), y)
include $(src)/rtl8822c.mk
endif
########### HAL_RTL8814B #################################
ifeq ($(CONFIG_RTL8814B), y)
include $(src)/rtl8814b.mk
endif
rtk_core := core/rtw_cmd.o \ rtk_core := core/rtw_cmd.o \
core/rtw_security.o \ core/rtw_security.o \
core/rtw_debug.o \ core/rtw_debug.o \
@ -2208,6 +2337,7 @@ rtk_core := core/rtw_cmd.o \
core/rtw_odm.o \ core/rtw_odm.o \
core/rtw_rm.o \ core/rtw_rm.o \
core/rtw_rm_fsm.o \ core/rtw_rm_fsm.o \
core/rtw_rm_util.o \
core/efuse/rtw_efuse.o core/efuse/rtw_efuse.o
ifeq ($(CONFIG_SDIO_HCI), y) ifeq ($(CONFIG_SDIO_HCI), y)
@ -2216,8 +2346,6 @@ endif
$(MODULE_NAME)-y += $(rtk_core) $(MODULE_NAME)-y += $(rtk_core)
$(MODULE_NAME)-$(CONFIG_INTEL_WIDI) += core/rtw_intel_widi.o
$(MODULE_NAME)-$(CONFIG_WAPI_SUPPORT) += core/rtw_wapi.o \ $(MODULE_NAME)-$(CONFIG_WAPI_SUPPORT) += core/rtw_wapi.o \
core/rtw_wapi_sms4.o core/rtw_wapi_sms4.o
@ -2298,17 +2426,17 @@ config_r:
clean: clean:
#$(MAKE) -C $(KSRC) M=$(shell pwd) clean #$(MAKE) -C $(KSRC) M=$(shell pwd) clean
cd hal ; rm -fr */*/*/*.mod.c */*/*/*.mod */*/*/*.o */*/*/.*.cmd */*/*/*.ko cd hal ; rm -fr */*/*/*.mod.c */*/*/*.mod */*/*/*.o */*/*/.*.cmd */*/*/*.ko */*/*/*.ur-safe
cd hal ; rm -fr */*/*.mod.c */*/*.mod */*/*.o */*/.*.cmd */*/*.ko cd hal ; rm -fr */*/*.mod.c */*/*.mod */*/*.o */*/.*.cmd */*/*.ko */*/*.ur-safe
cd hal ; rm -fr */*.mod.c */*.mod */*.o */.*.cmd */*.ko cd hal ; rm -fr */*.mod.c */*.mod */*.o */.*.cmd */*.ko */*.ur-safe
cd hal ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko cd hal ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko *.ur-safe
cd core ; rm -fr */*.mod.c */*.mod */*.o */.*.cmd */*.ko cd core ; rm -fr */*.mod.c */*.mod */*.o */.*.cmd */*.ko */*.ur-safe
cd core ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko cd core ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko *.ur-safe
cd os_dep/linux ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko cd os_dep/linux ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko *.ur-safe
cd os_dep ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko cd os_dep ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko *.ur-safe
cd platform ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko cd platform ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko *.ur-safe
rm -fr Module.symvers ; rm -fr Module.markers ; rm -fr modules.order rm -fr Module.symvers ; rm -fr Module.markers ; rm -fr modules.order
rm -fr *.mod.c *.mod *.o .*.cmd *.ko *~ rm -fr *.mod.c *.mod *.o .*.cmd *.ko *~
rm -fr .tmp_versions rm -fr .tmp_versions *.ur-safe
endif endif

Binary file not shown.

10
clean
View File

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
rmmod 8192cu rmmod 8822be
rmmod 8192ce rmmod 88x2be
rmmod 8192du rmmod 8822bs
rmmod 8192de rmmod 88x2bs
rmmod 8822bu
rmmod 88x2bu

File diff suppressed because it is too large Load Diff

View File

@ -354,7 +354,6 @@ static bool rtw_mesh_acnode_candidate_exist(_adapter *adapter)
_exit_critical_bh(&(mlme->scanned_queue.lock), &irqL); _exit_critical_bh(&(mlme->scanned_queue.lock), &irqL);
exit:
return need; return need;
} }
@ -456,7 +455,7 @@ static void rtw_mesh_acnode_rsvd_chk(_adapter *adapter)
if (plink_ctl->acnode_rsvd != acnode_rsvd) { if (plink_ctl->acnode_rsvd != acnode_rsvd) {
plink_ctl->acnode_rsvd = acnode_rsvd; plink_ctl->acnode_rsvd = acnode_rsvd;
RTW_INFO(FUNC_ADPT_FMT" acnode_rsvd = %d\n", FUNC_ADPT_ARG(adapter), plink_ctl->acnode_rsvd); RTW_INFO(FUNC_ADPT_FMT" acnode_rsvd = %d\n", FUNC_ADPT_ARG(adapter), plink_ctl->acnode_rsvd);
update_beacon(adapter, WLAN_EID_MESH_CONFIG, NULL, 1); update_beacon(adapter, WLAN_EID_MESH_CONFIG, NULL, 1, 0);
} }
} }
@ -707,6 +706,7 @@ void rtw_chk_candidate_peer_notify(_adapter *adapter, struct wlan_network *scann
, scanned->network.MacAddress , scanned->network.MacAddress
, BSS_EX_TLV_IES(&scanned->network) , BSS_EX_TLV_IES(&scanned->network)
, BSS_EX_TLV_IES_LEN(&scanned->network) , BSS_EX_TLV_IES_LEN(&scanned->network)
, scanned->network.Rssi
, GFP_ATOMIC , GFP_ATOMIC
); );
#endif #endif
@ -999,6 +999,7 @@ u8 rtw_mesh_select_operating_ch(_adapter *adapter)
int ch_set_idx = rtw_chset_search_ch(rfctl->channel_set, scanned->network.Configuration.DSConfig); int ch_set_idx = rtw_chset_search_ch(rfctl->channel_set, scanned->network.Configuration.DSConfig);
if (ch_set_idx >= 0 if (ch_set_idx >= 0
&& rfctl->channel_set[ch_set_idx].ScanType != SCAN_PASSIVE
&& !CH_IS_NON_OCP(&rfctl->channel_set[ch_set_idx]) && !CH_IS_NON_OCP(&rfctl->channel_set[ch_set_idx])
) { ) {
u8 nop, accept; u8 nop, accept;
@ -1791,7 +1792,6 @@ static int rtw_mesh_check_frames(_adapter *adapter, const u8 **buf, size_t *len,
}; };
} }
exit:
return is_mesh_frame; return is_mesh_frame;
} }
@ -2028,7 +2028,6 @@ struct mesh_plink_ent *_rtw_mesh_plink_get(_adapter *adapter, const u8 *hwaddr)
} }
} }
exit:
return ent; return ent;
} }
@ -2043,7 +2042,6 @@ struct mesh_plink_ent *rtw_mesh_plink_get(_adapter *adapter, const u8 *hwaddr)
ent = _rtw_mesh_plink_get(adapter, hwaddr); ent = _rtw_mesh_plink_get(adapter, hwaddr);
_exit_critical_bh(&(plink_ctl->lock), &irqL); _exit_critical_bh(&(plink_ctl->lock), &irqL);
exit:
return ent; return ent;
} }
@ -2117,7 +2115,6 @@ int _rtw_mesh_plink_add(_adapter *adapter, const u8 *hwaddr)
plink_ctl->num++; plink_ctl->num++;
} }
exit:
return exist == _TRUE ? RTW_ALREADY : (ent ? _SUCCESS : _FAIL); return exist == _TRUE ? RTW_ALREADY : (ent ? _SUCCESS : _FAIL);
} }
@ -2148,7 +2145,6 @@ int rtw_mesh_plink_set_state(_adapter *adapter, const u8 *hwaddr, u8 state)
ent->plink_state = state; ent->plink_state = state;
_exit_critical_bh(&(plink_ctl->lock), &irqL); _exit_critical_bh(&(plink_ctl->lock), &irqL);
exit:
return ent ? _SUCCESS : _FAIL; return ent ? _SUCCESS : _FAIL;
} }
@ -2168,7 +2164,6 @@ int rtw_mesh_plink_set_aek(_adapter *adapter, const u8 *hwaddr, const u8 *aek)
} }
_exit_critical_bh(&(plink_ctl->lock), &irqL); _exit_critical_bh(&(plink_ctl->lock), &irqL);
exit:
return ent ? _SUCCESS : _FAIL; return ent ? _SUCCESS : _FAIL;
} }
#endif #endif
@ -2190,7 +2185,6 @@ int rtw_mesh_plink_set_peer_conf_timeout(_adapter *adapter, const u8 *hwaddr)
} }
_exit_critical_bh(&(plink_ctl->lock), &irqL); _exit_critical_bh(&(plink_ctl->lock), &irqL);
exit:
return ent ? _SUCCESS : _FAIL; return ent ? _SUCCESS : _FAIL;
} }
#endif #endif
@ -2241,7 +2235,6 @@ int rtw_mesh_plink_del(_adapter *adapter, const u8 *hwaddr)
_exit_critical_bh(&(plink_ctl->lock), &irqL); _exit_critical_bh(&(plink_ctl->lock), &irqL);
exit:
return exist == _TRUE ? _SUCCESS : RTW_ALREADY; return exist == _TRUE ? _SUCCESS : RTW_ALREADY;
} }
@ -2465,6 +2458,7 @@ int rtw_mesh_peer_establish(_adapter *adapter, struct mesh_plink_ent *plink, str
rtw_ewma_err_rate_add(&sta->metrics.err_rate, 1); rtw_ewma_err_rate_add(&sta->metrics.err_rate, 1);
/* init data_rate to 1M */ /* init data_rate to 1M */
sta->metrics.data_rate = 10; sta->metrics.data_rate = 10;
sta->alive = _TRUE;
_enter_critical_bh(&stapriv->asoc_list_lock, &irqL); _enter_critical_bh(&stapriv->asoc_list_lock, &irqL);
if (rtw_is_list_empty(&sta->asoc_list)) { if (rtw_is_list_empty(&sta->asoc_list)) {
@ -2495,11 +2489,11 @@ void rtw_mesh_expire_peer_notify(_adapter *adapter, const u8 *peer_addr)
, peer_addr , peer_addr
, null_ssid , null_ssid
, 2 , 2
, 0
, GFP_ATOMIC , GFP_ATOMIC
); );
#endif #endif
exit:
return; return;
} }
@ -3208,6 +3202,9 @@ int rtw_mesh_nexthop_lookup(_adapter *adapter,
struct sta_info *next_hop; struct sta_info *next_hop;
const u8 *target_addr = mda; const u8 *target_addr = mda;
int err = -ENOENT; int err = -ENOENT;
struct registry_priv *registry_par = &adapter->registrypriv;
u8 peer_alive_based_preq = registry_par->peer_alive_based_preq;
BOOLEAN nexthop_alive = _TRUE;
rtw_rcu_read_lock(); rtw_rcu_read_lock();
mpath = rtw_mesh_path_lookup(adapter, target_addr); mpath = rtw_mesh_path_lookup(adapter, target_addr);
@ -3215,21 +3212,41 @@ int rtw_mesh_nexthop_lookup(_adapter *adapter,
if (!mpath || !(mpath->flags & RTW_MESH_PATH_ACTIVE)) if (!mpath || !(mpath->flags & RTW_MESH_PATH_ACTIVE))
goto endlookup; goto endlookup;
if (rtw_time_after(rtw_get_current_time(),
mpath->exp_time -
rtw_ms_to_systime(adapter->mesh_cfg.path_refresh_time)) &&
_rtw_memcmp(adapter_mac_addr(adapter), msa, ETH_ALEN) == _TRUE &&
!(mpath->flags & RTW_MESH_PATH_RESOLVING) &&
!(mpath->flags & RTW_MESH_PATH_FIXED)) {
rtw_mesh_queue_preq(mpath, RTW_PREQ_Q_F_START | RTW_PREQ_Q_F_REFRESH);
}
next_hop = rtw_rcu_dereference(mpath->next_hop); next_hop = rtw_rcu_dereference(mpath->next_hop);
if (next_hop) { if (next_hop) {
_rtw_memcpy(ra, next_hop->cmn.mac_addr, ETH_ALEN); _rtw_memcpy(ra, next_hop->cmn.mac_addr, ETH_ALEN);
err = 0; err = 0;
} }
if (peer_alive_based_preq && next_hop)
nexthop_alive = next_hop->alive;
if (_rtw_memcmp(adapter_mac_addr(adapter), msa, ETH_ALEN) == _TRUE &&
!(mpath->flags & RTW_MESH_PATH_RESOLVING) &&
!(mpath->flags & RTW_MESH_PATH_FIXED)) {
u8 flags = RTW_PREQ_Q_F_START | RTW_PREQ_Q_F_REFRESH;
if (peer_alive_based_preq && nexthop_alive == _FALSE) {
flags |= RTW_PREQ_Q_F_BCAST_PREQ;
rtw_mesh_queue_preq(mpath, flags);
} else if (rtw_time_after(rtw_get_current_time(),
mpath->exp_time -
rtw_ms_to_systime(adapter->mesh_cfg.path_refresh_time))) {
rtw_mesh_queue_preq(mpath, flags);
}
/* Avoid keeping trying unicast PREQ toward root,
when next_hop leaves */
} else if (peer_alive_based_preq &&
_rtw_memcmp(adapter_mac_addr(adapter), msa, ETH_ALEN) == _TRUE &&
(mpath->flags & RTW_MESH_PATH_RESOLVING) &&
!(mpath->flags & RTW_MESH_PATH_FIXED) &&
!(mpath->flags & RTW_MESH_PATH_BCAST_PREQ) &&
mpath->is_root && nexthop_alive == _FALSE) {
enter_critical_bh(&mpath->state_lock);
mpath->flags |= RTW_MESH_PATH_BCAST_PREQ;
exit_critical_bh(&mpath->state_lock);
}
endlookup: endlookup:
rtw_rcu_read_unlock(); rtw_rcu_read_unlock();
return err; return err;

View File

@ -106,6 +106,7 @@ extern const char *_rtw_mesh_ps_str[];
#define RTW_PREQ_Q_F_REFRESH 0x2 #define RTW_PREQ_Q_F_REFRESH 0x2
#define RTW_PREQ_Q_F_CHK 0x4 #define RTW_PREQ_Q_F_CHK 0x4
#define RTW_PREQ_Q_F_PEER_AKA 0x8 #define RTW_PREQ_Q_F_PEER_AKA 0x8
#define RTW_PREQ_Q_F_BCAST_PREQ 0x10 /* force path_dicover using broadcast */
struct rtw_mesh_preq_queue { struct rtw_mesh_preq_queue {
_list list; _list list;
u8 dst[ETH_ALEN]; u8 dst[ETH_ALEN];
@ -391,7 +392,7 @@ struct rtw_mesh_info {
_queue mpath_tx_queue; _queue mpath_tx_queue;
u32 mpath_tx_queue_len; u32 mpath_tx_queue_len;
struct tasklet_struct mpath_tx_tasklet; _tasklet mpath_tx_tasklet;
struct rtw_mrc *mrc; struct rtw_mrc *mrc;

View File

@ -1319,6 +1319,8 @@ void rtw_mesh_queue_preq(struct rtw_mesh_path *path, u8 flags)
#endif #endif
if (flags & RTW_PREQ_Q_F_PEER_AKA) if (flags & RTW_PREQ_Q_F_PEER_AKA)
path->flags |= RTW_MESH_PATH_PEER_AKA; path->flags |= RTW_MESH_PATH_PEER_AKA;
if (flags & RTW_PREQ_Q_F_BCAST_PREQ)
path->flags |= RTW_MESH_PATH_BCAST_PREQ;
_rtw_spinunlock(&path->state_lock); _rtw_spinunlock(&path->state_lock);
rtw_list_insert_tail(&preq_node->list, &minfo->preq_queue.list); rtw_list_insert_tail(&preq_node->list, &minfo->preq_queue.list);
@ -1338,12 +1340,15 @@ void rtw_mesh_queue_preq(struct rtw_mesh_path *path, u8 flags)
} }
static const u8 *rtw_hwmp_preq_da(struct rtw_mesh_path *path, static const u8 *rtw_hwmp_preq_da(struct rtw_mesh_path *path,
BOOLEAN is_root_add_chk, BOOLEAN da_is_peer) BOOLEAN is_root_add_chk, BOOLEAN da_is_peer,
BOOLEAN force_preq_bcast)
{ {
const u8 *da; const u8 *da;
if (da_is_peer) if (da_is_peer)
da = path->dst; da = path->dst;
else if (force_preq_bcast)
da = bcast_addr;
else if (path->is_root) else if (path->is_root)
#ifdef CONFIG_RTW_MESH_ADD_ROOT_CHK #ifdef CONFIG_RTW_MESH_ADD_ROOT_CHK
da = is_root_add_chk ? path->add_chk_rann_snd_addr: da = is_root_add_chk ? path->add_chk_rann_snd_addr:
@ -1368,7 +1373,7 @@ void rtw_mesh_path_start_discovery(_adapter *adapter)
u32 lifetime; u32 lifetime;
u8 flags = 0; u8 flags = 0;
BOOLEAN is_root_add_chk = _FALSE; BOOLEAN is_root_add_chk = _FALSE;
BOOLEAN da_is_peer; BOOLEAN da_is_peer, force_preq_bcast;
enter_critical_bh(&minfo->mesh_preq_queue_lock); enter_critical_bh(&minfo->mesh_preq_queue_lock);
if (!minfo->preq_queue_len || if (!minfo->preq_queue_len ||
@ -1437,9 +1442,11 @@ void rtw_mesh_path_start_discovery(_adapter *adapter)
is_root_add_chk = !!(path->flags & RTW_MESH_PATH_ROOT_ADD_CHK); is_root_add_chk = !!(path->flags & RTW_MESH_PATH_ROOT_ADD_CHK);
#endif #endif
da_is_peer = !!(path->flags & RTW_MESH_PATH_PEER_AKA); da_is_peer = !!(path->flags & RTW_MESH_PATH_PEER_AKA);
force_preq_bcast = !!(path->flags & RTW_MESH_PATH_BCAST_PREQ);
exit_critical_bh(&path->state_lock); exit_critical_bh(&path->state_lock);
da = rtw_hwmp_preq_da(path, is_root_add_chk, da_is_peer); da = rtw_hwmp_preq_da(path, is_root_add_chk,
da_is_peer, force_preq_bcast);
#ifdef CONFIG_RTW_MESH_ON_DMD_GANN #ifdef CONFIG_RTW_MESH_ON_DMD_GANN
flags = (mshcfg->dot11MeshGateAnnouncementProtocol) flags = (mshcfg->dot11MeshGateAnnouncementProtocol)
@ -1475,7 +1482,8 @@ void rtw_mesh_path_timer(void *ctx)
path->flags &= ~(RTW_MESH_PATH_RESOLVING | path->flags &= ~(RTW_MESH_PATH_RESOLVING |
RTW_MESH_PATH_RESOLVED | RTW_MESH_PATH_RESOLVED |
RTW_MESH_PATH_ROOT_ADD_CHK | RTW_MESH_PATH_ROOT_ADD_CHK |
RTW_MESH_PATH_PEER_AKA); RTW_MESH_PATH_PEER_AKA |
RTW_MESH_PATH_BCAST_PREQ);
exit_critical_bh(&path->state_lock); exit_critical_bh(&path->state_lock);
} else if (path->discovery_retries < rtw_max_preq_retries(adapter)) { } else if (path->discovery_retries < rtw_max_preq_retries(adapter)) {
++path->discovery_retries; ++path->discovery_retries;
@ -1495,7 +1503,8 @@ void rtw_mesh_path_timer(void *ctx)
RTW_MESH_PATH_RESOLVED | RTW_MESH_PATH_RESOLVED |
RTW_MESH_PATH_REQ_QUEUED | RTW_MESH_PATH_REQ_QUEUED |
RTW_MESH_PATH_ROOT_ADD_CHK | RTW_MESH_PATH_ROOT_ADD_CHK |
RTW_MESH_PATH_PEER_AKA); RTW_MESH_PATH_PEER_AKA |
RTW_MESH_PATH_BCAST_PREQ);
path->exp_time = rtw_get_current_time(); path->exp_time = rtw_get_current_time();
exit_critical_bh(&path->state_lock); exit_critical_bh(&path->state_lock);
if (!path->is_gate && rtw_mesh_gate_num(adapter) > 0) { if (!path->is_gate && rtw_mesh_gate_num(adapter) > 0) {

View File

@ -324,6 +324,63 @@ rtw_mesh_path_lookup_by_idx(_adapter *adapter, int idx)
return __rtw_mesh_path_lookup_by_idx(adapter->mesh_info.mesh_paths, idx); return __rtw_mesh_path_lookup_by_idx(adapter->mesh_info.mesh_paths, idx);
} }
void dump_mpath(void *sel, _adapter *adapter)
{
struct rtw_mesh_path *mpath;
int idx = 0;
char dst[ETH_ALEN];
char next_hop[ETH_ALEN];
u32 sn, metric, qlen;
u32 exp_ms = 0, dto_ms;
u8 drty;
enum rtw_mesh_path_flags flags;
RTW_PRINT_SEL(sel, "%-17s %-17s %-10s %-10s %-4s %-6s %-6s %-4s flags\n"
, "dst", "next_hop", "sn", "metric", "qlen", "exp_ms", "dto_ms", "drty"
);
do {
rtw_rcu_read_lock();
mpath = rtw_mesh_path_lookup_by_idx(adapter, idx);
if (mpath) {
_rtw_memcpy(dst, mpath->dst, ETH_ALEN);
_rtw_memcpy(next_hop, mpath->next_hop->cmn.mac_addr, ETH_ALEN);
sn = mpath->sn;
metric = mpath->metric;
qlen = mpath->frame_queue_len;
if (rtw_time_after(mpath->exp_time, rtw_get_current_time()))
exp_ms = rtw_get_remaining_time_ms(mpath->exp_time);
dto_ms = rtw_systime_to_ms(mpath->discovery_timeout);
drty = mpath->discovery_retries;
flags = mpath->flags;
}
rtw_rcu_read_unlock();
if (mpath) {
RTW_PRINT_SEL(sel, MAC_FMT" "MAC_FMT" %10u %10u %4u %6u %6u %4u%s%s%s%s%s%s%s%s%s%s\n"
, MAC_ARG(dst), MAC_ARG(next_hop), sn, metric, qlen
, exp_ms < 999999 ? exp_ms : 999999
, dto_ms < 999999 ? dto_ms : 999999
, drty
, (flags & RTW_MESH_PATH_ACTIVE) ? " ACT" : ""
, (flags & RTW_MESH_PATH_RESOLVING) ? " RSVING" : ""
, (flags & RTW_MESH_PATH_SN_VALID) ? " SN_VALID" : ""
, (flags & RTW_MESH_PATH_FIXED) ? " FIXED" : ""
, (flags & RTW_MESH_PATH_RESOLVED) ? " RSVED" : ""
, (flags & RTW_MESH_PATH_REQ_QUEUED) ? " REQ_IN_Q" : ""
, (flags & RTW_MESH_PATH_DELETED) ? " DELETED" : ""
, (flags & RTW_MESH_PATH_ROOT_ADD_CHK) ? " R_ADD_CHK" : ""
, (flags & RTW_MESH_PATH_PEER_AKA) ? " PEER_AKA" : ""
, (flags & RTW_MESH_PATH_BCAST_PREQ) ? " BC_PREQ" : ""
);
}
idx++;
} while (mpath);
}
/** /**
* rtw_mpp_path_lookup_by_idx - look up a path in the proxy path table by its index * rtw_mpp_path_lookup_by_idx - look up a path in the proxy path table by its index
* @idx: index * @idx: index
@ -387,8 +444,13 @@ int rtw_mesh_path_add_gate(struct rtw_mesh_path *mpath)
exit_critical_bh(&mpath->state_lock); exit_critical_bh(&mpath->state_lock);
if (ori_num_gates == 0) if (ori_num_gates == 0) {
update_beacon(mpath->adapter, WLAN_EID_MESH_CONFIG, NULL, _TRUE); update_beacon(mpath->adapter, WLAN_EID_MESH_CONFIG, NULL, _TRUE, 0);
#if CONFIG_RTW_MESH_CTO_MGATE_CARRIER
if (!rtw_mesh_cto_mgate_required(mpath->adapter))
rtw_netif_carrier_on(mpath->adapter->pnetdev);
#endif
}
RTW_MPATH_DBG( RTW_MPATH_DBG(
FUNC_ADPT_FMT" Mesh path: Recorded new gate: %pM. %d known gates\n", FUNC_ADPT_FMT" Mesh path: Recorded new gate: %pM. %d known gates\n",
@ -442,8 +504,13 @@ void rtw_mesh_gate_del(struct rtw_mesh_table *tbl, struct rtw_mesh_path *mpath)
exit_critical_bh(&tbl->gates_lock); exit_critical_bh(&tbl->gates_lock);
if (ori_num_gates == 1) if (ori_num_gates == 1) {
update_beacon(mpath->adapter, WLAN_EID_MESH_CONFIG, NULL, _TRUE); update_beacon(mpath->adapter, WLAN_EID_MESH_CONFIG, NULL, _TRUE, 0);
#if CONFIG_RTW_MESH_CTO_MGATE_CARRIER
if (rtw_mesh_cto_mgate_required(mpath->adapter))
rtw_netif_carrier_off(mpath->adapter->pnetdev);
#endif
}
RTW_MPATH_DBG( RTW_MPATH_DBG(
FUNC_ADPT_FMT" Mesh path: Deleted gate: %pM. %d known gates\n", FUNC_ADPT_FMT" Mesh path: Deleted gate: %pM. %d known gates\n",

View File

@ -42,6 +42,8 @@
* With this flag, It will try the last used rann_snd_addr * With this flag, It will try the last used rann_snd_addr
* @RTW_MESH_PATH_PEER_AKA: only used toward a peer, only used in active keep * @RTW_MESH_PATH_PEER_AKA: only used toward a peer, only used in active keep
* alive mechanism. PREQ's da = path dst * alive mechanism. PREQ's da = path dst
* @RTW_MESH_PATH_BCAST_PREQ: for re-checking next hop resolve toward root.
* Use it to force path_discover sending broadcast PREQ for root.
* *
* RTW_MESH_PATH_RESOLVED is used by the mesh path timer to * RTW_MESH_PATH_RESOLVED is used by the mesh path timer to
* decide when to stop or cancel the mesh path discovery. * decide when to stop or cancel the mesh path discovery.
@ -56,6 +58,7 @@ enum rtw_mesh_path_flags {
RTW_MESH_PATH_DELETED = BIT(6), RTW_MESH_PATH_DELETED = BIT(6),
RTW_MESH_PATH_ROOT_ADD_CHK = BIT(7), RTW_MESH_PATH_ROOT_ADD_CHK = BIT(7),
RTW_MESH_PATH_PEER_AKA = BIT(8), RTW_MESH_PATH_PEER_AKA = BIT(8),
RTW_MESH_PATH_BCAST_PREQ = BIT(9),
}; };
/** /**
@ -166,6 +169,8 @@ void dump_mpp(void *sel, _adapter *adapter);
struct rtw_mesh_path * struct rtw_mesh_path *
rtw_mesh_path_lookup_by_idx(_adapter *adapter, int idx); rtw_mesh_path_lookup_by_idx(_adapter *adapter, int idx);
void dump_mpath(void *sel, _adapter *adapter);
struct rtw_mesh_path * struct rtw_mesh_path *
rtw_mpp_path_lookup_by_idx(_adapter *adapter, int idx); rtw_mpp_path_lookup_by_idx(_adapter *adapter, int idx);
void rtw_mesh_path_fix_nexthop(struct rtw_mesh_path *mpath, struct sta_info *next_hop); void rtw_mesh_path_fix_nexthop(struct rtw_mesh_path *mpath, struct sta_info *next_hop);

View File

@ -291,16 +291,27 @@ u8 chk_sta_is_alive(struct sta_info *psta)
#if 0 #if 0
if (psta->state & WIFI_SLEEP_STATE) if (psta->state & WIFI_SLEEP_STATE)
ret = _TRUE; ret = _TRUE;
#endif
#ifdef CONFIG_RTW_MESH
if (MLME_IS_MESH(psta->padapter) &&
(psta->sta_stats.last_rx_hwmp_pkts !=
psta->sta_stats.rx_hwmp_pkts))
ret = _TRUE;
#endif #endif
} else } else
ret = _TRUE; ret = _TRUE;
#ifdef CONFIG_RTW_MESH
if (MLME_IS_MESH(psta->padapter)) {
u8 bcn_alive, hwmp_alive;
hwmp_alive = (psta->sta_stats.rx_hwmp_pkts !=
psta->sta_stats.last_rx_hwmp_pkts);
bcn_alive = (psta->sta_stats.rx_beacon_pkts !=
psta->sta_stats.last_rx_beacon_pkts);
/* The reference for nexthop_lookup */
psta->alive = ret || hwmp_alive || bcn_alive;
/* The reference for expire_timeout_chk */
/* Exclude bcn_alive to avoid a misjudge condition
that a peer unexpectedly leave and restart quickly*/
ret = ret || hwmp_alive;
}
#endif
sta_update_last_rx_pkts(psta); sta_update_last_rx_pkts(psta);
return ret; return ret;
@ -310,6 +321,7 @@ u8 chk_sta_is_alive(struct sta_info *psta)
* issue_aka_chk_frame - issue active keep alive check frame * issue_aka_chk_frame - issue active keep alive check frame
* aka = active keep alive * aka = active keep alive
*/ */
#ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
static int issue_aka_chk_frame(_adapter *adapter, struct sta_info *psta) static int issue_aka_chk_frame(_adapter *adapter, struct sta_info *psta)
{ {
int ret = _FAIL; int ret = _FAIL;
@ -351,6 +363,7 @@ static int issue_aka_chk_frame(_adapter *adapter, struct sta_info *psta)
#endif #endif
return ret; return ret;
} }
#endif
#ifdef RTW_CONFIG_RFREG18_WA #ifdef RTW_CONFIG_RFREG18_WA
static void rtw_check_restore_rf18(_adapter *padapter) static void rtw_check_restore_rf18(_adapter *padapter)
@ -601,7 +614,7 @@ void expire_timeout_chk(_adapter *padapter)
/* to update bcn with tim_bitmap for this station */ /* to update bcn with tim_bitmap for this station */
rtw_tim_map_set(padapter, pstapriv->tim_bitmap, psta->cmn.aid); rtw_tim_map_set(padapter, pstapriv->tim_bitmap, psta->cmn.aid);
update_beacon(padapter, _TIM_IE_, NULL, _TRUE); update_beacon(padapter, _TIM_IE_, NULL, _TRUE, 0);
if (!pmlmeext->active_keep_alive_check) if (!pmlmeext->active_keep_alive_check)
continue; continue;
@ -1773,10 +1786,7 @@ chbw_decision:
if (!(ifbmp_ch_changed & BIT(i)) || !pdvobj->padapters[i]) if (!(ifbmp_ch_changed & BIT(i)) || !pdvobj->padapters[i])
continue; continue;
/* pure AP is not needed*/ {
if (MLME_IS_GO(pdvobj->padapters[i])
|| MLME_IS_MESH(pdvobj->padapters[i])
) {
u8 ht_option = 0; u8 ht_option = 0;
#ifdef CONFIG_80211N_HT #ifdef CONFIG_80211N_HT
@ -1818,11 +1828,11 @@ update_beacon:
/* AP is not starting a 40 MHz BSS in presence of an 802.11g BSS. */ /* AP is not starting a 40 MHz BSS in presence of an 802.11g BSS. */
mlme->ht_op_mode &= (~HT_INFO_OPERATION_MODE_OP_MODE_MASK); mlme->ht_op_mode &= (~HT_INFO_OPERATION_MODE_OP_MODE_MASK);
mlme->ht_op_mode |= OP_MODE_MAY_BE_LEGACY_STAS; mlme->ht_op_mode |= OP_MODE_MAY_BE_LEGACY_STAS;
update_beacon(pdvobj->padapters[i], _HT_ADD_INFO_IE_, NULL, _FALSE); update_beacon(pdvobj->padapters[i], _HT_ADD_INFO_IE_, NULL, _FALSE, 0);
} }
#endif #endif
update_beacon(pdvobj->padapters[i], _TIM_IE_, NULL, _FALSE); update_beacon(pdvobj->padapters[i], _TIM_IE_, NULL, _FALSE, 0);
} }
if (mlme_act != MLME_OPCH_SWITCH if (mlme_act != MLME_OPCH_SWITCH
@ -1899,8 +1909,7 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len)
int group_cipher, pairwise_cipher; int group_cipher, pairwise_cipher;
u32 akm; u32 akm;
u8 mfp_opt = MFP_NO; u8 mfp_opt = MFP_NO;
u8 channel, network_type, supportRate[NDIS_802_11_LENGTH_RATES_EX]; u8 channel, network_type;
int supportRateNum = 0;
u8 OUI1[] = {0x00, 0x50, 0xf2, 0x01}; u8 OUI1[] = {0x00, 0x50, 0xf2, 0x01};
u8 WMM_PARA_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01}; u8 WMM_PARA_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01};
HT_CAP_AMPDU_DENSITY best_ampdu_density; HT_CAP_AMPDU_DENSITY best_ampdu_density;
@ -2000,41 +2009,8 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len)
pbss_network->Configuration.DSConfig = channel; pbss_network->Configuration.DSConfig = channel;
/* support rate ie & ext support ie & IElen & SupportedRates */
_rtw_memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX); network_type = rtw_update_rate_bymode(pbss_network, pregistrypriv->wireless_mode);
/* get supported rates */
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
if (p != NULL) {
if (padapter->registrypriv.wireless_mode == WIRELESS_11B) {
ret_rm = rtw_remove_ie_g_rate(ie , &len, _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_);
RTW_DBG("%s, rtw_remove_ie_g_rate=%d\n", __FUNCTION__,ret_rm);
ie_len = ie_len - ret_rm;
pbss_network->IELength=pbss_network->IELength - ret_rm;
}
RTW_DBG("%s, ie_len=%u\n", __FUNCTION__, ie_len);
_rtw_memcpy(supportRate, p + 2, ie_len);
supportRateNum = ie_len;
}
/* get ext_supported rates */
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _EXT_SUPPORTEDRATES_IE_, &ie_len, pbss_network->IELength - _BEACON_IE_OFFSET_);
if (p != NULL) {
if (padapter->registrypriv.wireless_mode == WIRELESS_11B) {
pbss_network->IELength = pbss_network->IELength-*(p+1) -2;
ret_rm = rtw_ies_remove_ie(ie , &len,_BEACON_IE_OFFSET_,
_EXT_SUPPORTEDRATES_IE_,NULL,0);
RTW_DBG("%s, remove_ie of ext_supported rates =%d\n", __FUNCTION__, ret_rm);
} else {
_rtw_memcpy(supportRate + supportRateNum, p + 2, ie_len);
supportRateNum += ie_len;
}
}
network_type = rtw_check_network_type(supportRate, supportRateNum, channel);
rtw_set_supported_rate(pbss_network->SupportedRates, network_type);
/* parsing ERP_IE */ /* parsing ERP_IE */
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
@ -2074,6 +2050,7 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len)
psecuritypriv->wpa2_group_cipher = group_cipher; psecuritypriv->wpa2_group_cipher = group_cipher;
psecuritypriv->wpa2_pairwise_cipher = pairwise_cipher; psecuritypriv->wpa2_pairwise_cipher = pairwise_cipher;
#ifdef CONFIG_IOCTL_CFG80211
/* /*
Kernel < v5.1, the auth_type set as NL80211_AUTHTYPE_AUTOMATIC Kernel < v5.1, the auth_type set as NL80211_AUTHTYPE_AUTOMATIC
in cfg80211_rtw_start_ap(). in cfg80211_rtw_start_ap().
@ -2082,6 +2059,7 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len)
*/ */
if (CHECK_BIT(WLAN_AKM_TYPE_SAE, akm)) if (CHECK_BIT(WLAN_AKM_TYPE_SAE, akm))
psecuritypriv->auth_type = NL80211_AUTHTYPE_SAE; psecuritypriv->auth_type = NL80211_AUTHTYPE_SAE;
#endif
#if 0 #if 0
switch (group_cipher) { switch (group_cipher) {
case WPA_CIPHER_NONE: case WPA_CIPHER_NONE:
@ -2239,7 +2217,6 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len)
/* parsing HT_CAP_IE */ /* parsing HT_CAP_IE */
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_CAPABILITY_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_CAPABILITY_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
if (p && ie_len > 0) { if (p && ie_len > 0) {
u8 rf_type = 0;
HT_CAP_AMPDU_FACTOR max_rx_ampdu_factor = MAX_AMPDU_FACTOR_64K; HT_CAP_AMPDU_FACTOR max_rx_ampdu_factor = MAX_AMPDU_FACTOR_64K;
struct rtw_ieee80211_ht_cap *pht_cap = (struct rtw_ieee80211_ht_cap *)(p + 2); struct rtw_ieee80211_ht_cap *pht_cap = (struct rtw_ieee80211_ht_cap *)(p + 2);
@ -2288,12 +2265,10 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len)
/* Update Supported MCS Set field */ /* Update Supported MCS Set field */
{ {
struct hal_spec_t *hal_spec = GET_HAL_SPEC(padapter);
u8 rx_nss = 0; u8 rx_nss = 0;
int i; int i;
rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); rx_nss = GET_HAL_RX_NSS(padapter);
rx_nss = rtw_min(rf_type_to_rf_rx_cnt(rf_type), hal_spec->rx_nss_num);
/* RX MCS Bitmask */ /* RX MCS Bitmask */
switch (rx_nss) { switch (rx_nss) {
@ -2310,7 +2285,7 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len)
set_mcs_rate_by_mask(HT_CAP_ELE_RX_MCS_MAP(pht_cap), MCS_RATE_4R); set_mcs_rate_by_mask(HT_CAP_ELE_RX_MCS_MAP(pht_cap), MCS_RATE_4R);
break; break;
default: default:
RTW_WARN("rf_type:%d or rx_nss:%u is not expected\n", rf_type, hal_spec->rx_nss_num); RTW_WARN("rf_type:%d or rx_nss:%u is not expected\n", GET_HAL_RFPATH(padapter), rx_nss);
} }
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
*(HT_CAP_ELE_RX_MCS_MAP(pht_cap) + i) &= padapter->mlmeextpriv.default_supported_mcs_set[i]; *(HT_CAP_ELE_RX_MCS_MAP(pht_cap) + i) &= padapter->mlmeextpriv.default_supported_mcs_set[i];
@ -2365,25 +2340,6 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len)
} }
} }
#endif /* CONFIG_80211N_HT */ #endif /* CONFIG_80211N_HT */
switch (network_type) {
case WIRELESS_11B:
pbss_network->NetworkTypeInUse = Ndis802_11DS;
break;
case WIRELESS_11G:
case WIRELESS_11BG:
case WIRELESS_11G_24N:
case WIRELESS_11BG_24N:
pbss_network->NetworkTypeInUse = Ndis802_11OFDM24;
break;
case WIRELESS_11A:
pbss_network->NetworkTypeInUse = Ndis802_11OFDM5;
break;
default:
pbss_network->NetworkTypeInUse = Ndis802_11OFDM24;
break;
}
pmlmepriv->cur_network.network_type = network_type; pmlmepriv->cur_network.network_type = network_type;
#ifdef CONFIG_80211N_HT #ifdef CONFIG_80211N_HT
@ -2878,7 +2834,7 @@ u8 rtw_ap_bmc_frames_hdl(_adapter *padapter)
if ((rtw_tim_map_is_set(padapter, pstapriv->tim_bitmap, 0)) && (psta_bmc->sleepq_len > 0)) { if ((rtw_tim_map_is_set(padapter, pstapriv->tim_bitmap, 0)) && (psta_bmc->sleepq_len > 0)) {
int tx_counts = 0; int tx_counts = 0;
_update_beacon(padapter, _TIM_IE_, NULL, _FALSE, "update TIM with TIB=1"); _update_beacon(padapter, _TIM_IE_, NULL, _FALSE, 0, "update TIM with TIB=1");
RTW_INFO("sleepq_len of bmc_sta = %d\n", psta_bmc->sleepq_len); RTW_INFO("sleepq_len of bmc_sta = %d\n", psta_bmc->sleepq_len);
@ -2928,7 +2884,7 @@ u8 rtw_ap_bmc_frames_hdl(_adapter *padapter)
if (update_tim == _TRUE) { if (update_tim == _TRUE) {
RTW_INFO("clear TIB\n"); RTW_INFO("clear TIB\n");
_update_beacon(padapter, _TIM_IE_, NULL, _TRUE, "bmc sleepq and HIQ empty"); _update_beacon(padapter, _TIM_IE_, NULL, _TRUE, 0, "bmc sleepq and HIQ empty");
} }
} }
} }
@ -3250,7 +3206,7 @@ static void update_bcn_vendor_spec_ie(_adapter *padapter, u8 *oui)
} }
void _update_beacon(_adapter *padapter, u8 ie_id, u8 *oui, u8 tx, const char *tag) void _update_beacon(_adapter *padapter, u8 ie_id, u8 *oui, u8 tx, u8 flags, const char *tag)
{ {
_irqL irqL; _irqL irqL;
struct mlme_priv *pmlmepriv; struct mlme_priv *pmlmepriv;
@ -3321,7 +3277,10 @@ void _update_beacon(_adapter *padapter, u8 ie_id, u8 *oui, u8 tx, const char *ta
/* send_beacon(padapter); */ /* send_beacon must execute on TSR level */ /* send_beacon(padapter); */ /* send_beacon must execute on TSR level */
if (0) if (0)
RTW_INFO(FUNC_ADPT_FMT" ie_id:%u - %s\n", FUNC_ADPT_ARG(padapter), ie_id, tag); RTW_INFO(FUNC_ADPT_FMT" ie_id:%u - %s\n", FUNC_ADPT_ARG(padapter), ie_id, tag);
set_tx_beacon_cmd(padapter); if(flags == RTW_CMDF_WAIT_ACK)
set_tx_beacon_cmd(padapter, RTW_CMDF_WAIT_ACK);
else
set_tx_beacon_cmd(padapter, 0);
} }
#else #else
{ {
@ -3384,7 +3343,7 @@ void rtw_process_public_act_bsscoex(_adapter *padapter, u8 *pframe, uint frame_l
if (beacon_updated) { if (beacon_updated) {
update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _TRUE); update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _TRUE, 0);
associated_stainfo_update(padapter, psta, STA_INFO_UPDATE_BW); associated_stainfo_update(padapter, psta, STA_INFO_UPDATE_BW);
} }
@ -3595,7 +3554,7 @@ void bss_cap_update_on_sta_join(_adapter *padapter, struct sta_info *psta)
if (pmlmepriv->num_sta_non_erp == 1) { if (pmlmepriv->num_sta_non_erp == 1) {
beacon_updated = _TRUE; beacon_updated = _TRUE;
update_beacon(padapter, _ERPINFO_IE_, NULL, _FALSE); update_beacon(padapter, _ERPINFO_IE_, NULL, _FALSE, 0);
} }
} }
@ -3607,7 +3566,7 @@ void bss_cap_update_on_sta_join(_adapter *padapter, struct sta_info *psta)
if (pmlmepriv->num_sta_non_erp == 0) { if (pmlmepriv->num_sta_non_erp == 0) {
beacon_updated = _TRUE; beacon_updated = _TRUE;
update_beacon(padapter, _ERPINFO_IE_, NULL, _FALSE); update_beacon(padapter, _ERPINFO_IE_, NULL, _FALSE, 0);
} }
} }
@ -3705,8 +3664,8 @@ void bss_cap_update_on_sta_join(_adapter *padapter, struct sta_info *psta)
} }
if (rtw_ht_operation_update(padapter) > 0) { if (rtw_ht_operation_update(padapter) > 0) {
update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE); update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE, 0);
update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _FALSE); update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _FALSE, 0);
beacon_updated = _TRUE; beacon_updated = _TRUE;
} }
} }
@ -3716,7 +3675,7 @@ void bss_cap_update_on_sta_join(_adapter *padapter, struct sta_info *psta)
if (MLME_IS_MESH(padapter)) { if (MLME_IS_MESH(padapter)) {
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
update_beacon(padapter, WLAN_EID_MESH_CONFIG, NULL, _FALSE); update_beacon(padapter, WLAN_EID_MESH_CONFIG, NULL, _FALSE, 0);
if (pstapriv->asoc_list_cnt == 1) if (pstapriv->asoc_list_cnt == 1)
_set_timer(&padapter->mesh_atlm_param_req_timer, 0); _set_timer(&padapter->mesh_atlm_param_req_timer, 0);
beacon_updated = _TRUE; beacon_updated = _TRUE;
@ -3724,7 +3683,7 @@ void bss_cap_update_on_sta_join(_adapter *padapter, struct sta_info *psta)
#endif #endif
if (beacon_updated) if (beacon_updated)
update_beacon(padapter, 0xFF, NULL, _TRUE); update_beacon(padapter, 0xFF, NULL, _TRUE, 0);
/* update associcated stations cap. */ /* update associcated stations cap. */
associated_clients_update(padapter, beacon_updated, STA_INFO_UPDATE_ALL); associated_clients_update(padapter, beacon_updated, STA_INFO_UPDATE_ALL);
@ -3746,7 +3705,7 @@ u8 bss_cap_update_on_sta_leave(_adapter *padapter, struct sta_info *psta)
if (rtw_tim_map_is_set(padapter, pstapriv->tim_bitmap, psta->cmn.aid)) { if (rtw_tim_map_is_set(padapter, pstapriv->tim_bitmap, psta->cmn.aid)) {
rtw_tim_map_clear(padapter, pstapriv->tim_bitmap, psta->cmn.aid); rtw_tim_map_clear(padapter, pstapriv->tim_bitmap, psta->cmn.aid);
beacon_updated = _TRUE; beacon_updated = _TRUE;
update_beacon(padapter, _TIM_IE_, NULL, _FALSE); update_beacon(padapter, _TIM_IE_, NULL, _FALSE, 0);
} }
if (psta->no_short_preamble_set) { if (psta->no_short_preamble_set) {
@ -3762,7 +3721,7 @@ u8 bss_cap_update_on_sta_leave(_adapter *padapter, struct sta_info *psta)
pmlmepriv->num_sta_non_erp--; pmlmepriv->num_sta_non_erp--;
if (pmlmepriv->num_sta_non_erp == 0) { if (pmlmepriv->num_sta_non_erp == 0) {
beacon_updated = _TRUE; beacon_updated = _TRUE;
update_beacon(padapter, _ERPINFO_IE_, NULL, _FALSE); update_beacon(padapter, _ERPINFO_IE_, NULL, _FALSE, 0);
} }
} }
@ -3799,14 +3758,14 @@ u8 bss_cap_update_on_sta_leave(_adapter *padapter, struct sta_info *psta)
} }
if (rtw_ht_operation_update(padapter) > 0) { if (rtw_ht_operation_update(padapter) > 0) {
update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE); update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE, 0);
update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _FALSE); update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _FALSE, 0);
} }
#endif /* CONFIG_80211N_HT */ #endif /* CONFIG_80211N_HT */
#ifdef CONFIG_RTW_MESH #ifdef CONFIG_RTW_MESH
if (MLME_IS_MESH(padapter)) { if (MLME_IS_MESH(padapter)) {
update_beacon(padapter, WLAN_EID_MESH_CONFIG, NULL, _FALSE); update_beacon(padapter, WLAN_EID_MESH_CONFIG, NULL, _FALSE, 0);
if (pstapriv->asoc_list_cnt == 0) if (pstapriv->asoc_list_cnt == 0)
_cancel_timer_ex(&padapter->mesh_atlm_param_req_timer); _cancel_timer_ex(&padapter->mesh_atlm_param_req_timer);
beacon_updated = _TRUE; beacon_updated = _TRUE;
@ -3814,7 +3773,7 @@ u8 bss_cap_update_on_sta_leave(_adapter *padapter, struct sta_info *psta)
#endif #endif
if (beacon_updated == _TRUE) if (beacon_updated == _TRUE)
update_beacon(padapter, 0xFF, NULL, _TRUE); update_beacon(padapter, 0xFF, NULL, _TRUE, 0);
#if 0 #if 0
/* update associated stations cap. */ /* update associated stations cap. */
@ -3870,11 +3829,13 @@ u8 ap_free_sta(_adapter *padapter, struct sta_info *psta, bool active, u16 reaso
_enter_critical_bh(&psta->lock, &irqL); _enter_critical_bh(&psta->lock, &irqL);
psta->state &= ~(_FW_LINKED | WIFI_UNDER_KEY_HANDSHAKE); psta->state &= ~(_FW_LINKED | WIFI_UNDER_KEY_HANDSHAKE);
#ifdef CONFIG_IOCTL_CFG80211
if ((psta->auth_len != 0) && (psta->pauth_frame != NULL)) { if ((psta->auth_len != 0) && (psta->pauth_frame != NULL)) {
rtw_mfree(psta->pauth_frame, psta->auth_len); rtw_mfree(psta->pauth_frame, psta->auth_len);
psta->pauth_frame = NULL; psta->pauth_frame = NULL;
psta->auth_len = 0; psta->auth_len = 0;
} }
#endif /* CONFIG_IOCTL_CFG80211 */
_exit_critical_bh(&psta->lock, &irqL); _exit_critical_bh(&psta->lock, &irqL);
if (!MLME_IS_MESH(padapter)) { if (!MLME_IS_MESH(padapter)) {
@ -4252,6 +4213,7 @@ void stop_ap_mode(_adapter *padapter)
/*_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);*/ /*_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);*/
} }
pmlmepriv->ap_isolate = 0;
rtw_free_mlme_priv_ie_data(pmlmepriv); rtw_free_mlme_priv_ie_data(pmlmepriv);
#ifdef CONFIG_SUPPORT_MULTI_BCN #ifdef CONFIG_SUPPORT_MULTI_BCN
@ -4499,15 +4461,22 @@ static u8 rtw_ap_update_chbw_by_ifbmp(struct dvobj_priv *dvobj, u8 ifbmp
static u8 rtw_ap_ch_specific_chk(_adapter *adapter, u8 ch, u8 *bw, u8 *offset, const char *caller) static u8 rtw_ap_ch_specific_chk(_adapter *adapter, u8 ch, u8 *bw, u8 *offset, const char *caller)
{ {
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); struct rf_ctl_t *rfctl = adapter_to_rfctl(adapter);
RT_CHANNEL_INFO *chset = adapter_to_chset(adapter); RT_CHANNEL_INFO *chset = rfctl->channel_set;
int ch_idx;
u8 ret = _SUCCESS; u8 ret = _SUCCESS;
if (rtw_chset_search_ch(chset, ch) < 0) { ch_idx = rtw_chset_search_ch(chset, ch);
if (ch_idx < 0) {
RTW_WARN("%s ch:%u doesn't fit in chplan\n", caller, ch); RTW_WARN("%s ch:%u doesn't fit in chplan\n", caller, ch);
ret = _FAIL; ret = _FAIL;
goto exit; goto exit;
} }
if (chset[ch_idx].ScanType == SCAN_PASSIVE) {
RTW_WARN("%s ch:%u is passive\n", caller, ch);
ret = _FAIL;
goto exit;
}
rtw_adjust_chbw(adapter, ch, bw, offset); rtw_adjust_chbw(adapter, ch, bw, offset);
@ -4517,8 +4486,8 @@ static u8 rtw_ap_ch_specific_chk(_adapter *adapter, u8 ch, u8 *bw, u8 *offset, c
goto exit; goto exit;
} }
while (!rtw_chset_is_chbw_valid(chset, ch, *bw, *offset) while (!rtw_chset_is_chbw_valid(chset, ch, *bw, *offset, 0, 0)
|| (rtw_odm_dfs_domain_unknown(dvobj) && rtw_is_dfs_chbw(ch, *bw, *offset)) || (rtw_rfctl_dfs_domain_unknown(rfctl) && rtw_chset_is_dfs_chbw(chset, ch, *bw, *offset))
) { ) {
if (*bw > CHANNEL_WIDTH_20) if (*bw > CHANNEL_WIDTH_20)
(*bw)--; (*bw)--;
@ -4528,7 +4497,7 @@ static u8 rtw_ap_ch_specific_chk(_adapter *adapter, u8 ch, u8 *bw, u8 *offset, c
} }
} }
if (rtw_odm_dfs_domain_unknown(dvobj) && rtw_is_dfs_chbw(ch, *bw, *offset)) { if (rtw_rfctl_dfs_domain_unknown(rfctl) && rtw_chset_is_dfs_chbw(chset, ch, *bw, *offset)) {
RTW_WARN("%s DFS channel %u can't be used\n", caller, ch); RTW_WARN("%s DFS channel %u can't be used\n", caller, ch);
ret = _FAIL; ret = _FAIL;
goto exit; goto exit;
@ -4539,22 +4508,20 @@ exit:
} }
static bool rtw_ap_choose_chbw(_adapter *adapter, u8 sel_ch, u8 max_bw, u8 cur_ch static bool rtw_ap_choose_chbw(_adapter *adapter, u8 sel_ch, u8 max_bw, u8 cur_ch
, u8 *ch, u8 *bw, u8 *offset, u8 mesh_only, const char *caller) , u8 *ch, u8 *bw, u8 *offset, bool by_int_info, u8 mesh_only, const char *caller)
{ {
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
struct rf_ctl_t *rfctl = adapter_to_rfctl(adapter); struct rf_ctl_t *rfctl = adapter_to_rfctl(adapter);
bool ch_avail = _FALSE; bool ch_avail = _FALSE;
#if defined(CONFIG_DFS_MASTER) #if defined(CONFIG_DFS_MASTER)
if (!rtw_odm_dfs_domain_unknown(dvobj)) { if (!rtw_rfctl_dfs_domain_unknown(rfctl)) {
if (rfctl->radar_detected if (rfctl->radar_detected
&& rfctl->dbg_dfs_choose_dfs_ch_first && rfctl->dbg_dfs_choose_dfs_ch_first
) { ) {
ch_avail = rtw_choose_shortest_waiting_ch(rfctl, sel_ch, max_bw ch_avail = rtw_choose_shortest_waiting_ch(rfctl, sel_ch, max_bw
, ch, bw, offset , ch, bw, offset
, RTW_CHF_2G | RTW_CHF_NON_DFS , RTW_CHF_2G | RTW_CHF_NON_DFS
, cur_ch , cur_ch, by_int_info, mesh_only);
, rfctl->ch_sel_same_band_prefer, mesh_only);
if (ch_avail == _TRUE) { if (ch_avail == _TRUE) {
RTW_INFO("%s choose 5G DFS channel for debug\n", caller); RTW_INFO("%s choose 5G DFS channel for debug\n", caller);
goto exit; goto exit;
@ -4567,8 +4534,7 @@ static bool rtw_ap_choose_chbw(_adapter *adapter, u8 sel_ch, u8 max_bw, u8 cur_c
ch_avail = rtw_choose_shortest_waiting_ch(rfctl, sel_ch, max_bw ch_avail = rtw_choose_shortest_waiting_ch(rfctl, sel_ch, max_bw
, ch, bw, offset , ch, bw, offset
, rfctl->dfs_ch_sel_d_flags , rfctl->dfs_ch_sel_d_flags
, cur_ch , cur_ch, by_int_info, mesh_only);
, rfctl->ch_sel_same_band_prefer, mesh_only);
if (ch_avail == _TRUE) { if (ch_avail == _TRUE) {
RTW_INFO("%s choose with dfs_ch_sel_d_flags:0x%02x for debug\n" RTW_INFO("%s choose with dfs_ch_sel_d_flags:0x%02x for debug\n"
, caller, rfctl->dfs_ch_sel_d_flags); , caller, rfctl->dfs_ch_sel_d_flags);
@ -4579,19 +4545,18 @@ static bool rtw_ap_choose_chbw(_adapter *adapter, u8 sel_ch, u8 max_bw, u8 cur_c
ch_avail = rtw_choose_shortest_waiting_ch(rfctl, sel_ch, max_bw ch_avail = rtw_choose_shortest_waiting_ch(rfctl, sel_ch, max_bw
, ch, bw, offset , ch, bw, offset
, 0 , 0
, cur_ch , cur_ch, by_int_info, mesh_only);
, rfctl->ch_sel_same_band_prefer, mesh_only);
} else } else
#endif /* defined(CONFIG_DFS_MASTER) */ #endif /* defined(CONFIG_DFS_MASTER) */
{ {
ch_avail = rtw_choose_shortest_waiting_ch(rfctl, sel_ch, max_bw ch_avail = rtw_choose_shortest_waiting_ch(rfctl, sel_ch, max_bw
, ch, bw, offset , ch, bw, offset
, RTW_CHF_DFS , RTW_CHF_DFS
, cur_ch , cur_ch, by_int_info, mesh_only);
, rfctl->ch_sel_same_band_prefer, mesh_only);
} }
#if defined(CONFIG_DFS_MASTER)
exit: exit:
#endif
if (ch_avail == _FALSE) if (ch_avail == _FALSE)
RTW_WARN("%s no available channel\n", caller); RTW_WARN("%s no available channel\n", caller);
@ -4725,7 +4690,7 @@ u8 rtw_ap_chbw_decision(_adapter *adapter, u8 ifbmp, u8 excl_ifbmp
if (rtw_is_chbw_grouped(u_ch, u_bw, u_offset, dec_ch[i], dec_bw[i], dec_offset[i])) { if (rtw_is_chbw_grouped(u_ch, u_bw, u_offset, dec_ch[i], dec_bw[i], dec_offset[i])) {
rtw_chset_sync_chbw(chset rtw_chset_sync_chbw(chset
, &dec_ch[i], &dec_bw[i], &dec_offset[i] , &dec_ch[i], &dec_bw[i], &dec_offset[i]
, &u_ch, &u_bw, &u_offset); , &u_ch, &u_bw, &u_offset, 1, 0);
set_u_ch = _TRUE; set_u_ch = _TRUE;
/* channel bw offset can be allowed, not need MCC */ /* channel bw offset can be allowed, not need MCC */
@ -4786,7 +4751,7 @@ u8 rtw_ap_chbw_decision(_adapter *adapter, u8 ifbmp, u8 excl_ifbmp
#endif /* CONFIG_MCC_MODE */ #endif /* CONFIG_MCC_MODE */
if (req_ch == 0 && dec_bw[i] > u_bw if (req_ch == 0 && dec_bw[i] > u_bw
&& rtw_is_dfs_chbw(u_ch, u_bw, u_offset) && rtw_chset_is_dfs_chbw(chset, u_ch, u_bw, u_offset)
) { ) {
/* request comes from upper layer, prevent from additional channel waiting */ /* request comes from upper layer, prevent from additional channel waiting */
dec_bw[i] = u_bw; dec_bw[i] = u_bw;
@ -4797,7 +4762,7 @@ u8 rtw_ap_chbw_decision(_adapter *adapter, u8 ifbmp, u8 excl_ifbmp
/* follow */ /* follow */
rtw_chset_sync_chbw(chset rtw_chset_sync_chbw(chset
, &dec_ch[i], &dec_bw[i], &dec_offset[i] , &dec_ch[i], &dec_bw[i], &dec_offset[i]
, &u_ch, &u_bw, &u_offset); , &u_ch, &u_bw, &u_offset, 1, 0);
} }
set_u_ch = _TRUE; set_u_ch = _TRUE;
@ -4806,6 +4771,7 @@ u8 rtw_ap_chbw_decision(_adapter *adapter, u8 ifbmp, u8 excl_ifbmp
/* autonomous decision */ /* autonomous decision */
u8 ori_ch = 0; u8 ori_ch = 0;
u8 max_bw; u8 max_bw;
bool by_int_info;
/* autonomous decision, not need MCC */ /* autonomous decision, not need MCC */
*chbw_allow = _TRUE; *chbw_allow = _TRUE;
@ -4862,6 +4828,7 @@ u8 rtw_ap_chbw_decision(_adapter *adapter, u8 ifbmp, u8 excl_ifbmp
goto update_bss_chbw; goto update_bss_chbw;
choose_chbw: choose_chbw:
by_int_info = req_ch == REQ_CH_INT_INFO ? 1 : 0;
req_ch = req_ch > 0 ? req_ch : 0; req_ch = req_ch > 0 ? req_ch : 0;
max_bw = req_bw > REQ_BW_NONE ? req_bw : CHANNEL_WIDTH_20; max_bw = req_bw > REQ_BW_NONE ? req_bw : CHANNEL_WIDTH_20;
for (i = 0; i < dvobj->iface_nums; i++) { for (i = 0; i < dvobj->iface_nums; i++) {
@ -4894,7 +4861,7 @@ choose_chbw:
} }
ch_avail = rtw_ap_choose_chbw(adapter, req_ch, max_bw ch_avail = rtw_ap_choose_chbw(adapter, req_ch, max_bw
, ori_ch, &u_ch, &u_bw, &u_offset, ifbmp_all_mesh, __func__); , ori_ch, &u_ch, &u_bw, &u_offset, by_int_info, ifbmp_all_mesh, __func__);
if (ch_avail == _FALSE) if (ch_avail == _FALSE)
goto exit; goto exit;
@ -5110,7 +5077,7 @@ void tx_beacon_handlder(struct dvobj_priv *pdvobj)
if (!check_fwstate(&padapter->mlmepriv, WIFI_OP_CH_SWITCHING) if (!check_fwstate(&padapter->mlmepriv, WIFI_OP_CH_SWITCHING)
&& !IS_CH_WAITING(adapter_to_rfctl(padapter)) && !IS_CH_WAITING(adapter_to_rfctl(padapter))
) { ) {
/*update_beacon(padapter, _TIM_IE_, NULL, _FALSE);*/ /*update_beacon(padapter, _TIM_IE_, NULL, _FALSE, 0);*/
/*issue_beacon(padapter, 0);*/ /*issue_beacon(padapter, 0);*/
send_beacon(padapter); send_beacon(padapter);
} }
@ -5134,7 +5101,7 @@ void tx_beacon_timer_handlder(void *ctx)
_adapter *padapter = pdvobj->padapters[0]; _adapter *padapter = pdvobj->padapters[0];
if (padapter) if (padapter)
set_tx_beacon_cmd(padapter); set_tx_beacon_cmd(padapter, 0);
} }
#endif #endif
@ -5213,7 +5180,7 @@ u16 rtw_ap_parse_sta_security_ie(_adapter *adapter, struct sta_info *sta, struct
sta->wpa2_pairwise_cipher = pairwise_cipher & sec->wpa2_pairwise_cipher; sta->wpa2_pairwise_cipher = pairwise_cipher & sec->wpa2_pairwise_cipher;
sta->akm_suite_type = akm; sta->akm_suite_type = akm;
if ((CHECK_BIT(WLAN_AKM_TYPE_SAE, akm)) && (MFP_NO == mfp_opt)) if (MLME_IS_AP(adapter) && (CHECK_BIT(WLAN_AKM_TYPE_SAE, akm)) && (MFP_NO == mfp_opt))
status = WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION; status = WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION;
if (!sta->wpa2_group_cipher) if (!sta->wpa2_group_cipher)
@ -5261,7 +5228,9 @@ u16 rtw_ap_parse_sta_security_ie(_adapter *adapter, struct sta_info *sta, struct
else if (sec->mfp_opt >= MFP_OPTIONAL && mfp_opt >= MFP_OPTIONAL) else if (sec->mfp_opt >= MFP_OPTIONAL && mfp_opt >= MFP_OPTIONAL)
sta->flags |= WLAN_STA_MFP; sta->flags |= WLAN_STA_MFP;
if ((sec->auth_type == NL80211_AUTHTYPE_SAE) && #ifdef CONFIG_IOCTL_CFG80211
if (MLME_IS_AP(adapter) &&
(sec->auth_type == NL80211_AUTHTYPE_SAE) &&
(CHECK_BIT(WLAN_AKM_TYPE_SAE, sta->akm_suite_type)) && (CHECK_BIT(WLAN_AKM_TYPE_SAE, sta->akm_suite_type)) &&
(WLAN_AUTH_OPEN == sta->authalg)) { (WLAN_AUTH_OPEN == sta->authalg)) {
/* WPA3-SAE, PMK caching */ /* WPA3-SAE, PMK caching */
@ -5272,6 +5241,7 @@ u16 rtw_ap_parse_sta_security_ie(_adapter *adapter, struct sta_info *sta, struct
RTW_INFO("SAE: PMKSA cache entry found\n"); RTW_INFO("SAE: PMKSA cache entry found\n");
} }
} }
#endif
if (status != _STATS_SUCCESSFUL_) if (status != _STATS_SUCCESSFUL_)
goto exit; goto exit;

File diff suppressed because it is too large Load Diff

View File

@ -97,13 +97,13 @@ BT_CTRL_STATUS
mptbt_SendH2c( mptbt_SendH2c(
PADAPTER Adapter, PADAPTER Adapter,
PBT_H2C pH2c, PBT_H2C pH2c,
u2Byte h2cCmdLen u16 h2cCmdLen
) )
{ {
/* KIRQL OldIrql = KeGetCurrentIrql(); */ /* KIRQL OldIrql = KeGetCurrentIrql(); */
BT_CTRL_STATUS h2cStatus = BT_STATUS_H2C_SUCCESS; BT_CTRL_STATUS h2cStatus = BT_STATUS_H2C_SUCCESS;
PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);
u1Byte i; u8 i;
RTW_INFO("[MPT], mptbt_SendH2c()=========>\n"); RTW_INFO("[MPT], mptbt_SendH2c()=========>\n");
@ -192,17 +192,17 @@ mptbt_CheckBtRspStatus(
BT_CTRL_STATUS BT_CTRL_STATUS
mptbt_BtFwOpCodeProcess( mptbt_BtFwOpCodeProcess(
PADAPTER Adapter, PADAPTER Adapter,
u1Byte btFwOpCode, u8 btFwOpCode,
u1Byte opCodeVer, u8 opCodeVer,
pu1Byte pH2cPar, u8 *pH2cPar,
u1Byte h2cParaLen u8 h2cParaLen
) )
{ {
u1Byte H2C_Parameter[6] = {0}; u8 H2C_Parameter[6] = {0};
PBT_H2C pH2c = (PBT_H2C)&H2C_Parameter[0]; PBT_H2C pH2c = (PBT_H2C)&H2C_Parameter[0];
PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);
PBT_EXT_C2H pExtC2h = (PBT_EXT_C2H)&pMptCtx->c2hBuf[0]; PBT_EXT_C2H pExtC2h = (PBT_EXT_C2H)&pMptCtx->c2hBuf[0];
u2Byte paraLen = 0, i; u16 paraLen = 0, i;
BT_CTRL_STATUS h2cStatus = BT_STATUS_H2C_SUCCESS, c2hStatus = BT_STATUS_C2H_SUCCESS; BT_CTRL_STATUS h2cStatus = BT_STATUS_H2C_SUCCESS, c2hStatus = BT_STATUS_C2H_SUCCESS;
BT_CTRL_STATUS retStatus = BT_STATUS_H2C_BT_NO_RSP; BT_CTRL_STATUS retStatus = BT_STATUS_H2C_BT_NO_RSP;
@ -248,25 +248,25 @@ mptbt_BtFwOpCodeProcess(
u2Byte u16
mptbt_BtReady( mptbt_BtReady(
PADAPTER Adapter, PADAPTER Adapter,
PBT_REQ_CMD pBtReq, PBT_REQ_CMD pBtReq,
PBT_RSP_CMD pBtRsp PBT_RSP_CMD pBtRsp
) )
{ {
u1Byte h2cParaBuf[6] = {0}; u8 h2cParaBuf[6] = {0};
u1Byte h2cParaLen = 0; u8 h2cParaLen = 0;
u2Byte paraLen = 0; u16 paraLen = 0;
u1Byte retStatus = BT_STATUS_BT_OP_SUCCESS; u8 retStatus = BT_STATUS_BT_OP_SUCCESS;
u1Byte btOpcode; u8 btOpcode;
u1Byte btOpcodeVer = 0; u8 btOpcodeVer = 0;
PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);
PBT_EXT_C2H pExtC2h = (PBT_EXT_C2H)&pMptCtx->c2hBuf[0]; PBT_EXT_C2H pExtC2h = (PBT_EXT_C2H)&pMptCtx->c2hBuf[0];
u1Byte i; u8 i;
u1Byte btFwVer = 0, bdAddr[6] = {0}; u8 btFwVer = 0, bdAddr[6] = {0};
u2Byte btRealFwVer = 0; u16 btRealFwVer = 0;
pu2Byte pu2Tmp = NULL; u16 *pu2Tmp = NULL;
/* */ /* */
/* check upper layer parameters */ /* check upper layer parameters */
@ -296,7 +296,7 @@ mptbt_BtReady(
RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status); RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);
return paraLen; return paraLen;
} else { } else {
pu2Tmp = (pu2Byte)&pExtC2h->buf[0]; pu2Tmp = (u16 *)&pExtC2h->buf[0];
btRealFwVer = *pu2Tmp; btRealFwVer = *pu2Tmp;
btFwVer = pExtC2h->buf[1]; btFwVer = pExtC2h->buf[1];
RTW_INFO("[MPT], btRealFwVer=0x%x, btFwVer=0x%x\n", btRealFwVer, btFwVer); RTW_INFO("[MPT], btRealFwVer=0x%x, btFwVer=0x%x\n", btRealFwVer, btFwVer);
@ -337,7 +337,7 @@ mptbt_BtReady(
RTW_INFO(" 0x%x ", bdAddr[i]); RTW_INFO(" 0x%x ", bdAddr[i]);
pBtRsp->status = BT_STATUS_SUCCESS; pBtRsp->status = BT_STATUS_SUCCESS;
pBtRsp->pParamStart[0] = MP_BT_READY; pBtRsp->pParamStart[0] = MP_BT_READY;
pu2Tmp = (pu2Byte)&pBtRsp->pParamStart[1]; pu2Tmp = (u16 *)&pBtRsp->pParamStart[1];
*pu2Tmp = btRealFwVer; *pu2Tmp = btRealFwVer;
pBtRsp->pParamStart[3] = btFwVer; pBtRsp->pParamStart[3] = btFwVer;
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
@ -360,9 +360,9 @@ void mptbt_open_WiFiRF(PADAPTER Adapter)
phy_set_rf_reg(Adapter, RF_PATH_A, 0x0, 0xF0000, 0x3); phy_set_rf_reg(Adapter, RF_PATH_A, 0x0, 0xF0000, 0x3);
} }
u4Byte mptbt_switch_RF(PADAPTER Adapter, u1Byte Enter) u32 mptbt_switch_RF(PADAPTER Adapter, u8 Enter)
{ {
u2Byte tmp_2byte = 0; u16 tmp_2byte = 0;
/* Enter test mode */ /* Enter test mode */
if (Enter) { if (Enter) {
@ -390,20 +390,20 @@ u4Byte mptbt_switch_RF(PADAPTER Adapter, u1Byte Enter)
return 0; return 0;
} }
u2Byte u16
mptbt_BtSetMode( mptbt_BtSetMode(
PADAPTER Adapter, PADAPTER Adapter,
PBT_REQ_CMD pBtReq, PBT_REQ_CMD pBtReq,
PBT_RSP_CMD pBtRsp PBT_RSP_CMD pBtRsp
) )
{ {
u1Byte h2cParaBuf[6] = {0}; u8 h2cParaBuf[6] = {0};
u1Byte h2cParaLen = 0; u8 h2cParaLen = 0;
u2Byte paraLen = 0; u16 paraLen = 0;
u1Byte retStatus = BT_STATUS_BT_OP_SUCCESS; u8 retStatus = BT_STATUS_BT_OP_SUCCESS;
u1Byte btOpcode; u8 btOpcode;
u1Byte btOpcodeVer = 0; u8 btOpcodeVer = 0;
u1Byte btModeToSet = 0; u8 btModeToSet = 0;
/* */ /* */
/* check upper layer parameters */ /* check upper layer parameters */
@ -455,11 +455,11 @@ mptbt_BtSetMode(
} }
VOID void
MPTBT_FwC2hBtMpCtrl( MPTBT_FwC2hBtMpCtrl(
PADAPTER Adapter, PADAPTER Adapter,
pu1Byte tmpBuf, u8 *tmpBuf,
u1Byte length u8 length
) )
{ {
u32 i; u32 i;
@ -525,28 +525,28 @@ MPTBT_FwC2hBtMpCtrl(
} }
u2Byte u16
mptbt_BtGetGeneral( mptbt_BtGetGeneral(
IN PADAPTER Adapter, PADAPTER Adapter,
IN PBT_REQ_CMD pBtReq, PBT_REQ_CMD pBtReq,
IN PBT_RSP_CMD pBtRsp PBT_RSP_CMD pBtRsp
) )
{ {
PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);
PBT_EXT_C2H pExtC2h = (PBT_EXT_C2H)&pMptCtx->c2hBuf[0]; PBT_EXT_C2H pExtC2h = (PBT_EXT_C2H)&pMptCtx->c2hBuf[0];
u1Byte h2cParaBuf[6] = {0}; u8 h2cParaBuf[6] = {0};
u1Byte h2cParaLen = 0; u8 h2cParaLen = 0;
u2Byte paraLen = 0; u16 paraLen = 0;
u1Byte retStatus = BT_STATUS_BT_OP_SUCCESS; u8 retStatus = BT_STATUS_BT_OP_SUCCESS;
u1Byte btOpcode, bdAddr[6] = {0}; u8 btOpcode, bdAddr[6] = {0};
u1Byte btOpcodeVer = 0; u8 btOpcodeVer = 0;
u1Byte getType = 0, i; u8 getType = 0, i;
u2Byte getParaLen = 0, validParaLen = 0; u16 getParaLen = 0, validParaLen = 0;
u1Byte regType = 0, reportType = 0; u8 regType = 0, reportType = 0;
u4Byte regAddr = 0, regValue = 0; u32 regAddr = 0, regValue = 0;
pu4Byte pu4Tmp; u32 *pu4Tmp;
pu2Byte pu2Tmp; u16 *pu2Tmp;
pu1Byte pu1Tmp; u8 *pu1Tmp;
/* */ /* */
/* check upper layer parameters */ /* check upper layer parameters */
@ -577,7 +577,7 @@ mptbt_BtGetGeneral(
if (getParaLen == validParaLen) { if (getParaLen == validParaLen) {
btOpcode = BT_LO_OP_READ_REG; btOpcode = BT_LO_OP_READ_REG;
regType = pBtReq->pParamStart[1]; regType = pBtReq->pParamStart[1];
pu4Tmp = (pu4Byte)&pBtReq->pParamStart[2]; pu4Tmp = (u32 *)&pBtReq->pParamStart[2];
regAddr = *pu4Tmp; regAddr = *pu4Tmp;
RTW_INFO("[MPT], BT_GGET_REG regType=0x%02x, regAddr=0x%08x!!\n", RTW_INFO("[MPT], BT_GGET_REG regType=0x%02x, regAddr=0x%08x!!\n",
regType, regAddr); regType, regAddr);
@ -646,12 +646,12 @@ mptbt_BtGetGeneral(
return paraLen; return paraLen;
} }
pu2Tmp = (pu2Byte)&pExtC2h->buf[0]; pu2Tmp = (u16 *)&pExtC2h->buf[0];
regValue = *pu2Tmp; regValue = *pu2Tmp;
RTW_INFO("[MPT], read reg regType=0x%02x, regAddr=0x%08x, regValue=0x%04x\n", RTW_INFO("[MPT], read reg regType=0x%02x, regAddr=0x%08x, regValue=0x%04x\n",
regType, regAddr, regValue); regType, regAddr, regValue);
pu4Tmp = (pu4Byte)&pBtRsp->pParamStart[0]; pu4Tmp = (u32 *)&pBtRsp->pParamStart[0];
*pu4Tmp = regValue; *pu4Tmp = regValue;
paraLen = 4; paraLen = 4;
} else if (BT_GGET_STATUS == getType) { } else if (BT_GGET_STATUS == getType) {
@ -829,26 +829,26 @@ mptbt_BtGetGeneral(
u2Byte u16
mptbt_BtSetGeneral( mptbt_BtSetGeneral(
IN PADAPTER Adapter, PADAPTER Adapter,
IN PBT_REQ_CMD pBtReq, PBT_REQ_CMD pBtReq,
IN PBT_RSP_CMD pBtRsp PBT_RSP_CMD pBtRsp
) )
{ {
u1Byte h2cParaBuf[6] = {0}; u8 h2cParaBuf[6] = {0};
u1Byte h2cParaLen = 0; u8 h2cParaLen = 0;
u2Byte paraLen = 0; u16 paraLen = 0;
u1Byte retStatus = BT_STATUS_BT_OP_SUCCESS; u8 retStatus = BT_STATUS_BT_OP_SUCCESS;
u1Byte btOpcode; u8 btOpcode;
u1Byte btOpcodeVer = 0; u8 btOpcodeVer = 0;
u1Byte setType = 0; u8 setType = 0;
u2Byte setParaLen = 0, validParaLen = 0; u16 setParaLen = 0, validParaLen = 0;
u1Byte regType = 0, bdAddr[6] = {0}, calVal = 0; u8 regType = 0, bdAddr[6] = {0}, calVal = 0;
u4Byte regAddr = 0, regValue = 0; u32 regAddr = 0, regValue = 0;
pu4Byte pu4Tmp; u32 *pu4Tmp;
pu2Byte pu2Tmp; u16 *pu2Tmp;
pu1Byte pu1Tmp; u8 *pu1Tmp;
/* */ /* */
/* check upper layer parameters */ /* check upper layer parameters */
@ -879,9 +879,9 @@ mptbt_BtSetGeneral(
if (setParaLen == validParaLen) { if (setParaLen == validParaLen) {
btOpcode = BT_LO_OP_WRITE_REG_VALUE; btOpcode = BT_LO_OP_WRITE_REG_VALUE;
regType = pBtReq->pParamStart[1]; regType = pBtReq->pParamStart[1];
pu4Tmp = (pu4Byte)&pBtReq->pParamStart[2]; pu4Tmp = (u32 *)&pBtReq->pParamStart[2];
regAddr = *pu4Tmp; regAddr = *pu4Tmp;
pu4Tmp = (pu4Byte)&pBtReq->pParamStart[6]; pu4Tmp = (u32 *)&pBtReq->pParamStart[6];
regValue = *pu4Tmp; regValue = *pu4Tmp;
RTW_INFO("[MPT], BT_GSET_REG regType=0x%x, regAddr=0x%x, regValue=0x%x!!\n", RTW_INFO("[MPT], BT_GSET_REG regType=0x%x, regAddr=0x%x, regValue=0x%x!!\n",
regType, regAddr, regValue); regType, regAddr, regValue);
@ -1116,23 +1116,23 @@ mptbt_BtSetGeneral(
u2Byte u16
mptbt_BtSetTxRxPars( mptbt_BtSetTxRxPars(
IN PADAPTER Adapter, PADAPTER Adapter,
IN PBT_REQ_CMD pBtReq, PBT_REQ_CMD pBtReq,
IN PBT_RSP_CMD pBtRsp PBT_RSP_CMD pBtRsp
) )
{ {
u1Byte h2cParaBuf[6] = {0}; u8 h2cParaBuf[6] = {0};
u1Byte h2cParaLen = 0; u8 h2cParaLen = 0;
u2Byte paraLen = 0; u16 paraLen = 0;
u1Byte retStatus = BT_STATUS_BT_OP_SUCCESS; u8 retStatus = BT_STATUS_BT_OP_SUCCESS;
u1Byte btOpcode; u8 btOpcode;
u1Byte btOpcodeVer = 0; u8 btOpcodeVer = 0;
PBT_TXRX_PARAMETERS pTxRxPars = (PBT_TXRX_PARAMETERS)&pBtReq->pParamStart[0]; PBT_TXRX_PARAMETERS pTxRxPars = (PBT_TXRX_PARAMETERS)&pBtReq->pParamStart[0];
u2Byte lenTxRx = sizeof(BT_TXRX_PARAMETERS); u16 lenTxRx = sizeof(BT_TXRX_PARAMETERS);
u1Byte i; u8 i;
u1Byte bdAddr[6] = {0}; u8 bdAddr[6] = {0};
/* */ /* */
/* check upper layer parameters */ /* check upper layer parameters */
@ -1179,9 +1179,9 @@ mptbt_BtSetTxRxPars(
pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U; pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
return paraLen; return paraLen;
} else { } else {
h2cParaBuf[0] = (u1Byte)(pTxRxPars->txrxPktHeader & 0xff); h2cParaBuf[0] = (u8)(pTxRxPars->txrxPktHeader & 0xff);
h2cParaBuf[1] = (u1Byte)((pTxRxPars->txrxPktHeader & 0xff00) >> 8); h2cParaBuf[1] = (u8)((pTxRxPars->txrxPktHeader & 0xff00) >> 8);
h2cParaBuf[2] = (u1Byte)((pTxRxPars->txrxPktHeader & 0xff0000) >> 16); h2cParaBuf[2] = (u8)((pTxRxPars->txrxPktHeader & 0xff0000) >> 16);
h2cParaLen = 3; h2cParaLen = 3;
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen); retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
} }
@ -1196,7 +1196,7 @@ mptbt_BtSetTxRxPars(
/* fill h2c parameters */ /* fill h2c parameters */
btOpcode = BT_LO_OP_SET_PKT_TYPE_LEN; btOpcode = BT_LO_OP_SET_PKT_TYPE_LEN;
{ {
u2Byte payloadLenLimit = 0; u16 payloadLenLimit = 0;
switch (pTxRxPars->txrxPktType) { switch (pTxRxPars->txrxPktType) {
case MP_BT_PKT_DH1: case MP_BT_PKT_DH1:
payloadLenLimit = 27 * 8; payloadLenLimit = 27 * 8;
@ -1244,8 +1244,8 @@ mptbt_BtSetTxRxPars(
} }
h2cParaBuf[0] = pTxRxPars->txrxPktType; h2cParaBuf[0] = pTxRxPars->txrxPktType;
h2cParaBuf[1] = (u1Byte)((pTxRxPars->txrxPayloadLen & 0xff)); h2cParaBuf[1] = (u8)((pTxRxPars->txrxPayloadLen & 0xff));
h2cParaBuf[2] = (u1Byte)((pTxRxPars->txrxPayloadLen & 0xff00) >> 8); h2cParaBuf[2] = (u8)((pTxRxPars->txrxPayloadLen & 0xff00) >> 8);
h2cParaLen = 3; h2cParaLen = 3;
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen); retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
} }
@ -1264,8 +1264,8 @@ mptbt_BtSetTxRxPars(
pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U; pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
return paraLen; return paraLen;
} else { } else {
h2cParaBuf[0] = (u1Byte)((pTxRxPars->txrxTxPktCnt & 0xff)); h2cParaBuf[0] = (u8)((pTxRxPars->txrxTxPktCnt & 0xff));
h2cParaBuf[1] = (u1Byte)((pTxRxPars->txrxTxPktCnt & 0xff00) >> 8); h2cParaBuf[1] = (u8)((pTxRxPars->txrxTxPktCnt & 0xff00) >> 8);
h2cParaBuf[2] = pTxRxPars->txrxPayloadType; h2cParaBuf[2] = pTxRxPars->txrxPayloadType;
h2cParaLen = 3; h2cParaLen = 3;
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen); retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
@ -1285,8 +1285,8 @@ mptbt_BtSetTxRxPars(
pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U; pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
return paraLen; return paraLen;
} else { } else {
h2cParaBuf[0] = (u1Byte)((pTxRxPars->txrxTxPktCnt & 0xff0000) >> 16); h2cParaBuf[0] = (u8)((pTxRxPars->txrxTxPktCnt & 0xff0000) >> 16);
h2cParaBuf[1] = (u1Byte)((pTxRxPars->txrxTxPktCnt & 0xff000000) >> 24); h2cParaBuf[1] = (u8)((pTxRxPars->txrxTxPktCnt & 0xff000000) >> 24);
h2cParaBuf[2] = pTxRxPars->txrxTxPktInterval; h2cParaBuf[2] = pTxRxPars->txrxTxPktInterval;
h2cParaLen = 3; h2cParaLen = 3;
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen); retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
@ -1395,20 +1395,20 @@ mptbt_BtSetTxRxPars(
u2Byte u16
mptbt_BtTestCtrl( mptbt_BtTestCtrl(
IN PADAPTER Adapter, PADAPTER Adapter,
IN PBT_REQ_CMD pBtReq, PBT_REQ_CMD pBtReq,
IN PBT_RSP_CMD pBtRsp PBT_RSP_CMD pBtRsp
) )
{ {
u1Byte h2cParaBuf[6] = {0}; u8 h2cParaBuf[6] = {0};
u1Byte h2cParaLen = 0; u8 h2cParaLen = 0;
u2Byte paraLen = 0; u16 paraLen = 0;
u1Byte retStatus = BT_STATUS_BT_OP_SUCCESS; u8 retStatus = BT_STATUS_BT_OP_SUCCESS;
u1Byte btOpcode; u8 btOpcode;
u1Byte btOpcodeVer = 0; u8 btOpcodeVer = 0;
u1Byte testCtrl = 0; u8 testCtrl = 0;
/* */ /* */
/* check upper layer parameters */ /* check upper layer parameters */
@ -1460,21 +1460,21 @@ mptbt_BtTestCtrl(
} }
u2Byte u16
mptbt_TestBT( mptbt_TestBT(
IN PADAPTER Adapter, PADAPTER Adapter,
IN PBT_REQ_CMD pBtReq, PBT_REQ_CMD pBtReq,
IN PBT_RSP_CMD pBtRsp PBT_RSP_CMD pBtRsp
) )
{ {
u1Byte h2cParaBuf[6] = {0}; u8 h2cParaBuf[6] = {0};
u1Byte h2cParaLen = 0; u8 h2cParaLen = 0;
u2Byte paraLen = 0; u16 paraLen = 0;
u1Byte retStatus = BT_STATUS_BT_OP_SUCCESS; u8 retStatus = BT_STATUS_BT_OP_SUCCESS;
u1Byte btOpcode; u8 btOpcode;
u1Byte btOpcodeVer = 0; u8 btOpcodeVer = 0;
u1Byte testCtrl = 0; u8 testCtrl = 0;
/* 1. fill h2c parameters */ /* 1. fill h2c parameters */
btOpcode = 0x11; btOpcode = 0x11;
@ -1499,18 +1499,18 @@ mptbt_TestBT(
return paraLen; return paraLen;
} }
VOID void
mptbt_BtControlProcess( mptbt_BtControlProcess(
PADAPTER Adapter, PADAPTER Adapter,
PVOID pInBuf void *pInBuf
) )
{ {
u1Byte H2C_Parameter[6] = {0}; u8 H2C_Parameter[6] = {0};
PBT_H2C pH2c = (PBT_H2C)&H2C_Parameter[0]; PBT_H2C pH2c = (PBT_H2C)&H2C_Parameter[0];
PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);
PBT_REQ_CMD pBtReq = (PBT_REQ_CMD)pInBuf; PBT_REQ_CMD pBtReq = (PBT_REQ_CMD)pInBuf;
PBT_RSP_CMD pBtRsp; PBT_RSP_CMD pBtRsp;
u1Byte i; u8 i;
RTW_INFO("[MPT], mptbt_BtControlProcess()=========>\n"); RTW_INFO("[MPT], mptbt_BtControlProcess()=========>\n");

View File

@ -100,7 +100,7 @@ void rtw_btcoex_ScanNotify(PADAPTER padapter, u8 type)
hal_btcoex_ScanNotify(padapter, type); hal_btcoex_ScanNotify(padapter, type);
} }
void rtw_btcoex_ConnectNotify(PADAPTER padapter, u8 action) static void _rtw_btcoex_connect_notify(PADAPTER padapter, u8 action)
{ {
PHAL_DATA_TYPE pHalData; PHAL_DATA_TYPE pHalData;
@ -345,6 +345,21 @@ u32 rtw_btcoex_GetRaMask(PADAPTER padapter)
return hal_btcoex_GetRaMask(padapter); return hal_btcoex_GetRaMask(padapter);
} }
u8 rtw_btcoex_query_reduced_wl_pwr_lvl(PADAPTER padapter)
{
return hal_btcoex_query_reduced_wl_pwr_lvl(padapter);
}
void rtw_btcoex_set_reduced_wl_pwr_lvl(PADAPTER padapter, u8 val)
{
hal_btcoex_set_reduced_wl_pwr_lvl(padapter, val);
}
void rtw_btcoex_do_reduce_wl_pwr_lvl(PADAPTER padapter)
{
hal_btcoex_do_reduce_wl_pwr_lvl(padapter);
}
void rtw_btcoex_RecordPwrMode(PADAPTER padapter, u8 *pCmdBuf, u8 cmdLen) void rtw_btcoex_RecordPwrMode(PADAPTER padapter, u8 *pCmdBuf, u8 cmdLen)
{ {
hal_btcoex_RecordPwrMode(padapter, pCmdBuf, cmdLen); hal_btcoex_RecordPwrMode(padapter, pCmdBuf, cmdLen);
@ -453,6 +468,16 @@ u16 rtw_btcoex_btreg_write(PADAPTER padapter, u8 type, u16 addr, u16 val)
return hal_btcoex_btreg_write(padapter, type, addr, val); return hal_btcoex_btreg_write(padapter, type, addr, val);
} }
u16 rtw_btcoex_btset_testmode(PADAPTER padapter, u8 type)
{
return hal_btcoex_btset_testode(padapter, type);
}
u8 rtw_btcoex_get_reduce_wl_txpwr(PADAPTER padapter)
{
return rtw_btcoex_query_reduced_wl_pwr_lvl(padapter);
}
u8 rtw_btcoex_get_bt_coexist(PADAPTER padapter) u8 rtw_btcoex_get_bt_coexist(PADAPTER padapter)
{ {
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
@ -490,9 +515,9 @@ u8 rtw_btcoex_get_pg_rfe_type(PADAPTER padapter)
u8 rtw_btcoex_is_tfbga_package_type(PADAPTER padapter) u8 rtw_btcoex_is_tfbga_package_type(PADAPTER padapter)
{ {
#ifdef CONFIG_RTL8723B
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
#ifdef CONFIG_RTL8723B
if ((pHalData->PackageType == PACKAGE_TFBGA79) || (pHalData->PackageType == PACKAGE_TFBGA80) if ((pHalData->PackageType == PACKAGE_TFBGA79) || (pHalData->PackageType == PACKAGE_TFBGA80)
|| (pHalData->PackageType == PACKAGE_TFBGA90)) || (pHalData->PackageType == PACKAGE_TFBGA90))
return _TRUE; return _TRUE;
@ -865,7 +890,7 @@ u8 rtw_btcoex_parse_HCI_link_status_notify_cmd(_adapter *padapter, u8 *pcmd, u16
RTW_INFO("Connection_Handle=0x%x, BTProfile=%d, BTSpec=%d\n", conHandle, btProfile, btCoreSpec); RTW_INFO("Connection_Handle=0x%x, BTProfile=%d, BTSpec=%d\n", conHandle, btProfile, btCoreSpec);
pTriple += 4; pTriple += 4;
} else if (pBtMgnt->ExtConfig.HCIExtensionVer >= 1) { } else if (pBtMgnt->ExtConfig.HCIExtensionVer >= 1) {
conHandle = *((pu2Byte)&pTriple[0]); conHandle = *((u16 *)&pTriple[0]);
btProfile = pTriple[2]; btProfile = pTriple[2];
btCoreSpec = pTriple[3]; btCoreSpec = pTriple[3];
linkRole = pTriple[4]; linkRole = pTriple[4];
@ -1626,7 +1651,7 @@ void rtw_btcoex_SendEventExtBtCoexControl(PADAPTER padapter, u8 bNeedDbgRsp, u8
u8 localBuf[32] = ""; u8 localBuf[32] = "";
u8 *pRetPar; u8 *pRetPar;
u8 opCode = 0; u8 opCode = 0;
u8 *pInBuf = (pu1Byte)pData; u8 *pInBuf = (u8 *)pData;
u8 *pOpCodeContent; u8 *pOpCodeContent;
rtw_HCI_event *pEvent; rtw_HCI_event *pEvent;
@ -1760,3 +1785,17 @@ void rtw_btcoex_set_ant_info(PADAPTER padapter)
rtw_btcoex_wifionly_AntInfoSetting(padapter); rtw_btcoex_wifionly_AntInfoSetting(padapter);
} }
void rtw_btcoex_connect_notify(PADAPTER padapter, u8 join_type)
{
#ifdef CONFIG_BT_COEXIST
PHAL_DATA_TYPE pHalData;
pHalData = GET_HAL_DATA(padapter);
if (pHalData->EEPROMBluetoothCoexist == _TRUE)
_rtw_btcoex_connect_notify(padapter, join_type ? _FALSE : _TRUE);
else
#endif /* CONFIG_BT_COEXIST */
rtw_btcoex_wifionly_connect_notify(padapter);
}

File diff suppressed because it is too large Load Diff

View File

@ -15,121 +15,18 @@
#ifndef __RTW_CHPLAN_H__ #ifndef __RTW_CHPLAN_H__
#define __RTW_CHPLAN_H__ #define __RTW_CHPLAN_H__
enum rtw_chplan_id { #define RTW_CHPLAN_UNSPECIFIED 0xFF
/* ===== 0x00 ~ 0x1F, legacy channel plan ===== */
RTW_CHPLAN_FCC = 0x00,
RTW_CHPLAN_IC = 0x01,
RTW_CHPLAN_ETSI = 0x02,
RTW_CHPLAN_SPAIN = 0x03,
RTW_CHPLAN_FRANCE = 0x04,
RTW_CHPLAN_MKK = 0x05,
RTW_CHPLAN_MKK1 = 0x06,
RTW_CHPLAN_ISRAEL = 0x07,
RTW_CHPLAN_TELEC = 0x08,
RTW_CHPLAN_GLOBAL_DOAMIN = 0x09,
RTW_CHPLAN_WORLD_WIDE_13 = 0x0A,
RTW_CHPLAN_TAIWAN = 0x0B,
RTW_CHPLAN_CHINA = 0x0C,
RTW_CHPLAN_SINGAPORE_INDIA_MEXICO = 0x0D,
RTW_CHPLAN_KOREA = 0x0E,
RTW_CHPLAN_TURKEY = 0x0F,
RTW_CHPLAN_JAPAN = 0x10,
RTW_CHPLAN_FCC_NO_DFS = 0x11,
RTW_CHPLAN_JAPAN_NO_DFS = 0x12,
RTW_CHPLAN_WORLD_WIDE_5G = 0x13,
RTW_CHPLAN_TAIWAN_NO_DFS = 0x14,
/* ===== 0x20 ~ 0x7F, new channel plan ===== */
RTW_CHPLAN_WORLD_NULL = 0x20,
RTW_CHPLAN_ETSI1_NULL = 0x21,
RTW_CHPLAN_FCC1_NULL = 0x22,
RTW_CHPLAN_MKK1_NULL = 0x23,
RTW_CHPLAN_ETSI2_NULL = 0x24,
RTW_CHPLAN_FCC1_FCC1 = 0x25,
RTW_CHPLAN_WORLD_ETSI1 = 0x26,
RTW_CHPLAN_MKK1_MKK1 = 0x27,
RTW_CHPLAN_WORLD_KCC1 = 0x28,
RTW_CHPLAN_WORLD_FCC2 = 0x29,
RTW_CHPLAN_FCC2_NULL = 0x2A,
RTW_CHPLAN_IC1_IC2 = 0x2B,
RTW_CHPLAN_MKK2_NULL = 0x2C,
RTW_CHPLAN_WORLD_CHILE1= 0x2D,
RTW_CHPLAN_WORLD1_WORLD1 = 0x2E,
RTW_CHPLAN_WORLD_CHILE2 = 0x2F,
RTW_CHPLAN_WORLD_FCC3 = 0x30,
RTW_CHPLAN_WORLD_FCC4 = 0x31,
RTW_CHPLAN_WORLD_FCC5 = 0x32,
RTW_CHPLAN_WORLD_FCC6 = 0x33,
RTW_CHPLAN_FCC1_FCC7 = 0x34,
RTW_CHPLAN_WORLD_ETSI2 = 0x35,
RTW_CHPLAN_WORLD_ETSI3 = 0x36,
RTW_CHPLAN_MKK1_MKK2 = 0x37,
RTW_CHPLAN_MKK1_MKK3 = 0x38,
RTW_CHPLAN_FCC1_NCC1 = 0x39,
RTW_CHPLAN_ETSI1_ETSI1 = 0x3A,
RTW_CHPLAN_ETSI1_ACMA1 = 0x3B,
RTW_CHPLAN_ETSI1_ETSI6 = 0x3C,
RTW_CHPLAN_ETSI1_ETSI12 = 0x3D,
RTW_CHPLAN_KCC1_KCC2 = 0x3E,
RTW_CHPLAN_FCC1_NCC2 = 0x40,
RTW_CHPLAN_GLOBAL_NULL = 0x41,
RTW_CHPLAN_ETSI1_ETSI4 = 0x42,
RTW_CHPLAN_FCC1_FCC2 = 0x43,
RTW_CHPLAN_FCC1_NCC3 = 0x44,
RTW_CHPLAN_WORLD_ACMA1 = 0x45,
RTW_CHPLAN_FCC1_FCC8 = 0x46,
RTW_CHPLAN_WORLD_ETSI6 = 0x47,
RTW_CHPLAN_WORLD_ETSI7 = 0x48,
RTW_CHPLAN_WORLD_ETSI8 = 0x49,
RTW_CHPLAN_WORLD_ETSI9 = 0x50,
RTW_CHPLAN_WORLD_ETSI10 = 0x51,
RTW_CHPLAN_WORLD_ETSI11 = 0x52,
RTW_CHPLAN_FCC1_NCC4 = 0x53,
RTW_CHPLAN_WORLD_ETSI12 = 0x54,
RTW_CHPLAN_FCC1_FCC9 = 0x55,
RTW_CHPLAN_WORLD_ETSI13 = 0x56,
RTW_CHPLAN_FCC1_FCC10 = 0x57,
RTW_CHPLAN_MKK2_MKK4 = 0x58,
RTW_CHPLAN_WORLD_ETSI14 = 0x59,
RTW_CHPLAN_FCC1_FCC5 = 0x60,
RTW_CHPLAN_FCC2_FCC7 = 0x61,
RTW_CHPLAN_FCC2_FCC1 = 0x62,
RTW_CHPLAN_WORLD_ETSI15 = 0x63,
RTW_CHPLAN_MKK2_MKK5 = 0x64,
RTW_CHPLAN_ETSI1_ETSI16 = 0x65,
RTW_CHPLAN_FCC1_FCC14 = 0x66,
RTW_CHPLAN_FCC1_FCC12 = 0x67,
RTW_CHPLAN_FCC2_FCC14 = 0x68,
RTW_CHPLAN_FCC2_FCC12 = 0x69,
RTW_CHPLAN_ETSI1_ETSI17 = 0x6A,
RTW_CHPLAN_WORLD_FCC16 = 0x6B,
RTW_CHPLAN_WORLD_FCC13 = 0x6C,
RTW_CHPLAN_FCC2_FCC15 = 0x6D,
RTW_CHPLAN_WORLD_FCC12 = 0x6E,
RTW_CHPLAN_NULL_ETSI8 = 0x6F,
RTW_CHPLAN_NULL_ETSI18 = 0x70,
RTW_CHPLAN_NULL_ETSI17 = 0x71,
RTW_CHPLAN_NULL_ETSI19 = 0x72,
RTW_CHPLAN_WORLD_FCC7 = 0x73,
RTW_CHPLAN_FCC2_FCC17 = 0x74,
RTW_CHPLAN_WORLD_ETSI20 = 0x75,
RTW_CHPLAN_FCC2_FCC11 = 0x76,
RTW_CHPLAN_WORLD_ETSI21 = 0x77,
RTW_CHPLAN_FCC1_FCC18 = 0x78,
RTW_CHPLAN_MKK2_MKK1 = 0x79,
RTW_CHPLAN_MAX,
RTW_CHPLAN_REALTEK_DEFINE = 0x7F,
RTW_CHPLAN_UNSPECIFIED = 0xFF,
};
u8 rtw_chplan_get_default_regd(u8 id); u8 rtw_chplan_get_default_regd(u8 id);
bool rtw_chplan_is_empty(u8 id); bool rtw_chplan_is_empty(u8 id);
#define rtw_is_channel_plan_valid(chplan) (((chplan) < RTW_CHPLAN_MAX || (chplan) == RTW_CHPLAN_REALTEK_DEFINE) && !rtw_chplan_is_empty(chplan)) bool rtw_is_channel_plan_valid(u8 id);
#define rtw_is_legacy_channel_plan(chplan) ((chplan) < 0x20)
struct _RT_CHANNEL_INFO; struct _RT_CHANNEL_INFO;
u8 init_channel_set(_adapter *padapter, u8 ChannelPlan, struct _RT_CHANNEL_INFO *channel_set); u8 init_channel_set(_adapter *padapter, u8 ChannelPlan, struct _RT_CHANNEL_INFO *channel_set);
bool rtw_chset_is_dfs_range(struct _RT_CHANNEL_INFO *chset, u32 hi, u32 lo);
bool rtw_chset_is_dfs_ch(struct _RT_CHANNEL_INFO *chset, u8 ch);
bool rtw_chset_is_dfs_chbw(struct _RT_CHANNEL_INFO *chset, u8 ch, u8 bw, u8 offset);
void rtw_process_beacon_hint(_adapter *adapter, WLAN_BSSID_EX *bss);
#define IS_ALPHA2_NO_SPECIFIED(_alpha2) ((*((u16 *)(_alpha2))) == 0xFFFF) #define IS_ALPHA2_NO_SPECIFIED(_alpha2) ((*((u16 *)(_alpha2))) == 0xFFFF)
@ -144,6 +41,7 @@ u8 init_channel_set(_adapter *padapter, u8 ChannelPlan, struct _RT_CHANNEL_INFO
#define RTW_MODULE_RTL8723DE_NGFF1630 BIT8 /* RTL8723DE(NGFF1630) */ #define RTW_MODULE_RTL8723DE_NGFF1630 BIT8 /* RTL8723DE(NGFF1630) */
#define RTW_MODULE_RTL8822BE BIT9 /* RTL8822BE */ #define RTW_MODULE_RTL8822BE BIT9 /* RTL8822BE */
#define RTW_MODULE_RTL8821CE BIT10 /* RTL8821CE */ #define RTW_MODULE_RTL8821CE BIT10 /* RTL8821CE */
#define RTW_MODULE_RTL8822CE BIT11 /* RTL8822CE */
struct country_chplan { struct country_chplan {
char alpha2[2]; char alpha2[2];

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2007 - 2017 Realtek Corporation. * Copyright(c) 2007 - 2019 Realtek Corporation.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -164,15 +164,6 @@ sint _rtw_init_evt_priv(struct evt_priv *pevtpriv)
pevtpriv->c2h_mem = pevtpriv->allocated_c2h_mem + 4\ pevtpriv->c2h_mem = pevtpriv->allocated_c2h_mem + 4\
- ((u32)(pevtpriv->allocated_c2h_mem) & 3); - ((u32)(pevtpriv->allocated_c2h_mem) & 3);
#ifdef PLATFORM_OS_XP
pevtpriv->pc2h_mdl = IoAllocateMdl((u8 *)pevtpriv->c2h_mem, C2H_MEM_SZ , FALSE, FALSE, NULL);
if (pevtpriv->pc2h_mdl == NULL) {
res = _FAIL;
goto exit;
}
MmBuildMdlForNonPagedPool(pevtpriv->pc2h_mdl);
#endif
#endif /* end of CONFIG_SDIO_HCI */ #endif /* end of CONFIG_SDIO_HCI */
_rtw_init_queue(&(pevtpriv->evt_queue)); _rtw_init_queue(&(pevtpriv->evt_queue));
@ -618,7 +609,7 @@ _next:
if (extra_parm && extra_parm->pbuf && extra_parm->size > 0) if (extra_parm && extra_parm->pbuf && extra_parm->size > 0)
rtw_mfree(extra_parm->pbuf, extra_parm->size); rtw_mfree(extra_parm->pbuf, extra_parm->size);
} }
#ifdef CONFIG_DFS #if CONFIG_DFS
else if (pcmd->cmdcode == GEN_CMD_CODE(_SetChannelSwitch)) else if (pcmd->cmdcode == GEN_CMD_CODE(_SetChannelSwitch))
adapter_to_rfctl(padapter)->csa_ch = 0; adapter_to_rfctl(padapter)->csa_ch = 0;
#endif #endif
@ -718,7 +709,7 @@ post_process:
if (extra_parm->pbuf && extra_parm->size > 0) if (extra_parm->pbuf && extra_parm->size > 0)
rtw_mfree(extra_parm->pbuf, extra_parm->size); rtw_mfree(extra_parm->pbuf, extra_parm->size);
} }
#ifdef CONFIG_DFS #if CONFIG_DFS
else if (pcmd->cmdcode == GEN_CMD_CODE(_SetChannelSwitch)) else if (pcmd->cmdcode == GEN_CMD_CODE(_SetChannelSwitch))
adapter_to_rfctl(padapter)->csa_ch = 0; adapter_to_rfctl(padapter)->csa_ch = 0;
#endif #endif
@ -871,7 +862,7 @@ u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm)
#ifdef CONFIG_LPS #ifdef CONFIG_LPS
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1); rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 0);
#endif #endif
#ifdef CONFIG_P2P_PS #ifdef CONFIG_P2P_PS
@ -1229,7 +1220,7 @@ static u8 rtw_createbss_cmd(_adapter *adapter, int flags, bool adhoc
u8 res = _SUCCESS; u8 res = _SUCCESS;
if (req_ch > 0 && req_bw >= 0 && req_offset >= 0) { if (req_ch > 0 && req_bw >= 0 && req_offset >= 0) {
if (!rtw_chset_is_chbw_valid(adapter_to_chset(adapter), req_ch, req_bw, req_offset)) { if (!rtw_chset_is_chbw_valid(adapter_to_chset(adapter), req_ch, req_bw, req_offset, 0, 0)) {
res = _FAIL; res = _FAIL;
goto exit; goto exit;
} }
@ -1387,12 +1378,12 @@ u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network *pnetwork)
} }
#if 0 #if 0
/* for IEs is pointer */ /* for IEs is pointer */
t_len = sizeof(ULONG) + sizeof(NDIS_802_11_MAC_ADDRESS) + 2 + t_len = sizeof(u32) + sizeof(NDIS_802_11_MAC_ADDRESS) + 2 +
sizeof(NDIS_802_11_SSID) + sizeof(ULONG) + sizeof(NDIS_802_11_SSID) + sizeof(u32) +
sizeof(NDIS_802_11_RSSI) + sizeof(NDIS_802_11_NETWORK_TYPE) + sizeof(NDIS_802_11_RSSI) + sizeof(NDIS_802_11_NETWORK_TYPE) +
sizeof(NDIS_802_11_CONFIGURATION) + sizeof(NDIS_802_11_CONFIGURATION) +
sizeof(NDIS_802_11_NETWORK_INFRASTRUCTURE) + sizeof(NDIS_802_11_NETWORK_INFRASTRUCTURE) +
sizeof(NDIS_802_11_RATES_EX) + sizeof(WLAN_PHY_INFO) + sizeof(ULONG) + MAX_IE_SZ; sizeof(NDIS_802_11_RATES_EX) + sizeof(WLAN_PHY_INFO) + sizeof(u32) + MAX_IE_SZ;
#endif #endif
/* for IEs is fix buf size */ /* for IEs is fix buf size */
t_len = sizeof(WLAN_BSSID_EX); t_len = sizeof(WLAN_BSSID_EX);
@ -1420,9 +1411,9 @@ u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network *pnetwork)
#ifdef CONFIG_80211AC_VHT #ifdef CONFIG_80211AC_VHT
/* save AP beamform_cap info for BCM IOT issue */ /* save AP beamform_cap info for BCM IOT issue */
if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_BROADCOM) if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_BROADCOM)
pvhtpriv->ap_is_mu_bfer = get_vht_bf_cap(pnetwork->network.IEs,
get_vht_mu_bfer_cap(pnetwork->network.IEs, pnetwork->network.IELength,
pnetwork->network.IELength); &pvhtpriv->ap_bf_cap);
#endif #endif
/* /*
Modified by Arvin 2015/05/13 Modified by Arvin 2015/05/13
@ -1506,6 +1497,13 @@ u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network *pnetwork)
#ifdef CONFIG_80211AC_VHT #ifdef CONFIG_80211AC_VHT
pvhtpriv->vht_option = _FALSE; pvhtpriv->vht_option = _FALSE;
if ((psecnetwork->Configuration.DSConfig <= 14) &&
(!rtw_is_vht_2g4(padapter))) {
RTW_PRINT("%s: Not support VHT rate on 2.4G (ch:%d)\n",
__FUNCTION__,
psecnetwork->Configuration.DSConfig);
goto skip_vht;
}
if (phtpriv->ht_option if (phtpriv->ht_option
&& REGSTY_IS_11AC_ENABLE(pregistrypriv) && REGSTY_IS_11AC_ENABLE(pregistrypriv)
&& is_supported_vht(pregistrypriv->wireless_mode) && is_supported_vht(pregistrypriv->wireless_mode)
@ -1513,7 +1511,14 @@ u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network *pnetwork)
) { ) {
rtw_restructure_vht_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0], rtw_restructure_vht_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0],
pnetwork->network.IELength, &psecnetwork->IELength); pnetwork->network.IELength, &psecnetwork->IELength);
if ((psecnetwork->Configuration.DSConfig <= 14) &&
(pvhtpriv->vht_option == _TRUE))
RTW_INFO("%s: AP support VHT rate on 2.4G (ch:%d)\n",
__FUNCTION__,
psecnetwork->Configuration.DSConfig);
} }
skip_vht:
#endif #endif
#endif /* CONFIG_80211N_HT */ #endif /* CONFIG_80211N_HT */
@ -1534,25 +1539,6 @@ u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network *pnetwork)
pcmd->cmdsz = sizeof(WLAN_BSSID_EX); pcmd->cmdsz = sizeof(WLAN_BSSID_EX);
#ifdef CONFIG_RTL8712
/* wlan_network endian conversion */
psecnetwork->Length = cpu_to_le32(psecnetwork->Length);
psecnetwork->Ssid.SsidLength = cpu_to_le32(psecnetwork->Ssid.SsidLength);
psecnetwork->Privacy = cpu_to_le32(psecnetwork->Privacy);
psecnetwork->Rssi = cpu_to_le32(psecnetwork->Rssi);
psecnetwork->NetworkTypeInUse = cpu_to_le32(psecnetwork->NetworkTypeInUse);
psecnetwork->Configuration.ATIMWindow = cpu_to_le32(psecnetwork->Configuration.ATIMWindow);
psecnetwork->Configuration.BeaconPeriod = cpu_to_le32(psecnetwork->Configuration.BeaconPeriod);
psecnetwork->Configuration.DSConfig = cpu_to_le32(psecnetwork->Configuration.DSConfig);
psecnetwork->Configuration.FHConfig.DwellTime = cpu_to_le32(psecnetwork->Configuration.FHConfig.DwellTime);
psecnetwork->Configuration.FHConfig.HopPattern = cpu_to_le32(psecnetwork->Configuration.FHConfig.HopPattern);
psecnetwork->Configuration.FHConfig.HopSet = cpu_to_le32(psecnetwork->Configuration.FHConfig.HopSet);
psecnetwork->Configuration.FHConfig.Length = cpu_to_le32(psecnetwork->Configuration.FHConfig.Length);
psecnetwork->Configuration.Length = cpu_to_le32(psecnetwork->Configuration.Length);
psecnetwork->InfrastructureMode = cpu_to_le32(psecnetwork->InfrastructureMode);
psecnetwork->IELength = cpu_to_le32(psecnetwork->IELength);
#endif
_rtw_init_listhead(&pcmd->list); _rtw_init_listhead(&pcmd->list);
pcmd->cmdcode = _JoinBss_CMD_;/* GEN_CMD_CODE(_JoinBss) */ pcmd->cmdcode = _JoinBss_CMD_;/* GEN_CMD_CODE(_JoinBss) */
pcmd->parmbuf = (unsigned char *)psecnetwork; pcmd->parmbuf = (unsigned char *)psecnetwork;
@ -1618,6 +1604,62 @@ exit:
return res; return res;
} }
u8 rtw_stop_ap_cmd(_adapter *adapter, u8 flags)
{
#ifdef CONFIG_AP_MODE
struct cmd_obj *cmdobj;
struct drvextra_cmd_parm *parm;
struct cmd_priv *pcmdpriv = &adapter->cmdpriv;
struct submit_ctx sctx;
u8 res = _SUCCESS;
if (flags & RTW_CMDF_DIRECTLY) {
/* no need to enqueue, do the cmd hdl directly and free cmd parameter */
if (H2C_SUCCESS != stop_ap_hdl(adapter))
res = _FAIL;
} else {
parm = (struct drvextra_cmd_parm *)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
if (parm == NULL) {
res = _FAIL;
goto exit;
}
parm->ec_id = STOP_AP_WK_CID;
parm->type = 0;
parm->size = 0;
parm->pbuf = NULL;
/* need enqueue, prepare cmd_obj and enqueue */
cmdobj = (struct cmd_obj *)rtw_zmalloc(sizeof(*cmdobj));
if (cmdobj == NULL) {
res = _FAIL;
goto exit;
}
init_h2fwcmd_w_parm_no_rsp(cmdobj, parm, GEN_CMD_CODE(_Set_Drv_Extra));
if (flags & RTW_CMDF_WAIT_ACK) {
cmdobj->sctx = &sctx;
rtw_sctx_init(&sctx, 2000);
}
res = rtw_enqueue_cmd(pcmdpriv, cmdobj);
if (res == _SUCCESS && (flags & RTW_CMDF_WAIT_ACK)) {
rtw_sctx_wait(&sctx, __func__);
_enter_critical_mutex(&pcmdpriv->sctx_mutex, NULL);
if (sctx.status == RTW_SCTX_SUBMITTED)
cmdobj->sctx = NULL;
_exit_critical_mutex(&pcmdpriv->sctx_mutex, NULL);
}
}
exit:
return res;
#endif
}
u8 rtw_setopmode_cmd(_adapter *adapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, u8 flags) u8 rtw_setopmode_cmd(_adapter *adapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, u8 flags)
{ {
struct cmd_obj *cmdobj; struct cmd_obj *cmdobj;
@ -2306,7 +2348,7 @@ inline u8 rtw_set_country_cmd(_adapter *adapter, int flags, const char *country_
return _rtw_set_chplan_cmd(adapter, flags, RTW_CHPLAN_UNSPECIFIED, ent, swconfig); return _rtw_set_chplan_cmd(adapter, flags, RTW_CHPLAN_UNSPECIFIED, ent, swconfig);
} }
u8 rtw_led_blink_cmd(_adapter *padapter, PVOID pLed) u8 rtw_led_blink_cmd(_adapter *padapter, void *pLed)
{ {
struct cmd_obj *pcmdobj; struct cmd_obj *pcmdobj;
struct LedBlink_param *ledBlink_param; struct LedBlink_param *ledBlink_param;
@ -2619,13 +2661,10 @@ void rtw_ctrl_txss_update_mimo_type(_adapter *adapter, struct sta_info *sta)
pmlmeext->txss_momi_type_bk = sta->cmn.mimo_type; pmlmeext->txss_momi_type_bk = sta->cmn.mimo_type;
} }
u8 rtw_ctrl_txss(_adapter *adapter, struct sta_info *sta, u8 tx_1ss) u8 rtw_ctrl_txss(_adapter *adapter, struct sta_info *sta, bool tx_1ss)
{ {
struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv); struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(adapter); struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(adapter);
enum bb_path txpath = BB_PATH_A | BB_PATH_B;
enum bb_path rxpath = BB_PATH_A | BB_PATH_B;
u8 tx2path = _FALSE;
u8 lps_changed = _FALSE; u8 lps_changed = _FALSE;
u8 rst = _SUCCESS; u8 rst = _SUCCESS;
@ -2646,11 +2685,7 @@ u8 rtw_ctrl_txss(_adapter *adapter, struct sta_info *sta, u8 tx_1ss)
rtw_phydm_ra_registed(adapter, sta); rtw_phydm_ra_registed(adapter, sta);
/*configure trx mode*/ /*configure trx mode*/
rtw_hal_get_rf_path(adapter_to_dvobj(adapter), NULL, &txpath, &rxpath); rtw_phydm_trx_cfg(adapter, tx_1ss);
txpath = (tx_1ss) ? BB_PATH_A : txpath;
if (phydm_api_trx_mode(adapter_to_phydm(adapter), txpath, rxpath, tx2path) == FALSE)
rst = _FALSE;
pmlmeext->txss_1ss = tx_1ss; pmlmeext->txss_1ss = tx_1ss;
if (lps_changed) if (lps_changed)
@ -2667,7 +2702,7 @@ u8 rtw_ctrl_txss_wk_hdl(_adapter *adapter, struct txss_cmd_parm *txss_param)
return rtw_ctrl_txss(adapter, txss_param->sta, txss_param->tx_1ss); return rtw_ctrl_txss(adapter, txss_param->sta, txss_param->tx_1ss);
} }
u8 rtw_ctrl_txss_wk_cmd(_adapter *adapter, struct sta_info *sta, u8 tx_1ss, u8 flag) u8 rtw_ctrl_txss_wk_cmd(_adapter *adapter, struct sta_info *sta, bool tx_1ss, u8 flag)
{ {
struct cmd_obj *cmdobj; struct cmd_obj *cmdobj;
struct drvextra_cmd_parm *cmd_parm; struct drvextra_cmd_parm *cmd_parm;
@ -2732,7 +2767,7 @@ exit:
void rtw_ctrl_tx_ss_by_tp(_adapter *adapter, u8 from_timer) void rtw_ctrl_tx_ss_by_tp(_adapter *adapter, u8 from_timer)
{ {
u8 tx_1ss = _FALSE; /*change tx from 2ss to 1ss*/ bool tx_1ss = _FALSE; /*change tx from 2ss to 1ss*/
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv); struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
struct sta_priv *pstapriv = &adapter->stapriv; struct sta_priv *pstapriv = &adapter->stapriv;
@ -2778,7 +2813,7 @@ void rtw_ctrl_tx_ss_by_tp(_adapter *adapter, u8 from_timer)
} }
} }
#ifdef DBG_CTRL_TXSS #ifdef DBG_CTRL_TXSS
void dbg_ctrl_txss(_adapter *adapter, u8 tx_1ss) void dbg_ctrl_txss(_adapter *adapter, bool tx_1ss)
{ {
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv); struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
@ -2816,7 +2851,7 @@ static u8 _bcn_cnt_expected(struct sta_info *psta)
if ((pmlmeinfo->bcn_interval !=0) && (dtim != 0)) if ((pmlmeinfo->bcn_interval !=0) && (dtim != 0))
bcn_cnt = 2000 / pmlmeinfo->bcn_interval / dtim * 4 / 5; /*2s*/ bcn_cnt = 2000 / pmlmeinfo->bcn_interval / dtim * 4 / 5; /*2s*/
if (0) if (0)
RTW_INFO("%s bcn_cnt:%d\n", bcn_cnt); RTW_INFO("%s bcn_cnt:%d\n", __func__, bcn_cnt);
if (bcn_cnt == 0) { if (bcn_cnt == 0) {
RTW_ERR(FUNC_ADPT_FMT" bcn_cnt == 0\n", FUNC_ADPT_ARG(adapter)); RTW_ERR(FUNC_ADPT_FMT" bcn_cnt == 0\n", FUNC_ADPT_ARG(adapter));
@ -2913,7 +2948,7 @@ u8 _lps_chk_by_tp(_adapter *adapter, u8 from_timer)
if (adapter->hw_port == HW_PORT0) if (adapter->hw_port == HW_PORT0)
#endif #endif
#endif #endif
rtw_lps_ctrl_wk_cmd(adapter, LPS_CTRL_TRAFFIC_BUSY, 1); rtw_lps_ctrl_wk_cmd(adapter, LPS_CTRL_TRAFFIC_BUSY, 0);
} }
} }
@ -2991,7 +3026,7 @@ static u8 _lps_chk_by_pkt_cnts(_adapter *padapter, u8 from_timer, u8 bBusyTraffi
LPS_Enter(padapter, "TRAFFIC_IDLE"); LPS_Enter(padapter, "TRAFFIC_IDLE");
} else { } else {
/* do this at caller */ /* do this at caller */
/* rtw_lps_ctrl_wk_cmd(adapter, LPS_CTRL_ENTER, 1); */ /* rtw_lps_ctrl_wk_cmd(adapter, LPS_CTRL_ENTER, 0); */
/* rtw_hal_dm_watchdog_in_lps(padapter); */ /* rtw_hal_dm_watchdog_in_lps(padapter); */
} }
@ -3015,7 +3050,7 @@ static u8 _lps_chk_by_pkt_cnts(_adapter *padapter, u8 from_timer, u8 bBusyTraffi
if (padapter->hw_port == HW_PORT0) if (padapter->hw_port == HW_PORT0)
#endif #endif
#endif #endif
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_TRAFFIC_BUSY, 1); rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_TRAFFIC_BUSY, 0);
} }
} }
@ -3191,8 +3226,8 @@ static void dynamic_update_bcn_check(_adapter *padapter)
&& _FALSE == ATOMIC_READ(&pmlmepriv->olbc_ht)) { && _FALSE == ATOMIC_READ(&pmlmepriv->olbc_ht)) {
if (rtw_ht_operation_update(padapter) > 0) { if (rtw_ht_operation_update(padapter) > 0) {
update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE); update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE, 0);
update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _TRUE); update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _TRUE, 0);
} }
} }
#endif /* CONFIG_80211N_HT */ #endif /* CONFIG_80211N_HT */
@ -3205,8 +3240,8 @@ static void dynamic_update_bcn_check(_adapter *padapter)
&& _FALSE != ATOMIC_READ(&pmlmepriv->olbc_ht)) { && _FALSE != ATOMIC_READ(&pmlmepriv->olbc_ht)) {
if (rtw_ht_operation_update(padapter) > 0) { if (rtw_ht_operation_update(padapter) > 0) {
update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE); update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE, 0);
update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _TRUE); update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _TRUE, 0);
} }
ATOMIC_SET(&pmlmepriv->olbc, _FALSE); ATOMIC_SET(&pmlmepriv->olbc, _FALSE);
@ -3238,14 +3273,6 @@ void rtw_iface_dynamic_chk_wk_hdl(_adapter *padapter)
/* for debug purpose */ /* for debug purpose */
_linked_info_dump(padapter); _linked_info_dump(padapter);
#ifdef CONFIG_BEAMFORMING
#ifndef RTW_BEAMFORMING_VERSION_2
#if (BEAMFORMING_SUPPORT == 0) /*for diver defined beamforming*/
beamforming_watchdog(padapter);
#endif
#endif /* !RTW_BEAMFORMING_VERSION_2 */
#endif
#ifdef CONFIG_RTW_CFGVEDNOR_RSSIMONITOR #ifdef CONFIG_RTW_CFGVEDNOR_RSSIMONITOR
rtw_cfgvendor_rssi_monitor_evt(padapter); rtw_cfgvendor_rssi_monitor_evt(padapter);
#endif #endif
@ -3290,15 +3317,20 @@ void rtw_dynamic_chk_wk_hdl(_adapter *padapter)
} }
#ifdef CONFIG_LPS #ifdef CONFIG_LPS
struct lps_ctrl_wk_parm {
s8 lps_level;
#ifdef CONFIG_LPS_1T1R
s8 lps_1t1r;
#endif
};
void lps_ctrl_wk_hdl(_adapter *padapter, u8 lps_ctrl_type); void lps_ctrl_wk_hdl(_adapter *padapter, u8 lps_ctrl_type, u8 *buf)
void lps_ctrl_wk_hdl(_adapter *padapter, u8 lps_ctrl_type)
{ {
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
struct lps_ctrl_wk_parm *parm = (struct lps_ctrl_wk_parm *)buf;
u8 mstatus; u8 mstatus;
if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE) if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE)
|| (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE)) || (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE))
return; return;
@ -3339,7 +3371,7 @@ void lps_ctrl_wk_hdl(_adapter *padapter, u8 lps_ctrl_type)
break; break;
case LPS_CTRL_SPECIAL_PACKET: case LPS_CTRL_SPECIAL_PACKET:
/* RTW_INFO("LPS_CTRL_SPECIAL_PACKET\n"); */ /* RTW_INFO("LPS_CTRL_SPECIAL_PACKET\n"); */
pwrpriv->DelayLPSLastTimeStamp = rtw_get_current_time(); rtw_set_lps_deny(padapter, LPS_DELAY_MS);
#ifdef CONFIG_BT_COEXIST #ifdef CONFIG_BT_COEXIST
rtw_btcoex_SpecialPacketNotify(padapter, PACKET_DHCP); rtw_btcoex_SpecialPacketNotify(padapter, PACKET_DHCP);
#endif /* CONFIG_BT_COEXIST */ #endif /* CONFIG_BT_COEXIST */
@ -3348,6 +3380,17 @@ void lps_ctrl_wk_hdl(_adapter *padapter, u8 lps_ctrl_type)
case LPS_CTRL_LEAVE: case LPS_CTRL_LEAVE:
LPS_Leave(padapter, "LPS_CTRL_LEAVE"); LPS_Leave(padapter, "LPS_CTRL_LEAVE");
break; break;
case LPS_CTRL_LEAVE_SET_OPTION:
LPS_Leave(padapter, "LPS_CTRL_LEAVE_SET_OPTION");
if (parm) {
if (parm->lps_level >= 0)
pwrpriv->lps_level = parm->lps_level;
#ifdef CONFIG_LPS_1T1R
if (parm->lps_1t1r >= 0)
pwrpriv->lps_1t1r = parm->lps_1t1r;
#endif
}
break;
case LPS_CTRL_LEAVE_CFG80211_PWRMGMT: case LPS_CTRL_LEAVE_CFG80211_PWRMGMT:
LPS_Leave(padapter, "CFG80211_PWRMGMT"); LPS_Leave(padapter, "CFG80211_PWRMGMT");
break; break;
@ -3369,50 +3412,97 @@ void lps_ctrl_wk_hdl(_adapter *padapter, u8 lps_ctrl_type)
} }
u8 rtw_lps_ctrl_wk_cmd(_adapter *padapter, u8 lps_ctrl_type, u8 enqueue) static u8 _rtw_lps_ctrl_wk_cmd(_adapter *adapter, u8 lps_ctrl_type, s8 lps_level, s8 lps_1t1r, u8 flags)
{ {
struct cmd_obj *ph2c; struct cmd_obj *cmdobj;
struct drvextra_cmd_parm *pdrvextra_cmd_parm; struct drvextra_cmd_parm *parm;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct lps_ctrl_wk_parm *wk_parm = NULL;
/* struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); */ struct cmd_priv *pcmdpriv = &adapter->cmdpriv;
struct submit_ctx sctx;
u8 res = _SUCCESS; u8 res = _SUCCESS;
if (lps_ctrl_type == LPS_CTRL_LEAVE_SET_OPTION) {
wk_parm = rtw_zmalloc(sizeof(*wk_parm));
if (wk_parm == NULL) {
res = _FAIL;
goto exit;
}
wk_parm->lps_level = lps_level;
#ifdef CONFIG_LPS_1T1R
wk_parm->lps_1t1r = lps_1t1r;
#endif
}
/* if(!pwrctrlpriv->bLeisurePs) */ if (flags & RTW_CMDF_DIRECTLY) {
/* return res; */ /* no need to enqueue, do the cmd hdl directly */
lps_ctrl_wk_hdl(adapter, lps_ctrl_type, (u8 *)wk_parm);
if (enqueue) { if (wk_parm)
ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); rtw_mfree(wk_parm, sizeof(*wk_parm));
if (ph2c == NULL) { } else {
/* need enqueue, prepare cmd_obj and enqueue */
parm = rtw_zmalloc(sizeof(*parm));
if (parm == NULL) {
if (wk_parm)
rtw_mfree(wk_parm, sizeof(*wk_parm));
res = _FAIL; res = _FAIL;
goto exit; goto exit;
} }
pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); parm->ec_id = LPS_CTRL_WK_CID;
if (pdrvextra_cmd_parm == NULL) { parm->type = lps_ctrl_type;
rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); parm->size = wk_parm ? sizeof(*wk_parm) : 0;
parm->pbuf = (u8 *)wk_parm;
cmdobj = rtw_zmalloc(sizeof(*cmdobj));
if (cmdobj == NULL) {
rtw_mfree(parm, sizeof(*parm));
if (wk_parm)
rtw_mfree(wk_parm, sizeof(*wk_parm));
res = _FAIL; res = _FAIL;
goto exit; goto exit;
} }
pdrvextra_cmd_parm->ec_id = LPS_CTRL_WK_CID; init_h2fwcmd_w_parm_no_rsp(cmdobj, parm, GEN_CMD_CODE(_Set_Drv_Extra));
pdrvextra_cmd_parm->type = lps_ctrl_type;
pdrvextra_cmd_parm->size = 0;
pdrvextra_cmd_parm->pbuf = NULL;
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); if (flags & RTW_CMDF_WAIT_ACK) {
cmdobj->sctx = &sctx;
rtw_sctx_init(&sctx, 2000);
}
res = rtw_enqueue_cmd(pcmdpriv, ph2c); res = rtw_enqueue_cmd(pcmdpriv, cmdobj);
} else
lps_ctrl_wk_hdl(padapter, lps_ctrl_type); if (res == _SUCCESS && (flags & RTW_CMDF_WAIT_ACK)) {
rtw_sctx_wait(&sctx, __func__);
_enter_critical_mutex(&pcmdpriv->sctx_mutex, NULL);
if (sctx.status == RTW_SCTX_SUBMITTED)
cmdobj->sctx = NULL;
_exit_critical_mutex(&pcmdpriv->sctx_mutex, NULL);
if (sctx.status != RTW_SCTX_DONE_SUCCESS)
res = _FAIL;
}
}
exit: exit:
return res; return res;
} }
u8 rtw_lps_ctrl_wk_cmd(_adapter *adapter, u8 lps_ctrl_type, u8 flags)
{
return _rtw_lps_ctrl_wk_cmd(adapter, lps_ctrl_type, -1, -1, flags);
}
u8 rtw_lps_ctrl_leave_set_level_cmd(_adapter *adapter, u8 lps_level, u8 flags)
{
return _rtw_lps_ctrl_wk_cmd(adapter, LPS_CTRL_LEAVE_SET_OPTION, lps_level, -1, flags);
}
#ifdef CONFIG_LPS_1T1R
u8 rtw_lps_ctrl_leave_set_1t1r_cmd(_adapter *adapter, u8 lps_1t1r, u8 flags)
{
return _rtw_lps_ctrl_wk_cmd(adapter, LPS_CTRL_LEAVE_SET_OPTION, -1, lps_1t1r, flags);
}
#endif
void rtw_dm_in_lps_hdl(_adapter *padapter) void rtw_dm_in_lps_hdl(_adapter *padapter)
{ {
rtw_hal_set_hwreg(padapter, HW_VAR_DM_IN_LPS_LCLK, NULL); rtw_hal_set_hwreg(padapter, HW_VAR_DM_IN_LPS_LCLK, NULL);
@ -3942,7 +4032,7 @@ exit:
} }
#ifdef CONFIG_DFS #if CONFIG_DFS
void rtw_dfs_ch_switch_hdl(struct dvobj_priv *dvobj) void rtw_dfs_ch_switch_hdl(struct dvobj_priv *dvobj)
{ {
struct rf_ctl_t *rfctl = dvobj_to_rfctl(dvobj); struct rf_ctl_t *rfctl = dvobj_to_rfctl(dvobj);
@ -4063,7 +4153,7 @@ static void rtw_chk_hi_queue_hdl(_adapter *padapter)
rtw_tim_map_clear(padapter, pstapriv->sta_dz_bitmap, 0); rtw_tim_map_clear(padapter, pstapriv->sta_dz_bitmap, 0);
if (update_tim == _TRUE) if (update_tim == _TRUE)
_update_beacon(padapter, _TIM_IE_, NULL, _TRUE, "bmc sleepq and HIQ empty"); _update_beacon(padapter, _TIM_IE_, NULL, _TRUE, 0,"bmc sleepq and HIQ empty");
} else /* re check again */ } else /* re check again */
rtw_chk_hi_queue_cmd(padapter); rtw_chk_hi_queue_cmd(padapter);
@ -4396,12 +4486,12 @@ void rtw_dfs_rd_en_decision(_adapter *adapter, u8 mlme_act, u8 excl_ifbmp)
} }
if (MSTATE_STA_LD_NUM(&mstate) > 0) { if (MSTATE_STA_LD_NUM(&mstate) > 0) {
if (rtw_is_dfs_chbw(u_ch, u_bw, u_offset)) { if (rtw_chset_is_dfs_chbw(rfctl->channel_set, u_ch, u_bw, u_offset)) {
/* /*
* if operate as slave w/o radar detect, * if operate as slave w/o radar detect,
* rely on AP on which STA mode connects * rely on AP on which STA mode connects
*/ */
if (IS_DFS_SLAVE_WITH_RD(rfctl) && !rtw_odm_dfs_domain_unknown(dvobj)) if (IS_DFS_SLAVE_WITH_RD(rfctl) && !rtw_rfctl_dfs_domain_unknown(rfctl))
needed = _TRUE; needed = _TRUE;
ld_sta_in_dfs = _TRUE; ld_sta_in_dfs = _TRUE;
} }
@ -4413,7 +4503,7 @@ void rtw_dfs_rd_en_decision(_adapter *adapter, u8 mlme_act, u8 excl_ifbmp)
goto apply; goto apply;
} }
if (rtw_is_dfs_chbw(u_ch, u_bw, u_offset)) if (rtw_chset_is_dfs_chbw(rfctl->channel_set, u_ch, u_bw, u_offset))
needed = _TRUE; needed = _TRUE;
apply: apply:
@ -4611,6 +4701,48 @@ u8 rtw_btinfo_cmd(_adapter *adapter, u8 *buf, u16 len)
res = rtw_enqueue_cmd(pcmdpriv, ph2c); res = rtw_enqueue_cmd(pcmdpriv, ph2c);
exit:
return res;
}
static void rtw_btc_reduce_wl_txpwr_hdl(_adapter *adapter, u32 pwr_lvl)
{
rtw_btcoex_set_reduced_wl_pwr_lvl(adapter, pwr_lvl);
rtw_btcoex_do_reduce_wl_pwr_lvl(adapter);
RTW_INFO(FUNC_ADPT_FMT ": BTC reduce WL TxPwr %d dB!\n",
FUNC_ADPT_ARG(adapter), pwr_lvl);
}
u8 rtw_btc_reduce_wl_txpwr_cmd(_adapter *adapter, u32 val)
{
struct cmd_obj *pcmdobj;
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
struct cmd_priv *pcmdpriv = &adapter->cmdpriv;
u8 res = _SUCCESS;
pcmdobj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
if (pcmdobj == NULL) {
res = _FAIL;
goto exit;
}
pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
if (pdrvextra_cmd_parm == NULL) {
rtw_mfree((u8 *)pcmdobj, sizeof(struct cmd_obj));
res = _FAIL;
goto exit;
}
pdrvextra_cmd_parm->ec_id = BTC_REDUCE_WL_TXPWR_CID;
pdrvextra_cmd_parm->type = val;
pdrvextra_cmd_parm->size = 0;
pdrvextra_cmd_parm->pbuf = NULL;
init_h2fwcmd_w_parm_no_rsp(pcmdobj, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
res = rtw_enqueue_cmd(pcmdpriv, pcmdobj);
exit: exit:
return res; return res;
} }
@ -4677,7 +4809,7 @@ static s32 rtw_mp_cmd_hdl(_adapter *padapter, u8 mp_cmd_id)
pHalData->EEPROMBluetoothCoexist = _FALSE; pHalData->EEPROMBluetoothCoexist = _FALSE;
#endif #endif
#ifdef CONFIG_RF_POWER_TRIM #ifdef CONFIG_RF_POWER_TRIM
if (!IS_HARDWARE_TYPE_8814A(padapter) && !IS_HARDWARE_TYPE_8822B(padapter)) { if (!IS_HARDWARE_TYPE_8814A(padapter) && !IS_HARDWARE_TYPE_8822B(padapter) && !IS_HARDWARE_TYPE_8822C(padapter)) {
padapter->registrypriv.RegPwrTrimEnable = 1; padapter->registrypriv.RegPwrTrimEnable = 1;
rtw_hal_read_chip_info(padapter); rtw_hal_read_chip_info(padapter);
} }
@ -4986,40 +5118,62 @@ inline u8 rtw_c2h_packet_wk_cmd(_adapter *adapter, u8 *c2h_evt, u16 length)
} }
#endif #endif
u8 rtw_run_in_thread_cmd(PADAPTER padapter, void (*func)(void *), void *context) static u8 _rtw_run_in_thread_cmd(_adapter *adapter, void (*func)(void *), void *context, s32 timeout_ms)
{ {
struct cmd_priv *pcmdpriv; struct cmd_priv *cmdpriv = &adapter->cmdpriv;
struct cmd_obj *ph2c; struct cmd_obj *cmdobj;
struct RunInThread_param *parm; struct RunInThread_param *parm;
struct submit_ctx sctx;
s32 res = _SUCCESS; s32 res = _SUCCESS;
cmdobj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
pcmdpriv = &padapter->cmdpriv; if (NULL == cmdobj) {
ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
if (NULL == ph2c) {
res = _FAIL; res = _FAIL;
goto exit; goto exit;
} }
parm = (struct RunInThread_param *)rtw_zmalloc(sizeof(struct RunInThread_param)); parm = (struct RunInThread_param *)rtw_zmalloc(sizeof(struct RunInThread_param));
if (NULL == parm) { if (NULL == parm) {
rtw_mfree((u8 *)ph2c, sizeof(struct cmd_obj)); rtw_mfree((u8 *)cmdobj, sizeof(struct cmd_obj));
res = _FAIL; res = _FAIL;
goto exit; goto exit;
} }
parm->func = func; parm->func = func;
parm->context = context; parm->context = context;
init_h2fwcmd_w_parm_no_rsp(ph2c, parm, GEN_CMD_CODE(_RunInThreadCMD)); init_h2fwcmd_w_parm_no_rsp(cmdobj, parm, GEN_CMD_CODE(_RunInThreadCMD));
if (timeout_ms >= 0) {
cmdobj->sctx = &sctx;
rtw_sctx_init(&sctx, timeout_ms);
}
res = rtw_enqueue_cmd(cmdpriv, cmdobj);
if (res == _SUCCESS && timeout_ms >= 0) {
rtw_sctx_wait(&sctx, __func__);
_enter_critical_mutex(&cmdpriv->sctx_mutex, NULL);
if (sctx.status == RTW_SCTX_SUBMITTED)
cmdobj->sctx = NULL;
_exit_critical_mutex(&cmdpriv->sctx_mutex, NULL);
if (sctx.status != RTW_SCTX_DONE_SUCCESS)
res = _FAIL;
}
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
exit: exit:
return res; return res;
} }
u8 rtw_run_in_thread_cmd(_adapter *adapter, void (*func)(void *), void *context)
{
return _rtw_run_in_thread_cmd(adapter, func, context, -1);
}
u8 rtw_run_in_thread_cmd_wait(_adapter *adapter, void (*func)(void *), void *context, s32 timeout_ms)
{
return _rtw_run_in_thread_cmd(adapter, func, context, timeout_ms);
}
#ifdef CONFIG_FW_C2H_REG #ifdef CONFIG_FW_C2H_REG
s32 c2h_evt_hdl(_adapter *adapter, u8 *c2h_evt, c2h_id_filter filter) s32 c2h_evt_hdl(_adapter *adapter, u8 *c2h_evt, c2h_id_filter filter)
{ {
@ -5388,6 +5542,41 @@ exit:
} }
#endif #endif
void rtw_ac_parm_cmd_hdl(_adapter *padapter, u8 *_ac_parm_buf, int ac_type)
{
u32 ac_parm_buf;
_rtw_memcpy(&ac_parm_buf, _ac_parm_buf, sizeof(ac_parm_buf));
switch (ac_type) {
case XMIT_VO_QUEUE:
RTW_INFO(FUNC_NDEV_FMT" AC_VO = 0x%08x\n", FUNC_ADPT_ARG(padapter), (unsigned int) ac_parm_buf);
rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VO, (u8 *)(&ac_parm_buf));
break;
case XMIT_VI_QUEUE:
RTW_INFO(FUNC_NDEV_FMT" AC_VI = 0x%08x\n", FUNC_ADPT_ARG(padapter), (unsigned int) ac_parm_buf);
rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VI, (u8 *)(&ac_parm_buf));
break;
case XMIT_BE_QUEUE:
RTW_INFO(FUNC_NDEV_FMT" AC_BE = 0x%08x\n", FUNC_ADPT_ARG(padapter), (unsigned int) ac_parm_buf);
rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&ac_parm_buf));
break;
case XMIT_BK_QUEUE:
RTW_INFO(FUNC_NDEV_FMT" AC_BK = 0x%08x\n", FUNC_ADPT_ARG(padapter), (unsigned int) ac_parm_buf);
rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&ac_parm_buf));
break;
default:
break;
}
}
u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf) u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf)
{ {
int ret = H2C_SUCCESS; int ret = H2C_SUCCESS;
@ -5411,7 +5600,7 @@ u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf)
break; break;
#ifdef CONFIG_LPS #ifdef CONFIG_LPS
case LPS_CTRL_WK_CID: case LPS_CTRL_WK_CID:
lps_ctrl_wk_hdl(padapter, (u8)pdrvextra_cmd->type); lps_ctrl_wk_hdl(padapter, (u8)pdrvextra_cmd->type, pdrvextra_cmd->pbuf);
break; break;
case DM_IN_LPS_WK_CID: case DM_IN_LPS_WK_CID:
rtw_dm_in_lps_hdl(padapter); rtw_dm_in_lps_hdl(padapter);
@ -5448,11 +5637,6 @@ u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf)
case CHECK_HIQ_WK_CID: case CHECK_HIQ_WK_CID:
rtw_chk_hi_queue_hdl(padapter); rtw_chk_hi_queue_hdl(padapter);
break; break;
#endif
#ifdef CONFIG_INTEL_WIDI
case INTEl_WIDI_WK_CID:
intel_widi_wk_hdl(padapter, pdrvextra_cmd->type, pdrvextra_cmd->pbuf);
break;
#endif #endif
/* add for CONFIG_IEEE80211W, none 11w can use it */ /* add for CONFIG_IEEE80211W, none 11w can use it */
case RESET_SECURITYPRIV: case RESET_SECURITYPRIV:
@ -5491,6 +5675,9 @@ u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf)
case BTINFO_WK_CID: case BTINFO_WK_CID:
rtw_btinfo_hdl(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->size); rtw_btinfo_hdl(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->size);
break; break;
case BTC_REDUCE_WL_TXPWR_CID:
rtw_btc_reduce_wl_txpwr_hdl(padapter, pdrvextra_cmd->type);
break;
#endif #endif
#ifdef CONFIG_DFS_MASTER #ifdef CONFIG_DFS_MASTER
case DFS_RADAR_DETECT_WK_CID: case DFS_RADAR_DETECT_WK_CID:
@ -5535,8 +5722,8 @@ u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf)
break; break;
#endif /* CONFIG_IOCTL_CFG80211 */ #endif /* CONFIG_IOCTL_CFG80211 */
#ifdef CONFIG_MCC_MODE #ifdef CONFIG_MCC_MODE
case MCC_SET_DURATION_WK_CID: case MCC_CMD_WK_CID:
ret = rtw_set_mcc_duration_hdl(padapter, pdrvextra_cmd->type, pdrvextra_cmd->pbuf); ret = rtw_mcc_cmd_hdl(padapter, pdrvextra_cmd->type, pdrvextra_cmd->pbuf);
break; break;
#endif /* CONFIG_MCC_MODE */ #endif /* CONFIG_MCC_MODE */
#if defined(CONFIG_RTW_MESH) && defined(RTW_PER_CMD_SUPPORT_FW) #if defined(CONFIG_RTW_MESH) && defined(RTW_PER_CMD_SUPPORT_FW)
@ -5554,7 +5741,14 @@ u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf)
rtw_ctrl_txss_wk_hdl(padapter, (struct txss_cmd_parm *)pdrvextra_cmd->pbuf); rtw_ctrl_txss_wk_hdl(padapter, (struct txss_cmd_parm *)pdrvextra_cmd->pbuf);
break; break;
#endif #endif
case AC_PARM_CMD_WK_CID:
rtw_ac_parm_cmd_hdl(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type);
break;
#ifdef CONFIG_AP_MODE
case STOP_AP_WK_CID:
stop_ap_hdl(padapter);
break;
#endif
default: default:
break; break;
} }
@ -5746,3 +5940,49 @@ void rtw_getrttbl_cmd_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd)
} }
u8 set_txq_params_cmd(_adapter *adapter, u32 ac_parm, u8 ac_type)
{
struct cmd_obj *cmdobj;
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
struct cmd_priv *pcmdpriv = &adapter->cmdpriv;
u8 *ac_parm_buf = NULL;
u8 sz;
u8 res = _SUCCESS;
cmdobj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
if (cmdobj == NULL) {
res = _FAIL;
goto exit;
}
pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
if (pdrvextra_cmd_parm == NULL) {
rtw_mfree((u8 *)cmdobj, sizeof(struct cmd_obj));
res = _FAIL;
goto exit;
}
sz = sizeof(ac_parm);
ac_parm_buf = rtw_zmalloc(sz);
if (ac_parm_buf == NULL) {
rtw_mfree((u8 *)cmdobj, sizeof(struct cmd_obj));
rtw_mfree((u8 *)pdrvextra_cmd_parm, sizeof(struct drvextra_cmd_parm));
res = _FAIL;
goto exit;
}
pdrvextra_cmd_parm->ec_id = AC_PARM_CMD_WK_CID;
pdrvextra_cmd_parm->type = ac_type;
pdrvextra_cmd_parm->size = sz;
pdrvextra_cmd_parm->pbuf = ac_parm_buf;
_rtw_memcpy(ac_parm_buf, &ac_parm, sz);
init_h2fwcmd_w_parm_no_rsp(cmdobj, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
res = rtw_enqueue_cmd(pcmdpriv, cmdobj);
exit:
return res;
}

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2007 - 2017 Realtek Corporation. * Copyright(c) 2007 - 2019 Realtek Corporation.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -78,6 +78,24 @@ void dump_drv_cfg(void *sel)
#ifdef CONFIG_POWER_SAVING #ifdef CONFIG_POWER_SAVING
RTW_PRINT_SEL(sel, "CONFIG_POWER_SAVING\n"); RTW_PRINT_SEL(sel, "CONFIG_POWER_SAVING\n");
#ifdef CONFIG_IPS
RTW_PRINT_SEL(sel, "CONFIG_IPS\n");
#endif
#ifdef CONFIG_LPS
RTW_PRINT_SEL(sel, "CONFIG_LPS\n");
#ifdef CONFIG_LPS_LCLK
RTW_PRINT_SEL(sel, "CONFIG_LPS_LCLK\n");
#ifdef CONFIG_DETECT_CPWM_BY_POLLING
RTW_PRINT_SEL(sel, "CONFIG_DETECT_CPWM_BY_POLLING\n");
#endif
#endif /*CONFIG_LPS_LCLK*/
#ifdef CONFIG_LPS_CHK_BY_TP
RTW_PRINT_SEL(sel, "CONFIG_LPS_CHK_BY_TP\n");
#endif
#ifdef CONFIG_LPS_ACK
RTW_PRINT_SEL(sel, "CONFIG_LPS_ACK\n");
#endif
#endif/*CONFIG_LPS*/
#endif #endif
#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE #ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
@ -96,7 +114,9 @@ void dump_drv_cfg(void *sel)
#endif #endif
RTW_PRINT_SEL(sel, "RTW_DEF_MODULE_REGULATORY_CERT=0x%02x\n", RTW_DEF_MODULE_REGULATORY_CERT); RTW_PRINT_SEL(sel, "RTW_DEF_MODULE_REGULATORY_CERT=0x%02x\n", RTW_DEF_MODULE_REGULATORY_CERT);
RTW_PRINT_SEL(sel, "CONFIG_TXPWR_BY_RATE=%d\n", CONFIG_TXPWR_BY_RATE);
RTW_PRINT_SEL(sel, "CONFIG_TXPWR_BY_RATE_EN=%d\n", CONFIG_TXPWR_BY_RATE_EN); RTW_PRINT_SEL(sel, "CONFIG_TXPWR_BY_RATE_EN=%d\n", CONFIG_TXPWR_BY_RATE_EN);
RTW_PRINT_SEL(sel, "CONFIG_TXPWR_LIMIT=%d\n", CONFIG_TXPWR_LIMIT);
RTW_PRINT_SEL(sel, "CONFIG_TXPWR_LIMIT_EN=%d\n", CONFIG_TXPWR_LIMIT_EN); RTW_PRINT_SEL(sel, "CONFIG_TXPWR_LIMIT_EN=%d\n", CONFIG_TXPWR_LIMIT_EN);
@ -141,6 +161,8 @@ void dump_drv_cfg(void *sel)
RTW_PRINT_SEL(sel, "CONFIG_RTW_TPT_MODE\n"); RTW_PRINT_SEL(sel, "CONFIG_RTW_TPT_MODE\n");
#endif #endif
RTW_PRINT_SEL(sel, "RTW_VHT_2G4=%d\n", RTW_VHT_2G4);
#ifdef CONFIG_USB_HCI #ifdef CONFIG_USB_HCI
#ifdef CONFIG_SUPPORT_USB_INT #ifdef CONFIG_SUPPORT_USB_INT
RTW_PRINT_SEL(sel, "CONFIG_SUPPORT_USB_INT\n"); RTW_PRINT_SEL(sel, "CONFIG_SUPPORT_USB_INT\n");
@ -175,6 +197,16 @@ void dump_drv_cfg(void *sel)
#ifdef CONFIG_RX_AGGREGATION #ifdef CONFIG_RX_AGGREGATION
RTW_PRINT_SEL(sel, "CONFIG_RX_AGGREGATION\n"); RTW_PRINT_SEL(sel, "CONFIG_RX_AGGREGATION\n");
#endif #endif
#ifdef RTW_XMIT_THREAD_HIGH_PRIORITY
RTW_PRINT_SEL(sel, "RTW_XMIT_THREAD_HIGH_PRIORITY\n");
#endif
#ifdef RTW_XMIT_THREAD_HIGH_PRIORITY_AGG
RTW_PRINT_SEL(sel, "RTW_XMIT_THREAD_HIGH_PRIORITY_AGG\n");
#endif
#ifdef DBG_SDIO
RTW_PRINT_SEL(sel, "DBG_SDIO = %d\n", DBG_SDIO);
#endif
#endif /*CONFIG_SDIO_HCI*/ #endif /*CONFIG_SDIO_HCI*/
#ifdef CONFIG_PCI_HCI #ifdef CONFIG_PCI_HCI
@ -194,6 +226,10 @@ void dump_drv_cfg(void *sel)
#ifdef CONFIG_CLIENT_PORT_CFG #ifdef CONFIG_CLIENT_PORT_CFG
RTW_PRINT_SEL(sel, "CONFIG_CLIENT_PORT_CFG\n"); RTW_PRINT_SEL(sel, "CONFIG_CLIENT_PORT_CFG\n");
#endif #endif
#ifdef CONFIG_PCI_TX_POLLING
RTW_PRINT_SEL(sel, "CONFIG_PCI_TX_POLLING\n");
#endif
RTW_PRINT_SEL(sel, "CONFIG_RTW_UP_MAPPING_RULE = %s\n", (CONFIG_RTW_UP_MAPPING_RULE == 1) ? "dscp" : "tos");
RTW_PRINT_SEL(sel, "\n=== XMIT-INFO ===\n"); RTW_PRINT_SEL(sel, "\n=== XMIT-INFO ===\n");
RTW_PRINT_SEL(sel, "NR_XMITFRAME = %d\n", NR_XMITFRAME); RTW_PRINT_SEL(sel, "NR_XMITFRAME = %d\n", NR_XMITFRAME);
@ -284,8 +320,7 @@ void mac_reg_dump(void *sel, _adapter *adapter)
} }
#endif /* CONFIG_RTL8814A */ #endif /* CONFIG_RTL8814A */
#if defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) ||defined(CONFIG_RTL8192F) || defined(CONFIG_RTL8822C) || defined(CONFIG_RTL8814B)
#if defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) ||defined(CONFIG_RTL8192F)
for (i = 0x1000; i < 0x1800; i += 4) { for (i = 0x1000; i < 0x1800; i += 4) {
if (j % 4 == 1) if (j % 4 == 1)
RTW_PRINT_SEL(sel, "0x%04x", i); RTW_PRINT_SEL(sel, "0x%04x", i);
@ -295,6 +330,24 @@ void mac_reg_dump(void *sel, _adapter *adapter)
} }
#endif /* CONFIG_RTL8822B or 8821c or 8192f*/ #endif /* CONFIG_RTL8822B or 8821c or 8192f*/
#if defined(CONFIG_RTL8814B)
for (i = 0x2000; i < 0x2800; i += 4) {
if (j % 4 == 1)
RTW_PRINT_SEL(sel, "0x%04x", i);
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
if ((j++) % 4 == 0)
_RTW_PRINT_SEL(sel, "\n");
}
for (i = 0x3000; i < 0x3800; i += 4) {
if (j % 4 == 1)
RTW_PRINT_SEL(sel, "0x%04x", i);
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
if ((j++) % 4 == 0)
_RTW_PRINT_SEL(sel, "\n");
}
#endif
} }
void bb_reg_dump(void *sel, _adapter *adapter) void bb_reg_dump(void *sel, _adapter *adapter)
@ -310,7 +363,7 @@ void bb_reg_dump(void *sel, _adapter *adapter)
_RTW_PRINT_SEL(sel, "\n"); _RTW_PRINT_SEL(sel, "\n");
} }
#if defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) #if defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8822C) || defined(CONFIG_RTL8814B)
for (i = 0x1800; i < 0x2000; i += 4) { for (i = 0x1800; i < 0x2000; i += 4) {
if (j % 4 == 1) if (j % 4 == 1)
RTW_PRINT_SEL(sel, "0x%04x", i); RTW_PRINT_SEL(sel, "0x%04x", i);
@ -319,6 +372,51 @@ void bb_reg_dump(void *sel, _adapter *adapter)
_RTW_PRINT_SEL(sel, "\n"); _RTW_PRINT_SEL(sel, "\n");
} }
#endif /* CONFIG_RTL8822B */ #endif /* CONFIG_RTL8822B */
#if defined(CONFIG_RTL8822C) || defined(CONFIG_RTL8814B)
for (i = 0x2c00; i < 0x2c60; i += 4) {
if (j % 4 == 1)
RTW_PRINT_SEL(sel, "0x%04x", i);
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
if ((j++) % 4 == 0)
_RTW_PRINT_SEL(sel, "\n");
}
for (i = 0x2d00; i < 0x2df0; i += 4) {
if (j % 4 == 1)
RTW_PRINT_SEL(sel, "0x%04x", i);
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
if ((j++) % 4 == 0)
_RTW_PRINT_SEL(sel, "\n");
}
for (i = 0x4000; i < 0x4060; i += 4) {
if (j % 4 == 1)
RTW_PRINT_SEL(sel, "0x%04x", i);
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
if ((j++) % 4 == 0)
_RTW_PRINT_SEL(sel, "\n");
}
for (i = 0x4100; i < 0x4200; i += 4) {
if (j % 4 == 1)
RTW_PRINT_SEL(sel, "0x%04x", i);
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
if ((j++) % 4 == 0)
_RTW_PRINT_SEL(sel, "\n");
}
#endif /* CONFIG_RTL8822C || CONFIG_RTL8814B */
#if defined(CONFIG_RTL8814B)
for (i = 0x5200; i < 0x5400; i += 4) {
if (j % 4 == 1)
RTW_PRINT_SEL(sel, "0x%04x", i);
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
if ((j++) % 4 == 0)
_RTW_PRINT_SEL(sel, "\n");
}
#endif /* CONFIG_RTL8814B */
} }
void bb_reg_dump_ex(void *sel, _adapter *adapter) void bb_reg_dump_ex(void *sel, _adapter *adapter)
@ -332,7 +430,7 @@ void bb_reg_dump_ex(void *sel, _adapter *adapter)
_RTW_PRINT_SEL(sel, "\n"); _RTW_PRINT_SEL(sel, "\n");
} }
#if defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) #if defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8822C) || defined(CONFIG_RTL8814B)
for (i = 0x1800; i < 0x2000; i += 4) { for (i = 0x1800; i < 0x2000; i += 4) {
RTW_PRINT_SEL(sel, "0x%04x", i); RTW_PRINT_SEL(sel, "0x%04x", i);
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i)); _RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
@ -345,14 +443,7 @@ void rf_reg_dump(void *sel, _adapter *adapter)
{ {
int i, j = 1, path; int i, j = 1, path;
u32 value; u32 value;
u8 rf_type = 0; u8 path_nums = GET_HAL_RFPATH_NUM(adapter);
u8 path_nums = 0;
rtw_hal_get_hwreg(adapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
if ((RF_1T2R == rf_type) || (RF_1T1R == rf_type))
path_nums = 1;
else
path_nums = 2;
RTW_PRINT_SEL(sel, "======= RF REG =======\n"); RTW_PRINT_SEL(sel, "======= RF REG =======\n");
@ -376,9 +467,16 @@ void rtw_sink_rtp_seq_dbg(_adapter *adapter, u8 *ehdr_pos)
if (*((u16 *)(ehdr_pos + 0x24)) == cpu_to_be16(precvpriv->sink_udpport)) { if (*((u16 *)(ehdr_pos + 0x24)) == cpu_to_be16(precvpriv->sink_udpport)) {
precvpriv->pre_rtp_rxseq = precvpriv->cur_rtp_rxseq; precvpriv->pre_rtp_rxseq = precvpriv->cur_rtp_rxseq;
precvpriv->cur_rtp_rxseq = be16_to_cpu(*((u16 *)(ehdr_pos + 0x2C))); precvpriv->cur_rtp_rxseq = be16_to_cpu(*((u16 *)(ehdr_pos + 0x2C)));
if (precvpriv->pre_rtp_rxseq + 1 != precvpriv->cur_rtp_rxseq) if (precvpriv->pre_rtp_rxseq + 1 != precvpriv->cur_rtp_rxseq) {
if(precvpriv->pre_rtp_rxseq == 65535 ) {
if( precvpriv->cur_rtp_rxseq != 0) {
RTW_INFO("%s : RTP Seq num from %d to %d\n", __FUNCTION__, precvpriv->pre_rtp_rxseq, precvpriv->cur_rtp_rxseq); RTW_INFO("%s : RTP Seq num from %d to %d\n", __FUNCTION__, precvpriv->pre_rtp_rxseq, precvpriv->cur_rtp_rxseq);
} }
} else {
RTW_INFO("%s : RTP Seq num from %d to %d\n", __FUNCTION__, precvpriv->pre_rtp_rxseq, precvpriv->cur_rtp_rxseq);
}
}
}
} }
} }
@ -405,7 +503,7 @@ void dump_tx_rate_bmp(void *sel, struct dvobj_priv *dvobj)
RTW_PRINT_SEL(sel, "%-6s", "bw"); RTW_PRINT_SEL(sel, "%-6s", "bw");
if (hal_chk_proto_cap(adapter, PROTO_CAP_11AC)) if (hal_chk_proto_cap(adapter, PROTO_CAP_11AC))
_RTW_PRINT_SEL(sel, " %-11s", "vht"); _RTW_PRINT_SEL(sel, " %-15s", "vht");
_RTW_PRINT_SEL(sel, " %-11s %-4s %-3s\n", "ht", "ofdm", "cck"); _RTW_PRINT_SEL(sel, " %-11s %-4s %-3s\n", "ht", "ofdm", "cck");
@ -415,7 +513,8 @@ void dump_tx_rate_bmp(void *sel, struct dvobj_priv *dvobj)
RTW_PRINT_SEL(sel, "%6s", ch_width_str(bw)); RTW_PRINT_SEL(sel, "%6s", ch_width_str(bw));
if (hal_chk_proto_cap(adapter, PROTO_CAP_11AC)) { if (hal_chk_proto_cap(adapter, PROTO_CAP_11AC)) {
_RTW_PRINT_SEL(sel, " %03x %03x %03x" _RTW_PRINT_SEL(sel, " %03x %03x %03x %03x"
, RATE_BMP_GET_VHT_4SS(rfctl->rate_bmp_vht_by_bw[bw])
, RATE_BMP_GET_VHT_3SS(rfctl->rate_bmp_vht_by_bw[bw]) , RATE_BMP_GET_VHT_3SS(rfctl->rate_bmp_vht_by_bw[bw])
, RATE_BMP_GET_VHT_2SS(rfctl->rate_bmp_vht_by_bw[bw]) , RATE_BMP_GET_VHT_2SS(rfctl->rate_bmp_vht_by_bw[bw])
, RATE_BMP_GET_VHT_1SS(rfctl->rate_bmp_vht_by_bw[bw]) , RATE_BMP_GET_VHT_1SS(rfctl->rate_bmp_vht_by_bw[bw])
@ -593,11 +692,10 @@ void dump_adapters_status(void *sel, struct dvobj_priv *dvobj)
P2P_INFO_DASH P2P_INFO_DASH
"-------\n"); "-------\n");
rtw_mi_get_ch_setting_union(dvobj_get_primary_adapter(dvobj), &u_ch, &u_bw, &u_offset); if (rtw_mi_get_ch_setting_union(dvobj_get_primary_adapter(dvobj), &u_ch, &u_bw, &u_offset))
RTW_PRINT_SEL(sel, "%55s %3u,%u,%u\n" RTW_PRINT_SEL(sel, "%55s %3u,%u,%u\n"
, "union:" , "union:"
, u_ch, u_bw, u_offset , u_ch, u_bw, u_offset);
);
RTW_PRINT_SEL(sel, "%55s %3u,%u,%u offch_state:%d\n" RTW_PRINT_SEL(sel, "%55s %3u,%u,%u offch_state:%d\n"
, "oper:" , "oper:"
@ -621,7 +719,7 @@ void dump_adapters_status(void *sel, struct dvobj_priv *dvobj)
else { else {
u32 non_ocp_ms; u32 non_ocp_ms;
u32 cac_ms; u32 cac_ms;
u8 dfs_domain = rtw_odm_get_dfs_domain(dvobj); u8 dfs_domain = rtw_rfctl_get_dfs_domain(rfctl);
_RTW_PRINT_SEL(sel, ", domain:%u", dfs_domain); _RTW_PRINT_SEL(sel, ", domain:%u", dfs_domain);
@ -639,7 +737,6 @@ void dump_adapters_status(void *sel, struct dvobj_priv *dvobj)
_RTW_PRINT_SEL(sel, ", cac:%d", cac_ms); _RTW_PRINT_SEL(sel, ", cac:%d", cac_ms);
} }
end_dfs_master:
_RTW_PRINT_SEL(sel, "\n"); _RTW_PRINT_SEL(sel, "\n");
} }
#endif /* CONFIG_DFS_MASTER */ #endif /* CONFIG_DFS_MASTER */
@ -711,6 +808,82 @@ void dump_sec_cam_cache(void *sel, _adapter *adapter)
} }
static u8 fwdl_test_chksum_fail = 0;
static u8 fwdl_test_wintint_rdy_fail = 0;
bool rtw_fwdl_test_trigger_chksum_fail(void)
{
if (fwdl_test_chksum_fail) {
RTW_PRINT("fwdl test case: trigger chksum_fail\n");
fwdl_test_chksum_fail--;
return _TRUE;
}
return _FALSE;
}
bool rtw_fwdl_test_trigger_wintint_rdy_fail(void)
{
if (fwdl_test_wintint_rdy_fail) {
RTW_PRINT("fwdl test case: trigger wintint_rdy_fail\n");
fwdl_test_wintint_rdy_fail--;
return _TRUE;
}
return _FALSE;
}
static u8 del_rx_ampdu_test_no_tx_fail = 0;
bool rtw_del_rx_ampdu_test_trigger_no_tx_fail(void)
{
if (del_rx_ampdu_test_no_tx_fail) {
RTW_PRINT("del_rx_ampdu test case: trigger no_tx_fail\n");
del_rx_ampdu_test_no_tx_fail--;
return _TRUE;
}
return _FALSE;
}
static u32 g_wait_hiq_empty_ms = 0;
u32 rtw_get_wait_hiq_empty_ms(void)
{
return g_wait_hiq_empty_ms;
}
static systime sta_linking_test_start_time = 0;
static u32 sta_linking_test_wait_ms = 0;
static u8 sta_linking_test_force_fail = 0;
void rtw_sta_linking_test_set_start(void)
{
sta_linking_test_start_time = rtw_get_current_time();
}
bool rtw_sta_linking_test_wait_done(void)
{
return rtw_get_passing_time_ms(sta_linking_test_start_time) >= sta_linking_test_wait_ms;
}
bool rtw_sta_linking_test_force_fail(void)
{
return sta_linking_test_force_fail;
}
#ifdef CONFIG_AP_MODE
static u16 ap_linking_test_force_auth_fail = 0;
static u16 ap_linking_test_force_asoc_fail = 0;
u16 rtw_ap_linking_test_force_auth_fail(void)
{
return ap_linking_test_force_auth_fail;
}
u16 rtw_ap_linking_test_force_asoc_fail(void)
{
return ap_linking_test_force_asoc_fail;
}
#endif
#ifdef CONFIG_PROC_DEBUG #ifdef CONFIG_PROC_DEBUG
ssize_t proc_set_write_reg(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) ssize_t proc_set_write_reg(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
{ {
@ -1480,9 +1653,28 @@ ssize_t proc_set_survey_info(struct file *file, const char __user *buffer, size_
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev); _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
u8 _status = _FALSE; u8 _status = _FALSE;
u8 ssc_chk; u8 ssc_chk;
char tmp[32] = {0};
char cmd[8] = {0};
bool acs = 0;
if (count < 1) if (count < 1)
return -EFAULT; return -EFAULT;
if (count > sizeof(tmp)) {
rtw_warn_on(1);
return -EFAULT;
}
if (buffer && !copy_from_user(tmp, buffer, count)) {
int num = sscanf(tmp, "%s", cmd);
if (num < 1)
return count;
if (strcmp("acs", cmd) == 0)
acs = 1;
}
#if 1 #if 1
ssc_chk = rtw_sitesurvey_condition_check(padapter, _FALSE); ssc_chk = rtw_sitesurvey_condition_check(padapter, _FALSE);
if (ssc_chk != SS_ALLOW) if (ssc_chk != SS_ALLOW)
@ -1538,6 +1730,12 @@ ssize_t proc_set_survey_info(struct file *file, const char __user *buffer, size_
} }
#endif #endif
#endif #endif
if (acs) {
#ifdef CONFIG_RTW_ACS
_status = rtw_set_acs_sitesurvey(padapter);
#endif
} else
_status = rtw_set_802_11_bssid_list_scan(padapter, NULL); _status = rtw_set_802_11_bssid_list_scan(padapter, NULL);
cancel_ps_deny: cancel_ps_deny:
@ -1608,6 +1806,26 @@ int proc_get_infra_ap(struct seq_file *m, void *v)
#endif /* ROKU_PRIVATE */ #endif /* ROKU_PRIVATE */
static int wireless_mode_to_str(u32 mode, char *str)
{
str[0]='\0';
if (mode&WIRELESS_11A)
sprintf(str+strlen(str),"%s","A/");
if (mode&WIRELESS_11B)
sprintf(str+strlen(str),"%s","B/");
if (mode&WIRELESS_11G)
sprintf(str+strlen(str),"%s","G/");
if (mode&(WIRELESS_11_24N|WIRELESS_11_5N))
sprintf(str+strlen(str),"%s","N/");
if (mode&WIRELESS_11AC)
sprintf(str+strlen(str),"%s","AC/");
if (strlen(str)>1)
str[strlen(str)-1]='\0';
return strlen(str);
}
int proc_get_ap_info(struct seq_file *m, void *v) int proc_get_ap_info(struct seq_file *m, void *v)
{ {
struct net_device *dev = m->private; struct net_device *dev = m->private;
@ -1618,6 +1836,7 @@ int proc_get_ap_info(struct seq_file *m, void *v)
struct wlan_network *cur_network = &(pmlmepriv->cur_network); struct wlan_network *cur_network = &(pmlmepriv->cur_network);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
char wl_mode[16];
/* ap vendor */ /* ap vendor */
char vendor[VENDOR_NAME_LEN] = {0}; char vendor[VENDOR_NAME_LEN] = {0};
@ -1626,10 +1845,11 @@ int proc_get_ap_info(struct seq_file *m, void *v)
psta = rtw_get_stainfo(pstapriv, cur_network->network.MacAddress); psta = rtw_get_stainfo(pstapriv, cur_network->network.MacAddress);
if (psta) { if (psta) {
wireless_mode_to_str(psta->wireless_mode, wl_mode);
RTW_PRINT_SEL(m, "SSID=%s\n", cur_network->network.Ssid.Ssid); RTW_PRINT_SEL(m, "SSID=%s\n", cur_network->network.Ssid.Ssid);
RTW_PRINT_SEL(m, "sta's macaddr:" MAC_FMT "\n", MAC_ARG(psta->cmn.mac_addr)); RTW_PRINT_SEL(m, "sta's macaddr:" MAC_FMT "\n", MAC_ARG(psta->cmn.mac_addr));
RTW_PRINT_SEL(m, "cur_channel=%d, cur_bwmode=%d, cur_ch_offset=%d\n", pmlmeext->cur_channel, pmlmeext->cur_bwmode, pmlmeext->cur_ch_offset); RTW_PRINT_SEL(m, "cur_channel=%d, cur_bwmode=%d(%s), cur_ch_offset=%d\n", pmlmeext->cur_channel, pmlmeext->cur_bwmode, ch_width_str(pmlmeext->cur_bwmode), pmlmeext->cur_ch_offset);
RTW_PRINT_SEL(m, "wireless_mode=0x%x, rtsen=%d, cts2slef=%d\n", psta->wireless_mode, psta->rtsen, psta->cts2self); RTW_PRINT_SEL(m, "wireless_mode=0x%x(%s), rtsen=%d, cts2slef=%d\n", psta->wireless_mode, wl_mode, psta->rtsen, psta->cts2self);
RTW_PRINT_SEL(m, "state=0x%x, aid=%d, macid=%d, raid=%d\n", RTW_PRINT_SEL(m, "state=0x%x, aid=%d, macid=%d, raid=%d\n",
psta->state, psta->cmn.aid, psta->cmn.mac_id, psta->cmn.ra_info.rate_id); psta->state, psta->cmn.aid, psta->cmn.mac_id, psta->cmn.ra_info.rate_id);
#ifdef CONFIG_80211N_HT #ifdef CONFIG_80211N_HT
@ -1845,7 +2065,7 @@ ssize_t proc_set_rate_ctl(struct file *file, const char __user *buffer, size_t c
hal_data->ForcedDataRate = hw_rate_to_m_rate(fix_rate & 0x7F); hal_data->ForcedDataRate = hw_rate_to_m_rate(fix_rate & 0x7F);
if (adapter->fix_bw != 0xFF && fix_rate_ori != fix_rate) if (adapter->fix_bw != 0xFF && fix_rate_ori != fix_rate)
rtw_update_tx_rate_bmp(adapter_to_dvobj(adapter)); rtw_run_in_thread_cmd(adapter, ((void *)(rtw_update_tx_rate_bmp)), adapter_to_dvobj(adapter));
} }
if (num >= 2) if (num >= 2)
adapter->data_fb = data_fb ? 1 : 0; adapter->data_fb = data_fb ? 1 : 0;
@ -1977,7 +2197,7 @@ ssize_t proc_set_bw_ctl(struct file *file, const char __user *buffer, size_t cou
adapter->fix_bw = fix_bw; adapter->fix_bw = fix_bw;
if (adapter->fix_rate != 0xFF && fix_bw_ori != fix_bw) if (adapter->fix_rate != 0xFF && fix_bw_ori != fix_bw)
rtw_update_tx_rate_bmp(adapter_to_dvobj(adapter)); rtw_run_in_thread_cmd(adapter, ((void *)(rtw_update_tx_rate_bmp)), adapter_to_dvobj(adapter));
} }
} }
@ -2028,29 +2248,6 @@ ssize_t proc_set_rx_cnt_dump(struct file *file, const char __user *buffer, size_
} }
#endif #endif
static u8 fwdl_test_chksum_fail = 0;
static u8 fwdl_test_wintint_rdy_fail = 0;
bool rtw_fwdl_test_trigger_chksum_fail(void)
{
if (fwdl_test_chksum_fail) {
RTW_PRINT("fwdl test case: trigger chksum_fail\n");
fwdl_test_chksum_fail--;
return _TRUE;
}
return _FALSE;
}
bool rtw_fwdl_test_trigger_wintint_rdy_fail(void)
{
if (fwdl_test_wintint_rdy_fail) {
RTW_PRINT("fwdl test case: trigger wintint_rdy_fail\n");
fwdl_test_wintint_rdy_fail--;
return _TRUE;
}
return _FALSE;
}
ssize_t proc_set_fwdl_test_case(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) ssize_t proc_set_fwdl_test_case(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
{ {
char tmp[32]; char tmp[32];
@ -2069,18 +2266,6 @@ ssize_t proc_set_fwdl_test_case(struct file *file, const char __user *buffer, si
return count; return count;
} }
static u8 del_rx_ampdu_test_no_tx_fail = 0;
bool rtw_del_rx_ampdu_test_trigger_no_tx_fail(void)
{
if (del_rx_ampdu_test_no_tx_fail) {
RTW_PRINT("del_rx_ampdu test case: trigger no_tx_fail\n");
del_rx_ampdu_test_no_tx_fail--;
return _TRUE;
}
return _FALSE;
}
ssize_t proc_set_del_rx_ampdu_test_case(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) ssize_t proc_set_del_rx_ampdu_test_case(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
{ {
char tmp[32]; char tmp[32];
@ -2099,13 +2284,6 @@ ssize_t proc_set_del_rx_ampdu_test_case(struct file *file, const char __user *bu
return count; return count;
} }
static u32 g_wait_hiq_empty_ms = 0;
u32 rtw_get_wait_hiq_empty_ms(void)
{
return g_wait_hiq_empty_ms;
}
ssize_t proc_set_wait_hiq_empty(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) ssize_t proc_set_wait_hiq_empty(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
{ {
char tmp[32]; char tmp[32];
@ -2124,25 +2302,6 @@ ssize_t proc_set_wait_hiq_empty(struct file *file, const char __user *buffer, si
return count; return count;
} }
static systime sta_linking_test_start_time = 0;
static u32 sta_linking_test_wait_ms = 0;
static u8 sta_linking_test_force_fail = 0;
void rtw_sta_linking_test_set_start(void)
{
sta_linking_test_start_time = rtw_get_current_time();
}
bool rtw_sta_linking_test_wait_done(void)
{
return rtw_get_passing_time_ms(sta_linking_test_start_time) >= sta_linking_test_wait_ms;
}
bool rtw_sta_linking_test_force_fail(void)
{
return sta_linking_test_force_fail;
}
ssize_t proc_set_sta_linking_test(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) ssize_t proc_set_sta_linking_test(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
{ {
char tmp[32]; char tmp[32];
@ -2170,19 +2329,6 @@ ssize_t proc_set_sta_linking_test(struct file *file, const char __user *buffer,
} }
#ifdef CONFIG_AP_MODE #ifdef CONFIG_AP_MODE
static u16 ap_linking_test_force_auth_fail = 0;
static u16 ap_linking_test_force_asoc_fail = 0;
u16 rtw_ap_linking_test_force_auth_fail(void)
{
return ap_linking_test_force_auth_fail;
}
u16 rtw_ap_linking_test_force_asoc_fail(void)
{
return ap_linking_test_force_asoc_fail;
}
ssize_t proc_set_ap_linking_test(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) ssize_t proc_set_ap_linking_test(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
{ {
char tmp[32]; char tmp[32];
@ -2754,13 +2900,14 @@ ssize_t proc_set_rx_signal(struct file *file, const char __user *buffer, size_t
int proc_get_mac_rptbuf(struct seq_file *m, void *v) int proc_get_mac_rptbuf(struct seq_file *m, void *v)
{ {
#ifdef CONFIG_RTL8814A
struct net_device *dev = m->private; struct net_device *dev = m->private;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev); _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
u16 i; u16 i;
u16 mac_id; u16 mac_id;
u32 shcut_addr = 0; u32 shcut_addr = 0;
u32 read_addr = 0; u32 read_addr = 0;
#ifdef CONFIG_RTL8814A
RTW_PRINT_SEL(m, "TX ShortCut:\n"); RTW_PRINT_SEL(m, "TX ShortCut:\n");
for (mac_id = 0; mac_id < 64; mac_id++) { for (mac_id = 0; mac_id < 64; mac_id++) {
rtw_write16(padapter, 0x140, 0x662 | ((mac_id & BIT5) >> 5)); rtw_write16(padapter, 0x140, 0x662 | ((mac_id & BIT5) >> 5));
@ -3751,12 +3898,14 @@ int proc_get_all_sta_info(struct seq_file *m, void *v)
#ifdef CONFIG_PREALLOC_RX_SKB_BUFFER #ifdef CONFIG_PREALLOC_RX_SKB_BUFFER
int proc_get_rtkm_info(struct seq_file *m, void *v) int proc_get_rtkm_info(struct seq_file *m, void *v)
{ {
#ifdef CONFIG_USB_HCI
struct net_device *dev = m->private; struct net_device *dev = m->private;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev); _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
struct recv_priv *precvpriv = &padapter->recvpriv; struct recv_priv *precvpriv = &padapter->recvpriv;
struct recv_buf *precvbuf; struct recv_buf *precvbuf;
precvbuf = (struct recv_buf *)precvpriv->precv_buf; precvbuf = (struct recv_buf *)precvpriv->precv_buf;
#endif /* CONFIG_USB_HCI */
RTW_PRINT_SEL(m, "============[RTKM Info]============\n"); RTW_PRINT_SEL(m, "============[RTKM Info]============\n");
RTW_PRINT_SEL(m, "MAX_RTKM_NR_PREALLOC_RECV_SKB: %d\n", rtw_rtkm_get_nr_recv_skb()); RTW_PRINT_SEL(m, "MAX_RTKM_NR_PREALLOC_RECV_SKB: %d\n", rtw_rtkm_get_nr_recv_skb());
@ -3764,7 +3913,11 @@ int proc_get_rtkm_info(struct seq_file *m, void *v)
RTW_PRINT_SEL(m, "============[Driver Info]============\n"); RTW_PRINT_SEL(m, "============[Driver Info]============\n");
RTW_PRINT_SEL(m, "NR_PREALLOC_RECV_SKB: %d\n", NR_PREALLOC_RECV_SKB); RTW_PRINT_SEL(m, "NR_PREALLOC_RECV_SKB: %d\n", NR_PREALLOC_RECV_SKB);
#ifdef CONFIG_USB_HCI
RTW_PRINT_SEL(m, "MAX_RECVBUF_SZ: %d\n", precvbuf->alloc_sz); RTW_PRINT_SEL(m, "MAX_RECVBUF_SZ: %d\n", precvbuf->alloc_sz);
#else /* !CONFIG_USB_HCI */
RTW_PRINT_SEL(m, "MAX_RECVBUF_SZ: %d\n", MAX_RECVBUF_SZ);
#endif /* !CONFIG_USB_HCI */
return 0; return 0;
} }
@ -3944,7 +4097,7 @@ int proc_get_btcoex_info(struct seq_file *m, void *v)
{ {
struct net_device *dev = m->private; struct net_device *dev = m->private;
PADAPTER padapter; PADAPTER padapter;
const u32 bufsize = 30 * 100; const u32 bufsize = 40 * 100;
u8 *pbuf = NULL; u8 *pbuf = NULL;
padapter = (PADAPTER)rtw_netdev_priv(dev); padapter = (PADAPTER)rtw_netdev_priv(dev);
@ -4281,6 +4434,12 @@ int proc_get_pci_aspm(struct seq_file *m, void *v)
RTW_PRINT_SEL(m, "ASPM L1 Idel Time: 0x%x\n", l1_idle>>3); RTW_PRINT_SEL(m, "ASPM L1 Idel Time: 0x%x\n", l1_idle>>3);
RTW_PRINT_SEL(m, "*************************\n"); RTW_PRINT_SEL(m, "*************************\n");
#ifdef CONFIG_PCI_DYNAMIC_ASPM
RTW_PRINT_SEL(m, "Dynamic ASPM mode: %d (%s)\n", pcipriv->aspm_mode,
pcipriv->aspm_mode == ASPM_MODE_PERF ? "Perf" :
pcipriv->aspm_mode == ASPM_MODE_PS ? "PS" : "Und");
#endif
return 0; return 0;
} }
@ -4523,8 +4682,7 @@ int proc_get_pattern_info(struct seq_file *m, void *v)
struct net_device *dev = m->private; struct net_device *dev = m->private;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev); _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
struct registry_priv *pregistrypriv = &padapter->registrypriv; u8 val8;
u8 pattern_num = 0, val8;
char str_1[128]; char str_1[128];
char *p_str; char *p_str;
int i = 0 , j = 0, k = 0; int i = 0 , j = 0, k = 0;
@ -4586,8 +4744,8 @@ ssize_t proc_set_pattern_info(struct file *file, const char __user *buffer,
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev); _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
struct wowlan_ioctl_param poidparam; struct wowlan_ioctl_param poidparam;
u8 tmp[MAX_WKFM_PATTERN_SIZE] = {0}; u8 tmp[MAX_WKFM_PATTERN_STR_LEN + 1] = {0};
int ret = 0, num = 0; int ret = 0;
u8 index = 0; u8 index = 0;
poidparam.subcode = 0; poidparam.subcode = 0;
@ -4595,15 +4753,16 @@ ssize_t proc_set_pattern_info(struct file *file, const char __user *buffer,
if (count < 1) if (count < 1)
return -EFAULT; return -EFAULT;
if (count > sizeof(tmp)) { if (count >= sizeof(tmp)) {
rtw_warn_on(1); RTW_ERR("%s: pattern string is too long, count=%zu\n",
__func__, count);
return -EFAULT; return -EFAULT;
} }
if (pwrpriv->wowlan_pattern_idx >= MAX_WKFM_CAM_NUM) { if (pwrpriv->wowlan_pattern_idx >= MAX_WKFM_CAM_NUM) {
RTW_INFO("WARNING: priv-pattern is full(idx: %d)\n", RTW_ERR("priv-pattern is full(idx: %d)\n",
pwrpriv->wowlan_pattern_idx); pwrpriv->wowlan_pattern_idx);
RTW_INFO("WARNING: please clean priv-pattern first\n"); RTW_ERR("please clean priv-pattern first\n");
return -ENOMEM; return -ENOMEM;
} }
@ -4621,6 +4780,9 @@ ssize_t proc_set_pattern_info(struct file *file, const char __user *buffer,
if (ret == _TRUE) if (ret == _TRUE)
pwrpriv->wowlan_pattern_idx++; pwrpriv->wowlan_pattern_idx++;
} }
} else {
rtw_warn_on(1);
return -EFAULT;
} }
return count; return count;
@ -4646,8 +4808,7 @@ ssize_t proc_set_wakeup_event(struct file *file, const char __user *buffer,
u32 wakeup_event = 0; u32 wakeup_event = 0;
u8 tmp[8] = {0}; u8 tmp[8] = {0};
int ret = 0, num = 0; int num = 0;
u8 index = 0;
if (count < 1) if (count < 1)
return -EFAULT; return -EFAULT;
@ -4833,6 +4994,16 @@ int proc_get_ps_info(struct seq_file *m, void *v)
u8 ips_mode = pwrpriv->ips_mode_req; u8 ips_mode = pwrpriv->ips_mode_req;
u8 lps_mode = pwrpriv->power_mgnt; u8 lps_mode = pwrpriv->power_mgnt;
u8 lps_level = pwrpriv->lps_level; u8 lps_level = pwrpriv->lps_level;
#ifdef CONFIG_LPS_1T1R
u8 lps_1t1r = pwrpriv->lps_1t1r;
#endif
#ifdef CONFIG_WOWLAN
u8 wow_lps_mode = pwrpriv->wowlan_power_mgmt;
u8 wow_lps_level = pwrpriv->wowlan_lps_level;
#ifdef CONFIG_LPS_1T1R
u8 wow_lps_1t1r = pwrpriv->wowlan_lps_1t1r;
#endif
#endif /* CONFIG_WOWLAN */
char *str = ""; char *str = "";
RTW_PRINT_SEL(m, "======Power Saving Info:======\n"); RTW_PRINT_SEL(m, "======Power Saving Info:======\n");
@ -4883,6 +5054,40 @@ int proc_get_ps_info(struct seq_file *m, void *v)
str = "LPS_NORMAL"; str = "LPS_NORMAL";
RTW_PRINT_SEL(m, " LPS level: %s\n", str); RTW_PRINT_SEL(m, " LPS level: %s\n", str);
#ifdef CONFIG_LPS_1T1R
RTW_PRINT_SEL(m, " LPS 1T1R: %d\n", lps_1t1r);
#endif
#ifdef CONFIG_WOWLAN
RTW_PRINT_SEL(m, "------------------------------\n");
RTW_PRINT_SEL(m, "*WOW LPS:\n");
if (wow_lps_mode == PS_MODE_ACTIVE)
str = "NO LPS";
else if (wow_lps_mode == PS_MODE_MIN)
str = "MIN";
else if (wow_lps_mode == PS_MODE_MAX)
str = "MAX";
else if (wow_lps_mode == PS_MODE_DTIM)
str = "DTIM";
else
sprintf(str, "%d", wow_lps_mode);
RTW_PRINT_SEL(m, " WOW LPS mode: %s\n", str);
if (wow_lps_level == LPS_LCLK)
str = "LPS_LCLK";
else if (wow_lps_level == LPS_PG)
str = "LPS_PG";
else
str = "LPS_NORMAL";
RTW_PRINT_SEL(m, " WOW LPS level: %s\n", str);
#ifdef CONFIG_LPS_1T1R
RTW_PRINT_SEL(m, " WOW LPS 1T1R: %d\n", wow_lps_1t1r);
#endif
#endif /* CONFIG_WOWLAN */
RTW_PRINT_SEL(m, "=============================\n"); RTW_PRINT_SEL(m, "=============================\n");
return 0; return 0;
} }
@ -4891,7 +5096,6 @@ ssize_t proc_set_ps_info(struct file *file, const char __user *buffer, size_t co
{ {
struct net_device *dev = data; struct net_device *dev = data;
struct _ADAPTER *adapter = (_adapter *)rtw_netdev_priv(dev); struct _ADAPTER *adapter = (_adapter *)rtw_netdev_priv(dev);
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
char tmp[8]; char tmp[8];
int num = 0; int num = 0;
int mode = 0; int mode = 0;
@ -4919,6 +5123,12 @@ ssize_t proc_set_ps_info(struct file *file, const char __user *buffer, size_t co
rtw_pm_set_ips(adapter, adapter->registrypriv.ips_mode); rtw_pm_set_ips(adapter, adapter->registrypriv.ips_mode);
#ifdef CONFIG_WOWLAN
RTW_INFO("%s: back to original WOW LPS Mode\n", __FUNCTION__);
rtw_pm_set_wow_lps(adapter, adapter->registrypriv.wow_power_mgnt);
#endif /* CONFIG_WOWLAN */
goto exit; goto exit;
} }
@ -4933,7 +5143,16 @@ ssize_t proc_set_ps_info(struct file *file, const char __user *buffer, size_t co
RTW_INFO("%s: IPS: %s, en=%d\n", __FUNCTION__, (en == 0) ? "disable":"enable", en); RTW_INFO("%s: IPS: %s, en=%d\n", __FUNCTION__, (en == 0) ? "disable":"enable", en);
if (rtw_pm_set_ips(adapter, en) != 0 ) if (rtw_pm_set_ips(adapter, en) != 0 )
RTW_ERR("%s: invalid parameter, mode=%d, level=%d\n", __FUNCTION__, mode, en); RTW_ERR("%s: invalid parameter, mode=%d, level=%d\n", __FUNCTION__, mode, en);
} else }
#ifdef CONFIG_WOWLAN
else if (mode == 3) {
/* WOW LPS */
RTW_INFO("%s: WOW LPS: %s, en=%d\n", __FUNCTION__, (en == 0) ? "disable":"enable", en);
if (rtw_pm_set_wow_lps(adapter, en) != 0 )
RTW_ERR("%s: invalid parameter, mode=%d, level=%d\n", __FUNCTION__, mode, en);
}
#endif /* CONFIG_WOWLAN */
else
RTW_ERR("%s: invalid parameter, mode = %d!\n", __FUNCTION__, mode); RTW_ERR("%s: invalid parameter, mode = %d!\n", __FUNCTION__, mode);
exit: exit:
@ -6029,7 +6248,7 @@ ssize_t proc_set_mcc_duration(struct file *file, const char __user *buffer, size
struct net_device *dev = data; struct net_device *dev = data;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev); _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
char tmp[255]; char tmp[255];
u32 enable_runtime_duration = 0, mcc_duration = 0; u32 enable_runtime_duration = 0, mcc_duration = 0, type = 0;
if (NULL == buffer) { if (NULL == buffer) {
RTW_INFO(FUNC_ADPT_FMT ": input buffer is NULL!\n", FUNC_ADPT_ARG(padapter)); RTW_INFO(FUNC_ADPT_FMT ": input buffer is NULL!\n", FUNC_ADPT_ARG(padapter));
@ -6048,14 +6267,19 @@ ssize_t proc_set_mcc_duration(struct file *file, const char __user *buffer, size
} }
if (buffer && !copy_from_user(tmp, buffer, count)) { if (buffer && !copy_from_user(tmp, buffer, count)) {
int num = sscanf(tmp, "%u %u", &enable_runtime_duration, &mcc_duration); int num = sscanf(tmp, "%u %u %u", &enable_runtime_duration, &type, &mcc_duration);
if (num < 1) { if (num < 1) {
RTW_INFO(FUNC_ADPT_FMT ": input parameters < 1\n", FUNC_ADPT_ARG(padapter)); RTW_INFO(FUNC_ADPT_FMT ": input parameters < 1\n", FUNC_ADPT_ARG(padapter));
return -EINVAL; return -EINVAL;
} }
if (num > 2) { if (num > 3) {
RTW_INFO(FUNC_ADPT_FMT ": input parameters > 2\n", FUNC_ADPT_ARG(padapter));
return -EINVAL;
}
if (num == 2) {
RTW_INFO(FUNC_ADPT_FMT ": input parameters > 2\n", FUNC_ADPT_ARG(padapter)); RTW_INFO(FUNC_ADPT_FMT ": input parameters > 2\n", FUNC_ADPT_ARG(padapter));
return -EINVAL; return -EINVAL;
} }
@ -6065,15 +6289,57 @@ ssize_t proc_set_mcc_duration(struct file *file, const char __user *buffer, size
RTW_INFO("runtime duration:%s\n", enable_runtime_duration ? "enable":"disable"); RTW_INFO("runtime duration:%s\n", enable_runtime_duration ? "enable":"disable");
} }
if (num == 2) { if (num == 3) {
RTW_INFO("mcc duration:%d\n", mcc_duration); RTW_INFO("type:%d, mcc duration:%d\n", type, mcc_duration);
rtw_set_mcc_duration_cmd(padapter, MCC_DURATION_DIRECET, mcc_duration); rtw_set_mcc_duration_cmd(padapter, type, mcc_duration);
} }
} }
return count; return count;
} }
#ifdef CONFIG_MCC_PHYDM_OFFLOAD
ssize_t proc_set_mcc_phydm_offload_enable(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
{
struct net_device *dev = data;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
char tmp[255];
u32 mcc_phydm_enable = 0;
if (NULL == buffer) {
RTW_INFO(FUNC_ADPT_FMT ": input buffer is NULL!\n", FUNC_ADPT_ARG(padapter));
return -EFAULT;
}
if (count < 1) {
RTW_INFO(FUNC_ADPT_FMT ": input length is 0!\n", FUNC_ADPT_ARG(padapter));
return -EFAULT;
}
if (count > sizeof(tmp)) {
RTW_INFO(FUNC_ADPT_FMT ": input length is too large\n", FUNC_ADPT_ARG(padapter));
rtw_warn_on(1);
return -EFAULT;
}
if (buffer && !copy_from_user(tmp, buffer, count)) {
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
u8 i = 0;
int num = sscanf(tmp, "%u", &mcc_phydm_enable);
if (num < 1) {
RTW_INFO(FUNC_ADPT_FMT ": input parameters < 1\n", FUNC_ADPT_ARG(padapter));
return -EINVAL;
}
RTW_INFO("%s: mcc phydm enable = %d\n", __func__, mcc_phydm_enable);
rtw_set_mcc_phydm_offload_enable_cmd(padapter, mcc_phydm_enable, _TRUE);
}
return count;
}
#endif
ssize_t proc_set_mcc_single_tx_criteria(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) ssize_t proc_set_mcc_single_tx_criteria(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
{ {
struct net_device *dev = data; struct net_device *dev = data;
@ -6470,7 +6736,7 @@ ssize_t proc_set_fw_offload(struct file *file, const char __user *buffer, size_t
if (hal->RegIQKFWOffload != iqk_offload_enable) { if (hal->RegIQKFWOffload != iqk_offload_enable) {
hal->RegIQKFWOffload = iqk_offload_enable; hal->RegIQKFWOffload = iqk_offload_enable;
rtw_hal_update_iqk_fw_offload_cap(pri_adapter); rtw_run_in_thread_cmd(pri_adapter, ((void *)(rtw_hal_update_iqk_fw_offload_cap)), pri_adapter);
} }
if (hal->ch_switch_offload != ch_switch_offload_enable) if (hal->ch_switch_offload != ch_switch_offload_enable)

View File

@ -156,20 +156,6 @@ out:
void eeprom_write16(_adapter *padapter, u16 reg, u16 data) void eeprom_write16(_adapter *padapter, u16 reg, u16 data)
{ {
u8 x; u8 x;
#ifdef CONFIG_RTL8712
u8 tmp8_ori, tmp8_new, tmp8_clk_ori, tmp8_clk_new;
tmp8_ori = rtw_read8(padapter, 0x102502f1);
tmp8_new = tmp8_ori & 0xf7;
if (tmp8_ori != tmp8_new) {
rtw_write8(padapter, 0x102502f1, tmp8_new);
}
tmp8_clk_ori = rtw_read8(padapter, 0x10250003);
tmp8_clk_new = tmp8_clk_ori | 0x20;
if (tmp8_clk_new != tmp8_clk_ori) {
rtw_write8(padapter, 0x10250003, tmp8_clk_new);
}
#endif
x = rtw_read8(padapter, EE_9346CR); x = rtw_read8(padapter, EE_9346CR);
x &= ~(_EEDI | _EEDO | _EESK | _EEM0); x &= ~(_EEDI | _EEDO | _EESK | _EEM0);
@ -221,13 +207,6 @@ void eeprom_write16(_adapter *padapter, u16 reg, u16 data)
eeprom_clean(padapter); eeprom_clean(padapter);
exit: exit:
#ifdef CONFIG_RTL8712
if (tmp8_clk_new != tmp8_clk_ori)
rtw_write8(padapter, 0x10250003, tmp8_clk_ori);
if (tmp8_new != tmp8_ori)
rtw_write8(padapter, 0x102502f1, tmp8_ori);
#endif
return; return;
} }
@ -236,19 +215,6 @@ u16 eeprom_read16(_adapter *padapter, u16 reg) /* ReadEEprom */
u16 x; u16 x;
u16 data = 0; u16 data = 0;
#ifdef CONFIG_RTL8712
u8 tmp8_ori, tmp8_new, tmp8_clk_ori, tmp8_clk_new;
tmp8_ori = rtw_read8(padapter, 0x102502f1);
tmp8_new = tmp8_ori & 0xf7;
if (tmp8_ori != tmp8_new) {
rtw_write8(padapter, 0x102502f1, tmp8_new);
}
tmp8_clk_ori = rtw_read8(padapter, 0x10250003);
tmp8_clk_new = tmp8_clk_ori | 0x20;
if (tmp8_clk_new != tmp8_clk_ori) {
rtw_write8(padapter, 0x10250003, tmp8_clk_new);
}
#endif
if (rtw_is_surprise_removed(padapter)) { if (rtw_is_surprise_removed(padapter)) {
goto out; goto out;
@ -274,13 +240,7 @@ u16 eeprom_read16(_adapter *padapter, u16 reg) /* ReadEEprom */
eeprom_clean(padapter); eeprom_clean(padapter);
out: out:
#ifdef CONFIG_RTL8712
if (tmp8_clk_new != tmp8_clk_ori)
rtw_write8(padapter, 0x10250003, tmp8_clk_ori);
if (tmp8_new != tmp8_ori)
rtw_write8(padapter, 0x102502f1, tmp8_ori);
#endif
return data; return data;
@ -361,7 +321,7 @@ u8 eeprom_read(_adapter *padapter, u32 addr_off, u8 sz, u8 *rbuf)
VOID read_eeprom_content(_adapter *padapter) void read_eeprom_content(_adapter *padapter)
{ {

View File

@ -59,14 +59,14 @@ u8 WLAN_AKM_FT_FILS_SHA384[] = {0x00, 0x0f, 0xac, 17};
* for adhoc-master to generate ie and provide supported-rate to fw * for adhoc-master to generate ie and provide supported-rate to fw
* ----------------------------------------------------------- */ * ----------------------------------------------------------- */
static u8 WIFI_CCKRATES[] = { u8 WIFI_CCKRATES[] = {
(IEEE80211_CCK_RATE_1MB | IEEE80211_BASIC_RATE_MASK), (IEEE80211_CCK_RATE_1MB | IEEE80211_BASIC_RATE_MASK),
(IEEE80211_CCK_RATE_2MB | IEEE80211_BASIC_RATE_MASK), (IEEE80211_CCK_RATE_2MB | IEEE80211_BASIC_RATE_MASK),
(IEEE80211_CCK_RATE_5MB | IEEE80211_BASIC_RATE_MASK), (IEEE80211_CCK_RATE_5MB | IEEE80211_BASIC_RATE_MASK),
(IEEE80211_CCK_RATE_11MB | IEEE80211_BASIC_RATE_MASK) (IEEE80211_CCK_RATE_11MB | IEEE80211_BASIC_RATE_MASK)
}; };
static u8 WIFI_OFDMRATES[] = { u8 WIFI_OFDMRATES[] = {
(IEEE80211_OFDM_RATE_6MB), (IEEE80211_OFDM_RATE_6MB),
(IEEE80211_OFDM_RATE_9MB), (IEEE80211_OFDM_RATE_9MB),
(IEEE80211_OFDM_RATE_12MB), (IEEE80211_OFDM_RATE_12MB),
@ -96,6 +96,34 @@ u8 mgn_rates_vht4ss[10] = {MGN_VHT4SS_MCS0, MGN_VHT4SS_MCS1, MGN_VHT4SS_MCS2, MG
, MGN_VHT4SS_MCS5, MGN_VHT4SS_MCS6, MGN_VHT4SS_MCS7, MGN_VHT4SS_MCS8, MGN_VHT4SS_MCS9 , MGN_VHT4SS_MCS5, MGN_VHT4SS_MCS6, MGN_VHT4SS_MCS7, MGN_VHT4SS_MCS8, MGN_VHT4SS_MCS9
}; };
RATE_SECTION mgn_rate_to_rs(enum MGN_RATE rate)
{
RATE_SECTION rs = RATE_SECTION_NUM;
if (IS_CCK_RATE(rate))
rs = CCK;
else if (IS_OFDM_RATE(rate))
rs = OFDM;
else if (IS_HT1SS_RATE(rate))
rs = HT_1SS;
else if (IS_HT2SS_RATE(rate))
rs = HT_2SS;
else if (IS_HT3SS_RATE(rate))
rs = HT_3SS;
else if (IS_HT4SS_RATE(rate))
rs = HT_4SS;
else if (IS_VHT1SS_RATE(rate))
rs = VHT_1SS;
else if (IS_VHT2SS_RATE(rate))
rs = VHT_2SS;
else if (IS_VHT3SS_RATE(rate))
rs = VHT_3SS;
else if (IS_VHT4SS_RATE(rate))
rs = VHT_4SS;
return rs;
}
static const char *const _rate_section_str[] = { static const char *const _rate_section_str[] = {
"CCK", "CCK",
"OFDM", "OFDM",
@ -408,52 +436,6 @@ exit:
return ret; return ret;
} }
/* Returns: remove size OR _FAIL: not updated*/
int rtw_remove_ie_g_rate(u8 *ie, uint *ie_len, uint offset, u8 eid)
{
int ret = _FAIL;
u8 *tem_target_ie;
u8 *target_ie;
u32 target_ielen,temp_target_ielen,cck_rate_size,rm_size;
u8 *start;
uint search_len;
u8 *remain_ies;
uint remain_len;
if (!ie || !ie_len || *ie_len <= offset)
goto exit;
start = ie + offset;
search_len = *ie_len - offset;
while (1) {
tem_target_ie=rtw_get_ie(start,eid,&temp_target_ielen,search_len);
/*if(tem_target_ie)
RTW_INFO("%s, tem_target_ie=%u\n", __FUNCTION__,*tem_target_ie);*/
if (tem_target_ie && temp_target_ielen) {
cck_rate_size = rtw_get_cckrate_size((tem_target_ie+2), temp_target_ielen);
rm_size = temp_target_ielen - cck_rate_size;
RTW_DBG("%s,cck_rate_size=%u rm_size=%u\n", __FUNCTION__, cck_rate_size, rm_size);
temp_target_ielen=temp_target_ielen + 2;/*org size of Supposrted Rates(include id + length)*/
/*RTW_INFO("%s, temp_target_ielen=%u\n", __FUNCTION__,temp_target_ielen);*/
remain_ies = tem_target_ie + temp_target_ielen;
remain_len = search_len - (remain_ies - start);
target_ielen=cck_rate_size;/*discount g mode rate 6, 9 12,18Mbps,id , length*/
*(tem_target_ie+1)=target_ielen;/*set new length to Supposrted Rates*/
target_ie=tem_target_ie+target_ielen + 2;/*set target ie to address of rate 6Mbps */
_rtw_memmove(target_ie, remain_ies, remain_len);
*ie_len = *ie_len - rm_size;
ret = rm_size;
start = target_ie;
search_len = remain_len;
} else
break;
}
exit:
return ret;
}
void rtw_set_supported_rate(u8 *SupportedRates, uint mode) void rtw_set_supported_rate(u8 *SupportedRates, uint mode)
{ {
@ -483,6 +465,71 @@ void rtw_set_supported_rate(u8 *SupportedRates, uint mode)
} }
} }
void rtw_filter_suppport_rateie(WLAN_BSSID_EX *pbss_network, u8 keep)
{
u8 i, idx = 0, new_rate[NDIS_802_11_LENGTH_RATES_EX], *p;
uint iscck, isofdm, ie_orilen = 0, remain_len;
u8 *remain_ies;
p = rtw_get_ie(pbss_network->IEs + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &ie_orilen, (pbss_network->IELength - _BEACON_IE_OFFSET_));
if (!p)
return;
_rtw_memset(new_rate, 0, NDIS_802_11_LENGTH_RATES_EX);
for (i=0; i < ie_orilen; i++) {
iscck = rtw_is_cck_rate(p[i+2]);
isofdm= rtw_is_ofdm_rate(p[i+2]);
if (((keep == CCK) && iscck)
|| ((keep == OFDM) && isofdm))
new_rate[idx++]= rtw_is_basic_rate_ofdm(p[i+2]) ? p[i+2]|IEEE80211_BASIC_RATE_MASK : p[i+2];
}
/* update rate ie */
p[1] = idx;
_rtw_memcpy(p+2, new_rate, idx);
/* update remain ie & IELength*/
remain_ies = p + 2 + ie_orilen;
remain_len = pbss_network->IELength - (remain_ies - pbss_network->IEs);
_rtw_memmove(p+2+idx, remain_ies, remain_len);
pbss_network->IELength -= (ie_orilen - idx);
}
/*
Adjust those items by given wireless_mode
1. pbss_network->IELength
2. pbss_network->IE (SUPPORTRATE & EXT_SUPPORTRATE)
3. pbss_network->SupportedRates
*/
u8 rtw_update_rate_bymode(WLAN_BSSID_EX *pbss_network, u32 mode)
{
u8 network_type, *p, *ie = pbss_network->IEs;
sint ie_len;
uint network_ielen = pbss_network->IELength;
if (mode == WIRELESS_11B) {
/*only keep CCK in support_rate IE and remove whole ext_support_rate IE*/
rtw_filter_suppport_rateie(pbss_network, CCK);
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _EXT_SUPPORTEDRATES_IE_, &ie_len, pbss_network->IELength - _BEACON_IE_OFFSET_);
if (p) {
rtw_ies_remove_ie(ie , &network_ielen, _BEACON_IE_OFFSET_, _EXT_SUPPORTEDRATES_IE_, NULL, 0);
pbss_network->IELength -= ie_len;
}
network_type = WIRELESS_11B;
} else if ((mode & WIRELESS_11B) == 0) {
/* Remove CCK in support_rate IE */
rtw_filter_suppport_rateie(pbss_network, OFDM);
if (pbss_network->Configuration.DSConfig > 14)
network_type = WIRELESS_11A;
else
network_type = WIRELESS_11G;
} else
network_type = WIRELESS_11BG; /* do nothing */
rtw_set_supported_rate(pbss_network->SupportedRates, network_type);
return network_type;
}
uint rtw_get_rateset_len(u8 *rateset) uint rtw_get_rateset_len(u8 *rateset)
{ {
uint i = 0; uint i = 0;
@ -2798,7 +2845,7 @@ u32 rtw_ht_mcs_set_to_bitmap(u8 *mcs_set, u8 nss)
} }
/* show MCS rate, unit: 100Kbps */ /* show MCS rate, unit: 100Kbps */
u16 rtw_mcs_rate(u8 rf_type, u8 bw_40MHz, u8 short_GI, unsigned char *MCS_rate) u16 rtw_ht_mcs_rate(u8 bw_40MHz, u8 short_GI, unsigned char *MCS_rate)
{ {
u16 max_rate = 0; u16 max_rate = 0;

View File

@ -47,10 +47,6 @@ jackson@realtek.com.tw
#include <drv_types.h> #include <drv_types.h>
#include <hal_data.h> #include <hal_data.h>
#if defined(PLATFORM_LINUX) && defined (PLATFORM_WINDOWS)
#error "Shall be Linux or Windows, but not both!\n"
#endif
#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_PLATFORM_RTL8197D) #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_PLATFORM_RTL8197D)
#define rtw_le16_to_cpu(val) val #define rtw_le16_to_cpu(val) val
#define rtw_le32_to_cpu(val) val #define rtw_le32_to_cpu(val) val
@ -488,39 +484,221 @@ void rtw_reset_continual_io_error(struct dvobj_priv *dvobj)
} }
#ifdef DBG_IO #ifdef DBG_IO
#define RTW_IO_SNIFF_TYPE_RANGE 0 /* specific address range is accessed */
#define RTW_IO_SNIFF_TYPE_VALUE 1 /* value match for sniffed range */
u32 read_sniff_ranges[][2] = { struct rtw_io_sniff_ent {
/* {0x520, 0x523}, */ u8 chip;
u8 hci;
u32 addr;
u8 type;
union {
u32 end_addr;
struct {
u32 mask;
u32 val;
bool equal;
} vm; /* value match */
} u;
bool trace;
char *tag;
bool (*assert_protsel)(_adapter *adapter, u32 addr, u8 len);
}; };
u32 write_sniff_ranges[][2] = { #define RTW_IO_SNIFF_RANGE_ENT(_chip, _hci, _addr, _end_addr, _trace, _tag) \
/* {0x520, 0x523}, */ {.chip = _chip, .hci = _hci, .addr = _addr, .u.end_addr = _end_addr, .trace = _trace, .tag = _tag, .type = RTW_IO_SNIFF_TYPE_RANGE,}
/* {0x4c, 0x4c}, */
#define RTW_IO_SNIFF_RANGE_PROT_ENT(_chip, _hci, _addr, _end_addr, _assert_protsel, _tag) \
{.chip = _chip, .hci = _hci, .addr = _addr, .u.end_addr = _end_addr, .trace = 1, .assert_protsel = _assert_protsel, .tag = _tag, .type = RTW_IO_SNIFF_TYPE_RANGE,}
#define RTW_IO_SNIFF_VALUE_ENT(_chip, _hci, _addr, _mask, _val, _equal, _trace, _tag) \
{.chip = _chip, .hci = _hci, .addr = _addr, .u.vm.mask = _mask, .u.vm.val = _val, .u.vm.equal = _equal, .trace = _trace, .tag = _tag, .type = RTW_IO_SNIFF_TYPE_VALUE,}
/* part or all sniffed range is enabled (not all 0) */
#define RTW_IO_SNIFF_EN_ENT(_chip, _hci, _addr, _mask, _trace, _tag) \
{.chip = _chip, .hci = _hci, .addr = _addr, .u.vm.mask = _mask, .u.vm.val = 0, .u.vm.equal = 0, .trace = _trace, .tag = _tag, .type = RTW_IO_SNIFF_TYPE_VALUE,}
/* part or all sniffed range is disabled (not all 1) */
#define RTW_IO_SNIFF_DIS_ENT(_chip, _hci, _addr, _mask, _trace, _tag) \
{.chip = _chip, .hci = _hci, .addr = _addr, .u.vm.mask = _mask, .u.vm.val = 0xFFFFFFFF, .u.vm.equal = 0, .trace = _trace, .tag = _tag, .type = RTW_IO_SNIFF_TYPE_VALUE,}
const struct rtw_io_sniff_ent read_sniff[] = {
#ifdef DBG_IO_HCI_EN_CHK
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_SDIO, 0x02, 0x1FC, 1, "SDIO 0x02[8:2] not all 0"),
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_USB, 0x02, 0x1E0, 1, "USB 0x02[8:5] not all 0"),
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_PCIE, 0x02, 0x01C, 1, "PCI 0x02[4:2] not all 0"),
#endif
#ifdef DBG_IO_SNIFF_EXAMPLE
RTW_IO_SNIFF_RANGE_ENT(MAX_CHIP_TYPE, 0, 0x522, 0x522, 0, "read TXPAUSE"),
RTW_IO_SNIFF_DIS_ENT(MAX_CHIP_TYPE, 0, 0x02, 0x3, 0, "0x02[1:0] not all 1"),
#endif
#ifdef DBG_IO_PROT_SEL
RTW_IO_SNIFF_RANGE_PROT_ENT(MAX_CHIP_TYPE, 0, 0x1501, 0x1513, rtw_assert_protsel_port, "protsel port"),
RTW_IO_SNIFF_RANGE_PROT_ENT(MAX_CHIP_TYPE, 0, 0x153a, 0x153b, rtw_assert_protsel_atimdtim, "protsel atimdtim"),
#endif
}; };
int read_sniff_num = sizeof(read_sniff_ranges) / sizeof(u32) / 2; const int read_sniff_num = sizeof(read_sniff) / sizeof(struct rtw_io_sniff_ent);
int write_sniff_num = sizeof(write_sniff_ranges) / sizeof(u32) / 2;
bool match_read_sniff_ranges(u32 addr, u16 len) const struct rtw_io_sniff_ent write_sniff[] = {
#ifdef DBG_IO_HCI_EN_CHK
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_SDIO, 0x02, 0x1FC, 1, "SDIO 0x02[8:2] not all 0"),
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_USB, 0x02, 0x1E0, 1, "USB 0x02[8:5] not all 0"),
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_PCIE, 0x02, 0x01C, 1, "PCI 0x02[4:2] not all 0"),
#endif
#ifdef DBG_IO_8822C_1TX_PATH_EN
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x1a04, 0xc0000000, 0x02, 1, 0, "write tx_path_en_cck A enabled"),
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x1a04, 0xc0000000, 0x01, 1, 0, "write tx_path_en_cck B enabled"),
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x1a04, 0xc0000000, 0x03, 1, 1, "write tx_path_en_cck AB enabled"),
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x820, 0x03, 0x01, 1, 0, "write tx_path_en_ofdm_1sts A enabled"),
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x820, 0x03, 0x02, 1, 0, "write tx_path_en_ofdm_1sts B enabled"),
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x820, 0x03, 0x03, 1, 1, "write tx_path_en_ofdm_1sts AB enabled"),
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x820, 0x30, 0x01, 1, 0, "write tx_path_en_ofdm_2sts A enabled"),
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x820, 0x30, 0x02, 1, 0, "write tx_path_en_ofdm_2sts B enabled"),
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x820, 0x30, 0x03, 1, 1, "write tx_path_en_ofdm_2sts AB enabled"),
#endif
#ifdef DBG_IO_SNIFF_EXAMPLE
RTW_IO_SNIFF_RANGE_ENT(MAX_CHIP_TYPE, 0, 0x522, 0x522, 0, "write TXPAUSE"),
RTW_IO_SNIFF_DIS_ENT(MAX_CHIP_TYPE, 0, 0x02, 0x3, 0, "0x02[1:0] not all 1"),
#endif
};
const int write_sniff_num = sizeof(write_sniff) / sizeof(struct rtw_io_sniff_ent);
static bool match_io_sniff_ranges(_adapter *adapter
, const struct rtw_io_sniff_ent *sniff, int i, u32 addr, u16 len)
{
/* check if IO range after sniff end address */
if (addr > sniff->u.end_addr)
return 0;
if (sniff->assert_protsel &&
sniff->assert_protsel(adapter, addr, len))
return 0;
return 1;
}
static bool match_io_sniff_value(_adapter *adapter
, const struct rtw_io_sniff_ent *sniff, int i, u32 addr, u8 len, u32 val)
{
u8 sniff_len;
s8 mask_shift;
u32 mask;
s8 value_shift;
u32 value;
bool ret = 0;
/* check if IO range after sniff end address */
sniff_len = 4;
while (!(sniff->u.vm.mask & (0xFF << ((sniff_len - 1) * 8)))) {
sniff_len--;
if (sniff_len == 0)
goto exit;
}
if (sniff->addr + sniff_len <= addr)
goto exit;
/* align to IO addr */
mask_shift = (sniff->addr - addr) * 8;
value_shift = mask_shift + bitshift(sniff->u.vm.mask);
if (mask_shift > 0)
mask = sniff->u.vm.mask << mask_shift;
else if (mask_shift < 0)
mask = sniff->u.vm.mask >> -mask_shift;
else
mask = sniff->u.vm.mask;
if (value_shift > 0)
value = sniff->u.vm.val << value_shift;
else if (mask_shift < 0)
value = sniff->u.vm.val >> -value_shift;
else
value = sniff->u.vm.val;
if ((sniff->u.vm.equal && (mask & val) == (mask & value))
|| (!sniff->u.vm.equal && (mask & val) != (mask & value))
) {
ret = 1;
if (0)
RTW_INFO(FUNC_ADPT_FMT" addr:0x%x len:%u val:0x%x (i:%d sniff_len:%u m_shift:%d mask:0x%x v_shifd:%d value:0x%x equal:%d)\n"
, FUNC_ADPT_ARG(adapter), addr, len, val, i, sniff_len, mask_shift, mask, value_shift, value, sniff->u.vm.equal);
}
exit:
return ret;
}
static bool match_io_sniff(_adapter *adapter
, const struct rtw_io_sniff_ent *sniff, int i, u32 addr, u8 len, u32 val)
{
bool ret = 0;
if (sniff->chip != MAX_CHIP_TYPE
&& sniff->chip != rtw_get_chip_type(adapter))
goto exit;
if (sniff->hci
&& !(sniff->hci & rtw_get_intf_type(adapter)))
goto exit;
if (sniff->addr >= addr + len) /* IO range below sniff start address */
goto exit;
switch (sniff->type) {
case RTW_IO_SNIFF_TYPE_RANGE:
ret = match_io_sniff_ranges(adapter, sniff, i, addr, len);
break;
case RTW_IO_SNIFF_TYPE_VALUE:
if (len == 1 || len == 2 || len == 4)
ret = match_io_sniff_value(adapter, sniff, i, addr, len, val);
break;
default:
rtw_warn_on(1);
break;
}
exit:
return ret;
}
u32 match_read_sniff(_adapter *adapter, u32 addr, u16 len, u32 val)
{ {
int i; int i;
bool trace = 0;
u32 match = 0;
for (i = 0; i < read_sniff_num; i++) { for (i = 0; i < read_sniff_num; i++) {
if (addr + len > read_sniff_ranges[i][0] && addr <= read_sniff_ranges[i][1]) if (match_io_sniff(adapter, &read_sniff[i], i, addr, len, val)) {
return _TRUE; match++;
trace |= read_sniff[i].trace;
if (read_sniff[i].tag)
RTW_INFO("DBG_IO TAG %s\n", read_sniff[i].tag);
}
} }
return _FALSE; rtw_warn_on(trace);
return match;
} }
bool match_write_sniff_ranges(u32 addr, u16 len) u32 match_write_sniff(_adapter *adapter, u32 addr, u16 len, u32 val)
{ {
int i; int i;
bool trace = 0;
u32 match = 0;
for (i = 0; i < write_sniff_num; i++) { for (i = 0; i < write_sniff_num; i++) {
if (addr + len > write_sniff_ranges[i][0] && addr <= write_sniff_ranges[i][1]) if (match_io_sniff(adapter, &write_sniff[i], i, addr, len, val)) {
return _TRUE; match++;
trace |= write_sniff[i].trace;
if (write_sniff[i].tag)
RTW_INFO("DBG_IO TAG %s\n", write_sniff[i].tag);
}
} }
return _FALSE; rtw_warn_on(trace);
return match;
} }
struct rf_sniff_ent { struct rf_sniff_ent {
@ -542,7 +720,7 @@ struct rf_sniff_ent rf_write_sniff_ranges[] = {
int rf_read_sniff_num = sizeof(rf_read_sniff_ranges) / sizeof(struct rf_sniff_ent); int rf_read_sniff_num = sizeof(rf_read_sniff_ranges) / sizeof(struct rf_sniff_ent);
int rf_write_sniff_num = sizeof(rf_write_sniff_ranges) / sizeof(struct rf_sniff_ent); int rf_write_sniff_num = sizeof(rf_write_sniff_ranges) / sizeof(struct rf_sniff_ent);
bool match_rf_read_sniff_ranges(u8 path, u32 addr, u32 mask) bool match_rf_read_sniff_ranges(_adapter *adapter, u8 path, u32 addr, u32 mask)
{ {
int i; int i;
@ -555,7 +733,7 @@ bool match_rf_read_sniff_ranges(u8 path, u32 addr, u32 mask)
return _FALSE; return _FALSE;
} }
bool match_rf_write_sniff_ranges(u8 path, u32 addr, u32 mask) bool match_rf_write_sniff_ranges(_adapter *adapter, u8 path, u32 addr, u32 mask)
{ {
int i; int i;
@ -568,12 +746,60 @@ bool match_rf_write_sniff_ranges(u8 path, u32 addr, u32 mask)
return _FALSE; return _FALSE;
} }
void dbg_rtw_reg_read_monitor(_adapter *adapter, u32 addr, u32 len, u32 val, const char *caller, const int line)
{
if (match_read_sniff(adapter, addr, len, val)) {
switch (len) {
case 1:
RTW_INFO("DBG_IO %s:%d read8(0x%04x) return 0x%02x\n"
, caller, line, addr, val);
break;
case 2:
RTW_INFO("DBG_IO %s:%d read16(0x%04x) return 0x%04x\n"
, caller, line, addr, val);
break;
case 4:
RTW_INFO("DBG_IO %s:%d read32(0x%04x) return 0x%08x\n"
, caller, line, addr, val);
break;
default:
RTW_INFO("DBG_IO %s:%d readN(0x%04x, %u)\n"
, caller, line, addr, len);
}
}
}
void dbg_rtw_reg_write_monitor(_adapter *adapter, u32 addr, u32 len, u32 val, const char *caller, const int line)
{
if (match_write_sniff(adapter, addr, len, val)) {
switch (len) {
case 1:
RTW_INFO("DBG_IO %s:%d write8(0x%04x, 0x%02x)\n"
, caller, line, addr, val);
break;
case 2:
RTW_INFO("DBG_IO %s:%d write16(0x%04x, 0x%04x)\n"
, caller, line, addr, val);
break;
case 4:
RTW_INFO("DBG_IO %s:%d write32(0x%04x, 0x%08x)\n"
, caller, line, addr, val);
break;
default:
RTW_INFO("DBG_IO %s:%d rtw_writeN(0x%04x, %u)\n"
, caller, line, addr, len);
}
}
}
u8 dbg_rtw_read8(_adapter *adapter, u32 addr, const char *caller, const int line) u8 dbg_rtw_read8(_adapter *adapter, u32 addr, const char *caller, const int line)
{ {
u8 val = _rtw_read8(adapter, addr); u8 val = _rtw_read8(adapter, addr);
if (match_read_sniff_ranges(addr, 1)) if (match_read_sniff(adapter, addr, 1, val)) {
RTW_INFO("DBG_IO %s:%d rtw_read8(0x%04x) return 0x%02x\n", caller, line, addr, val); RTW_INFO("DBG_IO %s:%d rtw_read8(0x%04x) return 0x%02x\n"
, caller, line, addr, val);
}
return val; return val;
} }
@ -582,8 +808,10 @@ u16 dbg_rtw_read16(_adapter *adapter, u32 addr, const char *caller, const int li
{ {
u16 val = _rtw_read16(adapter, addr); u16 val = _rtw_read16(adapter, addr);
if (match_read_sniff_ranges(addr, 2)) if (match_read_sniff(adapter, addr, 2, val)) {
RTW_INFO("DBG_IO %s:%d rtw_read16(0x%04x) return 0x%04x\n", caller, line, addr, val); RTW_INFO("DBG_IO %s:%d rtw_read16(0x%04x) return 0x%04x\n"
, caller, line, addr, val);
}
return val; return val;
} }
@ -592,37 +820,47 @@ u32 dbg_rtw_read32(_adapter *adapter, u32 addr, const char *caller, const int li
{ {
u32 val = _rtw_read32(adapter, addr); u32 val = _rtw_read32(adapter, addr);
if (match_read_sniff_ranges(addr, 4)) if (match_read_sniff(adapter, addr, 4, val)) {
RTW_INFO("DBG_IO %s:%d rtw_read32(0x%04x) return 0x%08x\n", caller, line, addr, val); RTW_INFO("DBG_IO %s:%d rtw_read32(0x%04x) return 0x%08x\n"
, caller, line, addr, val);
}
return val; return val;
} }
int dbg_rtw_write8(_adapter *adapter, u32 addr, u8 val, const char *caller, const int line) int dbg_rtw_write8(_adapter *adapter, u32 addr, u8 val, const char *caller, const int line)
{ {
if (match_write_sniff_ranges(addr, 1)) if (match_write_sniff(adapter, addr, 1, val)) {
RTW_INFO("DBG_IO %s:%d rtw_write8(0x%04x, 0x%02x)\n", caller, line, addr, val); RTW_INFO("DBG_IO %s:%d rtw_write8(0x%04x, 0x%02x)\n"
, caller, line, addr, val);
}
return _rtw_write8(adapter, addr, val); return _rtw_write8(adapter, addr, val);
} }
int dbg_rtw_write16(_adapter *adapter, u32 addr, u16 val, const char *caller, const int line) int dbg_rtw_write16(_adapter *adapter, u32 addr, u16 val, const char *caller, const int line)
{ {
if (match_write_sniff_ranges(addr, 2)) if (match_write_sniff(adapter, addr, 2, val)) {
RTW_INFO("DBG_IO %s:%d rtw_write16(0x%04x, 0x%04x)\n", caller, line, addr, val); RTW_INFO("DBG_IO %s:%d rtw_write16(0x%04x, 0x%04x)\n"
, caller, line, addr, val);
}
return _rtw_write16(adapter, addr, val); return _rtw_write16(adapter, addr, val);
} }
int dbg_rtw_write32(_adapter *adapter, u32 addr, u32 val, const char *caller, const int line) int dbg_rtw_write32(_adapter *adapter, u32 addr, u32 val, const char *caller, const int line)
{ {
if (match_write_sniff_ranges(addr, 4)) if (match_write_sniff(adapter, addr, 4, val)) {
RTW_INFO("DBG_IO %s:%d rtw_write32(0x%04x, 0x%08x)\n", caller, line, addr, val); RTW_INFO("DBG_IO %s:%d rtw_write32(0x%04x, 0x%08x)\n"
, caller, line, addr, val);
}
return _rtw_write32(adapter, addr, val); return _rtw_write32(adapter, addr, val);
} }
int dbg_rtw_writeN(_adapter *adapter, u32 addr , u32 length , u8 *data, const char *caller, const int line) int dbg_rtw_writeN(_adapter *adapter, u32 addr , u32 length , u8 *data, const char *caller, const int line)
{ {
if (match_write_sniff_ranges(addr, length)) if (match_write_sniff(adapter, addr, length, 0)) {
RTW_INFO("DBG_IO %s:%d rtw_writeN(0x%04x, %u)\n", caller, line, addr, length); RTW_INFO("DBG_IO %s:%d rtw_writeN(0x%04x, %u)\n"
, caller, line, addr, length);
}
return _rtw_writeN(adapter, addr, length, data); return _rtw_writeN(adapter, addr, length, data);
} }
@ -633,8 +871,10 @@ u8 dbg_rtw_sd_f0_read8(_adapter *adapter, u32 addr, const char *caller, const in
u8 val = _rtw_sd_f0_read8(adapter, addr); u8 val = _rtw_sd_f0_read8(adapter, addr);
#if 0 #if 0
if (match_read_sniff_ranges(addr, 1)) if (match_read_sniff(adapter, addr, 1, val)) {
RTW_INFO("DBG_IO %s:%d rtw_sd_f0_read8(0x%04x) return 0x%02x\n", caller, line, addr, val); RTW_INFO("DBG_IO %s:%d rtw_sd_f0_read8(0x%04x) return 0x%02x\n"
, caller, line, addr, val);
}
#endif #endif
return val; return val;
@ -645,8 +885,10 @@ u8 dbg_rtw_sd_iread8(_adapter *adapter, u32 addr, const char *caller, const int
{ {
u8 val = rtw_sd_iread8(adapter, addr); u8 val = rtw_sd_iread8(adapter, addr);
if (match_read_sniff_ranges(addr, 1)) if (match_read_sniff(adapter, addr, 1, val)) {
RTW_INFO("DBG_IO %s:%d rtw_sd_iread8(0x%04x) return 0x%02x\n", caller, line, addr, val); RTW_INFO("DBG_IO %s:%d rtw_sd_iread8(0x%04x) return 0x%02x\n"
, caller, line, addr, val);
}
return val; return val;
} }
@ -655,8 +897,10 @@ u16 dbg_rtw_sd_iread16(_adapter *adapter, u32 addr, const char *caller, const in
{ {
u16 val = _rtw_sd_iread16(adapter, addr); u16 val = _rtw_sd_iread16(adapter, addr);
if (match_read_sniff_ranges(addr, 2)) if (match_read_sniff(adapter, addr, 2, val)) {
RTW_INFO("DBG_IO %s:%d rtw_sd_iread16(0x%04x) return 0x%04x\n", caller, line, addr, val); RTW_INFO("DBG_IO %s:%d rtw_sd_iread16(0x%04x) return 0x%04x\n"
, caller, line, addr, val);
}
return val; return val;
} }
@ -665,30 +909,38 @@ u32 dbg_rtw_sd_iread32(_adapter *adapter, u32 addr, const char *caller, const in
{ {
u32 val = _rtw_sd_iread32(adapter, addr); u32 val = _rtw_sd_iread32(adapter, addr);
if (match_read_sniff_ranges(addr, 4)) if (match_read_sniff(adapter, addr, 4, val)) {
RTW_INFO("DBG_IO %s:%d rtw_sd_iread32(0x%04x) return 0x%08x\n", caller, line, addr, val); RTW_INFO("DBG_IO %s:%d rtw_sd_iread32(0x%04x) return 0x%08x\n"
, caller, line, addr, val);
}
return val; return val;
} }
int dbg_rtw_sd_iwrite8(_adapter *adapter, u32 addr, u8 val, const char *caller, const int line) int dbg_rtw_sd_iwrite8(_adapter *adapter, u32 addr, u8 val, const char *caller, const int line)
{ {
if (match_write_sniff_ranges(addr, 1)) if (match_write_sniff(adapter, addr, 1, val)) {
RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite8(0x%04x, 0x%02x)\n", caller, line, addr, val); RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite8(0x%04x, 0x%02x)\n"
, caller, line, addr, val);
}
return _rtw_sd_iwrite8(adapter, addr, val); return _rtw_sd_iwrite8(adapter, addr, val);
} }
int dbg_rtw_sd_iwrite16(_adapter *adapter, u32 addr, u16 val, const char *caller, const int line) int dbg_rtw_sd_iwrite16(_adapter *adapter, u32 addr, u16 val, const char *caller, const int line)
{ {
if (match_write_sniff_ranges(addr, 2)) if (match_write_sniff(adapter, addr, 2, val)) {
RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite16(0x%04x, 0x%04x)\n", caller, line, addr, val); RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite16(0x%04x, 0x%04x)\n"
, caller, line, addr, val);
}
return _rtw_sd_iwrite16(adapter, addr, val); return _rtw_sd_iwrite16(adapter, addr, val);
} }
int dbg_rtw_sd_iwrite32(_adapter *adapter, u32 addr, u32 val, const char *caller, const int line) int dbg_rtw_sd_iwrite32(_adapter *adapter, u32 addr, u32 val, const char *caller, const int line)
{ {
if (match_write_sniff_ranges(addr, 4)) if (match_write_sniff(adapter, addr, 4, val)) {
RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite32(0x%04x, 0x%08x)\n", caller, line, addr, val); RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite32(0x%04x, 0x%08x)\n"
, caller, line, addr, val);
}
return _rtw_sd_iwrite32(adapter, addr, val); return _rtw_sd_iwrite32(adapter, addr, val);
} }

View File

@ -17,150 +17,3 @@
#include <drv_types.h> #include <drv_types.h>
#ifdef PLATFORM_WINDOWS
/*
* Added for WPA2-PSK, by Annie, 2005-09-20.
* */
u8
query_802_11_capability(
_adapter *Adapter,
u8 *pucBuf,
u32 *pulOutLen
)
{
static NDIS_802_11_AUTHENTICATION_ENCRYPTION szAuthEnc[] = {
{Ndis802_11AuthModeOpen, Ndis802_11EncryptionDisabled},
{Ndis802_11AuthModeOpen, Ndis802_11Encryption1Enabled},
{Ndis802_11AuthModeShared, Ndis802_11EncryptionDisabled},
{Ndis802_11AuthModeShared, Ndis802_11Encryption1Enabled},
{Ndis802_11AuthModeWPA, Ndis802_11Encryption2Enabled},
{Ndis802_11AuthModeWPA, Ndis802_11Encryption3Enabled},
{Ndis802_11AuthModeWPAPSK, Ndis802_11Encryption2Enabled},
{Ndis802_11AuthModeWPAPSK, Ndis802_11Encryption3Enabled},
{Ndis802_11AuthModeWPANone, Ndis802_11Encryption2Enabled},
{Ndis802_11AuthModeWPANone, Ndis802_11Encryption3Enabled},
{Ndis802_11AuthModeWPA2, Ndis802_11Encryption2Enabled},
{Ndis802_11AuthModeWPA2, Ndis802_11Encryption3Enabled},
{Ndis802_11AuthModeWPA2PSK, Ndis802_11Encryption2Enabled},
{Ndis802_11AuthModeWPA2PSK, Ndis802_11Encryption3Enabled}
};
static ULONG ulNumOfPairSupported = sizeof(szAuthEnc) / sizeof(NDIS_802_11_AUTHENTICATION_ENCRYPTION);
NDIS_802_11_CAPABILITY *pCap = (NDIS_802_11_CAPABILITY *)pucBuf;
u8 *pucAuthEncryptionSupported = (u8 *) pCap->AuthenticationEncryptionSupported;
pCap->Length = sizeof(NDIS_802_11_CAPABILITY);
if (ulNumOfPairSupported > 1)
pCap->Length += (ulNumOfPairSupported - 1) * sizeof(NDIS_802_11_AUTHENTICATION_ENCRYPTION);
pCap->Version = 2;
pCap->NoOfPMKIDs = NUM_PMKID_CACHE;
pCap->NoOfAuthEncryptPairsSupported = ulNumOfPairSupported;
if (sizeof(szAuthEnc) <= 240) /* 240 = 256 - 4*4 */ { /* SecurityInfo.szCapability: only 256 bytes in size. */
_rtw_memcpy(pucAuthEncryptionSupported, (u8 *)szAuthEnc, sizeof(szAuthEnc));
*pulOutLen = pCap->Length;
return _TRUE;
} else {
*pulOutLen = 0;
return _FALSE;
}
}
u8 query_802_11_association_information(_adapter *padapter, PNDIS_802_11_ASSOCIATION_INFORMATION pAssocInfo)
{
struct wlan_network *tgt_network;
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
struct security_priv *psecuritypriv = &(padapter->securitypriv);
WLAN_BSSID_EX *psecnetwork = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
u8 *pDest = (u8 *)pAssocInfo + sizeof(NDIS_802_11_ASSOCIATION_INFORMATION);
unsigned char i, *auth_ie, *supp_ie;
/* NdisZeroMemory(pAssocInfo, sizeof(NDIS_802_11_ASSOCIATION_INFORMATION)); */
_rtw_memset(pAssocInfo, 0, sizeof(NDIS_802_11_ASSOCIATION_INFORMATION));
/* pAssocInfo->Length = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); */
/* ------------------------------------------------------ */
/* Association Request related information */
/* ------------------------------------------------------ */
/* Req_1. AvailableRequestFixedIEs */
if (psecnetwork != NULL) {
pAssocInfo->AvailableRequestFixedIEs |= NDIS_802_11_AI_REQFI_CAPABILITIES | NDIS_802_11_AI_REQFI_CURRENTAPADDRESS;
pAssocInfo->RequestFixedIEs.Capabilities = (unsigned short) *&psecnetwork->IEs[10];
_rtw_memcpy(pAssocInfo->RequestFixedIEs.CurrentAPAddress,
&psecnetwork->MacAddress, 6);
pAssocInfo->OffsetRequestIEs = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION);
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING | _FW_LINKED) == _TRUE) {
if (psecuritypriv->ndisauthtype >= Ndis802_11AuthModeWPA2)
pDest[0] = 48; /* RSN Information Element */
else
pDest[0] = 221; /* WPA(SSN) Information Element */
supp_ie = &psecuritypriv->supplicant_ie[0];
i = 13; /* 0~11 is fixed information element */
while ((i < supp_ie[0]) && (i < 256)) {
if ((unsigned char)supp_ie[i] == pDest[0]) {
_rtw_memcpy((u8 *)(pDest),
&supp_ie[i],
supp_ie[1 + i] + 2);
break;
}
i = i + supp_ie[i + 1] + 2;
if (supp_ie[1 + i] == 0)
i = i + 1;
}
pAssocInfo->RequestIELength += (2 + supp_ie[1 + i]); /* (2 + psecnetwork->IEs[1+i]+4); */
}
}
/* ------------------------------------------------------ */
/* Association Response related information */
/* ------------------------------------------------------ */
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) {
tgt_network = &(pmlmepriv->cur_network);
if (tgt_network != NULL) {
pAssocInfo->AvailableResponseFixedIEs =
NDIS_802_11_AI_RESFI_CAPABILITIES
| NDIS_802_11_AI_RESFI_ASSOCIATIONID
;
pAssocInfo->ResponseFixedIEs.Capabilities = (unsigned short) *&tgt_network->network.IEs[10];
pAssocInfo->ResponseFixedIEs.StatusCode = 0;
pAssocInfo->ResponseFixedIEs.AssociationId = (unsigned short) tgt_network->aid;
pDest = (u8 *)pAssocInfo + sizeof(NDIS_802_11_ASSOCIATION_INFORMATION) + pAssocInfo->RequestIELength;
auth_ie = &psecuritypriv->authenticator_ie[0];
i = auth_ie[0] - 12;
if (i > 0) {
_rtw_memcpy((u8 *)&pDest[0], &auth_ie[1], i);
pAssocInfo->ResponseIELength = i;
}
pAssocInfo->OffsetResponseIEs = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION) + pAssocInfo->RequestIELength;
}
}
return _TRUE;
}
#endif

View File

@ -1,901 +0,0 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2017 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*****************************************************************************/
#define _RTW_IOCTL_RTL_C_
#include <drv_types.h>
#ifdef CONFIG_MP_INCLUDED
#include <rtw_mp_ioctl.h>
#endif
struct oid_obj_priv oid_rtl_seg_01_01[] = {
{1, &oid_null_function}, /* 0x80 */
{1, &oid_null_function}, /* 0x81 */
{1, &oid_null_function}, /* 0x82 */
{1, &oid_null_function}, /* 0x83 */ /* OID_RT_SET_SNIFFER_MODE */
{1, &oid_rt_get_signal_quality_hdl}, /* 0x84 */
{1, &oid_rt_get_small_packet_crc_hdl}, /* 0x85 */
{1, &oid_rt_get_middle_packet_crc_hdl}, /* 0x86 */
{1, &oid_rt_get_large_packet_crc_hdl}, /* 0x87 */
{1, &oid_rt_get_tx_retry_hdl}, /* 0x88 */
{1, &oid_rt_get_rx_retry_hdl}, /* 0x89 */
{1, &oid_rt_pro_set_fw_dig_state_hdl}, /* 0x8A */
{1, &oid_rt_pro_set_fw_ra_state_hdl} , /* 0x8B */
{1, &oid_null_function}, /* 0x8C */
{1, &oid_null_function}, /* 0x8D */
{1, &oid_null_function}, /* 0x8E */
{1, &oid_null_function}, /* 0x8F */
{1, &oid_rt_get_rx_total_packet_hdl}, /* 0x90 */
{1, &oid_rt_get_tx_beacon_ok_hdl}, /* 0x91 */
{1, &oid_rt_get_tx_beacon_err_hdl}, /* 0x92 */
{1, &oid_rt_get_rx_icv_err_hdl}, /* 0x93 */
{1, &oid_rt_set_encryption_algorithm_hdl}, /* 0x94 */
{1, &oid_null_function}, /* 0x95 */
{1, &oid_rt_get_preamble_mode_hdl}, /* 0x96 */
{1, &oid_null_function}, /* 0x97 */
{1, &oid_rt_get_ap_ip_hdl}, /* 0x98 */
{1, &oid_rt_get_channelplan_hdl}, /* 0x99 */
{1, &oid_rt_set_preamble_mode_hdl}, /* 0x9A */
{1, &oid_rt_set_bcn_intvl_hdl}, /* 0x9B */
{1, &oid_null_function}, /* 0x9C */
{1, &oid_rt_dedicate_probe_hdl}, /* 0x9D */
{1, &oid_null_function}, /* 0x9E */
{1, &oid_null_function}, /* 0x9F */
{1, &oid_null_function}, /* 0xA0 */
{1, &oid_null_function}, /* 0xA1 */
{1, &oid_null_function}, /* 0xA2 */
{1, &oid_null_function}, /* 0xA3 */
{1, &oid_null_function}, /* 0xA4 */
{1, &oid_null_function}, /* 0xA5 */
{1, &oid_null_function}, /* 0xA6 */
{1, &oid_rt_get_total_tx_bytes_hdl}, /* 0xA7 */
{1, &oid_rt_get_total_rx_bytes_hdl}, /* 0xA8 */
{1, &oid_rt_current_tx_power_level_hdl}, /* 0xA9 */
{1, &oid_rt_get_enc_key_mismatch_count_hdl}, /* 0xAA */
{1, &oid_rt_get_enc_key_match_count_hdl}, /* 0xAB */
{1, &oid_rt_get_channel_hdl}, /* 0xAC */
{1, &oid_rt_set_channelplan_hdl}, /* 0xAD */
{1, &oid_rt_get_hardware_radio_off_hdl}, /* 0xAE */
{1, &oid_null_function}, /* 0xAF */
{1, &oid_null_function}, /* 0xB0 */
{1, &oid_null_function}, /* 0xB1 */
{1, &oid_null_function}, /* 0xB2 */
{1, &oid_null_function}, /* 0xB3 */
{1, &oid_rt_get_key_mismatch_hdl}, /* 0xB4 */
{1, &oid_null_function}, /* 0xB5 */
{1, &oid_null_function}, /* 0xB6 */
{1, &oid_null_function}, /* 0xB7 */
{1, &oid_null_function}, /* 0xB8 */
{1, &oid_null_function}, /* 0xB9 */
{1, &oid_null_function}, /* 0xBA */
{1, &oid_rt_supported_wireless_mode_hdl}, /* 0xBB */
{1, &oid_rt_get_channel_list_hdl}, /* 0xBC */
{1, &oid_rt_get_scan_in_progress_hdl}, /* 0xBD */
{1, &oid_null_function}, /* 0xBE */
{1, &oid_null_function}, /* 0xBF */
{1, &oid_null_function}, /* 0xC0 */
{1, &oid_rt_forced_data_rate_hdl}, /* 0xC1 */
{1, &oid_rt_wireless_mode_for_scan_list_hdl}, /* 0xC2 */
{1, &oid_rt_get_bss_wireless_mode_hdl}, /* 0xC3 */
{1, &oid_rt_scan_with_magic_packet_hdl}, /* 0xC4 */
{1, &oid_null_function}, /* 0xC5 */
{1, &oid_null_function}, /* 0xC6 */
{1, &oid_null_function}, /* 0xC7 */
{1, &oid_null_function}, /* 0xC8 */
{1, &oid_null_function}, /* 0xC9 */
{1, &oid_null_function}, /* 0xCA */
{1, &oid_null_function}, /* 0xCB */
{1, &oid_null_function}, /* 0xCC */
{1, &oid_null_function}, /* 0xCD */
{1, &oid_null_function}, /* 0xCE */
{1, &oid_null_function}, /* 0xCF */
};
struct oid_obj_priv oid_rtl_seg_01_03[] = {
{1, &oid_rt_ap_get_associated_station_list_hdl}, /* 0x00 */
{1, &oid_null_function}, /* 0x01 */
{1, &oid_rt_ap_switch_into_ap_mode_hdl}, /* 0x02 */
{1, &oid_null_function}, /* 0x03 */
{1, &oid_rt_ap_supported_hdl}, /* 0x04 */
{1, &oid_rt_ap_set_passphrase_hdl}, /* 0x05 */
};
struct oid_obj_priv oid_rtl_seg_01_11[] = {
{1, &oid_null_function}, /* 0xC0 OID_RT_PRO_RX_FILTER */
{1, &oid_null_function}, /* 0xC1 OID_CE_USB_WRITE_REGISTRY */
{1, &oid_null_function}, /* 0xC2 OID_CE_USB_READ_REGISTRY */
{1, &oid_null_function}, /* 0xC3 OID_RT_PRO_SET_INITIAL_GAIN */
{1, &oid_null_function}, /* 0xC4 OID_RT_PRO_SET_BB_RF_STANDBY_MODE */
{1, &oid_null_function}, /* 0xC5 OID_RT_PRO_SET_BB_RF_SHUTDOWN_MODE */
{1, &oid_null_function}, /* 0xC6 OID_RT_PRO_SET_TX_CHARGE_PUMP */
{1, &oid_null_function}, /* 0xC7 OID_RT_PRO_SET_RX_CHARGE_PUMP */
{1, &oid_rt_pro_rf_write_registry_hdl}, /* 0xC8 */
{1, &oid_rt_pro_rf_read_registry_hdl}, /* 0xC9 */
{1, &oid_null_function} /* 0xCA OID_RT_PRO_QUERY_RF_TYPE */
};
struct oid_obj_priv oid_rtl_seg_03_00[] = {
{1, &oid_null_function}, /* 0x00 */
{1, &oid_rt_get_connect_state_hdl}, /* 0x01 */
{1, &oid_null_function}, /* 0x02 */
{1, &oid_null_function}, /* 0x03 */
{1, &oid_rt_set_default_key_id_hdl}, /* 0x04 */
};
/* ************** oid_rtl_seg_01_01 section start ************** */
NDIS_STATUS oid_rt_pro_set_fw_dig_state_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
#if 0
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
_irqL oldirql;
if (poid_par_priv->type_of_oid != SET_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
_irqlevel_changed_(&oldirql, LOWER);
if (poid_par_priv->information_buf_len >= sizeof(struct setdig_parm)) {
/* DEBUG_ERR(("===> oid_rt_pro_set_fw_dig_state_hdl. type:0x%02x.\n",*((unsigned char*)poid_par_priv->information_buf ))); */
if (!rtw_setfwdig_cmd(Adapter, *((unsigned char *)poid_par_priv->information_buf)))
status = NDIS_STATUS_NOT_ACCEPTED;
} else
status = NDIS_STATUS_NOT_ACCEPTED;
_irqlevel_changed_(&oldirql, RAISE);
#endif
return status;
}
/* ----------------------------------------------------------------------------- */
NDIS_STATUS oid_rt_pro_set_fw_ra_state_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
#if 0
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
_irqL oldirql;
if (poid_par_priv->type_of_oid != SET_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
_irqlevel_changed_(&oldirql, LOWER);
if (poid_par_priv->information_buf_len >= sizeof(struct setra_parm)) {
/* DEBUG_ERR(("===> oid_rt_pro_set_fw_ra_state_hdl. type:0x%02x.\n",*((unsigned char*)poid_par_priv->information_buf ))); */
if (!rtw_setfwra_cmd(Adapter, *((unsigned char *)poid_par_priv->information_buf)))
status = NDIS_STATUS_NOT_ACCEPTED;
} else
status = NDIS_STATUS_NOT_ACCEPTED;
_irqlevel_changed_(&oldirql, RAISE);
#endif
return status;
}
/* ----------------------------------------------------------------------------- */
NDIS_STATUS oid_rt_get_signal_quality_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
/* DEBUG_ERR(("<**********************oid_rt_get_signal_quality_hdl\n")); */
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
#if 0
if (pMgntInfo->mAssoc || pMgntInfo->mIbss) {
ulInfo = pAdapter->RxStats.SignalQuality;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else {
ulInfo = 0xffffffff; /* It stands for -1 in 4-byte integer. */
}
break;
#endif
return status;
}
/* ------------------------------------------------------------------------------ */
NDIS_STATUS oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
*(ULONG *)poid_par_priv->information_buf = padapter->recvpriv.rx_smallpacket_crcerr;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else
status = NDIS_STATUS_INVALID_LENGTH;
return status;
}
/* ------------------------------------------------------------------------------ */
NDIS_STATUS oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
*(ULONG *)poid_par_priv->information_buf = padapter->recvpriv.rx_middlepacket_crcerr;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else
status = NDIS_STATUS_INVALID_LENGTH;
return status;
}
/* ------------------------------------------------------------------------------ */
NDIS_STATUS oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
*(ULONG *)poid_par_priv->information_buf = padapter->recvpriv.rx_largepacket_crcerr;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else
status = NDIS_STATUS_INVALID_LENGTH;
return status;
}
/* ------------------------------------------------------------------------------ */
NDIS_STATUS oid_rt_get_tx_retry_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
return status;
}
NDIS_STATUS oid_rt_get_rx_retry_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
return status;
}
/* ------------------------------------------------------------------------------ */
NDIS_STATUS oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
*(u64 *)poid_par_priv->information_buf = padapter->recvpriv.rx_pkts + padapter->recvpriv.rx_drop;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else
status = NDIS_STATUS_INVALID_LENGTH;
return status;
}
/* ------------------------------------------------------------------------------ */
NDIS_STATUS oid_rt_get_tx_beacon_ok_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
return status;
}
NDIS_STATUS oid_rt_get_tx_beacon_err_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
return status;
}
/* ------------------------------------------------------------------------------ */
NDIS_STATUS oid_rt_get_rx_icv_err_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
if (poid_par_priv->information_buf_len >= sizeof(u32)) {
/* _rtw_memcpy(*(uint *)poid_par_priv->information_buf,padapter->recvpriv.rx_icv_err,sizeof(u32)); */
*(uint *)poid_par_priv->information_buf = padapter->recvpriv.rx_icv_err;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else
status = NDIS_STATUS_INVALID_LENGTH ;
return status;
}
/* ------------------------------------------------------------------------------ */
NDIS_STATUS oid_rt_set_encryption_algorithm_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != SET_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
return status;
}
/* ------------------------------------------------------------------------------ */
NDIS_STATUS oid_rt_get_preamble_mode_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
ULONG preamblemode = 0 ;
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
if (padapter->registrypriv.preamble == PREAMBLE_LONG)
preamblemode = 0;
else if (padapter->registrypriv.preamble == PREAMBLE_AUTO)
preamblemode = 1;
else if (padapter->registrypriv.preamble == PREAMBLE_SHORT)
preamblemode = 2;
*(ULONG *)poid_par_priv->information_buf = preamblemode ;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else
status = NDIS_STATUS_INVALID_LENGTH ;
return status;
}
/* ------------------------------------------------------------------------------ */
NDIS_STATUS oid_rt_get_ap_ip_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
return status;
}
NDIS_STATUS oid_rt_get_channelplan_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
struct rf_ctl_t *rfctl = adapter_to_rfctl(padapter);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
*(u16 *)poid_par_priv->information_buf = rfctl->ChannelPlan;
return status;
}
NDIS_STATUS oid_rt_set_channelplan_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
struct rf_ctl_t *rfctl = adapter_to_rfctl(padapter);
if (poid_par_priv->type_of_oid != SET_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
rfctl->ChannelPlan = *(u16 *)poid_par_priv->information_buf;
return status;
}
/* ------------------------------------------------------------------------------ */
NDIS_STATUS oid_rt_set_preamble_mode_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
ULONG preamblemode = 0;
if (poid_par_priv->type_of_oid != SET_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
preamblemode = *(ULONG *)poid_par_priv->information_buf ;
if (preamblemode == 0)
padapter->registrypriv.preamble = PREAMBLE_LONG;
else if (preamblemode == 1)
padapter->registrypriv.preamble = PREAMBLE_AUTO;
else if (preamblemode == 2)
padapter->registrypriv.preamble = PREAMBLE_SHORT;
*(ULONG *)poid_par_priv->information_buf = preamblemode ;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else
status = NDIS_STATUS_INVALID_LENGTH ;
return status;
}
/* ------------------------------------------------------------------------------ */
NDIS_STATUS oid_rt_set_bcn_intvl_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != SET_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
return status;
}
NDIS_STATUS oid_rt_dedicate_probe_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
return status;
}
/* ------------------------------------------------------------------------------ */
NDIS_STATUS oid_rt_get_total_tx_bytes_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
*(u64 *)poid_par_priv->information_buf = padapter->xmitpriv.tx_bytes;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else
status = NDIS_STATUS_INVALID_LENGTH ;
return status;
}
/* ------------------------------------------------------------------------------ */
NDIS_STATUS oid_rt_get_total_rx_bytes_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
/* _rtw_memcpy(*(uint *)poid_par_priv->information_buf,padapter->recvpriv.rx_icv_err,sizeof(u32)); */
*(u64 *)poid_par_priv->information_buf = padapter->recvpriv.rx_bytes;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else
status = NDIS_STATUS_INVALID_LENGTH ;
return status;
}
/* ------------------------------------------------------------------------------ */
NDIS_STATUS oid_rt_current_tx_power_level_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
return status;
}
NDIS_STATUS oid_rt_get_enc_key_mismatch_count_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
return status;
}
NDIS_STATUS oid_rt_get_enc_key_match_count_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
return status;
}
NDIS_STATUS oid_rt_get_channel_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
NDIS_802_11_CONFIGURATION *pnic_Config;
ULONG channelnum;
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
if ((check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) ||
(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE))
pnic_Config = &pmlmepriv->cur_network.network.Configuration;
else
pnic_Config = &padapter->registrypriv.dev_network.Configuration;
channelnum = pnic_Config->DSConfig;
*(ULONG *)poid_par_priv->information_buf = channelnum;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
return status;
}
NDIS_STATUS oid_rt_get_hardware_radio_off_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
return status;
}
NDIS_STATUS oid_rt_get_key_mismatch_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
return status;
}
NDIS_STATUS oid_rt_supported_wireless_mode_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
ULONG ulInfo = 0 ;
/* DEBUG_ERR(("<**********************oid_rt_supported_wireless_mode_hdl\n")); */
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
ulInfo |= 0x0100; /* WIRELESS_MODE_B */
ulInfo |= 0x0200; /* WIRELESS_MODE_G */
ulInfo |= 0x0400; /* WIRELESS_MODE_A */
*(ULONG *) poid_par_priv->information_buf = ulInfo;
/* DEBUG_ERR(("<===oid_rt_supported_wireless_mode %x\n",ulInfo)); */
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else
status = NDIS_STATUS_INVALID_LENGTH;
return status;
}
NDIS_STATUS oid_rt_get_channel_list_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
return status;
}
NDIS_STATUS oid_rt_get_scan_in_progress_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
return status;
}
NDIS_STATUS oid_rt_forced_data_rate_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
return status;
}
NDIS_STATUS oid_rt_wireless_mode_for_scan_list_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
return status;
}
NDIS_STATUS oid_rt_get_bss_wireless_mode_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
return status;
}
NDIS_STATUS oid_rt_scan_with_magic_packet_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
return status;
}
/* ************** oid_rtl_seg_01_01 section end ************** */
/* ************** oid_rtl_seg_01_03 section start ************** */
NDIS_STATUS oid_rt_ap_get_associated_station_list_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
return status;
}
NDIS_STATUS oid_rt_ap_switch_into_ap_mode_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
return status;
}
NDIS_STATUS oid_rt_ap_supported_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
return status;
}
NDIS_STATUS oid_rt_ap_set_passphrase_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != SET_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
return status;
}
/* ************** oid_rtl_seg_01_03 section end ************** */
/* **************** oid_rtl_seg_01_11 section start **************** */
NDIS_STATUS oid_rt_pro_rf_write_registry_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
_irqL oldirql;
/* DEBUG_ERR(("<**********************oid_rt_pro_rf_write_registry_hdl\n")); */
if (poid_par_priv->type_of_oid != SET_OID) { /* QUERY_OID */
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
_irqlevel_changed_(&oldirql, LOWER);
if (poid_par_priv->information_buf_len == (sizeof(unsigned long) * 3)) {
/* RegOffsetValue - The offset of RF register to write. */
/* RegDataWidth - The data width of RF register to write. */
/* RegDataValue - The value to write. */
/* RegOffsetValue = *((unsigned long*)InformationBuffer); */
/* RegDataWidth = *((unsigned long*)InformationBuffer+1); */
/* RegDataValue = *((unsigned long*)InformationBuffer+2); */
if (!rtw_setrfreg_cmd(Adapter,
*(unsigned char *)poid_par_priv->information_buf,
(unsigned long)(*((unsigned long *)poid_par_priv->information_buf + 2))))
status = NDIS_STATUS_NOT_ACCEPTED;
} else
status = NDIS_STATUS_INVALID_LENGTH;
_irqlevel_changed_(&oldirql, RAISE);
return status;
}
/* ------------------------------------------------------------------------------ */
NDIS_STATUS oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
#if 0
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
_irqL oldirql;
/* DEBUG_ERR(("<**********************oid_rt_pro_rf_read_registry_hdl\n")); */
if (poid_par_priv->type_of_oid != SET_OID) { /* QUERY_OID */
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
_irqlevel_changed_(&oldirql, LOWER);
if (poid_par_priv->information_buf_len == (sizeof(unsigned long) * 3)) {
if (Adapter->mppriv.act_in_progress == _TRUE)
status = NDIS_STATUS_NOT_ACCEPTED;
else {
/* init workparam */
Adapter->mppriv.act_in_progress = _TRUE;
Adapter->mppriv.workparam.bcompleted = _FALSE;
Adapter->mppriv.workparam.act_type = MPT_READ_RF;
Adapter->mppriv.workparam.io_offset = *(unsigned long *)poid_par_priv->information_buf;
Adapter->mppriv.workparam.io_value = 0xcccccccc;
/* RegOffsetValue - The offset of RF register to read. */
/* RegDataWidth - The data width of RF register to read. */
/* RegDataValue - The value to read. */
/* RegOffsetValue = *((unsigned long*)InformationBuffer); */
/* RegDataWidth = *((unsigned long*)InformationBuffer+1); */
/* RegDataValue = *((unsigned long*)InformationBuffer+2); */
if (!rtw_getrfreg_cmd(Adapter,
*(unsigned char *)poid_par_priv->information_buf,
(unsigned char *)&Adapter->mppriv.workparam.io_value))
status = NDIS_STATUS_NOT_ACCEPTED;
}
} else
status = NDIS_STATUS_INVALID_LENGTH;
_irqlevel_changed_(&oldirql, RAISE);
#endif
return status;
}
/* **************** oid_rtl_seg_01_11 section end**************** */
/* ************** oid_rtl_seg_03_00 section start ************** */
enum _CONNECT_STATE_ {
CHECKINGSTATUS,
ASSOCIATED,
ADHOCMODE,
NOTASSOCIATED
};
NDIS_STATUS oid_rt_get_connect_state_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
ULONG ulInfo;
if (poid_par_priv->type_of_oid != QUERY_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
/* nStatus==0 CheckingStatus */
/* nStatus==1 Associated */
/* nStatus==2 AdHocMode */
/* nStatus==3 NotAssociated */
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE)
ulInfo = CHECKINGSTATUS;
else if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
ulInfo = ASSOCIATED;
else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE)
ulInfo = ADHOCMODE;
else
ulInfo = NOTASSOCIATED ;
*(ULONG *)poid_par_priv->information_buf = ulInfo;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
#if 0
/* Rearrange the order to let the UI still shows connection when scan is in progress */
if (pMgntInfo->mAssoc)
ulInfo = 1;
else if (pMgntInfo->mIbss)
ulInfo = 2;
else if (pMgntInfo->bScanInProgress)
ulInfo = 0;
else
ulInfo = 3;
ulInfoLen = sizeof(ULONG);
#endif
return status;
}
NDIS_STATUS oid_rt_set_default_key_id_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
if (poid_par_priv->type_of_oid != SET_OID) {
status = NDIS_STATUS_NOT_ACCEPTED;
return status;
}
return status;
}
/* ************** oid_rtl_seg_03_00 section end ************** */

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2007 - 2017 Realtek Corporation. * Copyright(c) 2007 - 2019 Realtek Corporation.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -98,6 +98,12 @@ u8 rtw_do_join(_adapter *padapter)
_rtw_memcpy(&parm.ssid[0], &pmlmepriv->assoc_ssid, sizeof(NDIS_802_11_SSID)); _rtw_memcpy(&parm.ssid[0], &pmlmepriv->assoc_ssid, sizeof(NDIS_802_11_SSID));
parm.ssid_num = 1; parm.ssid_num = 1;
if (pmlmepriv->assoc_ch) {
parm.ch_num = 1;
parm.ch[0].hw_value = pmlmepriv->assoc_ch;
parm.ch[0].flags = 0;
}
if (_rtw_queue_empty(queue) == _TRUE) { if (_rtw_queue_empty(queue) == _TRUE) {
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
@ -197,84 +203,6 @@ exit:
return ret; return ret;
} }
#ifdef PLATFORM_WINDOWS
u8 rtw_pnp_set_power_wakeup(_adapter *padapter)
{
u8 res = _SUCCESS;
res = rtw_setstandby_cmd(padapter, 0);
return res;
}
u8 rtw_pnp_set_power_sleep(_adapter *padapter)
{
u8 res = _SUCCESS;
/* DbgPrint("+rtw_pnp_set_power_sleep\n"); */
res = rtw_setstandby_cmd(padapter, 1);
return res;
}
u8 rtw_set_802_11_reload_defaults(_adapter *padapter, NDIS_802_11_RELOAD_DEFAULTS reloadDefaults)
{
/* SecClearAllKeys(Adapter); */
/* 8711 CAM was not for En/Decrypt only */
/* so, we can't clear all keys. */
/* should we disable WPAcfg (ox0088) bit 1-2, instead of clear all CAM */
/* TO DO... */
return _TRUE;
}
u8 set_802_11_test(_adapter *padapter, NDIS_802_11_TEST *test)
{
u8 ret = _TRUE;
switch (test->Type) {
case 1:
NdisMIndicateStatus(padapter->hndis_adapter, NDIS_STATUS_MEDIA_SPECIFIC_INDICATION, (PVOID)&test->AuthenticationEvent, test->Length - 8);
NdisMIndicateStatusComplete(padapter->hndis_adapter);
break;
case 2:
NdisMIndicateStatus(padapter->hndis_adapter, NDIS_STATUS_MEDIA_SPECIFIC_INDICATION, (PVOID)&test->RssiTrigger, sizeof(NDIS_802_11_RSSI));
NdisMIndicateStatusComplete(padapter->hndis_adapter);
break;
default:
ret = _FALSE;
break;
}
return ret;
}
u8 rtw_set_802_11_pmkid(_adapter *padapter, NDIS_802_11_PMKID *pmkid)
{
u8 ret = _SUCCESS;
return ret;
}
#endif
u8 rtw_set_802_11_bssid(_adapter *padapter, u8 *bssid) u8 rtw_set_802_11_bssid(_adapter *padapter, u8 *bssid)
{ {
_irqL irqL; _irqL irqL;
@ -329,6 +257,7 @@ handle_tkip_countermeasure:
_rtw_memset(&pmlmepriv->assoc_ssid, 0, sizeof(NDIS_802_11_SSID)); _rtw_memset(&pmlmepriv->assoc_ssid, 0, sizeof(NDIS_802_11_SSID));
_rtw_memcpy(&pmlmepriv->assoc_bssid, bssid, ETH_ALEN); _rtw_memcpy(&pmlmepriv->assoc_bssid, bssid, ETH_ALEN);
pmlmepriv->assoc_ch = 0;
pmlmepriv->assoc_by_bssid = _TRUE; pmlmepriv->assoc_by_bssid = _TRUE;
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE)
@ -395,7 +324,7 @@ u8 rtw_set_802_11_ssid(_adapter *padapter, NDIS_802_11_SSID *ssid)
} }
#ifdef CONFIG_LPS #ifdef CONFIG_LPS
else else
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_JOINBSS, 1); rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_JOINBSS, 0);
#endif #endif
} else { } else {
@ -425,6 +354,7 @@ handle_tkip_countermeasure:
} }
_rtw_memcpy(&pmlmepriv->assoc_ssid, ssid, sizeof(NDIS_802_11_SSID)); _rtw_memcpy(&pmlmepriv->assoc_ssid, ssid, sizeof(NDIS_802_11_SSID));
pmlmepriv->assoc_ch = 0;
pmlmepriv->assoc_by_bssid = _FALSE; pmlmepriv->assoc_by_bssid = _FALSE;
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE)
@ -442,7 +372,8 @@ exit:
} }
u8 rtw_set_802_11_connect(_adapter *padapter, u8 *bssid, NDIS_802_11_SSID *ssid) u8 rtw_set_802_11_connect(_adapter *padapter,
u8 *bssid, NDIS_802_11_SSID *ssid, u16 ch)
{ {
_irqL irqL; _irqL irqL;
u8 status = _SUCCESS; u8 status = _SUCCESS;
@ -496,6 +427,8 @@ handle_tkip_countermeasure:
} else } else
pmlmepriv->assoc_by_bssid = _FALSE; pmlmepriv->assoc_by_bssid = _FALSE;
pmlmepriv->assoc_ch = ch;
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE)
pmlmepriv->to_join = _TRUE; pmlmepriv->to_join = _TRUE;
else else
@ -505,13 +438,11 @@ release_mlme_lock:
_exit_critical_bh(&pmlmepriv->lock, &irqL); _exit_critical_bh(&pmlmepriv->lock, &irqL);
exit: exit:
return status; return status;
} }
u8 rtw_set_802_11_infrastructure_mode(_adapter *padapter, u8 rtw_set_802_11_infrastructure_mode(_adapter *padapter,
NDIS_802_11_NETWORK_INFRASTRUCTURE networktype) NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, u8 flags)
{ {
_irqL irqL; _irqL irqL;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@ -519,6 +450,7 @@ u8 rtw_set_802_11_infrastructure_mode(_adapter *padapter,
NDIS_802_11_NETWORK_INFRASTRUCTURE *pold_state = &(cur_network->network.InfrastructureMode); NDIS_802_11_NETWORK_INFRASTRUCTURE *pold_state = &(cur_network->network.InfrastructureMode);
u8 ap2sta_mode = _FALSE; u8 ap2sta_mode = _FALSE;
u8 ret = _TRUE; u8 ret = _TRUE;
u8 is_linked = _FALSE, is_adhoc_master = _FALSE;
if (*pold_state != networktype) { if (*pold_state != networktype) {
/* RTW_INFO("change mode, old_mode=%d, new_mode=%d, fw_state=0x%x\n", *pold_state, networktype, get_fwstate(pmlmepriv)); */ /* RTW_INFO("change mode, old_mode=%d, new_mode=%d, fw_state=0x%x\n", *pold_state, networktype, get_fwstate(pmlmepriv)); */
@ -535,20 +467,30 @@ u8 rtw_set_802_11_infrastructure_mode(_adapter *padapter,
} }
_enter_critical_bh(&pmlmepriv->lock, &irqL); _enter_critical_bh(&pmlmepriv->lock, &irqL);
is_linked = check_fwstate(pmlmepriv, _FW_LINKED);
is_adhoc_master = check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
if ((check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) || (*pold_state == Ndis802_11IBSS)) /* flags = 0, means enqueue cmd and no wait */
rtw_disassoc_cmd(padapter, 0, 0); if (flags != 0)
_exit_critical_bh(&pmlmepriv->lock, &irqL);
if ((check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) || if ((is_linked == _TRUE) || (*pold_state == Ndis802_11IBSS))
(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE)) rtw_disassoc_cmd(padapter, 0, flags);
rtw_free_assoc_resources_cmd(padapter, _TRUE, 0);
if ((is_linked == _TRUE) ||
(is_adhoc_master == _TRUE))
rtw_free_assoc_resources_cmd(padapter, _TRUE, flags);
if ((*pold_state == Ndis802_11Infrastructure) || (*pold_state == Ndis802_11IBSS)) { if ((*pold_state == Ndis802_11Infrastructure) || (*pold_state == Ndis802_11IBSS)) {
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) { if (is_linked == _TRUE) {
rtw_indicate_disconnect(padapter, 0, _FALSE); /*will clr Linked_state; before this function, we must have checked whether issue dis-assoc_cmd or not*/ rtw_indicate_disconnect(padapter, 0, _FALSE); /*will clr Linked_state; before this function, we must have checked whether issue dis-assoc_cmd or not*/
} }
} }
/* flags = 0, means enqueue cmd and no wait */
if (flags != 0)
_enter_critical_bh(&pmlmepriv->lock, &irqL);
*pold_state = networktype; *pold_state = networktype;
_clr_fwstate_(pmlmepriv, ~WIFI_NULL_STATE); _clr_fwstate_(pmlmepriv, ~WIFI_NULL_STATE);
@ -683,6 +625,71 @@ exit:
return res; return res;
} }
#endif #endif
#ifdef CONFIG_RTW_ACS
u8 rtw_set_acs_sitesurvey(_adapter *adapter)
{
struct rf_ctl_t *rfctl = adapter_to_rfctl(adapter);
struct sitesurvey_parm parm;
u8 uch;
u8 ch_num = 0;
int i;
BAND_TYPE band;
u8 (*center_chs_num)(u8) = NULL;
u8 (*center_chs)(u8, u8) = NULL;
u8 ret = _FAIL;
if (!rtw_mi_get_ch_setting_union(adapter, &uch, NULL, NULL))
goto exit;
_rtw_memset(&parm, 0, sizeof(struct sitesurvey_parm));
parm.scan_mode = SCAN_PASSIVE;
parm.bw = CHANNEL_WIDTH_20;
parm.acs = 1;
for (band = BAND_ON_2_4G; band < BAND_MAX; band++) {
if (band == BAND_ON_2_4G) {
center_chs_num = center_chs_2g_num;
center_chs = center_chs_2g;
} else
#ifdef CONFIG_IEEE80211_BAND_5GHZ
if (band == BAND_ON_5G) {
center_chs_num = center_chs_5g_num;
center_chs = center_chs_5g;
} else
#endif
{
center_chs_num = NULL;
center_chs = NULL;
}
if (!center_chs_num || !center_chs)
continue;
if (rfctl->ch_sel_within_same_band) {
if (rtw_is_2g_ch(uch) && band != BAND_ON_2_4G)
continue;
#ifdef CONFIG_IEEE80211_BAND_5GHZ
if (rtw_is_5g_ch(uch) && band != BAND_ON_5G)
continue;
#endif
}
ch_num = center_chs_num(CHANNEL_WIDTH_20);
for (i = 0; i < ch_num && parm.ch_num < RTW_CHANNEL_SCAN_AMOUNT; i++) {
parm.ch[parm.ch_num].hw_value = center_chs(CHANNEL_WIDTH_20, i);
parm.ch[parm.ch_num].flags = RTW_IEEE80211_CHAN_PASSIVE_SCAN;
parm.ch_num++;
}
}
ret = rtw_set_802_11_bssid_list_scan(adapter, &parm);
exit:
return ret;
}
#endif /* CONFIG_RTW_ACS */
u8 rtw_set_802_11_authentication_mode(_adapter *padapter, NDIS_802_11_AUTHENTICATION_MODE authmode) u8 rtw_set_802_11_authentication_mode(_adapter *padapter, NDIS_802_11_AUTHENTICATION_MODE authmode)
{ {
struct security_priv *psecuritypriv = &padapter->securitypriv; struct security_priv *psecuritypriv = &padapter->securitypriv;
@ -780,9 +787,6 @@ u16 rtw_get_cur_max_rate(_adapter *adapter)
unsigned char sta_bssrate[NumRates]; unsigned char sta_bssrate[NumRates];
struct sta_info *psta = NULL; struct sta_info *psta = NULL;
u8 short_GI = 0; u8 short_GI = 0;
#ifdef CONFIG_80211N_HT
u8 rf_type = 0;
#endif
#ifdef CONFIG_MP_INCLUDED #ifdef CONFIG_MP_INCLUDED
if (adapter->registrypriv.mp_mode == 1) { if (adapter->registrypriv.mp_mode == 1) {
@ -803,9 +807,7 @@ u16 rtw_get_cur_max_rate(_adapter *adapter)
#ifdef CONFIG_80211N_HT #ifdef CONFIG_80211N_HT
if (is_supported_ht(psta->wireless_mode)) { if (is_supported_ht(psta->wireless_mode)) {
rtw_hal_get_hwreg(adapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); max_rate = rtw_ht_mcs_rate((psta->cmn.bw_mode == CHANNEL_WIDTH_40) ? 1 : 0
max_rate = rtw_mcs_rate(rf_type
, (psta->cmn.bw_mode == CHANNEL_WIDTH_40) ? 1 : 0
, short_GI , short_GI
, psta->htpriv.ht_cap.supp_mcs_set , psta->htpriv.ht_cap.supp_mcs_set
); );

View File

@ -301,24 +301,30 @@ int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value)
#ifdef DBG_IO #ifdef DBG_IO
int dbg_rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, const char *caller, const int line) int dbg_rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, const char *caller, const int line)
{ {
if (match_write_sniff_ranges(addr, 1)) if (match_write_sniff(xmit_frame->padapter, addr, 1, value)) {
RTW_INFO("DBG_IO %s:%d IOL_WB(0x%04x, 0x%02x)\n", caller, line, addr, value); RTW_INFO("DBG_IO %s:%d IOL_WB(0x%04x, 0x%02x)\n"
, caller, line, addr, value);
}
return _rtw_IOL_append_WB_cmd(xmit_frame, addr, value); return _rtw_IOL_append_WB_cmd(xmit_frame, addr, value);
} }
int dbg_rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, const char *caller, const int line) int dbg_rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, const char *caller, const int line)
{ {
if (match_write_sniff_ranges(addr, 2)) if (match_write_sniff(xmit_frame->padapter, addr, 2, value)) {
RTW_INFO("DBG_IO %s:%d IOL_WW(0x%04x, 0x%04x)\n", caller, line, addr, value); RTW_INFO("DBG_IO %s:%d IOL_WW(0x%04x, 0x%04x)\n"
, caller, line, addr, value);
}
return _rtw_IOL_append_WW_cmd(xmit_frame, addr, value); return _rtw_IOL_append_WW_cmd(xmit_frame, addr, value);
} }
int dbg_rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, const char *caller, const int line) int dbg_rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, const char *caller, const int line)
{ {
if (match_write_sniff_ranges(addr, 4)) if (match_write_sniff(xmit_frame->padapter, addr, 4, value)) {
RTW_INFO("DBG_IO %s:%d IOL_WD(0x%04x, 0x%08x)\n", caller, line, addr, value); RTW_INFO("DBG_IO %s:%d IOL_WD(0x%04x, 0x%08x)\n"
, caller, line, addr, value);
}
return _rtw_IOL_append_WD_cmd(xmit_frame, addr, value); return _rtw_IOL_append_WD_cmd(xmit_frame, addr, value);
} }

View File

@ -754,12 +754,6 @@ void rtw_mi_buddy_intf_stop(_adapter *adapter)
} }
#ifdef CONFIG_NEW_NETDEV_HDL #ifdef CONFIG_NEW_NETDEV_HDL
static u8 _rtw_mi_hal_iface_init(_adapter *padapter, void *data)
{
if (rtw_hal_iface_init(padapter) == _SUCCESS)
return _TRUE;
return _FALSE;
}
u8 rtw_mi_hal_iface_init(_adapter *padapter) u8 rtw_mi_hal_iface_init(_adapter *padapter)
{ {
int i; int i;
@ -832,7 +826,7 @@ static u8 _rtw_mi_beacon_update(_adapter *padapter, void *data)
if (!MLME_IS_STA(padapter) if (!MLME_IS_STA(padapter)
&& check_fwstate(&padapter->mlmepriv, _FW_LINKED) == _TRUE) { && check_fwstate(&padapter->mlmepriv, _FW_LINKED) == _TRUE) {
RTW_INFO(ADPT_FMT" - update_beacon\n", ADPT_ARG(padapter)); RTW_INFO(ADPT_FMT" - update_beacon\n", ADPT_ARG(padapter));
update_beacon(padapter, 0xFF, NULL, _TRUE); update_beacon(padapter, 0xFF, NULL, _TRUE, 0);
} }
return _TRUE; return _TRUE;
} }
@ -1177,6 +1171,29 @@ u8 rtw_mi_sreset_adapter_hdl(_adapter *padapter, u8 bstart)
return _rtw_mi_process(padapter, _FALSE, &in_data, _rtw_mi_sreset_adapter_hdl); return _rtw_mi_process(padapter, _FALSE, &in_data, _rtw_mi_sreset_adapter_hdl);
} }
#if defined(DBG_CONFIG_ERROR_RESET) && defined(CONFIG_CONCURRENT_MODE)
void rtw_mi_ap_info_restore(_adapter *adapter)
{
int i;
_adapter *iface;
struct mlme_priv *pmlmepriv;
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
for (i = 0; i < dvobj->iface_nums; i++) {
iface = dvobj->padapters[i];
if (iface) {
pmlmepriv = &iface->mlmepriv;
if (MLME_IS_AP(iface) || MLME_IS_MESH(iface)) {
RTW_INFO(FUNC_ADPT_FMT" %s\n", FUNC_ADPT_ARG(iface), MLME_IS_AP(iface) ? "AP" : "MESH");
rtw_iface_bcmc_sec_cam_map_restore(iface);
}
}
}
}
#endif /*#if defined(DBG_CONFIG_ERROR_RESET) && defined(CONFIG_CONCURRENT_MODE)*/
u8 rtw_mi_buddy_sreset_adapter_hdl(_adapter *padapter, u8 bstart) u8 rtw_mi_buddy_sreset_adapter_hdl(_adapter *padapter, u8 bstart)
{ {
u8 in_data = bstart; u8 in_data = bstart;
@ -1212,7 +1229,7 @@ static u8 _rtw_mi_set_tx_beacon_cmd(_adapter *adapter, void *data)
if (MLME_IS_AP(adapter) || MLME_IS_MESH(adapter)) { if (MLME_IS_AP(adapter) || MLME_IS_MESH(adapter)) {
if (pmlmepriv->update_bcn == _TRUE) if (pmlmepriv->update_bcn == _TRUE)
set_tx_beacon_cmd(adapter); set_tx_beacon_cmd(adapter, 0);
} }
return _TRUE; return _TRUE;
} }
@ -1266,13 +1283,14 @@ u8 rtw_mi_buddy_stay_in_p2p_mode(_adapter *padapter)
_adapter *rtw_get_iface_by_id(_adapter *padapter, u8 iface_id) _adapter *rtw_get_iface_by_id(_adapter *padapter, u8 iface_id)
{ {
_adapter *iface = NULL; _adapter *iface = NULL;
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); struct dvobj_priv *dvobj;
if ((padapter == NULL) || (iface_id >= CONFIG_IFACE_NUMBER)) { if ((padapter == NULL) || (iface_id >= CONFIG_IFACE_NUMBER)) {
rtw_warn_on(1); rtw_warn_on(1);
return iface; return iface;
} }
dvobj = adapter_to_dvobj(padapter);
return dvobj->padapters[iface_id]; return dvobj->padapters[iface_id];
} }

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2007 - 2017 Realtek Corporation. * Copyright(c) 2007 - 2019 Realtek Corporation.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -385,6 +385,7 @@ struct wlan_network *_rtw_alloc_network(struct mlme_priv *pmlmepriv) /* (_queue
pnetwork->network_type = 0; pnetwork->network_type = 0;
pnetwork->fixed = _FALSE; pnetwork->fixed = _FALSE;
pnetwork->last_scanned = rtw_get_current_time(); pnetwork->last_scanned = rtw_get_current_time();
pnetwork->last_non_hidden_ssid_ap = pnetwork->last_scanned;
#if defined(CONFIG_RTW_MESH) && CONFIG_RTW_MESH_ACNODE_PREVENT #if defined(CONFIG_RTW_MESH) && CONFIG_RTW_MESH_ACNODE_PREVENT
pnetwork->acnode_stime = 0; pnetwork->acnode_stime = 0;
pnetwork->acnode_notify_etime = 0; pnetwork->acnode_notify_etime = 0;
@ -939,7 +940,7 @@ bool rtw_update_scanned_network(_adapter *adapter, WLAN_BSSID_EX *target)
{ {
_irqL irqL; _irqL irqL;
_list *plist, *phead; _list *plist, *phead;
ULONG bssid_ex_sz; u32 bssid_ex_sz;
struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &(adapter->wdinfo); struct wifidirect_info *pwdinfo = &(adapter->wdinfo);
@ -1037,10 +1038,13 @@ bool rtw_update_scanned_network(_adapter *adapter, WLAN_BSSID_EX *target)
rtw_hal_get_odm_var(adapter, HAL_ODM_ANTDIV_SELECT, &(target->PhyInfo.Optimum_antenna), NULL); rtw_hal_get_odm_var(adapter, HAL_ODM_ANTDIV_SELECT, &(target->PhyInfo.Optimum_antenna), NULL);
#endif #endif
_rtw_memcpy(&(pnetwork->network), target, get_WLAN_BSSID_EX_sz(target)); _rtw_memcpy(&(pnetwork->network), target, get_WLAN_BSSID_EX_sz(target));
/* pnetwork->last_scanned = rtw_get_current_time(); */ pnetwork->bcn_keys_valid = 0;
if (target->Reserved[0] == BSS_TYPE_BCN || target->Reserved[0] == BSS_TYPE_PROB_RSP)
rtw_update_bcn_keys_of_network(pnetwork);
/* variable initialize */ /* variable initialize */
pnetwork->fixed = _FALSE; pnetwork->fixed = _FALSE;
pnetwork->last_scanned = rtw_get_current_time(); pnetwork->last_scanned = rtw_get_current_time();
pnetwork->last_non_hidden_ssid_ap = pnetwork->last_scanned;
#if defined(CONFIG_RTW_MESH) && CONFIG_RTW_MESH_ACNODE_PREVENT #if defined(CONFIG_RTW_MESH) && CONFIG_RTW_MESH_ACNODE_PREVENT
pnetwork->acnode_stime = 0; pnetwork->acnode_stime = 0;
pnetwork->acnode_notify_etime = 0; pnetwork->acnode_notify_etime = 0;
@ -1066,8 +1070,9 @@ bool rtw_update_scanned_network(_adapter *adapter, WLAN_BSSID_EX *target)
rtw_hal_get_odm_var(adapter, HAL_ODM_ANTDIV_SELECT, &(target->PhyInfo.Optimum_antenna), NULL); rtw_hal_get_odm_var(adapter, HAL_ODM_ANTDIV_SELECT, &(target->PhyInfo.Optimum_antenna), NULL);
#endif #endif
_rtw_memcpy(&(pnetwork->network), target, bssid_ex_sz); _rtw_memcpy(&(pnetwork->network), target, bssid_ex_sz);
pnetwork->bcn_keys_valid = 0;
pnetwork->last_scanned = rtw_get_current_time(); if (target->Reserved[0] == BSS_TYPE_BCN || target->Reserved[0] == BSS_TYPE_PROB_RSP)
rtw_update_bcn_keys_of_network(pnetwork);
/* bss info not receving from the right channel */ /* bss info not receving from the right channel */
if (pnetwork->network.PhyInfo.SignalQuality == 101) if (pnetwork->network.PhyInfo.SignalQuality == 101)
@ -1084,21 +1089,36 @@ bool rtw_update_scanned_network(_adapter *adapter, WLAN_BSSID_EX *target)
#if defined(CONFIG_RTW_MESH) && CONFIG_RTW_MESH_ACNODE_PREVENT #if defined(CONFIG_RTW_MESH) && CONFIG_RTW_MESH_ACNODE_PREVENT
systime last_scanned = pnetwork->last_scanned; systime last_scanned = pnetwork->last_scanned;
#endif #endif
struct beacon_keys bcn_keys;
bool bcn_keys_valid = 0;
bool is_hidden_ssid_ap = 0;
pnetwork->last_scanned = rtw_get_current_time(); pnetwork->last_scanned = rtw_get_current_time();
/* target.Reserved[0]==BSS_TYPE_BCN, means that scanned network is a bcn frame. */ if (target->Reserved[0] == BSS_TYPE_BCN || target->Reserved[0] == BSS_TYPE_PROB_RSP) {
if ((pnetwork->network.IELength > target->IELength) && (target->Reserved[0] == BSS_TYPE_BCN)) if (target->InfrastructureMode == Ndis802_11Infrastructure) {
update_ie = _FALSE; is_hidden_ssid_ap = hidden_ssid_ap(target);
if (!is_hidden_ssid_ap) /* update last time it's non hidden ssid AP */
pnetwork->last_non_hidden_ssid_ap = rtw_get_current_time();
}
bcn_keys_valid = rtw_get_bcn_keys_from_bss(target, &bcn_keys);
}
if (MLME_IS_MESH(adapter) if (target->InfrastructureMode == Ndis802_11_mesh
/* probe resp(3) > beacon(1) > probe req(2) */ || target->Reserved[0] >= pnetwork->network.Reserved[0])
|| (target->Reserved[0] != BSS_TYPE_PROB_REQ
&& target->Reserved[0] >= pnetwork->network.Reserved[0])
)
update_ie = _TRUE; update_ie = _TRUE;
else else if (target->InfrastructureMode == Ndis802_11Infrastructure && !pnetwork->fixed
update_ie = _FALSE; && rtw_get_passing_time_ms(pnetwork->last_non_hidden_ssid_ap) > SCANQUEUE_LIFETIME)
update_ie = _TRUE;
else if (bcn_keys_valid) {
if (is_hidden_ssid(bcn_keys.ssid, bcn_keys.ssid_len)) {
/* hidden ssid, replace with current beacon ssid directly */
_rtw_memcpy(bcn_keys.ssid, pnetwork->bcn_keys.ssid, pnetwork->bcn_keys.ssid_len);
bcn_keys.ssid_len = pnetwork->bcn_keys.ssid_len;
}
if (rtw_bcn_key_compare(&pnetwork->bcn_keys, &bcn_keys) == _FALSE)
update_ie = _TRUE;
}
#if defined(CONFIG_RTW_MESH) && CONFIG_RTW_MESH_ACNODE_PREVENT #if defined(CONFIG_RTW_MESH) && CONFIG_RTW_MESH_ACNODE_PREVENT
if (!MLME_IS_MESH(adapter) || !MLME_IS_ASOC(adapter) if (!MLME_IS_MESH(adapter) || !MLME_IS_ASOC(adapter)
@ -1110,6 +1130,13 @@ bool rtw_update_scanned_network(_adapter *adapter, WLAN_BSSID_EX *target)
pnetwork->acnode_notify_etime = 0; pnetwork->acnode_notify_etime = 0;
} }
#endif #endif
if (bcn_keys_valid) {
_rtw_memcpy(&pnetwork->bcn_keys, &bcn_keys, sizeof(bcn_keys));
pnetwork->bcn_keys_valid = 1;
} else if (update_ie)
pnetwork->bcn_keys_valid = 0;
update_network(&(pnetwork->network), target, adapter, update_ie); update_network(&(pnetwork->network), target, adapter, update_ie);
} }
@ -1225,6 +1252,258 @@ void rtw_atimdone_event_callback(_adapter *adapter , u8 *pbuf)
} }
#ifdef CONFIG_80211D
static void process_80211d(PADAPTER padapter, WLAN_BSSID_EX *bssid)
{
struct rf_ctl_t *rfctl = adapter_to_rfctl(padapter);
struct registry_priv *pregistrypriv;
struct mlme_ext_priv *pmlmeext;
RT_CHANNEL_INFO *chplan_new;
u8 channel;
u8 i;
pregistrypriv = &padapter->registrypriv;
pmlmeext = &padapter->mlmeextpriv;
/* Adjust channel plan by AP Country IE */
if (pregistrypriv->enable80211d
&& (!pmlmeext->update_channel_plan_by_ap_done)) {
u8 *ie, *p;
u32 len;
RT_CHANNEL_PLAN chplan_ap;
RT_CHANNEL_INFO *chplan_sta = NULL;
u8 country[4];
u8 fcn; /* first channel number */
u8 noc; /* number of channel */
u8 j, k;
ie = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _COUNTRY_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
if (!ie)
return;
if (len < 6)
return;
ie += 2;
p = ie;
ie += len;
_rtw_memset(country, 0, 4);
_rtw_memcpy(country, p, 3);
p += 3;
RTW_INFO("%s: 802.11d country=%s\n", __FUNCTION__, country);
i = 0;
while ((ie - p) >= 3) {
fcn = *(p++);
noc = *(p++);
p++;
for (j = 0; j < noc; j++) {
if (fcn <= 14)
channel = fcn + j; /* 2.4 GHz */
else
channel = fcn + j * 4; /* 5 GHz */
chplan_ap.Channel[i++] = channel;
}
}
chplan_ap.Len = i;
#ifdef CONFIG_RTW_DEBUG
i = 0;
RTW_INFO("%s: AP[%s] channel plan {", __FUNCTION__, bssid->Ssid.Ssid);
while ((i < chplan_ap.Len) && (chplan_ap.Channel[i] != 0)) {
_RTW_INFO("%02d,", chplan_ap.Channel[i]);
i++;
}
_RTW_INFO("}\n");
#endif
chplan_sta = rtw_malloc(sizeof(RT_CHANNEL_INFO) * MAX_CHANNEL_NUM);
if (!chplan_sta)
goto done_update_chplan_from_ap;
_rtw_memcpy(chplan_sta, rfctl->channel_set, sizeof(RT_CHANNEL_INFO) * MAX_CHANNEL_NUM);
#ifdef CONFIG_RTW_DEBUG
i = 0;
RTW_INFO("%s: STA channel plan {", __FUNCTION__);
while ((i < MAX_CHANNEL_NUM) && (chplan_sta[i].ChannelNum != 0)) {
_RTW_INFO("%02d(%c),", chplan_sta[i].ChannelNum, chplan_sta[i].ScanType == SCAN_PASSIVE ? 'p' : 'a');
i++;
}
_RTW_INFO("}\n");
#endif
_rtw_memset(rfctl->channel_set, 0, sizeof(rfctl->channel_set));
chplan_new = rfctl->channel_set;
i = j = k = 0;
if (pregistrypriv->wireless_mode & WIRELESS_11G) {
do {
if ((i == MAX_CHANNEL_NUM)
|| (chplan_sta[i].ChannelNum == 0)
|| (chplan_sta[i].ChannelNum > 14))
break;
if ((j == chplan_ap.Len) || (chplan_ap.Channel[j] > 14))
break;
if (chplan_sta[i].ChannelNum == chplan_ap.Channel[j]) {
chplan_new[k].ChannelNum = chplan_ap.Channel[j];
chplan_new[k].ScanType = SCAN_ACTIVE;
i++;
j++;
k++;
} else if (chplan_sta[i].ChannelNum < chplan_ap.Channel[j]) {
chplan_new[k].ChannelNum = chplan_sta[i].ChannelNum;
#if 0
chplan_new[k].ScanType = chplan_sta[i].ScanType;
#else
chplan_new[k].ScanType = SCAN_PASSIVE;
#endif
i++;
k++;
} else if (chplan_sta[i].ChannelNum > chplan_ap.Channel[j]) {
chplan_new[k].ChannelNum = chplan_ap.Channel[j];
chplan_new[k].ScanType = SCAN_ACTIVE;
j++;
k++;
}
} while (1);
/* change AP not support channel to Passive scan */
while ((i < MAX_CHANNEL_NUM)
&& (chplan_sta[i].ChannelNum != 0)
&& (chplan_sta[i].ChannelNum <= 14)) {
chplan_new[k].ChannelNum = chplan_sta[i].ChannelNum;
#if 0
chplan_new[k].ScanType = chplan_sta[i].ScanType;
#else
chplan_new[k].ScanType = SCAN_PASSIVE;
#endif
i++;
k++;
}
/* add channel AP supported */
while ((j < chplan_ap.Len) && (chplan_ap.Channel[j] <= 14)) {
chplan_new[k].ChannelNum = chplan_ap.Channel[j];
chplan_new[k].ScanType = SCAN_ACTIVE;
j++;
k++;
}
} else {
/* keep original STA 2.4G channel plan */
while ((i < MAX_CHANNEL_NUM)
&& (chplan_sta[i].ChannelNum != 0)
&& (chplan_sta[i].ChannelNum <= 14)) {
chplan_new[k].ChannelNum = chplan_sta[i].ChannelNum;
chplan_new[k].ScanType = chplan_sta[i].ScanType;
i++;
k++;
}
/* skip AP 2.4G channel plan */
while ((j < chplan_ap.Len) && (chplan_ap.Channel[j] <= 14))
j++;
}
if (pregistrypriv->wireless_mode & WIRELESS_11A) {
do {
if ((i >= MAX_CHANNEL_NUM)
|| (chplan_sta[i].ChannelNum == 0))
break;
if ((j == chplan_ap.Len) || (chplan_ap.Channel[j] == 0))
break;
if (chplan_sta[i].ChannelNum == chplan_ap.Channel[j]) {
chplan_new[k].ChannelNum = chplan_ap.Channel[j];
chplan_new[k].ScanType = SCAN_ACTIVE;
i++;
j++;
k++;
} else if (chplan_sta[i].ChannelNum < chplan_ap.Channel[j]) {
chplan_new[k].ChannelNum = chplan_sta[i].ChannelNum;
#if 0
chplan_new[k].ScanType = chplan_sta[i].ScanType;
#else
chplan_new[k].ScanType = SCAN_PASSIVE;
#endif
i++;
k++;
} else if (chplan_sta[i].ChannelNum > chplan_ap.Channel[j]) {
chplan_new[k].ChannelNum = chplan_ap.Channel[j];
chplan_new[k].ScanType = SCAN_ACTIVE;
j++;
k++;
}
} while (1);
/* change AP not support channel to Passive scan */
while ((i < MAX_CHANNEL_NUM) && (chplan_sta[i].ChannelNum != 0)) {
chplan_new[k].ChannelNum = chplan_sta[i].ChannelNum;
#if 0
chplan_new[k].ScanType = chplan_sta[i].ScanType;
#else
chplan_new[k].ScanType = SCAN_PASSIVE;
#endif
i++;
k++;
}
/* add channel AP supported */
while ((j < chplan_ap.Len) && (chplan_ap.Channel[j] != 0)) {
chplan_new[k].ChannelNum = chplan_ap.Channel[j];
chplan_new[k].ScanType = SCAN_ACTIVE;
j++;
k++;
}
} else {
/* keep original STA 5G channel plan */
while ((i < MAX_CHANNEL_NUM) && (chplan_sta[i].ChannelNum != 0)) {
chplan_new[k].ChannelNum = chplan_sta[i].ChannelNum;
chplan_new[k].ScanType = chplan_sta[i].ScanType;
i++;
k++;
}
}
pmlmeext->update_channel_plan_by_ap_done = 1;
#ifdef CONFIG_RTW_DEBUG
k = 0;
RTW_INFO("%s: new STA channel plan {", __FUNCTION__);
while ((k < MAX_CHANNEL_NUM) && (chplan_new[k].ChannelNum != 0)) {
_RTW_INFO("%02d(%c),", chplan_new[k].ChannelNum, chplan_new[k].ScanType == SCAN_PASSIVE ? 'p' : 'c');
k++;
}
_RTW_INFO("}\n");
#endif
#if 0
/* recover the right channel index */
channel = chplan_sta[pmlmeext->sitesurvey_res.channel_idx].ChannelNum;
k = 0;
while ((k < MAX_CHANNEL_NUM) && (chplan_new[k].ChannelNum != 0)) {
if (chplan_new[k].ChannelNum == channel) {
RTW_INFO("%s: change mlme_ext sitesurvey channel index from %d to %d\n",
__FUNCTION__, pmlmeext->sitesurvey_res.channel_idx, k);
pmlmeext->sitesurvey_res.channel_idx = k;
break;
}
k++;
}
#endif
done_update_chplan_from_ap:
if (chplan_sta)
rtw_mfree(chplan_sta, sizeof(RT_CHANNEL_INFO) * MAX_CHANNEL_NUM);
}
}
#endif
void rtw_survey_event_callback(_adapter *adapter, u8 *pbuf) void rtw_survey_event_callback(_adapter *adapter, u8 *pbuf)
{ {
_irqL irqL; _irqL irqL;
@ -1232,34 +1511,19 @@ void rtw_survey_event_callback(_adapter *adapter, u8 *pbuf)
WLAN_BSSID_EX *pnetwork; WLAN_BSSID_EX *pnetwork;
struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
pnetwork = (WLAN_BSSID_EX *)pbuf; pnetwork = (WLAN_BSSID_EX *)pbuf;
#ifdef CONFIG_RTL8712
/* endian_convert */
pnetwork->Length = le32_to_cpu(pnetwork->Length);
pnetwork->Ssid.SsidLength = le32_to_cpu(pnetwork->Ssid.SsidLength);
pnetwork->Privacy = le32_to_cpu(pnetwork->Privacy);
pnetwork->Rssi = le32_to_cpu(pnetwork->Rssi);
pnetwork->NetworkTypeInUse = le32_to_cpu(pnetwork->NetworkTypeInUse);
pnetwork->Configuration.ATIMWindow = le32_to_cpu(pnetwork->Configuration.ATIMWindow);
pnetwork->Configuration.BeaconPeriod = le32_to_cpu(pnetwork->Configuration.BeaconPeriod);
pnetwork->Configuration.DSConfig = le32_to_cpu(pnetwork->Configuration.DSConfig);
pnetwork->Configuration.FHConfig.DwellTime = le32_to_cpu(pnetwork->Configuration.FHConfig.DwellTime);
pnetwork->Configuration.FHConfig.HopPattern = le32_to_cpu(pnetwork->Configuration.FHConfig.HopPattern);
pnetwork->Configuration.FHConfig.HopSet = le32_to_cpu(pnetwork->Configuration.FHConfig.HopSet);
pnetwork->Configuration.FHConfig.Length = le32_to_cpu(pnetwork->Configuration.FHConfig.Length);
pnetwork->Configuration.Length = le32_to_cpu(pnetwork->Configuration.Length);
pnetwork->InfrastructureMode = le32_to_cpu(pnetwork->InfrastructureMode);
pnetwork->IELength = le32_to_cpu(pnetwork->IELength);
#endif
len = get_WLAN_BSSID_EX_sz(pnetwork); len = get_WLAN_BSSID_EX_sz(pnetwork);
if (len > (sizeof(WLAN_BSSID_EX))) { if (len > (sizeof(WLAN_BSSID_EX))) {
return; return;
} }
if (pnetwork->InfrastructureMode == Ndis802_11Infrastructure) {
#ifdef CONFIG_80211D
process_80211d(adapter, pnetwork);
#endif
rtw_process_beacon_hint(adapter, pnetwork);
}
_enter_critical_bh(&pmlmepriv->lock, &irqL); _enter_critical_bh(&pmlmepriv->lock, &irqL);
@ -1299,7 +1563,7 @@ exit:
void rtw_surveydone_event_callback(_adapter *adapter, u8 *pbuf) void rtw_surveydone_event_callback(_adapter *adapter, u8 *pbuf)
{ {
_irqL irqL; _irqL irqL;
struct sitesurvey_parm parm; struct surveydone_event *parm = (struct surveydone_event *)pbuf;
struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
#ifdef CONFIG_RTW_80211R #ifdef CONFIG_RTW_80211R
struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
@ -1379,24 +1643,18 @@ void rtw_surveydone_event_callback(_adapter *adapter, u8 *pbuf)
RTW_INFO("try_to_join, but select scanning queue fail, to_roam:%d\n", rtw_to_roam(adapter)); RTW_INFO("try_to_join, but select scanning queue fail, to_roam:%d\n", rtw_to_roam(adapter));
if (rtw_to_roam(adapter) != 0) { if (rtw_to_roam(adapter) != 0) {
struct sitesurvey_parm scan_parm;
u8 ssc_chk = rtw_sitesurvey_condition_check(adapter, _FALSE); u8 ssc_chk = rtw_sitesurvey_condition_check(adapter, _FALSE);
rtw_init_sitesurvey_parm(adapter, &parm); rtw_init_sitesurvey_parm(adapter, &scan_parm);
_rtw_memcpy(&parm.ssid[0], &pmlmepriv->assoc_ssid, sizeof(NDIS_802_11_SSID)); _rtw_memcpy(&scan_parm.ssid[0], &pmlmepriv->assoc_ssid, sizeof(NDIS_802_11_SSID));
parm.ssid_num = 1; scan_parm.ssid_num = 1;
if (rtw_dec_to_roam(adapter) == 0 if (rtw_dec_to_roam(adapter) == 0
|| (ssc_chk != SS_ALLOW && ssc_chk != SS_DENY_BUSY_TRAFFIC) || (ssc_chk != SS_ALLOW && ssc_chk != SS_DENY_BUSY_TRAFFIC)
|| _SUCCESS != rtw_sitesurvey_cmd(adapter, &parm) || _SUCCESS != rtw_sitesurvey_cmd(adapter, &scan_parm)
) { ) {
rtw_set_to_roam(adapter, 0); rtw_set_to_roam(adapter, 0);
#ifdef CONFIG_INTEL_WIDI
if (adapter->mlmepriv.widi_state == INTEL_WIDI_STATE_ROAMING) {
_rtw_memset(pmlmepriv->sa_ext, 0x00, L2SDTA_SERVICE_VE_LEN);
intel_widi_wk_cmd(adapter, INTEL_WIDI_LISTEN_WK, NULL, 0);
RTW_INFO("change to widi listen\n");
}
#endif /* CONFIG_INTEL_WIDI */
rtw_free_assoc_resources(adapter, _TRUE); rtw_free_assoc_resources(adapter, _TRUE);
rtw_indicate_disconnect(adapter, 0, _FALSE); rtw_indicate_disconnect(adapter, 0, _FALSE);
} else } else
@ -1476,15 +1734,23 @@ void rtw_surveydone_event_callback(_adapter *adapter, u8 *pbuf)
} }
#endif #endif
#endif /* CONFIG_RTW_MESH */ #endif /* CONFIG_RTW_MESH */
#ifdef CONFIG_RTW_ACS
if (parm->acs) {
u8 ifbmp = rtw_mi_get_ap_mesh_ifbmp(adapter);
if (ifbmp)
rtw_change_bss_chbw_cmd(adapter, RTW_CMDF_DIRECTLY, ifbmp, 0, REQ_CH_INT_INFO, REQ_BW_ORI, REQ_OFFSET_NONE);
}
#endif
} }
u8 _rtw_sitesurvey_condition_check(const char *caller, _adapter *adapter, bool check_sc_interval) u8 _rtw_sitesurvey_condition_check(const char *caller, _adapter *adapter, bool check_sc_interval)
{ {
u8 ss_condition = SS_ALLOW; u8 ss_condition = SS_ALLOW;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
#ifdef DBG_LA_MODE
struct registry_priv *registry_par = &adapter->registrypriv; struct registry_priv *registry_par = &adapter->registrypriv;
#endif
#ifdef CONFIG_MP_INCLUDED #ifdef CONFIG_MP_INCLUDED
if (rtw_mp_mode_check(adapter)) { if (rtw_mp_mode_check(adapter)) {
@ -1529,6 +1795,18 @@ u8 _rtw_sitesurvey_condition_check(const char *caller, _adapter *adapter, bool c
goto _exit; goto _exit;
} }
#ifdef CONFIG_ADAPTIVITY_DENY_SCAN
if (registry_par->adaptivity_en
&& rtw_phydm_get_edcca_flag(adapter)
&& rtw_is_2g_ch(GET_HAL_DATA(adapter)->current_channel)) {
RTW_WARN(FUNC_ADPT_FMT": Adaptivity block scan! (ch=%u)\n",
FUNC_ADPT_ARG(adapter),
GET_HAL_DATA(adapter)->current_channel);
ss_condition = SS_DENY_ADAPTIVITY;
goto _exit;
}
#endif /* CONFIG_ADAPTIVITY_DENY_SCAN */
if (check_fwstate(pmlmepriv, WIFI_AP_STATE)){ if (check_fwstate(pmlmepriv, WIFI_AP_STATE)){
if(check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) { if(check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) {
RTW_INFO("%s ("ADPT_FMT") : scan abort!! AP mode process WPS\n", caller, ADPT_ARG(adapter)); RTW_INFO("%s ("ADPT_FMT") : scan abort!! AP mode process WPS\n", caller, ADPT_ARG(adapter));
@ -1740,9 +2018,11 @@ void rtw_free_assoc_resources(_adapter *adapter, u8 lock_scanned_queue)
/* /*
*rtw_indicate_connect: the caller has to lock pmlmepriv->lock *rtw_indicate_connect: the caller has to lock pmlmepriv->lock
*/ */
void rtw_indicate_connect(_adapter *padapter) int rtw_indicate_connect(_adapter *padapter)
{ {
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
int err = 0;
pmlmepriv->to_join = _FALSE; pmlmepriv->to_join = _FALSE;
@ -1752,21 +2032,14 @@ void rtw_indicate_connect(_adapter *padapter)
rtw_led_control(padapter, LED_CTL_LINK); rtw_led_control(padapter, LED_CTL_LINK);
rtw_os_indicate_connect(padapter); err = rtw_os_indicate_connect(padapter);
} }
rtw_set_to_roam(padapter, 0); rtw_set_to_roam(padapter, 0);
#ifdef CONFIG_INTEL_WIDI
if (padapter->mlmepriv.widi_state == INTEL_WIDI_STATE_ROAMING) {
_rtw_memset(pmlmepriv->sa_ext, 0x00, L2SDTA_SERVICE_VE_LEN);
intel_widi_wk_cmd(padapter, INTEL_WIDI_LISTEN_WK, NULL, 0);
RTW_INFO("change to widi listen\n");
}
#endif /* CONFIG_INTEL_WIDI */
if (!MLME_IS_AP(padapter) && !MLME_IS_MESH(padapter)) if (!MLME_IS_AP(padapter) && !MLME_IS_MESH(padapter))
rtw_mi_set_scan_deny(padapter, 3000); rtw_mi_set_scan_deny(padapter, 3000);
return err;
} }
@ -1842,7 +2115,7 @@ void rtw_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally_generate
#endif /* CONFIG_P2P_PS */ #endif /* CONFIG_P2P_PS */
#ifdef CONFIG_LPS #ifdef CONFIG_LPS
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_DISCONNECT, 1); rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_DISCONNECT, 0);
#endif #endif
#ifdef CONFIG_BEAMFORMING #ifdef CONFIG_BEAMFORMING
@ -1892,7 +2165,7 @@ static u32 _rtw_wait_scan_done(_adapter *adapter, u8 abort, u32 timeout_ms)
break; break;
RTW_INFO(FUNC_NDEV_FMT"fw_state=_FW_UNDER_SURVEY!\n", FUNC_NDEV_ARG(adapter->pnetdev)); RTW_INFO(FUNC_NDEV_FMT"fw_state=_FW_UNDER_SURVEY!\n", FUNC_NDEV_ARG(adapter->pnetdev));
rtw_msleep_os(20); rtw_msleep_os(SURVEY_TO);
} }
if (_TRUE == abort) { if (_TRUE == abort) {
@ -1939,7 +2212,7 @@ void rtw_scan_abort_no_wait(_adapter *adapter)
void rtw_scan_abort(_adapter *adapter) void rtw_scan_abort(_adapter *adapter)
{ {
rtw_scan_abort_timeout(adapter, 200); rtw_scan_abort_timeout(adapter, 3000);
} }
static u32 _rtw_wait_join_done(_adapter *adapter, u8 abort, u32 timeout_ms) static u32 _rtw_wait_join_done(_adapter *adapter, u8 abort, u32 timeout_ms)
@ -2074,9 +2347,14 @@ static struct sta_info *rtw_joinbss_update_stainfo(_adapter *padapter, struct wl
preorder_ctrl = &psta->recvreorder_ctrl[i]; preorder_ctrl = &psta->recvreorder_ctrl[i];
preorder_ctrl->enable = _FALSE; preorder_ctrl->enable = _FALSE;
preorder_ctrl->indicate_seq = 0xffff; preorder_ctrl->indicate_seq = 0xffff;
rtw_clear_bit(RTW_RECV_ACK_OR_TIMEOUT, &preorder_ctrl->rec_abba_rsp_ack);
#ifdef DBG_RX_SEQ #ifdef DBG_RX_SEQ
RTW_INFO("DBG_RX_SEQ "FUNC_ADPT_FMT" tid:%u SN_CLEAR indicate_seq:%u\n" RTW_INFO("DBG_RX_SEQ "FUNC_ADPT_FMT" tid:%u SN_CLEAR indicate_seq:%u preorder_ctrl->rec_abba_rsp_ack:%lu\n"
, FUNC_ADPT_ARG(padapter), i, preorder_ctrl->indicate_seq); , FUNC_ADPT_ARG(padapter)
, i
, preorder_ctrl->indicate_seq
,preorder_ctrl->rec_abba_rsp_ack
);
#endif #endif
preorder_ctrl->wend_b = 0xffff; preorder_ctrl->wend_b = 0xffff;
preorder_ctrl->wsize_b = 64;/* max_ampdu_sz; */ /* ex. 32(kbytes) -> wsize_b=32 */ preorder_ctrl->wsize_b = 64;/* max_ampdu_sz; */ /* ex. 32(kbytes) -> wsize_b=32 */
@ -2172,9 +2450,12 @@ static void rtw_joinbss_update_network(_adapter *padapter, struct wlan_network *
* if join_res > 0, for (fw_state==WIFI_STATION_STATE), we check if "ptarget_sta" & "ptarget_wlan" exist. * if join_res > 0, for (fw_state==WIFI_STATION_STATE), we check if "ptarget_sta" & "ptarget_wlan" exist.
* if join_res > 0, for (fw_state==WIFI_ADHOC_STATE), we only check if "ptarget_wlan" exist. * if join_res > 0, for (fw_state==WIFI_ADHOC_STATE), we only check if "ptarget_wlan" exist.
* if join_res > 0, update "cur_network->network" from "pnetwork->network" if (ptarget_wlan !=NULL). * if join_res > 0, update "cur_network->network" from "pnetwork->network" if (ptarget_wlan !=NULL).
*
* Return
* -1 indicate connect fail
*/ */
/* #define REJOIN */ /* #define REJOIN */
void rtw_joinbss_event_prehandle(_adapter *adapter, u8 *pbuf, u16 status) int rtw_joinbss_event_prehandle(_adapter *adapter, u8 *pbuf, u16 status)
{ {
_irqL irqL; _irqL irqL;
static u8 retry = 0; static u8 retry = 0;
@ -2185,34 +2466,10 @@ void rtw_joinbss_event_prehandle(_adapter *adapter, u8 *pbuf, u16 status)
struct wlan_network *cur_network = &(pmlmepriv->cur_network); struct wlan_network *cur_network = &(pmlmepriv->cur_network);
struct wlan_network *pcur_wlan = NULL, *ptarget_wlan = NULL; struct wlan_network *pcur_wlan = NULL, *ptarget_wlan = NULL;
unsigned int the_same_macaddr = _FALSE; unsigned int the_same_macaddr = _FALSE;
int err = 0;
#ifdef CONFIG_RTL8712
/* endian_convert */
pnetwork->join_res = le32_to_cpu(pnetwork->join_res);
pnetwork->network_type = le32_to_cpu(pnetwork->network_type);
pnetwork->network.Length = le32_to_cpu(pnetwork->network.Length);
pnetwork->network.Ssid.SsidLength = le32_to_cpu(pnetwork->network.Ssid.SsidLength);
pnetwork->network.Privacy = le32_to_cpu(pnetwork->network.Privacy);
pnetwork->network.Rssi = le32_to_cpu(pnetwork->network.Rssi);
pnetwork->network.NetworkTypeInUse = le32_to_cpu(pnetwork->network.NetworkTypeInUse) ;
pnetwork->network.Configuration.ATIMWindow = le32_to_cpu(pnetwork->network.Configuration.ATIMWindow);
pnetwork->network.Configuration.BeaconPeriod = le32_to_cpu(pnetwork->network.Configuration.BeaconPeriod);
pnetwork->network.Configuration.DSConfig = le32_to_cpu(pnetwork->network.Configuration.DSConfig);
pnetwork->network.Configuration.FHConfig.DwellTime = le32_to_cpu(pnetwork->network.Configuration.FHConfig.DwellTime);
pnetwork->network.Configuration.FHConfig.HopPattern = le32_to_cpu(pnetwork->network.Configuration.FHConfig.HopPattern);
pnetwork->network.Configuration.FHConfig.HopSet = le32_to_cpu(pnetwork->network.Configuration.FHConfig.HopSet);
pnetwork->network.Configuration.FHConfig.Length = le32_to_cpu(pnetwork->network.Configuration.FHConfig.Length);
pnetwork->network.Configuration.Length = le32_to_cpu(pnetwork->network.Configuration.Length);
pnetwork->network.InfrastructureMode = le32_to_cpu(pnetwork->network.InfrastructureMode);
pnetwork->network.IELength = le32_to_cpu(pnetwork->network.IELength);
#endif
rtw_get_encrypt_decrypt_from_registrypriv(adapter); rtw_get_encrypt_decrypt_from_registrypriv(adapter);
the_same_macaddr = _rtw_memcmp(pnetwork->network.MacAddress, cur_network->network.MacAddress, ETH_ALEN); the_same_macaddr = _rtw_memcmp(pnetwork->network.MacAddress, cur_network->network.MacAddress, ETH_ALEN);
pnetwork->network.Length = get_WLAN_BSSID_EX_sz(&pnetwork->network); pnetwork->network.Length = get_WLAN_BSSID_EX_sz(&pnetwork->network);
@ -2261,9 +2518,17 @@ void rtw_joinbss_event_prehandle(_adapter *adapter, u8 *pbuf, u16 status)
} }
/* s2. update cur_network */ /* s2. update cur_network */
if (ptarget_wlan) if (ptarget_wlan) {
/*
* Set scan deny to protect 4-way handshake or DHCP,
* because driver will leave under linking state in
* rtw_joinbss_update_network()
*/
if (!MLME_IS_AP(adapter) && !MLME_IS_MESH(adapter))
rtw_mi_set_scan_deny(adapter, 3000);
rtw_joinbss_update_network(adapter, ptarget_wlan, pnetwork); rtw_joinbss_update_network(adapter, ptarget_wlan, pnetwork);
else { } else {
RTW_PRINT("Can't find ptarget_wlan when joinbss_event callback\n"); RTW_PRINT("Can't find ptarget_wlan when joinbss_event callback\n");
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
goto ignore_joinbss_callback; goto ignore_joinbss_callback;
@ -2278,12 +2543,21 @@ void rtw_joinbss_event_prehandle(_adapter *adapter, u8 *pbuf, u16 status)
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
goto ignore_joinbss_callback; goto ignore_joinbss_callback;
} }
/* Queue TX packets before FW/HW ready */
/* clear in mlmeext_joinbss_event_callback() */
rtw_xmit_queue_set(ptarget_sta);
} }
/* s4. indicate connect */ /* s4. indicate connect */
if (MLME_IS_STA(adapter) || MLME_IS_ADHOC(adapter)) { if (MLME_IS_STA(adapter) || MLME_IS_ADHOC(adapter)) {
pmlmepriv->cur_network_scanned = ptarget_wlan; pmlmepriv->cur_network_scanned = ptarget_wlan;
rtw_indicate_connect(adapter); err = rtw_indicate_connect(adapter);
if (err) {
RTW_ERR(FUNC_ADPT_FMT ": Fail to indicate connect! err=%d\n",
FUNC_ADPT_ARG(adapter), err);
err = -1;
}
} }
/* s5. Cancle assoc_timer */ /* s5. Cancle assoc_timer */
@ -2340,7 +2614,7 @@ ignore_joinbss_callback:
_exit_critical_bh(&pmlmepriv->lock, &irqL); _exit_critical_bh(&pmlmepriv->lock, &irqL);
exit: exit:
return; return err;
} }
void rtw_joinbss_event_callback(_adapter *adapter, u8 *pbuf) void rtw_joinbss_event_callback(_adapter *adapter, u8 *pbuf)
@ -2807,7 +3081,7 @@ void rtw_sta_mstatus_disc_rpt(_adapter *adapter, u8 mac_id)
{ {
struct macid_ctl_t *macid_ctl = &adapter->dvobj->macid_ctl; struct macid_ctl_t *macid_ctl = &adapter->dvobj->macid_ctl;
if (mac_id >= 0 && mac_id < macid_ctl->num) { if (mac_id < macid_ctl->num) {
u8 id_is_shared = mac_id == RTW_DEFAULT_MGMT_MACID; /* TODO: real shared macid judgment */ u8 id_is_shared = mac_id == RTW_DEFAULT_MGMT_MACID; /* TODO: real shared macid judgment */
RTW_INFO(FUNC_ADPT_FMT" - mac_id=%d%s\n", FUNC_ADPT_ARG(adapter) RTW_INFO(FUNC_ADPT_FMT" - mac_id=%d%s\n", FUNC_ADPT_ARG(adapter)
@ -2920,11 +3194,6 @@ void rtw_stadel_event_callback(_adapter *adapter, u8 *pbuf)
roam = _TRUE; roam = _TRUE;
roam_target = pmlmepriv->roam_network; roam_target = pmlmepriv->roam_network;
} }
#ifdef CONFIG_INTEL_WIDI
else if (adapter->mlmepriv.widi_state == INTEL_WIDI_STATE_CONNECTED)
roam = _TRUE;
#endif /* CONFIG_INTEL_WIDI */
if (roam == _TRUE) { if (roam == _TRUE) {
if (rtw_to_roam(adapter) > 0) if (rtw_to_roam(adapter) > 0)
rtw_dec_to_roam(adapter); /* this stadel_event is caused by roaming, decrease to_roam */ rtw_dec_to_roam(adapter); /* this stadel_event is caused by roaming, decrease to_roam */
@ -2940,10 +3209,6 @@ void rtw_stadel_event_callback(_adapter *adapter, u8 *pbuf)
rtw_free_mlme_priv_ie_data(pmlmepriv); rtw_free_mlme_priv_ie_data(pmlmepriv);
rtw_indicate_disconnect(adapter, *(u16 *)pstadel->rsvd, pstadel->locally_generated); rtw_indicate_disconnect(adapter, *(u16 *)pstadel->rsvd, pstadel->locally_generated);
#ifdef CONFIG_INTEL_WIDI
if (!rtw_to_roam(adapter))
process_intel_widi_disconnect(adapter, 1);
#endif /* CONFIG_INTEL_WIDI */
_rtw_roaming(adapter, roam_target); _rtw_roaming(adapter, roam_target);
} }
@ -3065,13 +3330,6 @@ void rtw_join_timeout_handler(void *ctx)
} }
break; break;
} else { } else {
#ifdef CONFIG_INTEL_WIDI
if (adapter->mlmepriv.widi_state == INTEL_WIDI_STATE_ROAMING) {
_rtw_memset(pmlmepriv->sa_ext, 0x00, L2SDTA_SERVICE_VE_LEN);
intel_widi_wk_cmd(adapter, INTEL_WIDI_LISTEN_WK, NULL, 0);
RTW_INFO("change to widi listen\n");
}
#endif /* CONFIG_INTEL_WIDI */
RTW_INFO("%s We've try roaming but fail\n", __FUNCTION__); RTW_INFO("%s We've try roaming but fail\n", __FUNCTION__);
#ifdef CONFIG_RTW_80211R #ifdef CONFIG_RTW_80211R
rtw_ft_clr_flags(adapter, RTW_FT_PEER_EN|RTW_FT_PEER_OTD_EN); rtw_ft_clr_flags(adapter, RTW_FT_PEER_EN|RTW_FT_PEER_OTD_EN);
@ -3319,10 +3577,10 @@ void rtw_iface_dynamic_check_timer_handlder(_adapter *adapter)
bEnterPS = traffic_status_watchdog(adapter, 1); bEnterPS = traffic_status_watchdog(adapter, 1);
if (bEnterPS) { if (bEnterPS) {
/* rtw_lps_ctrl_wk_cmd(adapter, LPS_CTRL_ENTER, 1); */ /* rtw_lps_ctrl_wk_cmd(adapter, LPS_CTRL_ENTER, 0); */
rtw_hal_dm_watchdog_in_lps(adapter); rtw_hal_dm_watchdog_in_lps(adapter);
} else { } else {
/* call rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 1) in traffic_status_watchdog() */ /* call rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 0) in traffic_status_watchdog() */
} }
} }
#endif /* CONFIG_LPS_LCLK_WD_TIMER */ #endif /* CONFIG_LPS_LCLK_WD_TIMER */
@ -3491,6 +3749,9 @@ void rtw_dynamic_check_timer_handlder(void *ctx)
struct dvobj_priv *pdvobj = (struct dvobj_priv *)ctx; struct dvobj_priv *pdvobj = (struct dvobj_priv *)ctx;
_adapter *adapter = dvobj_get_primary_adapter(pdvobj); _adapter *adapter = dvobj_get_primary_adapter(pdvobj);
if (!adapter)
goto exit;
#if (MP_DRIVER == 1) #if (MP_DRIVER == 1)
if (adapter->registrypriv.mp_mode == 1 && adapter->mppriv.mp_dm == 0) { /* for MP ODM dynamic Tx power tracking */ if (adapter->registrypriv.mp_mode == 1 && adapter->mppriv.mp_dm == 0) { /* for MP ODM dynamic Tx power tracking */
/* RTW_INFO("%s mp_dm =0 return\n", __func__); */ /* RTW_INFO("%s mp_dm =0 return\n", __func__); */
@ -3498,9 +3759,6 @@ void rtw_dynamic_check_timer_handlder(void *ctx)
} }
#endif #endif
if (!adapter)
goto exit;
if (!rtw_is_hw_init_completed(adapter)) if (!rtw_is_hw_init_completed(adapter))
goto exit; goto exit;
@ -3568,7 +3826,7 @@ static int rtw_check_roaming_candidate(struct mlme_priv *mlme
if (rtw_chset_search_ch(chset, ch) < 0) if (rtw_chset_search_ch(chset, ch) < 0)
goto exit; goto exit;
if (IS_DFS_SLAVE_WITH_RD(rfctl) if (IS_DFS_SLAVE_WITH_RD(rfctl)
&& !rtw_odm_dfs_domain_unknown(rfctl_to_dvobj(rfctl)) && !rtw_rfctl_dfs_domain_unknown(rfctl)
&& rtw_chset_is_ch_non_ocp(chset, ch)) && rtw_chset_is_ch_non_ocp(chset, ch))
goto exit; goto exit;
@ -3745,7 +4003,7 @@ static int rtw_check_join_candidate(struct mlme_priv *mlme
if (rtw_chset_search_ch(chset, ch) < 0) if (rtw_chset_search_ch(chset, ch) < 0)
goto exit; goto exit;
if (IS_DFS_SLAVE_WITH_RD(rfctl) if (IS_DFS_SLAVE_WITH_RD(rfctl)
&& !rtw_odm_dfs_domain_unknown(rfctl_to_dvobj(rfctl)) && !rtw_rfctl_dfs_domain_unknown(rfctl)
&& rtw_chset_is_ch_non_ocp(chset, ch)) && rtw_chset_is_ch_non_ocp(chset, ch))
goto exit; goto exit;
@ -4394,13 +4652,6 @@ void rtw_init_registrypriv_dev_network(_adapter *adapter)
pdev_network->Configuration.Length = sizeof(NDIS_802_11_CONFIGURATION); pdev_network->Configuration.Length = sizeof(NDIS_802_11_CONFIGURATION);
pdev_network->Configuration.BeaconPeriod = 100; pdev_network->Configuration.BeaconPeriod = 100;
pdev_network->Configuration.FHConfig.Length = 0;
pdev_network->Configuration.FHConfig.HopPattern = 0;
pdev_network->Configuration.FHConfig.HopSet = 0;
pdev_network->Configuration.FHConfig.DwellTime = 0;
} }
void rtw_update_registrypriv_dev_network(_adapter *adapter) void rtw_update_registrypriv_dev_network(_adapter *adapter)
@ -4428,32 +4679,6 @@ void rtw_update_registrypriv_dev_network(_adapter *adapter)
pdev_network->Rssi = 0; pdev_network->Rssi = 0;
switch (pregistrypriv->wireless_mode) {
case WIRELESS_11B:
pdev_network->NetworkTypeInUse = (Ndis802_11DS);
break;
case WIRELESS_11G:
case WIRELESS_11BG:
case WIRELESS_11_24N:
case WIRELESS_11G_24N:
case WIRELESS_11BG_24N:
pdev_network->NetworkTypeInUse = (Ndis802_11OFDM24);
break;
case WIRELESS_11A:
case WIRELESS_11A_5N:
pdev_network->NetworkTypeInUse = (Ndis802_11OFDM5);
break;
case WIRELESS_11ABGN:
if (pregistrypriv->channel > 14)
pdev_network->NetworkTypeInUse = (Ndis802_11OFDM5);
else
pdev_network->NetworkTypeInUse = (Ndis802_11OFDM24);
break;
default:
/* TODO */
break;
}
pdev_network->Configuration.DSConfig = (pregistrypriv->channel); pdev_network->Configuration.DSConfig = (pregistrypriv->channel);
if (cur_network->network.InfrastructureMode == Ndis802_11IBSS) { if (cur_network->network.InfrastructureMode == Ndis802_11IBSS) {
@ -4506,7 +4731,7 @@ void rtw_joinbss_reset(_adapter *padapter)
phtpriv->ampdu_enable = _FALSE;/* reset to disabled */ phtpriv->ampdu_enable = _FALSE;/* reset to disabled */
#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) #ifdef CONFIG_USB_HCI
/* TH=1 => means that invalidate usb rx aggregation */ /* TH=1 => means that invalidate usb rx aggregation */
/* TH=0 => means that validate usb rx aggregation, use init value. */ /* TH=0 => means that validate usb rx aggregation, use init value. */
if (phtpriv->ht_option) { if (phtpriv->ht_option) {
@ -4519,7 +4744,7 @@ void rtw_joinbss_reset(_adapter *padapter)
threshold = 1; threshold = 1;
rtw_hal_set_hwreg(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold)); rtw_hal_set_hwreg(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold));
} }
#endif/* #if defined( CONFIG_USB_HCI) || defined (CONFIG_SDIO_HCI) */ #endif /* CONFIG_USB_HCI */
#endif/* #ifdef CONFIG_80211N_HT */ #endif/* #ifdef CONFIG_80211N_HT */
@ -4622,12 +4847,11 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui
HT_CAP_AMPDU_DENSITY best_ampdu_density; HT_CAP_AMPDU_DENSITY best_ampdu_density;
unsigned char *p, *pframe; unsigned char *p, *pframe;
struct rtw_ieee80211_ht_cap ht_capie; struct rtw_ieee80211_ht_cap ht_capie;
u8 cbw40_enable = 0, rf_type = 0, rf_num = 0, rx_stbc_nss = 0, rx_nss = 0; u8 cbw40_enable = 0, rf_num = 0, rx_stbc_nss = 0, rx_nss = 0;
struct registry_priv *pregistrypriv = &padapter->registrypriv; struct registry_priv *pregistrypriv = &padapter->registrypriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct ht_priv *phtpriv = &pmlmepriv->htpriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct hal_spec_t *hal_spec = GET_HAL_SPEC(padapter);
#ifdef CONFIG_80211AC_VHT #ifdef CONFIG_80211AC_VHT
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv; struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
@ -4685,21 +4909,30 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui
} }
} }
} }
// IOT issue : AP TP-Link WDR6500
if(oper_bw == CHANNEL_WIDTH_40){
p = rtw_get_ie(in_ie, WLAN_EID_HT_CAP, &ielen, in_len);
if (p && ielen == HT_CAP_IE_LEN) {
oper_bw = GET_HT_CAP_ELE_CHL_WIDTH(p + 2) ? CHANNEL_WIDTH_40 : CHANNEL_WIDTH_20;
if(oper_bw == CHANNEL_WIDTH_20)
oper_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
}
}
} }
/* adjust bw to fit in channel plan setting */ /* adjust bw to fit in channel plan setting */
if (oper_bw == CHANNEL_WIDTH_40 if (oper_bw == CHANNEL_WIDTH_40
&& oper_offset != HAL_PRIME_CHNL_OFFSET_DONT_CARE /* check this because TDLS has no info to set offset */ && oper_offset != HAL_PRIME_CHNL_OFFSET_DONT_CARE /* check this because TDLS has no info to set offset */
&& (!rtw_chset_is_chbw_valid(chset, channel, oper_bw, oper_offset) && (!rtw_chset_is_chbw_valid(chset, channel, oper_bw, oper_offset, 1, 1)
|| (IS_DFS_SLAVE_WITH_RD(rfctl) || (IS_DFS_SLAVE_WITH_RD(rfctl)
&& !rtw_odm_dfs_domain_unknown(rfctl_to_dvobj(rfctl)) && !rtw_rfctl_dfs_domain_unknown(rfctl)
&& rtw_chset_is_chbw_non_ocp(chset, channel, oper_bw, oper_offset)) && rtw_chset_is_chbw_non_ocp(chset, channel, oper_bw, oper_offset))
) )
) { ) {
oper_bw = CHANNEL_WIDTH_20; oper_bw = CHANNEL_WIDTH_20;
oper_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; oper_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
rtw_warn_on(!rtw_chset_is_chbw_valid(chset, channel, oper_bw, oper_offset)); rtw_warn_on(!rtw_chset_is_chbw_valid(chset, channel, oper_bw, oper_offset, 1, 1));
if (IS_DFS_SLAVE_WITH_RD(rfctl) && !rtw_odm_dfs_domain_unknown(rfctl_to_dvobj(rfctl))) if (IS_DFS_SLAVE_WITH_RD(rfctl) && !rtw_rfctl_dfs_domain_unknown(rfctl))
rtw_warn_on(rtw_chset_is_chbw_non_ocp(chset, channel, oper_bw, oper_offset)); rtw_warn_on(rtw_chset_is_chbw_non_ocp(chset, channel, oper_bw, oper_offset));
} }
@ -4744,8 +4977,7 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui
_rtw_memcpy(ht_capie.supp_mcs_set, pmlmeext->default_supported_mcs_set, 16); _rtw_memcpy(ht_capie.supp_mcs_set, pmlmeext->default_supported_mcs_set, 16);
/* update default supported_mcs_set */ /* update default supported_mcs_set */
rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); rx_nss = GET_HAL_RX_NSS(padapter);
rx_nss = rtw_min(rf_type_to_rf_rx_cnt(rf_type), hal_spec->rx_nss_num);
switch (rx_nss) { switch (rx_nss) {
case 1: case 1:
@ -4766,7 +4998,7 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui
set_mcs_rate_by_mask(ht_capie.supp_mcs_set, MCS_RATE_4R); set_mcs_rate_by_mask(ht_capie.supp_mcs_set, MCS_RATE_4R);
break; break;
default: default:
RTW_WARN("rf_type:%d or rx_nss:%u is not expected\n", rf_type, hal_spec->rx_nss_num); RTW_WARN("rf_type:%d or rx_nss:%u is not expected\n", GET_HAL_RFPATH(padapter), rx_nss);
} }
{ {
@ -4839,7 +5071,8 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui
#ifdef CONFIG_80211AC_VHT #ifdef CONFIG_80211AC_VHT
/* IOT action suggested by Yu Chen 2017/3/3 */ /* IOT action suggested by Yu Chen 2017/3/3 */
if ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_BROADCOM) && if ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_BROADCOM) &&
!pvhtpriv->ap_is_mu_bfer) !pvhtpriv->ap_bf_cap.is_mu_bfer &&
pvhtpriv->ap_bf_cap.su_sound_dim == 2)
rf_num = (rf_num >= 2 ? 2 : rf_num); rf_num = (rf_num >= 2 ? 2 : rf_num);
#endif #endif
SET_HT_CAP_TXBF_COMP_STEERING_NUM_ANTENNAS(&ht_capie, rf_num); SET_HT_CAP_TXBF_COMP_STEERING_NUM_ANTENNAS(&ht_capie, rf_num);
@ -4936,13 +5169,10 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len, u8 channel)
if ((cbw40_enable) && if ((cbw40_enable) &&
(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & BIT(1)) && (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & BIT(1)) &&
(pmlmeinfo->HT_info.infos[0] & BIT(2))) { (pmlmeinfo->HT_info.infos[0] & BIT(2))) {
struct hal_spec_t *hal_spec = GET_HAL_SPEC(padapter);
int i; int i;
u8 rf_type = RF_1T1R;
u8 tx_nss = 0; u8 tx_nss = 0;
rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); tx_nss = GET_HAL_TX_NSS(padapter);
tx_nss = rtw_min(rf_type_to_rf_tx_cnt(rf_type), hal_spec->tx_nss_num);
/* update the MCS set */ /* update the MCS set */
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
@ -4968,7 +5198,7 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len, u8 channel)
set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_4R); set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_4R);
break; break;
default: default:
RTW_WARN("rf_type:%d or tx_nss_num:%u is not expected\n", rf_type, hal_spec->tx_nss_num); RTW_WARN("tx_nss:%u is not expected\n", tx_nss);
} }
/* switch to the 40M Hz mode accoring to the AP */ /* switch to the 40M Hz mode accoring to the AP */
@ -4983,7 +5213,10 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len, u8 channel)
break; break;
default: default:
pmlmeext->cur_bwmode = CHANNEL_WIDTH_20;
pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
RTW_INFO("%s : ch offset is not assigned for HT40 mod , update cur_bwmode=%u, cur_ch_offset=%u\n",
__func__, pmlmeext->cur_bwmode, pmlmeext->cur_ch_offset);
break; break;
} }
} }
@ -5162,7 +5395,7 @@ void _rtw_roaming(_adapter *padapter, struct wlan_network *tgt_network)
cur_network->network.Ssid.Ssid, MAC_ARG(cur_network->network.MacAddress), cur_network->network.Ssid.Ssid, MAC_ARG(cur_network->network.MacAddress),
cur_network->network.Ssid.SsidLength); cur_network->network.Ssid.SsidLength);
_rtw_memcpy(&pmlmepriv->assoc_ssid, &cur_network->network.Ssid, sizeof(NDIS_802_11_SSID)); _rtw_memcpy(&pmlmepriv->assoc_ssid, &cur_network->network.Ssid, sizeof(NDIS_802_11_SSID));
pmlmepriv->assoc_ch = 0;
pmlmepriv->assoc_by_bssid = _FALSE; pmlmepriv->assoc_by_bssid = _FALSE;
#ifdef CONFIG_WAPI_SUPPORT #ifdef CONFIG_WAPI_SUPPORT

File diff suppressed because it is too large Load Diff

View File

@ -148,6 +148,7 @@ static void _init_mp_priv_(struct mp_priv *pmp_priv)
pmp_priv->bloadefusemap = _FALSE; pmp_priv->bloadefusemap = _FALSE;
pmp_priv->brx_filter_beacon = _FALSE; pmp_priv->brx_filter_beacon = _FALSE;
pmp_priv->mplink_brx = _FALSE;
pnetwork = &pmp_priv->mp_network.network; pnetwork = &pmp_priv->mp_network.network;
_rtw_memcpy(pnetwork->MacAddress, pmp_priv->network_macaddr, ETH_ALEN); _rtw_memcpy(pnetwork->MacAddress, pmp_priv->network_macaddr, ETH_ALEN);
@ -155,7 +156,7 @@ static void _init_mp_priv_(struct mp_priv *pmp_priv)
pnetwork->Ssid.SsidLength = 8; pnetwork->Ssid.SsidLength = 8;
_rtw_memcpy(pnetwork->Ssid.Ssid, "mp_871x", pnetwork->Ssid.SsidLength); _rtw_memcpy(pnetwork->Ssid.Ssid, "mp_871x", pnetwork->Ssid.SsidLength);
pmp_priv->tx.payload = 2; pmp_priv->tx.payload = MP_TX_Payload_default_random;
#ifdef CONFIG_80211N_HT #ifdef CONFIG_80211N_HT
pmp_priv->tx.attrib.ht_en = 1; pmp_priv->tx.attrib.ht_en = 1;
#endif #endif
@ -164,108 +165,6 @@ static void _init_mp_priv_(struct mp_priv *pmp_priv)
} }
#ifdef PLATFORM_WINDOWS
#if 0
void mp_wi_callback(
IN NDIS_WORK_ITEM *pwk_item,
IN PVOID cntx
)
{
_adapter *padapter = (_adapter *)cntx;
struct mp_priv *pmppriv = &padapter->mppriv;
struct mp_wi_cntx *pmp_wi_cntx = &pmppriv->wi_cntx;
/* Execute specified action. */
if (pmp_wi_cntx->curractfunc != NULL) {
LARGE_INTEGER cur_time;
ULONGLONG start_time, end_time;
NdisGetCurrentSystemTime(&cur_time); /* driver version */
start_time = cur_time.QuadPart / 10; /* The return value is in microsecond */
pmp_wi_cntx->curractfunc(padapter);
NdisGetCurrentSystemTime(&cur_time); /* driver version */
end_time = cur_time.QuadPart / 10; /* The return value is in microsecond */
}
NdisAcquireSpinLock(&(pmp_wi_cntx->mp_wi_lock));
pmp_wi_cntx->bmp_wi_progress = _FALSE;
NdisReleaseSpinLock(&(pmp_wi_cntx->mp_wi_lock));
if (pmp_wi_cntx->bmpdrv_unload)
NdisSetEvent(&(pmp_wi_cntx->mp_wi_evt));
}
#endif
static int init_mp_priv_by_os(struct mp_priv *pmp_priv)
{
struct mp_wi_cntx *pmp_wi_cntx;
if (pmp_priv == NULL)
return _FAIL;
pmp_priv->rx_testcnt = 0;
pmp_priv->rx_testcnt1 = 0;
pmp_priv->rx_testcnt2 = 0;
pmp_priv->tx_testcnt = 0;
pmp_priv->tx_testcnt1 = 0;
pmp_wi_cntx = &pmp_priv->wi_cntx
pmp_wi_cntx->bmpdrv_unload = _FALSE;
pmp_wi_cntx->bmp_wi_progress = _FALSE;
pmp_wi_cntx->curractfunc = NULL;
return _SUCCESS;
}
#endif
#ifdef PLATFORM_LINUX
#if 0
static int init_mp_priv_by_os(struct mp_priv *pmp_priv)
{
int i, res;
struct mp_xmit_frame *pmp_xmitframe;
if (pmp_priv == NULL)
return _FAIL;
_rtw_init_queue(&pmp_priv->free_mp_xmitqueue);
pmp_priv->pallocated_mp_xmitframe_buf = NULL;
pmp_priv->pallocated_mp_xmitframe_buf = rtw_zmalloc(NR_MP_XMITFRAME * sizeof(struct mp_xmit_frame) + 4);
if (pmp_priv->pallocated_mp_xmitframe_buf == NULL) {
res = _FAIL;
goto _exit_init_mp_priv;
}
pmp_priv->pmp_xmtframe_buf = pmp_priv->pallocated_mp_xmitframe_buf + 4 - ((SIZE_PTR)(pmp_priv->pallocated_mp_xmitframe_buf) & 3);
pmp_xmitframe = (struct mp_xmit_frame *)pmp_priv->pmp_xmtframe_buf;
for (i = 0; i < NR_MP_XMITFRAME; i++) {
_rtw_init_listhead(&pmp_xmitframe->list);
rtw_list_insert_tail(&pmp_xmitframe->list, &pmp_priv->free_mp_xmitqueue.queue);
pmp_xmitframe->pkt = NULL;
pmp_xmitframe->frame_tag = MP_FRAMETAG;
pmp_xmitframe->padapter = pmp_priv->papdater;
pmp_xmitframe++;
}
pmp_priv->free_mp_xmitframe_cnt = NR_MP_XMITFRAME;
res = _SUCCESS;
_exit_init_mp_priv:
return res;
}
#endif
#endif
static void mp_init_xmit_attrib(struct mp_tx *pmptx, PADAPTER padapter) static void mp_init_xmit_attrib(struct mp_tx *pmptx, PADAPTER padapter)
{ {
@ -327,16 +226,21 @@ s32 init_mp_priv(PADAPTER padapter)
_init_mp_priv_(pmppriv); _init_mp_priv_(pmppriv);
pmppriv->papdater = padapter; pmppriv->papdater = padapter;
if (IS_HARDWARE_TYPE_8822C(padapter))
pmppriv->mp_dm = 1;/* default enable dpk tracking */
else
pmppriv->mp_dm = 0; pmppriv->mp_dm = 0;
pmppriv->tx.stop = 1; pmppriv->tx.stop = 1;
pmppriv->bSetTxPower = 0; /*for manually set tx power*/ pmppriv->bSetTxPower = 0; /*for manually set tx power*/
pmppriv->bTxBufCkFail = _FALSE; pmppriv->bTxBufCkFail = _FALSE;
pmppriv->pktInterval = 0; pmppriv->pktInterval = 0;
pmppriv->pktLength = 1000; pmppriv->pktLength = 1000;
pmppriv->bprocess_mp_mode = _FALSE;
mp_init_xmit_attrib(&pmppriv->tx, padapter); mp_init_xmit_attrib(&pmppriv->tx, padapter);
switch (padapter->registrypriv.rf_config) { switch (GET_HAL_RFPATH(padapter)) {
case RF_1T1R: case RF_1T1R:
pmppriv->antenna_tx = ANTENNA_A; pmppriv->antenna_tx = ANTENNA_A;
pmppriv->antenna_rx = ANTENNA_A; pmppriv->antenna_rx = ANTENNA_A;
@ -372,24 +276,24 @@ void free_mp_priv(struct mp_priv *pmp_priv)
} }
#if 0 #if 0
static VOID PHY_IQCalibrate_default( static void PHY_IQCalibrate_default(
IN PADAPTER pAdapter, PADAPTER pAdapter,
IN BOOLEAN bReCovery BOOLEAN bReCovery
) )
{ {
RTW_INFO("%s\n", __func__); RTW_INFO("%s\n", __func__);
} }
static VOID PHY_LCCalibrate_default( static void PHY_LCCalibrate_default(
IN PADAPTER pAdapter PADAPTER pAdapter
) )
{ {
RTW_INFO("%s\n", __func__); RTW_INFO("%s\n", __func__);
} }
static VOID PHY_SetRFPathSwitch_default( static void PHY_SetRFPathSwitch_default(
IN PADAPTER pAdapter, PADAPTER pAdapter,
IN BOOLEAN bMain BOOLEAN bMain
) )
{ {
RTW_INFO("%s\n", __func__); RTW_INFO("%s\n", __func__);
@ -469,6 +373,26 @@ void mpt_InitHWConfig(PADAPTER Adapter)
} }
} }
#endif #endif
#if defined(CONFIG_RTL8822C)
else if( IS_HARDWARE_TYPE_8822C(Adapter)) {
rtw_write16(Adapter, REG_RXFLTMAP1_8822C, 0x2000);
/* 0x7D8[31] : time out enable when cca is not assert
0x60D[7:0] : time out value (Unit : us)*/
rtw_write8(Adapter, 0x7db, 0xc0);
RTW_INFO(" 0x7d8 = 0x%x\n", rtw_read8(Adapter, 0x7d8));
rtw_write8(Adapter, 0x60d, 0x0c);
RTW_INFO(" 0x60d = 0x%x\n", rtw_read8(Adapter, 0x60d));
phy_set_bb_reg(Adapter, 0x1c44, BIT10, 0x1);
RTW_INFO(" 0x1c44 = 0x%x\n", phy_query_bb_reg(Adapter, 0x1c44, bMaskDWord));
}
#endif
#if defined(CONFIG_RTL8814B)
else if(IS_HARDWARE_TYPE_8814B(Adapter))
{
PlatformEFIOWrite2Byte(Adapter, REG_RXFLTMAP1_8814B, 0x2000);
}
#endif
} }
static void PHY_IQCalibrate(PADAPTER padapter, u8 bReCovery) static void PHY_IQCalibrate(PADAPTER padapter, u8 bReCovery)
@ -585,6 +509,16 @@ static void PHY_SetRFPathSwitch(PADAPTER padapter , BOOLEAN bMain) {
} else if (IS_HARDWARE_TYPE_8821C(padapter)) { } else if (IS_HARDWARE_TYPE_8821C(padapter)) {
#ifdef CONFIG_RTL8821C #ifdef CONFIG_RTL8821C
phy_set_rf_path_switch_8821c(phydm, bMain); phy_set_rf_path_switch_8821c(phydm, bMain);
#endif
} else if (IS_HARDWARE_TYPE_8822C(padapter)) {
#ifdef CONFIG_RTL8822C
/* remove for MP EVM Fail, need to review by willis 20180809
phy_set_rf_path_switch_8822c(phydm, bMain);
*/
#endif
} else if (IS_HARDWARE_TYPE_8814B(padapter)) {
#ifdef CONFIG_RTL8814B
/* phy_set_rf_path_switch_8814b(phydm, bMain); */
#endif #endif
} }
} }
@ -626,8 +560,8 @@ u8 rtw_mp_set_antdiv(PADAPTER padapter, BOOLEAN bMain)
s32 s32
MPT_InitializeAdapter( MPT_InitializeAdapter(
IN PADAPTER pAdapter, PADAPTER pAdapter,
IN u8 Channel u8 Channel
) )
{ {
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
@ -689,21 +623,21 @@ MPT_InitializeAdapter(
PHY_SetRFPathSwitch(pAdapter, 1/*pHalData->bDefaultAntenna*/); /* default use Main */ PHY_SetRFPathSwitch(pAdapter, 1/*pHalData->bDefaultAntenna*/); /* default use Main */
pMptCtx->backup0xc50 = (u1Byte)phy_query_bb_reg(pAdapter, rOFDM0_XAAGCCore1, bMaskByte0); pMptCtx->backup0xc50 = (u8)phy_query_bb_reg(pAdapter, rOFDM0_XAAGCCore1, bMaskByte0);
pMptCtx->backup0xc58 = (u1Byte)phy_query_bb_reg(pAdapter, rOFDM0_XBAGCCore1, bMaskByte0); pMptCtx->backup0xc58 = (u8)phy_query_bb_reg(pAdapter, rOFDM0_XBAGCCore1, bMaskByte0);
pMptCtx->backup0xc30 = (u1Byte)phy_query_bb_reg(pAdapter, rOFDM0_RxDetector1, bMaskByte0); pMptCtx->backup0xc30 = (u8)phy_query_bb_reg(pAdapter, rOFDM0_RxDetector1, bMaskByte0);
pMptCtx->backup0x52_RF_A = (u1Byte)phy_query_rf_reg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0); pMptCtx->backup0x52_RF_A = (u8)phy_query_rf_reg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0);
pMptCtx->backup0x52_RF_B = (u1Byte)phy_query_rf_reg(pAdapter, RF_PATH_B, RF_0x52, 0x000F0); pMptCtx->backup0x52_RF_B = (u8)phy_query_rf_reg(pAdapter, RF_PATH_B, RF_0x52, 0x000F0);
#ifdef CONFIG_RTL8188E #ifdef CONFIG_RTL8188E
rtw_write32(pAdapter, REG_MACID_NO_LINK_0, 0x0); rtw_write32(pAdapter, REG_MACID_NO_LINK_0, 0x0);
rtw_write32(pAdapter, REG_MACID_NO_LINK_1, 0x0); rtw_write32(pAdapter, REG_MACID_NO_LINK_1, 0x0);
#endif #endif
#ifdef CONFIG_RTL8814A #ifdef CONFIG_RTL8814A
if (IS_HARDWARE_TYPE_8814A(pAdapter)) { if (IS_HARDWARE_TYPE_8814A(pAdapter)) {
pHalData->BackUp_IG_REG_4_Chnl_Section[0] = (u1Byte)phy_query_bb_reg(pAdapter, rA_IGI_Jaguar, bMaskByte0); pHalData->BackUp_IG_REG_4_Chnl_Section[0] = (u8)phy_query_bb_reg(pAdapter, rA_IGI_Jaguar, bMaskByte0);
pHalData->BackUp_IG_REG_4_Chnl_Section[1] = (u1Byte)phy_query_bb_reg(pAdapter, rB_IGI_Jaguar, bMaskByte0); pHalData->BackUp_IG_REG_4_Chnl_Section[1] = (u8)phy_query_bb_reg(pAdapter, rB_IGI_Jaguar, bMaskByte0);
pHalData->BackUp_IG_REG_4_Chnl_Section[2] = (u1Byte)phy_query_bb_reg(pAdapter, rC_IGI_Jaguar2, bMaskByte0); pHalData->BackUp_IG_REG_4_Chnl_Section[2] = (u8)phy_query_bb_reg(pAdapter, rC_IGI_Jaguar2, bMaskByte0);
pHalData->BackUp_IG_REG_4_Chnl_Section[3] = (u1Byte)phy_query_bb_reg(pAdapter, rD_IGI_Jaguar2, bMaskByte0); pHalData->BackUp_IG_REG_4_Chnl_Section[3] = (u8)phy_query_bb_reg(pAdapter, rD_IGI_Jaguar2, bMaskByte0);
} }
#endif #endif
return rtStatus; return rtStatus;
@ -726,9 +660,9 @@ MPT_InitializeAdapter(
* 05/18/2007 MHC Add normal driver MPHalt code. * 05/18/2007 MHC Add normal driver MPHalt code.
* *
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
VOID void
MPT_DeInitAdapter( MPT_DeInitAdapter(
IN PADAPTER pAdapter PADAPTER pAdapter
) )
{ {
PMPT_CONTEXT pMptCtx = &pAdapter->mppriv.mpt_ctx; PMPT_CONTEXT pMptCtx = &pAdapter->mppriv.mpt_ctx;
@ -793,6 +727,14 @@ void rtw_mp_trigger_lck(PADAPTER padapter)
PHY_LCCalibrate(padapter); PHY_LCCalibrate(padapter);
} }
void rtw_mp_trigger_dpk(PADAPTER padapter)
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
struct dm_struct *pDM_Odm = &pHalData->odmpriv;
halrf_dpk_trigger(pDM_Odm);
}
static void init_mp_data(PADAPTER padapter) static void init_mp_data(PADAPTER padapter)
{ {
u8 v8; u8 v8;
@ -800,9 +742,13 @@ static void init_mp_data(PADAPTER padapter)
struct dm_struct *pDM_Odm = &pHalData->odmpriv; struct dm_struct *pDM_Odm = &pHalData->odmpriv;
/*disable BCN*/ /*disable BCN*/
#ifdef CONFIG_PROTSEL_PORT
rtw_hal_hw_port_disable(padapter);
#else
v8 = rtw_read8(padapter, REG_BCN_CTRL); v8 = rtw_read8(padapter, REG_BCN_CTRL);
v8 &= ~EN_BCN_FUNCTION; v8 &= ~EN_BCN_FUNCTION;
rtw_write8(padapter, REG_BCN_CTRL, v8); rtw_write8(padapter, REG_BCN_CTRL, v8);
#endif
pDM_Odm->rf_calibrate_info.txpowertrack_control = _FALSE; pDM_Odm->rf_calibrate_info.txpowertrack_control = _FALSE;
} }
@ -813,12 +759,14 @@ void MPT_PwrCtlDM(PADAPTER padapter, u32 bstart)
struct dm_struct *pDM_Odm = &pHalData->odmpriv; struct dm_struct *pDM_Odm = &pHalData->odmpriv;
u32 rf_ability; u32 rf_ability;
padapter->mppriv.tssitrk_on = bstart == 3;
if (bstart == 1) { if (bstart == 1) {
RTW_INFO("in MPT_PwrCtlDM start\n"); RTW_INFO("in MPT_PwrCtlDM start\n");
rf_ability = ((u32)halrf_cmn_info_get(pDM_Odm, HALRF_CMNINFO_ABILITY)) | HAL_RF_TX_PWR_TRACK; rf_ability = ((u32)halrf_cmn_info_get(pDM_Odm, HALRF_CMNINFO_ABILITY)) | HAL_RF_TX_PWR_TRACK;
halrf_cmn_info_set(pDM_Odm, HALRF_CMNINFO_ABILITY, rf_ability); halrf_cmn_info_set(pDM_Odm, HALRF_CMNINFO_ABILITY, rf_ability);
halrf_set_pwr_track(pDM_Odm, bstart);
pDM_Odm->rf_calibrate_info.txpowertrack_control = _TRUE; pDM_Odm->rf_calibrate_info.txpowertrack_control = _TRUE;
padapter->mppriv.mp_dm = 1; padapter->mppriv.mp_dm = 1;
@ -826,11 +774,15 @@ void MPT_PwrCtlDM(PADAPTER padapter, u32 bstart)
RTW_INFO("in MPT_PwrCtlDM stop\n"); RTW_INFO("in MPT_PwrCtlDM stop\n");
rf_ability = ((u32)halrf_cmn_info_get(pDM_Odm, HALRF_CMNINFO_ABILITY)) & ~HAL_RF_TX_PWR_TRACK; rf_ability = ((u32)halrf_cmn_info_get(pDM_Odm, HALRF_CMNINFO_ABILITY)) & ~HAL_RF_TX_PWR_TRACK;
halrf_cmn_info_set(pDM_Odm, HALRF_CMNINFO_ABILITY, rf_ability); halrf_cmn_info_set(pDM_Odm, HALRF_CMNINFO_ABILITY, rf_ability);
halrf_set_pwr_track(pDM_Odm, bstart);
pDM_Odm->rf_calibrate_info.txpowertrack_control = _FALSE; pDM_Odm->rf_calibrate_info.txpowertrack_control = _FALSE;
if (IS_HARDWARE_TYPE_8822C(padapter))
padapter->mppriv.mp_dm = 1; /* default enable dpk tracking */
else
padapter->mppriv.mp_dm = 0; padapter->mppriv.mp_dm = 0;
{ {
struct txpwrtrack_cfg c; struct txpwrtrack_cfg c;
u1Byte chnl = 0 ; u8 chnl = 0 ;
_rtw_memset(&c, 0, sizeof(struct txpwrtrack_cfg)); _rtw_memset(&c, 0, sizeof(struct txpwrtrack_cfg));
configure_txpower_track(pDM_Odm, &c); configure_txpower_track(pDM_Odm, &c);
odm_clear_txpowertracking_state(pDM_Odm); odm_clear_txpowertracking_state(pDM_Odm);
@ -880,7 +832,6 @@ u32 mp_join(PADAPTER padapter, u8 mode)
bssid.Ssid.SsidLength = strlen("mp_pseudo_adhoc"); bssid.Ssid.SsidLength = strlen("mp_pseudo_adhoc");
_rtw_memcpy(bssid.Ssid.Ssid, (u8 *)"mp_pseudo_adhoc", bssid.Ssid.SsidLength); _rtw_memcpy(bssid.Ssid.Ssid, (u8 *)"mp_pseudo_adhoc", bssid.Ssid.SsidLength);
bssid.InfrastructureMode = Ndis802_11IBSS; bssid.InfrastructureMode = Ndis802_11IBSS;
bssid.NetworkTypeInUse = Ndis802_11DS;
bssid.IELength = 0; bssid.IELength = 0;
bssid.Configuration.DSConfig = pmppriv->channel; bssid.Configuration.DSConfig = pmppriv->channel;
@ -888,7 +839,6 @@ u32 mp_join(PADAPTER padapter, u8 mode)
bssid.Ssid.SsidLength = strlen("mp_pseudo_STATION"); bssid.Ssid.SsidLength = strlen("mp_pseudo_STATION");
_rtw_memcpy(bssid.Ssid.Ssid, (u8 *)"mp_pseudo_STATION", bssid.Ssid.SsidLength); _rtw_memcpy(bssid.Ssid.Ssid, (u8 *)"mp_pseudo_STATION", bssid.Ssid.SsidLength);
bssid.InfrastructureMode = Ndis802_11Infrastructure; bssid.InfrastructureMode = Ndis802_11Infrastructure;
bssid.NetworkTypeInUse = Ndis802_11DS;
bssid.IELength = 0; bssid.IELength = 0;
} }
@ -1019,10 +969,7 @@ s32 mp_start_test(PADAPTER padapter)
/* 3 0. update mp_priv */ /* 3 0. update mp_priv */
switch (GET_HAL_RFPATH(padapter)) {
if (!RF_TYPE_VALID(padapter->registrypriv.rf_config)) {
/* switch (phal->rf_type) { */
switch (GET_RF_TYPE(padapter)) {
case RF_1T1R: case RF_1T1R:
pmppriv->antenna_tx = ANTENNA_A; pmppriv->antenna_tx = ANTENNA_A;
pmppriv->antenna_rx = ANTENNA_A; pmppriv->antenna_rx = ANTENNA_A;
@ -1041,7 +988,6 @@ s32 mp_start_test(PADAPTER padapter)
pmppriv->antenna_rx = ANTENNA_ABCD; pmppriv->antenna_rx = ANTENNA_ABCD;
break; break;
} }
}
mpt_ProStartTest(padapter); mpt_ProStartTest(padapter);
@ -1124,7 +1070,7 @@ end_of_mp_stop_test:
/*---------------------------hal\rtl8192c\MPT_Phy.c---------------------------*/ /*---------------------------hal\rtl8192c\MPT_Phy.c---------------------------*/
#if 0 #if 0
/* #ifdef CONFIG_USB_HCI */ /* #ifdef CONFIG_USB_HCI */
static VOID mpt_AdjustRFRegByRateByChan92CU(PADAPTER pAdapter, u8 RateIdx, u8 Channel, u8 BandWidthID) static void mpt_AdjustRFRegByRateByChan92CU(PADAPTER pAdapter, u8 RateIdx, u8 Channel, u8 BandWidthID)
{ {
u8 eRFPath; u8 eRFPath;
u32 rfReg0x26; u32 rfReg0x26;
@ -1169,7 +1115,7 @@ static VOID mpt_AdjustRFRegByRateByChan92CU(PADAPTER pAdapter, u8 RateIdx, u8 Ch
* *
* Overview: Change RF Setting when we siwthc channel/rate/BW for MP. * Overview: Change RF Setting when we siwthc channel/rate/BW for MP.
* *
* Input: IN PADAPTER pAdapter * Input: PADAPTER pAdapter
* *
* Output: NONE * Output: NONE
* *
@ -1284,9 +1230,9 @@ static u8 ReadRFThermalMeter(PADAPTER pAdapter)
} }
#endif #endif
void GetThermalMeter(PADAPTER pAdapter, u8 *value) void GetThermalMeter(PADAPTER pAdapter, u8 rfpath ,u8 *value)
{ {
hal_mpt_GetThermalMeter(pAdapter, value); hal_mpt_GetThermalMeter(pAdapter, rfpath, value);
} }
void SetSingleCarrierTx(PADAPTER pAdapter, u8 bStart) void SetSingleCarrierTx(PADAPTER pAdapter, u8 bStart)
@ -1929,7 +1875,7 @@ static void Rtw_MPSetMacTxEDCA(PADAPTER padapter)
void SetPacketTx(PADAPTER padapter) void SetPacketTx(PADAPTER padapter)
{ {
u8 *ptr, *pkt_start, *pkt_end; u8 *ptr, *pkt_start, *pkt_end;
u32 pkt_size, i; u32 pkt_size = 0, i = 0, idx = 0, tmp_idx = 0;
struct rtw_ieee80211_hdr *hdr; struct rtw_ieee80211_hdr *hdr;
u8 payload; u8 payload;
s32 bmcast; s32 bmcast;
@ -1955,6 +1901,11 @@ void SetPacketTx(PADAPTER padapter)
else else
pattrib->psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv)); pattrib->psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv));
if (pattrib->psta == NULL) {
RTW_INFO("%s:psta = NULL !!\n", __func__);
return;
}
pattrib->mac_id = pattrib->psta->cmn.mac_id; pattrib->mac_id = pattrib->psta->cmn.mac_id;
pattrib->mbssid = 0; pattrib->mbssid = 0;
@ -1995,6 +1946,11 @@ void SetPacketTx(PADAPTER padapter)
rtl8822b_prepare_mp_txdesc(padapter, pmp_priv); rtl8822b_prepare_mp_txdesc(padapter, pmp_priv);
#endif /* CONFIG_RTL8822B */ #endif /* CONFIG_RTL8822B */
#if defined(CONFIG_RTL8822C)
if (IS_HARDWARE_TYPE_8822C(padapter))
rtl8822c_prepare_mp_txdesc(padapter, pmp_priv);
#endif /* CONFIG_RTL8822C */
#if defined(CONFIG_RTL8821C) #if defined(CONFIG_RTL8821C)
if (IS_HARDWARE_TYPE_8821C(padapter)) if (IS_HARDWARE_TYPE_8821C(padapter))
rtl8821c_prepare_mp_txdesc(padapter, pmp_priv); rtl8821c_prepare_mp_txdesc(padapter, pmp_priv);
@ -2042,6 +1998,11 @@ void SetPacketTx(PADAPTER padapter)
fill_tx_desc_8710b(padapter); fill_tx_desc_8710b(padapter);
#endif #endif
#if defined(CONFIG_RTL8814B)
if (IS_HARDWARE_TYPE_8814B(padapter))
rtl8814b_prepare_mp_txdesc(padapter, pmp_priv);
#endif /* CONFIG_RTL8814B */
/* 3 4. make wlan header, make_wlanhdr() */ /* 3 4. make wlan header, make_wlanhdr() */
hdr = (struct rtw_ieee80211_hdr *)pkt_start; hdr = (struct rtw_ieee80211_hdr *)pkt_start;
set_frame_sub_type(&hdr->frame_ctl, pattrib->subtype); set_frame_sub_type(&hdr->frame_ctl, pattrib->subtype);
@ -2053,38 +2014,67 @@ void SetPacketTx(PADAPTER padapter)
/* 3 5. make payload */ /* 3 5. make payload */
ptr = pkt_start + pattrib->hdrlen; ptr = pkt_start + pattrib->hdrlen;
if (pmp_priv->mplink_btx == _TRUE) {
_rtw_memcpy(ptr, pmp_priv->mplink_buf, pkt_end - ptr);
} else {
switch (pmp_priv->tx.payload) { switch (pmp_priv->tx.payload) {
case 0: case MP_TX_Payload_00:
RTW_INFO("MP packet tx 0x00 payload!\n");
payload = 0x00; payload = 0x00;
_rtw_memset(ptr, 0x00, pkt_end - ptr);
break; break;
case 1: case MP_TX_Payload_5a:
RTW_INFO("MP packet tx 0x5a payload!\n");
payload = 0x5a; payload = 0x5a;
_rtw_memset(ptr, 0x5a, pkt_end - ptr);
break; break;
case 2: case MP_TX_Payload_a5:
RTW_INFO("MP packet tx 0xa5 payload!\n");
payload = 0xa5; payload = 0xa5;
_rtw_memset(ptr, 0xa5, pkt_end - ptr);
break; break;
case 3: case MP_TX_Payload_ff:
RTW_INFO("MP packet tx 0xff payload!\n");
payload = 0xff; payload = 0xff;
_rtw_memset(ptr, 0xff, pkt_end - ptr);
break;
case MP_TX_Payload_prbs9:
RTW_INFO("MP packet tx PRBS9 payload!\n");
while (idx <= pkt_end - ptr) {
int start = 0x02;
int a = start;
for (i = 0;; i++) {
int newbit = (((a >> 8) ^ (a >> 4)) & 1);
a = ((a << 1) | newbit) & 0x1ff;
RTW_DBG("%x ", a);
ptr[idx + i] = a;
if (a == start) {
RTW_INFO("payload repetition period is %d , end %d\n", i , idx);
tmp_idx += i;
break;
}
if (idx + i >= (pkt_end - ptr)) {
tmp_idx += (idx + i);
RTW_INFO(" repetition period payload end curr ptr %d\n", idx + i);
break;
}
}
idx = tmp_idx;
}
break;
case MP_TX_Payload_default_random:
RTW_INFO("MP packet tx default random payload!\n");
for (i = 0; i < pkt_end - ptr; i++)
ptr[i] = rtw_random32() % 0xFF;
break; break;
default: default:
payload = 0x00; RTW_INFO("Config payload type default use 0x%x\n!", pmp_priv->tx.payload);
_rtw_memset(ptr, pmp_priv->tx.payload, pkt_end - ptr);
break; break;
} }
pmp_priv->TXradomBuffer = rtw_zmalloc(4096);
if (pmp_priv->TXradomBuffer == NULL) {
RTW_INFO("mp create random buffer fail!\n");
goto exit;
} }
for (i = 0; i < 4096; i++)
pmp_priv->TXradomBuffer[i] = rtw_random32() % 0xFF;
/* startPlace = (u32)(rtw_random32() % 3450); */
_rtw_memcpy(ptr, pmp_priv->TXradomBuffer, pkt_end - ptr);
/* _rtw_memset(ptr, payload, pkt_end - ptr); */
rtw_mfree(pmp_priv->TXradomBuffer, 4096);
/* 3 6. start thread */ /* 3 6. start thread */
#ifdef PLATFORM_LINUX #ifdef PLATFORM_LINUX
pmp_priv->tx.PktTxThread = kthread_run(mp_xmit_packet_thread, pmp_priv, "RTW_MP_THREAD"); pmp_priv->tx.PktTxThread = kthread_run(mp_xmit_packet_thread, pmp_priv, "RTW_MP_THREAD");
@ -2106,7 +2096,6 @@ void SetPacketTx(PADAPTER padapter)
#endif #endif
Rtw_MPSetMacTxEDCA(padapter); Rtw_MPSetMacTxEDCA(padapter);
exit:
return; return;
} }
@ -2132,7 +2121,7 @@ void SetPacketRx(PADAPTER pAdapter, u8 bStartRx, u8 bAB)
pHalData->ReceiveConfig |= RCR_CBSSID_DATA | RCR_CBSSID_BCN |RCR_APM | RCR_AM | RCR_AB |RCR_AMF; pHalData->ReceiveConfig |= RCR_CBSSID_DATA | RCR_CBSSID_BCN |RCR_APM | RCR_AM | RCR_AB |RCR_AMF;
pHalData->ReceiveConfig |= RCR_APP_PHYST_RXFF; pHalData->ReceiveConfig |= RCR_APP_PHYST_RXFF;
#if defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) #if defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8822C)
write_bbreg(pAdapter, 0x550, BIT3, bEnable); write_bbreg(pAdapter, 0x550, BIT3, bEnable);
#endif #endif
rtw_write16(pAdapter, REG_RXFLTMAP0, 0xFFEF); /* REG_RXFLTMAP0 (RX Filter Map Group 0) */ rtw_write16(pAdapter, REG_RXFLTMAP0, 0xFFEF); /* REG_RXFLTMAP0 (RX Filter Map Group 0) */
@ -2374,7 +2363,7 @@ static u32 rtw_GetPSDData(PADAPTER pAdapter, u32 point)
{ {
u32 psd_val = 0; u32 psd_val = 0;
#if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) #if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8822C)
u16 psd_reg = 0x910; u16 psd_reg = 0x910;
u16 psd_regL = 0xF44; u16 psd_regL = 0xF44;
#else #else
@ -2414,10 +2403,15 @@ static u32 rtw_GetPSDData(PADAPTER pAdapter, u32 point)
*/ */
u32 mp_query_psd(PADAPTER pAdapter, u8 *data) u32 mp_query_psd(PADAPTER pAdapter, u8 *data)
{ {
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
struct dm_struct *p_dm = adapter_to_phydm(pAdapter);
u32 i, psd_pts = 0, psd_start = 0, psd_stop = 0; u32 i, psd_pts = 0, psd_start = 0, psd_stop = 0;
u32 psd_data = 0; u32 psd_data = 0;
struct psd_init_regs regs = {}; struct psd_init_regs regs = {};
int psd_analysis = 0; int psd_analysis = 0;
char *pdata = NULL;
#ifdef PLATFORM_LINUX #ifdef PLATFORM_LINUX
if (!netif_running(pAdapter->pnetdev)) { if (!netif_running(pAdapter->pnetdev)) {
@ -2442,17 +2436,58 @@ u32 mp_query_psd(PADAPTER pAdapter, u8 *data)
sscanf(data, "pts=%d,start=%d,stop=%d", &psd_pts, &psd_start, &psd_stop); sscanf(data, "pts=%d,start=%d,stop=%d", &psd_pts, &psd_start, &psd_stop);
data[0] = '\0'; data[0] = '\0';
pdata = data;
if (psd_stop > 1536 || psd_stop < 1) {
rtw_warn_on(1);
psd_stop = 1536;
}
if (IS_HARDWARE_TYPE_8822C(pAdapter)) {
u32 *psdbuf = rtw_zmalloc(sizeof(u32)*256);
if (psdbuf == NULL) {
RTW_INFO("%s: psd buf malloc fail!!\n", __func__);
return 0;
}
halrf_cmn_info_set(p_dm, HALRF_CMNINFO_MP_PSD_POINT, psd_pts);
halrf_cmn_info_set(p_dm, HALRF_CMNINFO_MP_PSD_START_POINT, psd_start);
halrf_cmn_info_set(p_dm, HALRF_CMNINFO_MP_PSD_STOP_POINT, psd_stop);
halrf_cmn_info_set(p_dm, HALRF_CMNINFO_MP_PSD_AVERAGE, 0x20000);
halrf_psd_init(p_dm);
#ifdef CONFIG_LONG_DELAY_ISSUE
rtw_msleep_os(100);
#else
rtw_mdelay_os(10);
#endif
halrf_psd_query(p_dm, psdbuf, 256);
i = 0;
while (i < 256) {
pdata += sprintf(pdata, "%x ", (psdbuf[i]));
i++;
}
if (psdbuf)
rtw_mfree(psdbuf, sizeof(u32)*256);
} else {
i = psd_start; i = psd_start;
while (i < psd_stop) { while (i < psd_stop) {
if (i >= psd_pts) if (i >= psd_pts)
psd_data = rtw_GetPSDData(pAdapter, i - psd_pts); psd_data = rtw_GetPSDData(pAdapter, i - psd_pts);
else else
psd_data = rtw_GetPSDData(pAdapter, i); psd_data = rtw_GetPSDData(pAdapter, i);
sprintf(data, "%s%x ", data, psd_data);
pdata += sprintf(pdata, "%x ", psd_data);
i++; i++;
} }
}
#ifdef CONFIG_LONG_DELAY_ISSUE #ifdef CONFIG_LONG_DELAY_ISSUE
rtw_msleep_os(100); rtw_msleep_os(100);
#else #else
@ -2553,7 +2588,7 @@ exit:
u8 u8
mpt_to_mgnt_rate( mpt_to_mgnt_rate(
IN ULONG MptRateIdx u32 MptRateIdx
) )
{ {
/* Mapped to MGN_XXX defined in MgntGen.h */ /* Mapped to MGN_XXX defined in MgntGen.h */
@ -3041,14 +3076,20 @@ u8 rtw_mp_mode_check(PADAPTER pAdapter)
{ {
PADAPTER primary_adapter = GET_PRIMARY_ADAPTER(pAdapter); PADAPTER primary_adapter = GET_PRIMARY_ADAPTER(pAdapter);
if (primary_adapter->registrypriv.mp_mode == 1) if (primary_adapter->registrypriv.mp_mode == 1 || primary_adapter->mppriv.bprocess_mp_mode == _TRUE)
return _TRUE; return _TRUE;
else else
return _FALSE; return _FALSE;
} }
bool rtw_is_mp_tssitrk_on(_adapter *adapter)
{
_adapter *primary_adapter = GET_PRIMARY_ADAPTER(adapter);
ULONG mpt_ProQueryCalTxPower( return primary_adapter->mppriv.tssitrk_on;
}
u32 mpt_ProQueryCalTxPower(
PADAPTER pAdapter, PADAPTER pAdapter,
u8 RfPath u8 RfPath
) )
@ -3057,15 +3098,17 @@ ULONG mpt_ProQueryCalTxPower(
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx);
ULONG TxPower = 1; u32 TxPower = 1;
struct txpwr_idx_comp tic; struct txpwr_idx_comp tic;
u8 mgn_rate = mpt_to_mgnt_rate(pMptCtx->mpt_rate_index); u8 mgn_rate = mpt_to_mgnt_rate(pMptCtx->mpt_rate_index);
RATE_SECTION rs = mgn_rate_to_rs(mgn_rate);
TxPower = rtw_hal_get_tx_power_index(pAdapter, RfPath, mgn_rate, pHalData->current_channel_bw, pHalData->current_channel, &tic); TxPower = rtw_hal_get_tx_power_index(pAdapter, RfPath, rs, mgn_rate
, pHalData->current_channel_bw, pHalData->current_band_type, pHalData->current_channel, 0, &tic);
RTW_INFO("bw=%d, ch=%d, rate=%d, txPower:%u = %u + (%d=%d:%d) + (%d) + (%d)\n", dump_tx_power_index_inline(RTW_DBGDUMP, pAdapter, RfPath
pHalData->current_channel_bw, pHalData->current_channel, mgn_rate , pHalData->current_channel_bw, pHalData->current_channel
, TxPower, tic.base, (tic.by_rate > tic.limit ? tic.limit : tic.by_rate), tic.by_rate, tic.limit, tic.tpt, tic.ebias); , mgn_rate, TxPower, &tic);
pAdapter->mppriv.txpoweridx = (u8)TxPower; pAdapter->mppriv.txpoweridx = (u8)TxPower;
if (RfPath == RF_PATH_A) if (RfPath == RF_PATH_A)
@ -3081,6 +3124,22 @@ ULONG mpt_ProQueryCalTxPower(
return TxPower; return TxPower;
} }
u32 mpt_get_tx_power_finalabs_val(PADAPTER padapter, u8 rf_path)
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
PMPT_CONTEXT pMptCtx = &(padapter->mppriv.mpt_ctx);
u8 mgn_rate = mpt_to_mgnt_rate(pMptCtx->mpt_rate_index);
u32 powerdbm = 0;
powerdbm = phy_get_tx_power_final_absolute_value(padapter, rf_path, mgn_rate, pHalData->current_channel_bw, pHalData->current_channel);
RTW_INFO("bw=%d, ch=%d, rateid=%d, TSSI Power(dBm):%d\n",
pHalData->current_channel_bw, pHalData->current_channel, mgn_rate ,powerdbm);
return powerdbm;
}
#ifdef CONFIG_MP_VHT_HW_TX_MODE #ifdef CONFIG_MP_VHT_HW_TX_MODE
static inline void dump_buf(u8 *buf, u32 len) static inline void dump_buf(u8 *buf, u32 len)
{ {
@ -3093,11 +3152,11 @@ static inline void dump_buf(u8 *buf, u32 len)
} }
void ByteToBit( void ByteToBit(
UCHAR *out, u8 *out,
bool *in, bool *in,
UCHAR in_size) u8 in_size)
{ {
UCHAR i = 0, j = 0; u8 i = 0, j = 0;
for (i = 0; i < in_size; i++) { for (i = 0; i < in_size; i++) {
for (j = 0; j < 8; j++) { for (j = 0; j < 8; j++) {
@ -3111,10 +3170,10 @@ void ByteToBit(
void CRC16_generator( void CRC16_generator(
bool *out, bool *out,
bool *in, bool *in,
UCHAR in_size u8 in_size
) )
{ {
UCHAR i = 0; u8 i = 0;
bool temp = 0, reg[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; bool temp = 0, reg[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
for (i = 0; i < in_size; i++) {/* take one's complement and bit reverse*/ for (i = 0; i < in_size; i++) {/* take one's complement and bit reverse*/
@ -3159,8 +3218,8 @@ void CCK_generator(
bool LengthExtBit; bool LengthExtBit;
double LengthExact; double LengthExact;
double LengthPSDU; double LengthPSDU;
UCHAR i; u8 i;
UINT PacketLength = pPMacTxInfo->PacketLength; u32 PacketLength = pPMacTxInfo->PacketLength;
if (pPMacTxInfo->bSPreamble) if (pPMacTxInfo->bSPreamble)
pPMacTxInfo->SFD = 0x05CF; pPMacTxInfo->SFD = 0x05CF;
@ -3204,7 +3263,7 @@ void CCK_generator(
LengthExtBit = 0; LengthExtBit = 0;
pPMacTxInfo->LENGTH = (UINT)LengthPSDU; pPMacTxInfo->LENGTH = (u32)LengthPSDU;
/* CRC16_in(1,16:31) = LengthPSDU[0:15]*/ /* CRC16_in(1,16:31) = LengthPSDU[0:15]*/
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
crc16_in[i + 16] = (pPMacTxInfo->LENGTH >> i) & 0x1; crc16_in[i + 16] = (pPMacTxInfo->LENGTH >> i) & 0x1;
@ -3231,8 +3290,8 @@ void PMAC_Get_Pkt_Param(
PRT_PMAC_PKT_INFO pPMacPktInfo) PRT_PMAC_PKT_INFO pPMacPktInfo)
{ {
UCHAR TX_RATE_HEX = 0, MCS = 0; u8 TX_RATE_HEX = 0, MCS = 0;
UCHAR TX_RATE = pPMacTxInfo->TX_RATE; u8 TX_RATE = pPMacTxInfo->TX_RATE;
/* TX_RATE & Nss */ /* TX_RATE & Nss */
if (MPT_IS_2SS_RATE(TX_RATE)) if (MPT_IS_2SS_RATE(TX_RATE))
@ -3298,13 +3357,13 @@ void PMAC_Get_Pkt_Param(
} }
UINT LDPC_parameter_generator( u32 LDPC_parameter_generator(
UINT N_pld_int, u32 N_pld_int,
UINT N_CBPSS, u32 N_CBPSS,
UINT N_SS, u32 N_SS,
UINT R, u32 R,
UINT m_STBC, u32 m_STBC,
UINT N_TCB_int u32 N_TCB_int
) )
{ {
double CR = 0.; double CR = 0.;
@ -3314,7 +3373,7 @@ UINT LDPC_parameter_generator(
double L_LDPC = 0., K_LDPC = 0., L_LDPC_info = 0.; double L_LDPC = 0., K_LDPC = 0., L_LDPC_info = 0.;
double N_punc = 0., N_ppcw = 0., N_fpunc = 0., N_rep = 0., N_rpcw = 0., N_frep = 0.; double N_punc = 0., N_ppcw = 0., N_fpunc = 0., N_rep = 0., N_rpcw = 0., N_frep = 0.;
double R_eff = 0.; double R_eff = 0.;
UINT VHTSIGA2B3 = 0;/* extra symbol from VHT-SIG-A2 Bit 3*/ u32 VHTSIGA2B3 = 0;/* extra symbol from VHT-SIG-A2 Bit 3*/
if (R == 0) if (R == 0)
CR = 0.5; CR = 0.5;
@ -3382,13 +3441,13 @@ void PMAC_Nsym_generator(
PRT_PMAC_TX_INFO pPMacTxInfo, PRT_PMAC_TX_INFO pPMacTxInfo,
PRT_PMAC_PKT_INFO pPMacPktInfo) PRT_PMAC_PKT_INFO pPMacPktInfo)
{ {
UINT SIGA2B3 = 0; u32 SIGA2B3 = 0;
UCHAR TX_RATE = pPMacTxInfo->TX_RATE; u8 TX_RATE = pPMacTxInfo->TX_RATE;
UINT R, R_list[10] = {0, 0, 2, 0, 2, 1, 2, 3, 2, 3}; u32 R, R_list[10] = {0, 0, 2, 0, 2, 1, 2, 3, 2, 3};
double CR = 0; double CR = 0;
UINT N_SD, N_BPSC_list[10] = {1, 2, 2, 4, 4, 6, 6, 6, 8, 8}; u32 N_SD, N_BPSC_list[10] = {1, 2, 2, 4, 4, 6, 6, 6, 8, 8};
UINT N_BPSC = 0, N_CBPS = 0, N_DBPS = 0, N_ES = 0, N_SYM = 0, N_pld = 0, N_TCB = 0; u32 N_BPSC = 0, N_CBPS = 0, N_DBPS = 0, N_ES = 0, N_SYM = 0, N_pld = 0, N_TCB = 0;
int D_R = 0; int D_R = 0;
RTW_INFO("TX_RATE = %d\n", TX_RATE); RTW_INFO("TX_RATE = %d\n", TX_RATE);
@ -3401,7 +3460,7 @@ void PMAC_Nsym_generator(
N_SD = 234; N_SD = 234;
if (MPT_IS_HT_RATE(TX_RATE)) { if (MPT_IS_HT_RATE(TX_RATE)) {
UCHAR MCS_temp; u8 MCS_temp;
if (pPMacPktInfo->MCS > 23) if (pPMacPktInfo->MCS > 23)
MCS_temp = pPMacPktInfo->MCS - 24; MCS_temp = pPMacPktInfo->MCS - 24;
@ -3431,14 +3490,14 @@ void PMAC_Nsym_generator(
N_BPSC = N_BPSC_list[MCS_temp]; N_BPSC = N_BPSC_list[MCS_temp];
N_CBPS = N_BPSC * N_SD * pPMacPktInfo->Nss; N_CBPS = N_BPSC * N_SD * pPMacPktInfo->Nss;
N_DBPS = (UINT)((double)N_CBPS * CR); N_DBPS = (u32)((double)N_CBPS * CR);
if (pPMacTxInfo->bLDPC == FALSE) { if (pPMacTxInfo->bLDPC == FALSE) {
N_ES = (UINT)ceil((double)(N_DBPS * pPMacPktInfo->Nss) / 4. / 300.); N_ES = (u32)ceil((double)(N_DBPS * pPMacPktInfo->Nss) / 4. / 300.);
RTW_INFO("N_ES = %d\n", N_ES); RTW_INFO("N_ES = %d\n", N_ES);
/* N_SYM = m_STBC* (8*length+16+6*N_ES) / (m_STBC*N_DBPS)*/ /* N_SYM = m_STBC* (8*length+16+6*N_ES) / (m_STBC*N_DBPS)*/
N_SYM = pPMacTxInfo->m_STBC * (UINT)ceil((double)(pPMacTxInfo->PacketLength * 8 + 16 + N_ES * 6) / N_SYM = pPMacTxInfo->m_STBC * (u32)ceil((double)(pPMacTxInfo->PacketLength * 8 + 16 + N_ES * 6) /
(double)(N_DBPS * pPMacTxInfo->m_STBC)); (double)(N_DBPS * pPMacTxInfo->m_STBC));
} else { } else {
@ -3446,7 +3505,7 @@ void PMAC_Nsym_generator(
/* N_pld = length * 8 + 16*/ /* N_pld = length * 8 + 16*/
N_pld = pPMacTxInfo->PacketLength * 8 + 16; N_pld = pPMacTxInfo->PacketLength * 8 + 16;
RTW_INFO("N_pld = %d\n", N_pld); RTW_INFO("N_pld = %d\n", N_pld);
N_SYM = pPMacTxInfo->m_STBC * (UINT)ceil((double)(N_pld) / N_SYM = pPMacTxInfo->m_STBC * (u32)ceil((double)(N_pld) /
(double)(N_DBPS * pPMacTxInfo->m_STBC)); (double)(N_DBPS * pPMacTxInfo->m_STBC));
RTW_INFO("N_SYM = %d\n", N_SYM); RTW_INFO("N_SYM = %d\n", N_SYM);
/* N_avbits = N_CBPS *m_STBC *(N_pld/N_CBPS*R*m_STBC)*/ /* N_avbits = N_CBPS *m_STBC *(N_pld/N_CBPS*R*m_STBC)*/
@ -3476,19 +3535,19 @@ void PMAC_Nsym_generator(
} }
N_BPSC = N_BPSC_list[pPMacPktInfo->MCS]; N_BPSC = N_BPSC_list[pPMacPktInfo->MCS];
N_CBPS = N_BPSC * N_SD * pPMacPktInfo->Nss; N_CBPS = N_BPSC * N_SD * pPMacPktInfo->Nss;
N_DBPS = (UINT)((double)N_CBPS * CR); N_DBPS = (u32)((double)N_CBPS * CR);
if (pPMacTxInfo->bLDPC == FALSE) { if (pPMacTxInfo->bLDPC == FALSE) {
if (pPMacTxInfo->bSGI) if (pPMacTxInfo->bSGI)
N_ES = (UINT)ceil((double)(N_DBPS) / 3.6 / 600.); N_ES = (u32)ceil((double)(N_DBPS) / 3.6 / 600.);
else else
N_ES = (UINT)ceil((double)(N_DBPS) / 4. / 600.); N_ES = (u32)ceil((double)(N_DBPS) / 4. / 600.);
/* N_SYM = m_STBC* (8*length+16+6*N_ES) / (m_STBC*N_DBPS)*/ /* N_SYM = m_STBC* (8*length+16+6*N_ES) / (m_STBC*N_DBPS)*/
N_SYM = pPMacTxInfo->m_STBC * (UINT)ceil((double)(pPMacTxInfo->PacketLength * 8 + 16 + N_ES * 6) / (double)(N_DBPS * pPMacTxInfo->m_STBC)); N_SYM = pPMacTxInfo->m_STBC * (u32)ceil((double)(pPMacTxInfo->PacketLength * 8 + 16 + N_ES * 6) / (double)(N_DBPS * pPMacTxInfo->m_STBC));
SIGA2B3 = 0; SIGA2B3 = 0;
} else { } else {
N_ES = 1; N_ES = 1;
/* N_SYM = m_STBC* (8*length+N_service) / (m_STBC*N_DBPS)*/ /* N_SYM = m_STBC* (8*length+N_service) / (m_STBC*N_DBPS)*/
N_SYM = pPMacTxInfo->m_STBC * (UINT)ceil((double)(pPMacTxInfo->PacketLength * 8 + 16) / (double)(N_DBPS * pPMacTxInfo->m_STBC)); N_SYM = pPMacTxInfo->m_STBC * (u32)ceil((double)(pPMacTxInfo->PacketLength * 8 + 16) / (double)(N_DBPS * pPMacTxInfo->m_STBC));
/* N_avbits = N_sys_init * N_CBPS*/ /* N_avbits = N_sys_init * N_CBPS*/
N_TCB = N_CBPS * N_SYM; N_TCB = N_CBPS * N_SYM;
/* N_pld = N_sys_init * N_DBPS*/ /* N_pld = N_sys_init * N_DBPS*/
@ -3530,21 +3589,21 @@ void PMAC_Nsym_generator(
========================================*/ ========================================*/
void L_SIG_generator( void L_SIG_generator(
UINT N_SYM, /* Max: 750*/ u32 N_SYM, /* Max: 750*/
PRT_PMAC_TX_INFO pPMacTxInfo, PRT_PMAC_TX_INFO pPMacTxInfo,
PRT_PMAC_PKT_INFO pPMacPktInfo) PRT_PMAC_PKT_INFO pPMacPktInfo)
{ {
u8 sig_bi[24] = {0}; /* 24 BIT*/ u8 sig_bi[24] = {0}; /* 24 BIT*/
UINT mode, LENGTH; u32 mode, LENGTH;
int i; int i;
if (MPT_IS_OFDM_RATE(pPMacTxInfo->TX_RATE)) { if (MPT_IS_OFDM_RATE(pPMacTxInfo->TX_RATE)) {
mode = pPMacPktInfo->MCS; mode = pPMacPktInfo->MCS;
LENGTH = pPMacTxInfo->PacketLength; LENGTH = pPMacTxInfo->PacketLength;
} else { } else {
UCHAR N_LTF; u8 N_LTF;
double T_data; double T_data;
UINT OFDM_symbol; u32 OFDM_symbol;
mode = 0; mode = 0;
@ -3561,9 +3620,9 @@ void L_SIG_generator(
/*(L-SIG, HT-SIG, HT-STF, HT-LTF....HT-LTF, Data)*/ /*(L-SIG, HT-SIG, HT-STF, HT-LTF....HT-LTF, Data)*/
if (MPT_IS_VHT_RATE(pPMacTxInfo->TX_RATE)) if (MPT_IS_VHT_RATE(pPMacTxInfo->TX_RATE))
OFDM_symbol = (UINT)ceil((double)(8 + 4 + N_LTF * 4 + N_SYM * T_data + 4) / 4.); OFDM_symbol = (u32)ceil((double)(8 + 4 + N_LTF * 4 + N_SYM * T_data + 4) / 4.);
else else
OFDM_symbol = (UINT)ceil((double)(8 + 4 + N_LTF * 4 + N_SYM * T_data) / 4.); OFDM_symbol = (u32)ceil((double)(8 + 4 + N_LTF * 4 + N_SYM * T_data) / 4.);
RTW_INFO("%s , OFDM_symbol =%d\n", __func__, OFDM_symbol); RTW_INFO("%s , OFDM_symbol =%d\n", __func__, OFDM_symbol);
LENGTH = OFDM_symbol * 3 - 3; LENGTH = OFDM_symbol * 3 - 3;
@ -3648,10 +3707,10 @@ void L_SIG_generator(
void CRC8_generator( void CRC8_generator(
bool *out, bool *out,
bool *in, bool *in,
UCHAR in_size u8 in_size
) )
{ {
UCHAR i = 0; u8 i = 0;
bool temp = 0, reg[] = {1, 1, 1, 1, 1, 1, 1, 1}; bool temp = 0, reg[] = {1, 1, 1, 1, 1, 1, 1, 1};
for (i = 0; i < in_size; i++) { /* take one's complement and bit reverse*/ for (i = 0; i < in_size; i++) { /* take one's complement and bit reverse*/
@ -3680,7 +3739,7 @@ void HT_SIG_generator(
PRT_PMAC_PKT_INFO pPMacPktInfo PRT_PMAC_PKT_INFO pPMacPktInfo
) )
{ {
UINT i; u32 i;
bool sig_bi[48] = {0}, crc8[8] = {0}; bool sig_bi[48] = {0}, crc8[8] = {0};
/* MCS Field*/ /* MCS Field*/
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
@ -3747,7 +3806,7 @@ void VHT_SIG_A_generator(
PRT_PMAC_TX_INFO pPMacTxInfo, PRT_PMAC_TX_INFO pPMacTxInfo,
PRT_PMAC_PKT_INFO pPMacPktInfo) PRT_PMAC_PKT_INFO pPMacPktInfo)
{ {
UINT i; u32 i;
bool sig_bi[48], crc8[8]; bool sig_bi[48], crc8[8];
_rtw_memset(sig_bi, 0, 48); _rtw_memset(sig_bi, 0, 48);
@ -3811,8 +3870,8 @@ void VHT_SIG_B_generator(
PRT_PMAC_TX_INFO pPMacTxInfo) PRT_PMAC_TX_INFO pPMacTxInfo)
{ {
bool sig_bi[32], crc8_bi[8]; bool sig_bi[32], crc8_bi[8];
UINT i, len, res, tail = 6, total_len, crc8_in_len; u32 i, len, res, tail = 6, total_len, crc8_in_len;
UINT sigb_len; u32 sigb_len;
_rtw_memset(sig_bi, 0, 32); _rtw_memset(sig_bi, 0, 32);
_rtw_memset(crc8_bi, 0, 8); _rtw_memset(crc8_bi, 0, 8);
@ -3882,8 +3941,8 @@ void VHT_Delimiter_generator(
) )
{ {
bool sig_bi[32] = {0}, crc8[8] = {0}; bool sig_bi[32] = {0}, crc8[8] = {0};
UINT crc8_in_len = 16; u32 crc8_in_len = 16;
UINT PacketLength = pPMacTxInfo->PacketLength; u32 PacketLength = pPMacTxInfo->PacketLength;
int j; int j;
/* Delimiter[0]: EOF*/ /* Delimiter[0]: EOF*/

File diff suppressed because it is too large Load Diff

View File

@ -57,7 +57,7 @@ u32 rtw_phydm_ability_ops(_adapter *adapter, HAL_PHYDM_OPS ops, u32 ability)
void rtw_odm_init_ic_type(_adapter *adapter) void rtw_odm_init_ic_type(_adapter *adapter)
{ {
struct dm_struct *odm = adapter_to_phydm(adapter); struct dm_struct *odm = adapter_to_phydm(adapter);
u4Byte ic_type = chip_type_to_odm_ic_type(rtw_get_chip_type(adapter)); u32 ic_type = chip_type_to_odm_ic_type(rtw_get_chip_type(adapter));
rtw_warn_on(!ic_type); rtw_warn_on(!ic_type);
@ -178,39 +178,19 @@ void rtw_odm_releasespinlock(_adapter *adapter, enum rt_spinlock_type type)
} }
} }
inline u8 rtw_odm_get_dfs_domain(struct dvobj_priv *dvobj)
{
#ifdef CONFIG_DFS_MASTER #ifdef CONFIG_DFS_MASTER
struct dm_struct *pDM_Odm = dvobj_to_phydm(dvobj); inline void rtw_odm_radar_detect_reset(_adapter *adapter)
return pDM_Odm->dfs_region_domain;
#else
return PHYDM_DFS_DOMAIN_UNKNOWN;
#endif
}
inline u8 rtw_odm_dfs_domain_unknown(struct dvobj_priv *dvobj)
{
#ifdef CONFIG_DFS_MASTER
return rtw_odm_get_dfs_domain(dvobj) == PHYDM_DFS_DOMAIN_UNKNOWN;
#else
return 1;
#endif
}
#ifdef CONFIG_DFS_MASTER
inline VOID rtw_odm_radar_detect_reset(_adapter *adapter)
{ {
phydm_radar_detect_reset(adapter_to_phydm(adapter)); phydm_radar_detect_reset(adapter_to_phydm(adapter));
} }
inline VOID rtw_odm_radar_detect_disable(_adapter *adapter) inline void rtw_odm_radar_detect_disable(_adapter *adapter)
{ {
phydm_radar_detect_disable(adapter_to_phydm(adapter)); phydm_radar_detect_disable(adapter_to_phydm(adapter));
} }
/* called after ch, bw is set */ /* called after ch, bw is set */
inline VOID rtw_odm_radar_detect_enable(_adapter *adapter) inline void rtw_odm_radar_detect_enable(_adapter *adapter)
{ {
phydm_radar_detect_enable(adapter_to_phydm(adapter)); phydm_radar_detect_enable(adapter_to_phydm(adapter));
} }
@ -337,12 +317,6 @@ void rtw_odm_parse_rx_phy_status_chinfo(union recv_frame *rframe, u8 *phys)
static const s8 cch_offset_by_rxsc[15] = {0, 2, -2, 6, -6, 10, -10, 14, -14, 4, -4, 12, -12, 8, -8}; static const s8 cch_offset_by_rxsc[15] = {0, 2, -2, 6, -6, 10, -10, 14, -14, 4, -4, 12, -12, 8, -8};
if (phys_t1->rf_mode > 3) {
/* invalid rf_mode */
rtw_warn_on(1);
goto type1_end;
}
if (phys_t1->rf_mode == 0) { if (phys_t1->rf_mode == 0) {
/* RF 20MHz */ /* RF 20MHz */
pkt_cch = phys_t1->channel; pkt_cch = phys_t1->channel;
@ -418,3 +392,190 @@ type1_end:
} }
#if defined(CONFIG_RTL8822C) && defined(CONFIG_LPS_PG)
void
debug_DACK(
struct dm_struct *dm
)
{
//P_PHYDM_FUNC dm;
//dm = &(SysMib.ODM.Phydm);
//PIQK_OFFLOAD_PARM pIQK_info;
//pIQK_info= &(SysMib.ODM.IQKParm);
u8 i;
u32 temp1, temp2, temp3;
temp1 = odm_get_bb_reg(dm, 0x1860, bMaskDWord);
temp2 = odm_get_bb_reg(dm, 0x4160, bMaskDWord);
temp3 = odm_get_bb_reg(dm, 0x9b4, bMaskDWord);
odm_set_bb_reg(dm, 0x9b4, bMaskDWord, 0xdb66db00);
//pathA
odm_set_bb_reg(dm, 0x1830, BIT(30), 0x0);
odm_set_bb_reg(dm, 0x1860, 0xfc000000, 0x3c);
RTW_INFO("path A i\n");
//i
for (i = 0; i < 0xf; i++) {
odm_set_bb_reg(dm, 0x18b0, 0xf0000000, i);
RTW_INFO("[0][0][%d] = 0x%08x\n", i, (u16)odm_get_bb_reg(dm,0x2810,0x7fc0000));
//pIQK_info->msbk_d[0][0][i] = (u16)odm_get_bb_reg(dm,0x2810,0x7fc0000);
}
RTW_INFO("path A q\n");
//q
for (i = 0; i < 0xf; i++) {
odm_set_bb_reg(dm, 0x18cc, 0xf0000000, i);
RTW_INFO("[0][1][%d] = 0x%08x\n", i, (u16)odm_get_bb_reg(dm,0x283c,0x7fc0000));
//pIQK_info->msbk_d[0][1][i] = (u16)odm_get_bb_reg(dm,0x283c,0x7fc0000);
}
//pathB
odm_set_bb_reg(dm, 0x4130, BIT(30), 0x0);
odm_set_bb_reg(dm, 0x4160, 0xfc000000, 0x3c);
RTW_INFO("\npath B i\n");
//i
for (i = 0; i < 0xf; i++) {
odm_set_bb_reg(dm, 0x41b0, 0xf0000000, i);
RTW_INFO("[1][0][%d] = 0x%08x\n", i, (u16)odm_get_bb_reg(dm,0x4510,0x7fc0000));
//pIQK_info->msbk_d[1][0][i] = (u16)odm_get_bb_reg(dm,0x2810,0x7fc0000);
}
RTW_INFO("path B q\n");
//q
for (i = 0; i < 0xf; i++) {
odm_set_bb_reg(dm, 0x41cc, 0xf0000000, i);
RTW_INFO("[1][1][%d] = 0x%08x\n", i, (u16)odm_get_bb_reg(dm,0x453c,0x7fc0000));
//pIQK_info->msbk_d[1][1][i] = (u16)odm_get_bb_reg(dm,0x283c,0x7fc0000);
}
//restore to normal
odm_set_bb_reg(dm, 0x1830, BIT(30), 0x1);
odm_set_bb_reg(dm, 0x4130, BIT(30), 0x1);
odm_set_bb_reg(dm, 0x1860, bMaskDWord, temp1);
odm_set_bb_reg(dm, 0x4160, bMaskDWord, temp2);
odm_set_bb_reg(dm, 0x9b4, bMaskDWord, temp3);
}
void
debug_IQK(
struct dm_struct *dm,
IN u8 idx,
IN u8 path
)
{
u8 i, ch;
u32 tmp;
u32 bit_mask_20_16 = BIT(20) | BIT(19) | BIT(18) | BIT(17) | BIT(16);
RTW_INFO("idx = %d, path = %d\n", idx, path);
odm_set_bb_reg(dm, 0x1b00, MASKDWORD, 0x8 | path << 1);
if (idx == TX_IQK) {//TXCFIR
odm_set_bb_reg(dm, R_0x1b20, BIT(31) | BIT(30), 0x3);
} else {//RXCFIR
odm_set_bb_reg(dm, R_0x1b20, BIT(31) | BIT(30), 0x1);
}
odm_set_bb_reg(dm, R_0x1bd4, BIT(21), 0x1);
odm_set_bb_reg(dm, R_0x1bd4, bit_mask_20_16, 0x10);
for (i = 0; i <= 16; i++) {
odm_set_bb_reg(dm, R_0x1bd8, MASKDWORD, 0xe0000001 | i << 2);
tmp = odm_get_bb_reg(dm, R_0x1bfc, MASKDWORD);
RTW_INFO("iqk_cfir_real[%d][%d][%d] = 0x%x\n", path, idx, i, ((tmp & 0x0fff0000) >> 16));
//iqk_info->iqk_cfir_real[ch][path][idx][i] =
// (tmp & 0x0fff0000) >> 16;
RTW_INFO("iqk_cfir_imag[%d][%d][%d] = 0x%x\n", path, idx, i, (tmp & 0x0fff));
//iqk_info->iqk_cfir_imag[ch][path][idx][i] = tmp & 0x0fff;
}
odm_set_bb_reg(dm, R_0x1b20, BIT(31) | BIT(30), 0x0);
//odm_set_bb_reg(dm, R_0x1bd8, MASKDWORD, 0x0);
}
__odm_func__ void
debug_information_8822c(
struct dm_struct *dm)
{
struct dm_dpk_info *dpk_info = &dm->dpk_info;
u32 reg_rf18;
if (odm_get_bb_reg(dm, R_0x1e7c, BIT(30)))
dpk_info->is_tssi_mode = true;
else
dpk_info->is_tssi_mode = false;
reg_rf18 = odm_get_rf_reg(dm, RF_PATH_A, RF_0x18, RFREG_MASK);
dpk_info->dpk_band = (u8)((reg_rf18 & BIT(16)) >> 16); /*0/1:G/A*/
dpk_info->dpk_ch = (u8)reg_rf18 & 0xff;
dpk_info->dpk_bw = (u8)((reg_rf18 & 0x3000) >> 12); /*3/2/1:20/40/80*/
RTW_INFO("[DPK] TSSI/ Band/ CH/ BW = %d / %s / %d / %s\n",
dpk_info->is_tssi_mode, dpk_info->dpk_band == 0 ? "2G" : "5G",
dpk_info->dpk_ch,
dpk_info->dpk_bw == 3 ? "20M" : (dpk_info->dpk_bw == 2 ? "40M" : "80M"));
}
extern void _dpk_get_coef_8822c(void *dm_void, u8 path);
__odm_func__ void
debug_reload_data_8822c(
void *dm_void)
{
struct dm_struct *dm = (struct dm_struct *)dm_void;
struct dm_dpk_info *dpk_info = &dm->dpk_info;
u8 path;
u32 u32tmp;
debug_information_8822c(dm);
for (path = 0; path < DPK_RF_PATH_NUM_8822C; path++) {
RTW_INFO("[DPK] Reload path: 0x%x\n", path);
odm_set_bb_reg(dm, R_0x1b00, MASKDWORD, 0x8 | (path << 1));
/*txagc bnd*/
if (dpk_info->dpk_band == 0x0)
u32tmp = odm_get_bb_reg(dm, R_0x1b60, MASKDWORD);
else
u32tmp = odm_get_bb_reg(dm, R_0x1b60, MASKDWORD);
RTW_INFO("[DPK] txagc bnd = 0x%08x\n", u32tmp);
u32tmp = odm_get_bb_reg(dm, R_0x1b64, MASKBYTE3);
RTW_INFO("[DPK] dpk_txagc = 0x%08x\n", u32tmp);
//debug_coef_write_8822c(dm, path, dpk_info->dpk_path_ok & BIT(path) >> path);
_dpk_get_coef_8822c(dm, path);
//debug_one_shot_8822c(dm, path, DPK_ON);
odm_set_bb_reg(dm, R_0x1b00, 0x0000000f, 0xc);
if (path == RF_PATH_A)
u32tmp = odm_get_bb_reg(dm, R_0x1b04, 0x0fffffff);
else
u32tmp = odm_get_bb_reg(dm, R_0x1b5c, 0x0fffffff);
RTW_INFO("[DPK] dpk_gs = 0x%08x\n", u32tmp);
}
}
void odm_lps_pg_debug_8822c(void *dm_void)
{
struct dm_struct *dm = (struct dm_struct *)dm_void;
debug_DACK(dm);
debug_IQK(dm, TX_IQK, RF_PATH_A);
debug_IQK(dm, RX_IQK, RF_PATH_A);
debug_IQK(dm, TX_IQK, RF_PATH_B);
debug_IQK(dm, RX_IQK, RF_PATH_B);
debug_reload_data_8822c(dm);
}
#endif /* defined(CONFIG_RTL8822C) && defined(CONFIG_LPS_PG) */

View File

@ -1869,16 +1869,6 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
{ {
u8 p2pie[MAX_P2P_IE_LEN] = { 0x00 }; u8 p2pie[MAX_P2P_IE_LEN] = { 0x00 };
u32 len = 0, p2pielen = 0; u32 len = 0, p2pielen = 0;
#ifdef CONFIG_INTEL_WIDI
struct mlme_priv *pmlmepriv = &(pwdinfo->padapter->mlmepriv);
u8 zero_array_check[L2SDTA_SERVICE_VE_LEN] = { 0x00 };
u8 widi_version = 0, i = 0;
if (_rtw_memcmp(pmlmepriv->sa_ext, zero_array_check, L2SDTA_SERVICE_VE_LEN) == _FALSE)
widi_version = 35;
else if (pmlmepriv->num_p2p_sdt != 0)
widi_version = 40;
#endif /* CONFIG_INTEL_WIDI */
/* P2P OUI */ /* P2P OUI */
p2pielen = 0; p2pielen = 0;
@ -1961,13 +1951,6 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
/* 21->P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) */ /* 21->P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) */
/* + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) */ /* + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) */
/* *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len ); */ /* *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len ); */
#ifdef CONFIG_INTEL_WIDI
if (widi_version == 35)
RTW_PUT_LE16(p2pie + p2pielen, 21 + 8 + pwdinfo->device_name_len);
else if (widi_version == 40)
RTW_PUT_LE16(p2pie + p2pielen, 21 + 8 * pmlmepriv->num_p2p_sdt + pwdinfo->device_name_len);
else
#endif /* CONFIG_INTEL_WIDI */
RTW_PUT_LE16(p2pie + p2pielen, 21 + pwdinfo->device_name_len); RTW_PUT_LE16(p2pie + p2pielen, 21 + pwdinfo->device_name_len);
p2pielen += 2; p2pielen += 2;
@ -1982,25 +1965,6 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
RTW_PUT_BE16(p2pie + p2pielen, pwdinfo->supported_wps_cm); RTW_PUT_BE16(p2pie + p2pielen, pwdinfo->supported_wps_cm);
p2pielen += 2; p2pielen += 2;
#ifdef CONFIG_INTEL_WIDI
if (widi_version == 40) {
/* Primary Device Type */
/* Category ID */
/* *(u16*) ( p2pie + p2pielen ) = cpu_to_be16( WPS_PDT_CID_MULIT_MEDIA ); */
RTW_PUT_BE16(p2pie + p2pielen, pmlmepriv->p2p_pdt_cid);
p2pielen += 2;
/* OUI */
/* *(u32*) ( p2pie + p2pielen ) = cpu_to_be32( WPSOUI ); */
RTW_PUT_BE32(p2pie + p2pielen, WPSOUI);
p2pielen += 4;
/* Sub Category ID */
/* *(u16*) ( p2pie + p2pielen ) = cpu_to_be16( WPS_PDT_SCID_MEDIA_SERVER ); */
RTW_PUT_BE16(p2pie + p2pielen, pmlmepriv->p2p_pdt_scid);
p2pielen += 2;
} else
#endif /* CONFIG_INTEL_WIDI */
{ {
/* Primary Device Type */ /* Primary Device Type */
/* Category ID */ /* Category ID */
@ -2020,32 +1984,6 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
} }
/* Number of Secondary Device Types */ /* Number of Secondary Device Types */
#ifdef CONFIG_INTEL_WIDI
if (widi_version == 35) {
p2pie[p2pielen++] = 0x01;
RTW_PUT_BE16(p2pie + p2pielen, WPS_PDT_CID_DISPLAYS);
p2pielen += 2;
RTW_PUT_BE32(p2pie + p2pielen, INTEL_DEV_TYPE_OUI);
p2pielen += 4;
RTW_PUT_BE16(p2pie + p2pielen, P2P_SCID_WIDI_CONSUMER_SINK);
p2pielen += 2;
} else if (widi_version == 40) {
p2pie[p2pielen++] = pmlmepriv->num_p2p_sdt;
for (; i < pmlmepriv->num_p2p_sdt; i++) {
RTW_PUT_BE16(p2pie + p2pielen, pmlmepriv->p2p_sdt_cid[i]);
p2pielen += 2;
RTW_PUT_BE32(p2pie + p2pielen, INTEL_DEV_TYPE_OUI);
p2pielen += 4;
RTW_PUT_BE16(p2pie + p2pielen, pmlmepriv->p2p_sdt_scid[i]);
p2pielen += 2;
}
} else
#endif /* CONFIG_INTEL_WIDI */
p2pie[p2pielen++] = 0x00; /* No Secondary Device Type List */ p2pie[p2pielen++] = 0x00; /* No Secondary Device Type List */
/* Device Name */ /* Device Name */
@ -3169,7 +3107,6 @@ void p2p_concurrent_handler(_adapter *padapter)
{ {
struct wifidirect_info *pwdinfo = &padapter->wdinfo; struct wifidirect_info *pwdinfo = &padapter->wdinfo;
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
u8 val8; u8 val8;
#ifdef CONFIG_IOCTL_CFG80211 #ifdef CONFIG_IOCTL_CFG80211
@ -4495,8 +4432,10 @@ void process_p2p_ps_ie(PADAPTER padapter, u8 *IEs, u32 IELength)
(noa_index != pwdinfo->noa_index)) { /* if index change, driver should reconfigure related setting. */ (noa_index != pwdinfo->noa_index)) { /* if index change, driver should reconfigure related setting. */
pwdinfo->noa_index = noa_index; pwdinfo->noa_index = noa_index;
pwdinfo->opp_ps = noa_attr[1] >> 7; pwdinfo->opp_ps = noa_attr[1] >> 7;
if (pwdinfo->opp_ps != 1)
pwdinfo->ctwindow = 0;
else
pwdinfo->ctwindow = noa_attr[1] & 0x7F; pwdinfo->ctwindow = noa_attr[1] & 0x7F;
noa_offset = 2; noa_offset = 2;
noa_num = 0; noa_num = 0;
/* NoA length should be n*(13) + 2 */ /* NoA length should be n*(13) + 2 */
@ -4560,17 +4499,19 @@ void p2p_ps_wk_hdl(_adapter *padapter, u8 p2p_ps_state)
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_P2P_PS_OFFLOAD, (u8 *)(&p2p_ps_state)); rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_P2P_PS_OFFLOAD, (u8 *)(&p2p_ps_state));
if (pwdinfo->opp_ps == 1) {
if (pwrpriv->smart_ps == 0) {
pwrpriv->smart_ps = 2;
if (pwrpriv->pwr_mode != PS_MODE_ACTIVE)
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&(pwrpriv->pwr_mode)));
}
}
pwdinfo->noa_index = 0; pwdinfo->noa_index = 0;
pwdinfo->ctwindow = 0; pwdinfo->ctwindow = 0;
pwdinfo->opp_ps = 0; pwdinfo->opp_ps = 0;
pwdinfo->noa_num = 0; pwdinfo->noa_num = 0;
pwdinfo->p2p_ps_mode = P2P_PS_NONE; pwdinfo->p2p_ps_mode = P2P_PS_NONE;
if (pwrpriv->bFwCurrentInPSMode == _TRUE) {
if (pwrpriv->smart_ps == 0) {
pwrpriv->smart_ps = 2;
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&(pwrpriv->pwr_mode)));
}
}
break; break;
case P2P_PS_ENABLE: case P2P_PS_ENABLE:
_enter_pwrlock(&adapter_to_pwrctl(padapter)->lock); _enter_pwrlock(&adapter_to_pwrctl(padapter)->lock);
@ -4599,6 +4540,7 @@ void p2p_ps_wk_hdl(_adapter *padapter, u8 p2p_ps_state)
if (pwrpriv->smart_ps != 0) { if (pwrpriv->smart_ps != 0) {
pwrpriv->smart_ps = 0; pwrpriv->smart_ps = 0;
RTW_INFO("%s(): Enter CTW, change SmartPS\n", __FUNCTION__); RTW_INFO("%s(): Enter CTW, change SmartPS\n", __FUNCTION__);
if (pwrpriv->pwr_mode != PS_MODE_ACTIVE)
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&(pwrpriv->pwr_mode))); rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&(pwrpriv->pwr_mode)));
} }
} }
@ -5354,9 +5296,12 @@ int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role)
/* So, this function will do nothing if the buddy adapter had enabled the P2P function. */ /* So, this function will do nothing if the buddy adapter had enabled the P2P function. */
/*if(!rtw_p2p_chk_state(pbuddy_wdinfo, P2P_STATE_NONE)) /*if(!rtw_p2p_chk_state(pbuddy_wdinfo, P2P_STATE_NONE))
return ret;*/ return ret;*/
/*The buddy adapter had enabled the P2P function.*/ /* Only selected interface can be P2P interface */
if (rtw_mi_buddy_stay_in_p2p_mode(padapter)) if (padapter->iface_id != padapter->registrypriv.sel_p2p_iface) {
RTW_ERR("%s, iface_id:%d is not P2P interface!\n", __func__, padapter->iface_id);
ret = _FAIL;
return ret; return ret;
}
#endif /* CONFIG_CONCURRENT_MODE */ #endif /* CONFIG_CONCURRENT_MODE */
/* leave IPS/Autosuspend */ /* leave IPS/Autosuspend */
@ -5388,10 +5333,6 @@ int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role)
#endif #endif
} else if (role == P2P_ROLE_DISABLE) { } else if (role == P2P_ROLE_DISABLE) {
#ifdef CONFIG_INTEL_WIDI
if (padapter->mlmepriv.p2p_reject_disable == _TRUE)
return ret;
#endif /* CONFIG_INTEL_WIDI */
#ifdef CONFIG_IOCTL_CFG80211 #ifdef CONFIG_IOCTL_CFG80211
if (padapter->wdinfo.driver_interface == DRIVER_CFG80211) if (padapter->wdinfo.driver_interface == DRIVER_CFG80211)
@ -5436,10 +5377,6 @@ int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role)
/* Restore to initial setting. */ /* Restore to initial setting. */
update_tx_basic_rate(padapter, padapter->registrypriv.wireless_mode); update_tx_basic_rate(padapter, padapter->registrypriv.wireless_mode);
#ifdef CONFIG_INTEL_WIDI
rtw_reset_widi_info(padapter);
#endif /* CONFIG_INTEL_WIDI */
/* For WiDi purpose. */ /* For WiDi purpose. */
#ifdef CONFIG_IOCTL_CFG80211 #ifdef CONFIG_IOCTL_CFG80211
pwdinfo->driver_interface = DRIVER_CFG80211; pwdinfo->driver_interface = DRIVER_CFG80211;

View File

@ -117,6 +117,10 @@ void ips_enter(_adapter *padapter)
_enter_pwrlock(&pwrpriv->lock); _enter_pwrlock(&pwrpriv->lock);
_ips_enter(padapter); _ips_enter(padapter);
_exit_pwrlock(&pwrpriv->lock); _exit_pwrlock(&pwrpriv->lock);
#ifdef CONFIG_PCI_DYNAMIC_ASPM
rtw_pci_dynamic_aspm_set_mode(padapter, ASPM_MODE_PS);
#endif
} }
int _ips_leave(_adapter *padapter) int _ips_leave(_adapter *padapter)
@ -172,6 +176,10 @@ int ips_leave(_adapter *padapter)
#endif /* DBG_CHECK_FW_PS_STATE */ #endif /* DBG_CHECK_FW_PS_STATE */
_exit_pwrlock(&pwrpriv->lock); _exit_pwrlock(&pwrpriv->lock);
#ifdef CONFIG_PCI_DYNAMIC_ASPM
rtw_pci_dynamic_aspm_set_mode(padapter, ASPM_MODE_PERF);
#endif
if (_SUCCESS == ret) if (_SUCCESS == ret)
odm_dm_reset(&GET_HAL_DATA(padapter)->odmpriv); odm_dm_reset(&GET_HAL_DATA(padapter)->odmpriv);
@ -248,11 +256,6 @@ bool rtw_pwr_unassociated_idle(_adapter *adapter)
goto exit; goto exit;
#endif #endif
#ifdef CONFIG_INTEL_PROXIM
if (adapter->proximity.proxim_on == _TRUE)
return;
#endif
if (pxmit_priv->free_xmitbuf_cnt != NR_XMITBUFF || if (pxmit_priv->free_xmitbuf_cnt != NR_XMITBUFF ||
pxmit_priv->free_xmit_extbuf_cnt != NR_XMIT_EXTBUFF) { pxmit_priv->free_xmit_extbuf_cnt != NR_XMIT_EXTBUFF) {
RTW_PRINT("There are some pkts to transmit\n"); RTW_PRINT("There are some pkts to transmit\n");
@ -461,8 +464,8 @@ void traffic_check_for_leave_lps_by_tp(PADAPTER padapter, u8 tx, struct sta_info
RTW_INFO("Rx = %d [%d] (KB)\n", rx_tp_kbyte, rx_tp_th); RTW_INFO("Rx = %d [%d] (KB)\n", rx_tp_kbyte, rx_tp_th);
#endif #endif
pwrpriv->lps_chk_cnt = pwrpriv->lps_chk_cnt_th; pwrpriv->lps_chk_cnt = pwrpriv->lps_chk_cnt_th;
/* rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 1); */ /* rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 0); */
rtw_lps_ctrl_wk_cmd(padapter, tx ? LPS_CTRL_TX_TRAFFIC_LEAVE : LPS_CTRL_RX_TRAFFIC_LEAVE, 1); rtw_lps_ctrl_wk_cmd(padapter, tx ? LPS_CTRL_TX_TRAFFIC_LEAVE : LPS_CTRL_RX_TRAFFIC_LEAVE, 0);
} }
} }
#endif /*CONFIG_LPS_CHK_BY_TP*/ #endif /*CONFIG_LPS_CHK_BY_TP*/
@ -515,8 +518,8 @@ void traffic_check_for_leave_lps(PADAPTER padapter, u8 tx, u32 tx_packets)
if (bLeaveLPS) { if (bLeaveLPS) {
/* RTW_INFO("leave lps via %s, Tx = %d, Rx = %d\n", tx?"Tx":"Rx", pmlmepriv->LinkDetectInfo.NumTxOkInPeriod,pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod); */ /* RTW_INFO("leave lps via %s, Tx = %d, Rx = %d\n", tx?"Tx":"Rx", pmlmepriv->LinkDetectInfo.NumTxOkInPeriod,pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod); */
/* rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 1); */ /* rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 0); */
rtw_lps_ctrl_wk_cmd(padapter, tx ? LPS_CTRL_TX_TRAFFIC_LEAVE : LPS_CTRL_RX_TRAFFIC_LEAVE, tx ? 0 : 1); rtw_lps_ctrl_wk_cmd(padapter, tx ? LPS_CTRL_TX_TRAFFIC_LEAVE : LPS_CTRL_RX_TRAFFIC_LEAVE, tx ? RTW_CMDF_DIRECTLY : 0);
} }
} }
#endif /* CONFIG_CHECK_LEAVE_LPS */ #endif /* CONFIG_CHECK_LEAVE_LPS */
@ -691,7 +694,6 @@ u8 rtw_set_rpwm(PADAPTER padapter, u8 pslv)
u8 PS_RDY_CHECK(_adapter *padapter) u8 PS_RDY_CHECK(_adapter *padapter)
{ {
u32 delta_ms;
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
@ -707,14 +709,14 @@ u8 PS_RDY_CHECK(_adapter *padapter)
return _FALSE; return _FALSE;
#endif #endif
delta_ms = rtw_get_passing_time_ms(pwrpriv->DelayLPSLastTimeStamp); if (rtw_time_after(pwrpriv->lps_deny_time, rtw_get_current_time()))
if (delta_ms < LPS_DELAY_MS)
return _FALSE; return _FALSE;
if (check_fwstate(pmlmepriv, WIFI_SITE_MONITOR) if (check_fwstate(pmlmepriv, WIFI_SITE_MONITOR)
|| check_fwstate(pmlmepriv, WIFI_UNDER_LINKING | WIFI_UNDER_WPS) || check_fwstate(pmlmepriv, WIFI_UNDER_LINKING | WIFI_UNDER_WPS)
|| MLME_IS_AP(padapter) || MLME_IS_AP(padapter)
|| MLME_IS_MESH(padapter) || MLME_IS_MESH(padapter)
|| MLME_IS_MONITOR(padapter)
|| check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE)
#if defined(CONFIG_P2P) && defined(CONFIG_IOCTL_CFG80211) #if defined(CONFIG_P2P) && defined(CONFIG_IOCTL_CFG80211)
|| rtw_cfg80211_get_is_roch(padapter) == _TRUE || rtw_cfg80211_get_is_roch(padapter) == _TRUE
@ -743,73 +745,6 @@ u8 PS_RDY_CHECK(_adapter *padapter)
return _TRUE; return _TRUE;
} }
#ifdef CONFIG_LPS_LCLK
void rtw_set_fw_config_32k(PADAPTER padapter, u8 enable)
{
u8 val8 = 0;
u8 cpwm_orig = 0, cpwm_now = 0;
int cnt = 0;
systime start_time;
if (enable){
/* H2C done, enter 32k */
if (val8 == 0) {
/* ser rpwm to enter 32k */
rtw_hal_get_hwreg(padapter, HW_VAR_RPWM_TOG, &val8);
RTW_INFO("%s: read rpwm=%02x\n", __FUNCTION__, val8);
val8 += 0x80;
val8 |= BIT(0);
rtw_hal_set_hwreg(padapter, HW_VAR_SET_RPWM, (u8 *)(&val8));
RTW_INFO("%s: write rpwm=%02x\n", __FUNCTION__, val8);
adapter_to_pwrctl(padapter)->tog = (val8 + 0x80) & 0x80;
cnt = val8 = 0;
do {
val8 = rtw_read8(padapter, REG_CR);
cnt++;
RTW_INFO("%s polling 0x100=0x%x, cnt=%d\n",
__func__, val8, cnt);
RTW_INFO("%s 0x08:%02x, 0x03:%02x\n",
__func__,
rtw_read8(padapter, 0x08),
rtw_read8(padapter, 0x03));
rtw_mdelay_os(10);
} while (cnt < 20 && (val8 != 0xEA));
}
} else {
/* for polling cpwm */
cpwm_orig = 0;
rtw_hal_get_hwreg(padapter, HW_VAR_CPWM, &cpwm_orig);
/* ser rpwm */
rtw_hal_get_hwreg(padapter, HW_VAR_RPWM_TOG, &val8);
val8 += 0x80;
val8 |= BIT(6);
rtw_hal_set_hwreg(padapter, HW_VAR_SET_RPWM, (u8 *)(&val8));
RTW_INFO("%s: write rpwm=%02x\n", __FUNCTION__, val8);
adapter_to_pwrctl(padapter)->tog = (val8 + 0x80) & 0x80;
/* do polling cpwm */
start_time = rtw_get_current_time();
do {
rtw_mdelay_os(1);
rtw_hal_get_hwreg(padapter, HW_VAR_CPWM, &cpwm_now);
if ((cpwm_orig ^ cpwm_now) & 0x80)
break;
if (rtw_get_passing_time_ms(start_time) > 100) {
RTW_INFO("%s: polling cpwm timeout when leaving IPS in FWLPS state\n", __FUNCTION__);
break;
}
} while (1);
}
}
#endif
#if defined(CONFIG_FWLPS_IN_IPS) #if defined(CONFIG_FWLPS_IN_IPS)
void rtw_set_fw_in_ips_mode(PADAPTER padapter, u8 enable) void rtw_set_fw_in_ips_mode(PADAPTER padapter, u8 enable)
{ {
@ -852,15 +787,67 @@ void rtw_set_fw_in_ips_mode(PADAPTER padapter, u8 enable)
__func__, val8, cnt); __func__, val8, cnt);
rtw_mdelay_os(10); rtw_mdelay_os(10);
} while (cnt < 100 && (val8 != 0)); } while (cnt < 100 && (val8 != 0));
#if defined(CONFIG_LPS_LCLK) && !defined(CONFIG_PNO_SUPPORT)
rtw_set_fw_config_32k(padapter, enable); #ifdef CONFIG_LPS_LCLK
/* H2C done, enter 32k */
if (val8 == 0) {
/* ser rpwm to enter 32k */
rtw_hal_get_hwreg(padapter, HW_VAR_RPWM_TOG, &val8);
RTW_INFO("%s: read rpwm=%02x\n", __FUNCTION__, val8);
val8 += 0x80;
val8 |= BIT(0);
rtw_hal_set_hwreg(padapter, HW_VAR_SET_RPWM, (u8 *)(&val8));
RTW_INFO("%s: write rpwm=%02x\n", __FUNCTION__, val8);
adapter_to_pwrctl(padapter)->tog = (val8 + 0x80) & 0x80;
cnt = val8 = 0;
if (parm[1] == 0 || parm[2] == 0) {
do {
val8 = rtw_read8(padapter, REG_CR);
cnt++;
RTW_INFO("%s polling 0x100=0x%x, cnt=%d\n",
__func__, val8, cnt);
RTW_INFO("%s 0x08:%02x, 0x03:%02x\n",
__func__,
rtw_read8(padapter, 0x08),
rtw_read8(padapter, 0x03));
rtw_mdelay_os(10);
} while (cnt < 20 && (val8 != 0xEA));
}
}
#endif #endif
} else { } else {
/* Leave IPS */ /* Leave IPS */
RTW_INFO("%s: Leaving IPS in FWLPS state\n", __func__); RTW_INFO("%s: Leaving IPS in FWLPS state\n", __func__);
#if defined(CONFIG_LPS_LCLK) && !defined(CONFIG_PNO_SUPPORT) #ifdef CONFIG_LPS_LCLK
rtw_set_fw_config_32k(padapter, enable); /* for polling cpwm */
cpwm_orig = 0;
rtw_hal_get_hwreg(padapter, HW_VAR_CPWM, &cpwm_orig);
/* ser rpwm */
rtw_hal_get_hwreg(padapter, HW_VAR_RPWM_TOG, &val8);
val8 += 0x80;
val8 |= BIT(6);
rtw_hal_set_hwreg(padapter, HW_VAR_SET_RPWM, (u8 *)(&val8));
RTW_INFO("%s: write rpwm=%02x\n", __FUNCTION__, val8);
adapter_to_pwrctl(padapter)->tog = (val8 + 0x80) & 0x80;
/* do polling cpwm */
start_time = rtw_get_current_time();
do {
rtw_mdelay_os(1);
rtw_hal_get_hwreg(padapter, HW_VAR_CPWM, &cpwm_now);
if ((cpwm_orig ^ cpwm_now) & 0x80)
break;
if (rtw_get_passing_time_ms(start_time) > 100) {
RTW_INFO("%s: polling cpwm timeout when leaving IPS in FWLPS state\n", __FUNCTION__);
break;
}
} while (1);
#endif #endif
parm[0] = 0x0; parm[0] = 0x0;
parm[1] = 0x0; parm[1] = 0x0;
@ -874,6 +861,7 @@ void rtw_set_fw_in_ips_mode(PADAPTER padapter, u8 enable)
} }
#endif /* CONFIG_PNO_SUPPORT */ #endif /* CONFIG_PNO_SUPPORT */
void rtw_leave_lps_and_chk(_adapter *padapter, u8 ps_mode) void rtw_leave_lps_and_chk(_adapter *padapter, u8 ps_mode)
{ {
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
@ -944,11 +932,13 @@ void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode
#endif #endif
#ifdef CONFIG_LPS_PG #ifdef CONFIG_LPS_PG
if ((PS_MODE_ACTIVE != ps_mode) && (pwrpriv->blpspg_info_up)) { if ((PS_MODE_ACTIVE != ps_mode) && (pwrpriv->lps_level == LPS_PG)) {
if (pwrpriv->wowlan_mode != _TRUE) {
/*rtw_hal_set_lps_pg_info(padapter);*/ /*rtw_hal_set_lps_pg_info(padapter);*/
lps_pg_hdl_id = LPS_PG_INFO_CFG; lps_pg_hdl_id = LPS_PG_INFO_CFG;
rtw_hal_set_hwreg(padapter, HW_VAR_LPS_PG_HANDLE, (u8 *)(&lps_pg_hdl_id)); rtw_hal_set_hwreg(padapter, HW_VAR_LPS_PG_HANDLE, (u8 *)(&lps_pg_hdl_id));
} }
}
#endif #endif
#ifdef CONFIG_LPS_LCLK #ifdef CONFIG_LPS_LCLK
@ -1157,6 +1147,8 @@ void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode
} }
const char * const LPS_CTRL_PHYDM = "LPS_CTRL_PHYDM";
/* /*
* Description: * Description:
* Enter the leisure power save mode. * Enter the leisure power save mode.
@ -1233,6 +1225,11 @@ void LPS_Enter(PADAPTER padapter, const char *msg)
#endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */ #endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */
rtw_set_ps_mode(padapter, pwrpriv->power_mgnt, padapter->registrypriv.smart_ps, 0, buf); rtw_set_ps_mode(padapter, pwrpriv->power_mgnt, padapter->registrypriv.smart_ps, 0, buf);
#ifdef CONFIG_PCI_DYNAMIC_ASPM
if (msg != LPS_CTRL_PHYDM)
rtw_pci_dynamic_aspm_set_mode(padapter, ASPM_MODE_PS);
#endif
} }
} else } else
pwrpriv->LpsIdleCount++; pwrpriv->LpsIdleCount++;
@ -1267,7 +1264,10 @@ void LPS_Leave(PADAPTER padapter, const char *msg)
if (pwrpriv->bLeisurePs) { if (pwrpriv->bLeisurePs) {
if (pwrpriv->pwr_mode != PS_MODE_ACTIVE) { if (pwrpriv->pwr_mode != PS_MODE_ACTIVE) {
#ifdef CONFIG_PCI_DYNAMIC_ASPM
if (msg != LPS_CTRL_PHYDM)
rtw_pci_dynamic_aspm_set_mode(padapter, ASPM_MODE_PERF);
#endif
#ifdef CONFIG_WMMPS_STA #ifdef CONFIG_WMMPS_STA
if (rtw_is_wmmps_mode(padapter)) if (rtw_is_wmmps_mode(padapter))
msg = "WMMPS_BUSY"; msg = "WMMPS_BUSY";
@ -1293,23 +1293,32 @@ void LPS_Leave(PADAPTER padapter, const char *msg)
} }
#ifdef CONFIG_WOWLAN
void rtw_wow_lps_level_decide(_adapter *adapter, u8 wow_en) void rtw_wow_lps_level_decide(_adapter *adapter, u8 wow_en)
{ {
#if defined(CONFIG_USB_HCI) && defined(CONFIG_LPS_LCLK)
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(dvobj); struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(dvobj);
if (wow_en) { if (wow_en) {
pwrpriv->lps_level_bk = pwrpriv->lps_level; pwrpriv->lps_level_bk = pwrpriv->lps_level;
pwrpriv->lps_level = LPS_LCLK; pwrpriv->lps_level = pwrpriv->wowlan_lps_level;
} else #ifdef CONFIG_LPS_1T1R
pwrpriv->lps_1t1r_bk = pwrpriv->lps_1t1r;
pwrpriv->lps_1t1r = pwrpriv->wowlan_lps_1t1r;
#endif
} else {
pwrpriv->lps_level = pwrpriv->lps_level_bk; pwrpriv->lps_level = pwrpriv->lps_level_bk;
#ifdef CONFIG_LPS_1T1R
pwrpriv->lps_1t1r = pwrpriv->lps_1t1r_bk;
#endif #endif
} }
#endif }
#endif /* CONFIG_WOWLAN */
#endif /* CONFIG_LPS */
void LeaveAllPowerSaveModeDirect(PADAPTER Adapter) void LeaveAllPowerSaveModeDirect(PADAPTER Adapter)
{ {
struct dvobj_priv *dvobj = adapter_to_dvobj(Adapter);
PADAPTER pri_padapter = GET_PRIMARY_ADAPTER(Adapter); PADAPTER pri_padapter = GET_PRIMARY_ADAPTER(Adapter);
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(Adapter); struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(Adapter);
#ifdef CONFIG_LPS_LCLK #ifdef CONFIG_LPS_LCLK
@ -1318,6 +1327,7 @@ void LeaveAllPowerSaveModeDirect(PADAPTER Adapter)
#endif /* CONFIG_DETECT_CPWM_BY_POLLING */ #endif /* CONFIG_DETECT_CPWM_BY_POLLING */
u8 rpwm; u8 rpwm;
#endif #endif
int i;
RTW_INFO("%s.....\n", __FUNCTION__); RTW_INFO("%s.....\n", __FUNCTION__);
@ -1351,11 +1361,17 @@ void LeaveAllPowerSaveModeDirect(PADAPTER Adapter)
#endif/*CONFIG_LPS_LCLK*/ #endif/*CONFIG_LPS_LCLK*/
#ifdef CONFIG_P2P_PS #ifdef CONFIG_P2P_PS
p2p_ps_wk_cmd(pri_padapter, P2P_PS_DISABLE, 0); for (i = 0; i < dvobj->iface_nums; i++) {
_adapter *iface = dvobj->padapters[i];
struct wifidirect_info *pwdinfo = &(iface->wdinfo);
if (pwdinfo->p2p_ps_mode > P2P_PS_NONE)
p2p_ps_wk_cmd(iface, P2P_PS_DISABLE, 0);
}
#endif /* CONFIG_P2P_PS */ #endif /* CONFIG_P2P_PS */
#ifdef CONFIG_LPS #ifdef CONFIG_LPS
rtw_lps_ctrl_wk_cmd(pri_padapter, LPS_CTRL_LEAVE, 0); rtw_lps_ctrl_wk_cmd(pri_padapter, LPS_CTRL_LEAVE, RTW_CMDF_DIRECTLY);
#endif #endif
} else { } else {
if (pwrpriv->rf_pwrstate == rf_off) { if (pwrpriv->rf_pwrstate == rf_off) {
@ -1369,7 +1385,7 @@ void LeaveAllPowerSaveModeDirect(PADAPTER Adapter)
} else } else
#endif #endif
{ {
#if defined(CONFIG_FWLPS_IN_IPS) || defined(CONFIG_SWLPS_IN_IPS) || defined(CONFIG_RTL8188E) || defined(CONFIG_PNO_SUPPORT) #if defined(CONFIG_FWLPS_IN_IPS) || defined(CONFIG_SWLPS_IN_IPS) || defined(CONFIG_RTL8188E)
#ifdef CONFIG_IPS #ifdef CONFIG_IPS
if (_FALSE == ips_leave(pri_padapter)) if (_FALSE == ips_leave(pri_padapter))
RTW_INFO("======> ips_leave fail.............\n"); RTW_INFO("======> ips_leave fail.............\n");
@ -1385,7 +1401,7 @@ void LeaveAllPowerSaveModeDirect(PADAPTER Adapter)
* Description: Leave all power save mode: LPS, FwLPS, IPS if needed. * Description: Leave all power save mode: LPS, FwLPS, IPS if needed.
* Move code to function by tynli. 2010.03.26. * Move code to function by tynli. 2010.03.26.
* */ * */
void LeaveAllPowerSaveMode(IN PADAPTER Adapter) void LeaveAllPowerSaveMode(PADAPTER Adapter)
{ {
struct dvobj_priv *dvobj = adapter_to_dvobj(Adapter); struct dvobj_priv *dvobj = adapter_to_dvobj(Adapter);
u8 enqueue = 0; u8 enqueue = 0;
@ -1423,7 +1439,7 @@ void LeaveAllPowerSaveMode(IN PADAPTER Adapter)
#endif /* CONFIG_P2P_PS */ #endif /* CONFIG_P2P_PS */
#ifdef CONFIG_LPS #ifdef CONFIG_LPS
rtw_lps_ctrl_wk_cmd(Adapter, LPS_CTRL_LEAVE, enqueue); rtw_lps_ctrl_wk_cmd(Adapter, LPS_CTRL_LEAVE, enqueue ? 0 : RTW_CMDF_DIRECTLY);
#endif #endif
#ifdef CONFIG_LPS_LCLK #ifdef CONFIG_LPS_LCLK
@ -1573,7 +1589,7 @@ static void dma_event_callback(struct work_struct *work)
#ifdef CONFIG_LPS_RPWM_TIMER #ifdef CONFIG_LPS_RPWM_TIMER
#define DBG_CPWM_CHK_FAIL #define DBG_CPWM_CHK_FAIL
#if defined(DBG_CPWM_CHK_FAIL) && (defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C)) #if defined(DBG_CPWM_CHK_FAIL) && (defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8822C))
#define CPU_EXCEPTION_CODE 0xFAFAFAFA #define CPU_EXCEPTION_CODE 0xFAFAFAFA
static void rtw_cpwm_chk_fail_debug(_adapter *padapter) static void rtw_cpwm_chk_fail_debug(_adapter *padapter)
{ {
@ -1642,7 +1658,7 @@ static void rpwmtimeout_workitem_callback(struct work_struct *work)
pwrpriv->rpwm_retry = 0; pwrpriv->rpwm_retry = 0;
_exit_pwrlock(&pwrpriv->lock); _exit_pwrlock(&pwrpriv->lock);
#if defined(DBG_CPWM_CHK_FAIL) && (defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C)) #if defined(DBG_CPWM_CHK_FAIL) && (defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8822C))
RTW_INFO("+%s: rpwm=0x%02X cpwm=0x%02X\n", __func__, pwrpriv->rpwm, pwrpriv->cpwm); RTW_INFO("+%s: rpwm=0x%02X cpwm=0x%02X\n", __func__, pwrpriv->rpwm, pwrpriv->cpwm);
rtw_cpwm_chk_fail_debug(padapter); rtw_cpwm_chk_fail_debug(padapter);
#endif #endif
@ -2126,6 +2142,14 @@ void rtw_unregister_evt_alive(PADAPTER padapter)
void rtw_init_pwrctrl_priv(PADAPTER padapter) void rtw_init_pwrctrl_priv(PADAPTER padapter)
{ {
#ifdef CONFIG_LPS_1T1R
#define LPS_1T1R_FMT ", LPS_1T1R=%d"
#define LPS_1T1R_ARG , pwrctrlpriv->lps_1t1r
#else
#define LPS_1T1R_FMT ""
#define LPS_1T1R_ARG
#endif
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter);
#ifdef CONFIG_WOWLAN #ifdef CONFIG_WOWLAN
struct registry_priv *registry_par = &padapter->registrypriv; struct registry_priv *registry_par = &padapter->registrypriv;
@ -2139,11 +2163,6 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter)
return; return;
#endif #endif
#ifdef PLATFORM_WINDOWS
pwrctrlpriv->pnp_current_pwr_state = NdisDeviceStateD0;
#endif
_init_pwrlock(&pwrctrlpriv->lock); _init_pwrlock(&pwrctrlpriv->lock);
_init_pwrlock(&pwrctrlpriv->check_32k_lock); _init_pwrlock(&pwrctrlpriv->check_32k_lock);
pwrctrlpriv->rf_pwrstate = rf_on; pwrctrlpriv->rf_pwrstate = rf_on;
@ -2166,6 +2185,9 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter)
pwrctrlpriv->ips_mode_req = padapter->registrypriv.ips_mode; pwrctrlpriv->ips_mode_req = padapter->registrypriv.ips_mode;
pwrctrlpriv->ips_deny_time = rtw_get_current_time(); pwrctrlpriv->ips_deny_time = rtw_get_current_time();
pwrctrlpriv->lps_level = padapter->registrypriv.lps_level; pwrctrlpriv->lps_level = padapter->registrypriv.lps_level;
#ifdef CONFIG_LPS_1T1R
pwrctrlpriv->lps_1t1r = padapter->registrypriv.lps_1t1r;
#endif
pwrctrlpriv->pwr_state_check_interval = RTW_PWR_STATE_CHK_INTERVAL; pwrctrlpriv->pwr_state_check_interval = RTW_PWR_STATE_CHK_INTERVAL;
pwrctrlpriv->pwr_state_check_cnts = 0; pwrctrlpriv->pwr_state_check_cnts = 0;
@ -2183,10 +2205,6 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter)
pwrctrlpriv->LpsIdleCount = 0; pwrctrlpriv->LpsIdleCount = 0;
#ifdef CONFIG_LPS_PG
pwrctrlpriv->lpspg_rsvd_page_locate = 0;
#endif
/* pwrctrlpriv->FWCtrlPSMode =padapter->registrypriv.power_mgnt; */ /* PS_MODE_MIN; */ /* pwrctrlpriv->FWCtrlPSMode =padapter->registrypriv.power_mgnt; */ /* PS_MODE_MIN; */
if (padapter->registrypriv.mp_mode == 1) if (padapter->registrypriv.mp_mode == 1)
pwrctrlpriv->power_mgnt = PS_MODE_ACTIVE ; pwrctrlpriv->power_mgnt = PS_MODE_ACTIVE ;
@ -2195,6 +2213,7 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter)
pwrctrlpriv->bLeisurePs = (PS_MODE_ACTIVE != pwrctrlpriv->power_mgnt) ? _TRUE : _FALSE; pwrctrlpriv->bLeisurePs = (PS_MODE_ACTIVE != pwrctrlpriv->power_mgnt) ? _TRUE : _FALSE;
pwrctrlpriv->bFwCurrentInPSMode = _FALSE; pwrctrlpriv->bFwCurrentInPSMode = _FALSE;
pwrctrlpriv->lps_deny_time = rtw_get_current_time();
pwrctrlpriv->rpwm = 0; pwrctrlpriv->rpwm = 0;
pwrctrlpriv->cpwm = PS_STATE_S4; pwrctrlpriv->cpwm = PS_STATE_S4;
@ -2207,6 +2226,11 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter)
pwrctrlpriv->tog = 0x80; pwrctrlpriv->tog = 0x80;
pwrctrlpriv->rpwm_retry = 0; pwrctrlpriv->rpwm_retry = 0;
RTW_INFO("%s: IPS_mode=%d, LPS_mode=%d, LPS_level=%d"LPS_1T1R_FMT"\n",
__func__, pwrctrlpriv->ips_mode, pwrctrlpriv->power_mgnt, pwrctrlpriv->lps_level
LPS_1T1R_ARG
);
#ifdef CONFIG_LPS_LCLK #ifdef CONFIG_LPS_LCLK
rtw_hal_set_hwreg(padapter, HW_VAR_SET_RPWM, (u8 *)(&pwrctrlpriv->rpwm)); rtw_hal_set_hwreg(padapter, HW_VAR_SET_RPWM, (u8 *)(&pwrctrlpriv->rpwm));
@ -2221,6 +2245,14 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter)
#endif /* CONFIG_LPS_RPWM_TIMER */ #endif /* CONFIG_LPS_RPWM_TIMER */
#endif /* CONFIG_LPS_LCLK */ #endif /* CONFIG_LPS_LCLK */
#ifdef CONFIG_LPS_PG
pwrctrlpriv->lpspg_info.name = "LPSPG_INFO";
#ifdef CONFIG_RTL8822C
pwrctrlpriv->lpspg_dpk_info.name = "LPSPG_DPK_INFO";
pwrctrlpriv->lpspg_iqk_info.name = "LPSPG_IQK_INFO";
#endif
#endif
rtw_init_timer(&pwrctrlpriv->pwr_state_check_timer, padapter, pwr_state_check_handler, padapter); rtw_init_timer(&pwrctrlpriv->pwr_state_check_timer, padapter, pwr_state_check_handler, padapter);
pwrctrlpriv->wowlan_mode = _FALSE; pwrctrlpriv->wowlan_mode = _FALSE;
@ -2262,6 +2294,24 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter)
#endif /* CONFIG_GPIO_WAKEUP */ #endif /* CONFIG_GPIO_WAKEUP */
#ifdef CONFIG_WOWLAN #ifdef CONFIG_WOWLAN
#ifdef CONFIG_LPS_1T1R
#define WOW_LPS_1T1R_FMT ", WOW_LPS_1T1R=%d"
#define WOW_LPS_1T1R_ARG , pwrctrlpriv->wowlan_lps_1t1r
#else
#define WOW_LPS_1T1R_FMT ""
#define WOW_LPS_1T1R_ARG
#endif
pwrctrlpriv->wowlan_power_mgmt = padapter->registrypriv.wow_power_mgnt;
pwrctrlpriv->wowlan_lps_level = padapter->registrypriv.wow_lps_level;
#ifdef CONFIG_LPS_1T1R
pwrctrlpriv->wowlan_lps_1t1r = padapter->registrypriv.wow_lps_1t1r;
#endif
RTW_INFO("%s: WOW_LPS_mode=%d, WOW_LPS_level=%d"WOW_LPS_1T1R_FMT"\n",
__func__, pwrctrlpriv->wowlan_power_mgmt, pwrctrlpriv->wowlan_lps_level
WOW_LPS_1T1R_ARG
);
if (registry_par->wakeup_event & BIT(1)) if (registry_par->wakeup_event & BIT(1))
pwrctrlpriv->default_patterns_en = _TRUE; pwrctrlpriv->default_patterns_en = _TRUE;
@ -2324,6 +2374,14 @@ void rtw_free_pwrctrl_priv(PADAPTER adapter)
#endif #endif
#endif /* CONFIG_LPS_LCLK */ #endif /* CONFIG_LPS_LCLK */
#ifdef CONFIG_LPS_PG
rsvd_page_cache_free(&pwrctrlpriv->lpspg_info);
#ifdef CONFIG_RTL8822C
rsvd_page_cache_free(&pwrctrlpriv->lpspg_dpk_info);
rsvd_page_cache_free(&pwrctrlpriv->lpspg_iqk_info);
#endif
#endif
#ifdef CONFIG_WOWLAN #ifdef CONFIG_WOWLAN
#ifdef CONFIG_PNO_SUPPORT #ifdef CONFIG_PNO_SUPPORT
if (pwrctrlpriv->pnlo_info != NULL) if (pwrctrlpriv->pnlo_info != NULL)
@ -2700,14 +2758,82 @@ int rtw_pm_set_lps_level(_adapter *padapter, u8 level)
int ret = 0; int ret = 0;
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter);
if (level < LPS_LEVEL_MAX) if (level < LPS_LEVEL_MAX) {
if (pwrctrlpriv->lps_level != level) {
#ifdef CONFIG_LPS
if (rtw_lps_ctrl_leave_set_level_cmd(padapter, level, RTW_CMDF_WAIT_ACK) != _SUCCESS)
#endif
pwrctrlpriv->lps_level = level; pwrctrlpriv->lps_level = level;
}
} else
ret = -EINVAL;
return ret;
}
#ifdef CONFIG_LPS_1T1R
int rtw_pm_set_lps_1t1r(_adapter *padapter, u8 en)
{
int ret = 0;
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter);
en = en ? 1 : 0;
if (pwrctrlpriv->lps_1t1r != en) {
if (rtw_lps_ctrl_leave_set_1t1r_cmd(padapter, en, RTW_CMDF_WAIT_ACK) != _SUCCESS)
pwrctrlpriv->lps_1t1r = en;
}
return ret;
}
#endif
inline void rtw_set_lps_deny(_adapter *adapter, u32 ms)
{
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(adapter);
pwrpriv->lps_deny_time = rtw_get_current_time() + rtw_ms_to_systime(ms);
}
#ifdef CONFIG_WOWLAN
int rtw_pm_set_wow_lps(_adapter *padapter, u8 mode)
{
int ret = 0;
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter);
if (mode < PS_MODE_NUM) {
if (pwrctrlpriv->wowlan_power_mgmt != mode)
pwrctrlpriv->wowlan_power_mgmt = mode;
} else
ret = -EINVAL;
return ret;
}
int rtw_pm_set_wow_lps_level(_adapter *padapter, u8 level)
{
int ret = 0;
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter);
if (level < LPS_LEVEL_MAX)
pwrctrlpriv->wowlan_lps_level = level;
else else
ret = -EINVAL; ret = -EINVAL;
return ret; return ret;
} }
#ifdef CONFIG_LPS_1T1R
int rtw_pm_set_wow_lps_1t1r(_adapter *padapter, u8 en)
{
int ret = 0;
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter);
en = en ? 1 : 0;
pwrctrlpriv->wowlan_lps_1t1r = en;
return ret;
}
#endif /* CONFIG_LPS_1T1R */
#endif /* CONFIG_WOWLAN */
int rtw_pm_set_ips(_adapter *padapter, u8 mode) int rtw_pm_set_ips(_adapter *padapter, u8 mode)
{ {
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter);

View File

@ -17,13 +17,6 @@
#include <drv_types.h> #include <drv_types.h>
#include <hal_data.h> #include <hal_data.h>
#if defined(PLATFORM_LINUX) && defined (PLATFORM_WINDOWS)
#error "Shall be Linux or Windows, but not both!\n"
#endif
#ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS
static void rtw_signal_stat_timer_hdl(void *ctx); static void rtw_signal_stat_timer_hdl(void *ctx);
@ -130,7 +123,7 @@ sint _rtw_init_recv_priv(struct recv_priv *precvpriv, _adapter *padapter)
rtw_list_insert_tail(&(precvframe->u.list), &(precvpriv->free_recv_queue.queue)); rtw_list_insert_tail(&(precvframe->u.list), &(precvpriv->free_recv_queue.queue));
res = rtw_os_recv_resource_alloc(padapter, precvframe); rtw_os_recv_resource_alloc(padapter, precvframe);
precvframe->u.hdr.len = 0; precvframe->u.hdr.len = 0;
@ -785,34 +778,6 @@ union recv_frame *portctrl(_adapter *adapter, union recv_frame *precv_frame)
} }
sint recv_decache(union recv_frame *precv_frame, u16 *tid_rxseq)
{
struct sta_info *sta = precv_frame->u.hdr.psta;
sint tid = precv_frame->u.hdr.attrib.priority;
u16 seq_ctrl = ((precv_frame->u.hdr.attrib.seq_num & 0xffff) << 4) |
(precv_frame->u.hdr.attrib.frag_num & 0xf);
if (tid > 15)
return _FAIL;
if (seq_ctrl == tid_rxseq[tid]) {
/* for non-AMPDU case */
sta->sta_stats.duplicate_cnt++;
if (sta->sta_stats.duplicate_cnt % 100 == 0)
RTW_INFO("%s: tid=%u seq=%d frag=%d\n", __func__
, tid, precv_frame->u.hdr.attrib.seq_num
, precv_frame->u.hdr.attrib.frag_num);
return _FAIL;
}
tid_rxseq[tid] = seq_ctrl;
return _SUCCESS;
}
/* VALID_PN_CHK /* VALID_PN_CHK
* Return true when PN is legal, otherwise false. * Return true when PN is legal, otherwise false.
* Legal PN: * Legal PN:
@ -886,6 +851,61 @@ sint recv_bcast_pn_decache(union recv_frame *precv_frame)
return _SUCCESS; return _SUCCESS;
} }
sint recv_decache(union recv_frame *precv_frame)
{
struct sta_info *psta = precv_frame->u.hdr.psta;
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
_adapter *adapter = psta->padapter;
sint tid = pattrib->priority;
u16 seq_ctrl = ((precv_frame->u.hdr.attrib.seq_num & 0xffff) << 4) |
(precv_frame->u.hdr.attrib.frag_num & 0xf);
u16 *prxseq;
if (tid > 15)
return _FAIL;
if (pattrib->qos) {
if (IS_MCAST(pattrib->ra))
prxseq = &psta->sta_recvpriv.bmc_tid_rxseq[tid];
else
prxseq = &psta->sta_recvpriv.rxcache.tid_rxseq[tid];
} else {
if (IS_MCAST(pattrib->ra)) {
prxseq = &psta->sta_recvpriv.nonqos_bmc_rxseq;
#ifdef DBG_RX_SEQ
RTW_INFO("DBG_RX_SEQ "FUNC_ADPT_FMT" nonqos bmc seq_num:%d\n"
, FUNC_ADPT_ARG(adapter), pattrib->seq_num);
#endif
} else {
prxseq = &psta->sta_recvpriv.nonqos_rxseq;
#ifdef DBG_RX_SEQ
RTW_INFO("DBG_RX_SEQ "FUNC_ADPT_FMT" nonqos seq_num:%d\n"
, FUNC_ADPT_ARG(adapter), pattrib->seq_num);
#endif
}
}
if (seq_ctrl == *prxseq) {
/* for non-AMPDU case */
psta->sta_stats.duplicate_cnt++;
if (psta->sta_stats.duplicate_cnt % 100 == 0)
RTW_INFO("%s: tid=%u seq=%d frag=%d\n", __func__
, tid, precv_frame->u.hdr.attrib.seq_num
, precv_frame->u.hdr.attrib.frag_num);
#ifdef DBG_RX_DROP_FRAME
RTW_INFO("DBG_RX_DROP_FRAME "FUNC_ADPT_FMT" recv_decache _FAIL for sta="MAC_FMT"\n"
, FUNC_ADPT_ARG(adapter), MAC_ARG(psta->cmn.mac_addr));
#endif
return _FAIL;
}
*prxseq = seq_ctrl;
return _SUCCESS;
}
void process_pwrbit_data(_adapter *padapter, union recv_frame *precv_frame, struct sta_info *psta) void process_pwrbit_data(_adapter *padapter, union recv_frame *precv_frame, struct sta_info *psta)
{ {
#ifdef CONFIG_AP_MODE #ifdef CONFIG_AP_MODE
@ -1663,7 +1683,7 @@ sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv_frame)
/* upate BCN for TIM IE */ /* upate BCN for TIM IE */
/* update_BCNTIM(padapter); */ /* update_BCNTIM(padapter); */
update_beacon(padapter, _TIM_IE_, NULL, _TRUE); update_beacon(padapter, _TIM_IE_, NULL, _TRUE, 0);
} }
/* _exit_critical_bh(&psta->sleep_q.lock, &irqL); */ /* _exit_critical_bh(&psta->sleep_q.lock, &irqL); */
@ -1689,7 +1709,7 @@ sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv_frame)
/* upate BCN for TIM IE */ /* upate BCN for TIM IE */
/* update_BCNTIM(padapter); */ /* update_BCNTIM(padapter); */
update_beacon(padapter, _TIM_IE_, NULL, _TRUE); update_beacon(padapter, _TIM_IE_, NULL, _TRUE, 0);
} }
} }
} }
@ -1975,53 +1995,6 @@ sint validate_recv_mgnt_frame(PADAPTER padapter, union recv_frame *precv_frame)
} }
} }
#ifdef CONFIG_INTEL_PROXIM
if (padapter->proximity.proxim_on == _TRUE) {
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
struct recv_stat *prxstat = (struct recv_stat *) precv_frame->u.hdr.rx_head ;
u8 *pda, *psa, *pbssid, *ptr;
ptr = precv_frame->u.hdr.rx_data;
pda = get_da(ptr);
psa = get_sa(ptr);
pbssid = get_hdr_bssid(ptr);
_rtw_memcpy(pattrib->dst, pda, ETH_ALEN);
_rtw_memcpy(pattrib->src, psa, ETH_ALEN);
_rtw_memcpy(pattrib->bssid, pbssid, ETH_ALEN);
switch (pattrib->to_fr_ds) {
case 0:
_rtw_memcpy(pattrib->ra, pda, ETH_ALEN);
_rtw_memcpy(pattrib->ta, psa, ETH_ALEN);
break;
case 1:
_rtw_memcpy(pattrib->ra, pda, ETH_ALEN);
_rtw_memcpy(pattrib->ta, pbssid, ETH_ALEN);
break;
case 2:
_rtw_memcpy(pattrib->ra, pbssid, ETH_ALEN);
_rtw_memcpy(pattrib->ta, psa, ETH_ALEN);
break;
case 3:
_rtw_memcpy(pattrib->ra, GetAddr1Ptr(ptr), ETH_ALEN);
_rtw_memcpy(pattrib->ta, get_addr2_ptr(ptr), ETH_ALEN);
break;
default:
break;
}
pattrib->priority = 0;
pattrib->hdrlen = pattrib->to_fr_ds == 3 ? 30 : 24;
padapter->proximity.proxim_rx(padapter, precv_frame);
}
#endif
mgt_dispatcher(padapter, precv_frame); mgt_dispatcher(padapter, precv_frame);
#if defined(CONFIG_IEEE80211W) || defined(CONFIG_RTW_MESH) #if defined(CONFIG_IEEE80211W) || defined(CONFIG_RTW_MESH)
@ -2114,7 +2087,7 @@ pre_validate_status_chk:
} }
precv_frame->u.hdr.psta = psta; precv_frame->u.hdr.psta = psta;
precv_frame->u.hdr.preorder_ctrl = NULL;
pattrib->ack_policy = 0; pattrib->ack_policy = 0;
/* parsing QC field */ /* parsing QC field */
@ -2131,21 +2104,19 @@ pre_validate_status_chk:
pattrib->hdrlen = WLAN_HDR_A3_LEN + a4_shift; pattrib->hdrlen = WLAN_HDR_A3_LEN + a4_shift;
} }
if (pattrib->order) /* HT-CTRL 11n */ if (pattrib->order) /* HT-CTRL 11n */
pattrib->hdrlen += 4; pattrib->hdrlen += 4;
/* decache, drop duplicate recv packets */ /* decache, drop duplicate recv packets */
if (!IS_MCAST(pattrib->ra)) { ret = recv_decache(precv_frame);
precv_frame->u.hdr.preorder_ctrl = &psta->recvreorder_ctrl[pattrib->priority]; if (ret == _FAIL)
if (recv_decache(precv_frame, psta->sta_recvpriv.rxcache.tid_rxseq) == _FAIL) {
#ifdef DBG_RX_DROP_FRAME
RTW_INFO("DBG_RX_DROP_FRAME "FUNC_ADPT_FMT" recv_decache uc return _FAIL for sta="MAC_FMT"\n"
, FUNC_ADPT_ARG(adapter), MAC_ARG(psta->cmn.mac_addr));
#endif
ret = _FAIL;
goto exit; goto exit;
}
if (!IS_MCAST(pattrib->ra)) {
if (pattrib->qos)
precv_frame->u.hdr.preorder_ctrl = &psta->recvreorder_ctrl[pattrib->priority];
if (recv_ucast_pn_decache(precv_frame) == _FAIL) { if (recv_ucast_pn_decache(precv_frame) == _FAIL) {
#ifdef DBG_RX_DROP_FRAME #ifdef DBG_RX_DROP_FRAME
RTW_INFO("DBG_RX_DROP_FRAME "FUNC_ADPT_FMT" recv_ucast_pn_decache return _FAIL for sta="MAC_FMT"\n" RTW_INFO("DBG_RX_DROP_FRAME "FUNC_ADPT_FMT" recv_ucast_pn_decache return _FAIL for sta="MAC_FMT"\n"
@ -2155,15 +2126,6 @@ pre_validate_status_chk:
goto exit; goto exit;
} }
} else { } else {
precv_frame->u.hdr.preorder_ctrl = NULL;
if (recv_decache(precv_frame, psta->sta_recvpriv.bmc_tid_rxseq) == _FAIL) {
#ifdef DBG_RX_DROP_FRAME
RTW_INFO("DBG_RX_DROP_FRAME "FUNC_ADPT_FMT" recv_decache bmc return _FAIL for sta="MAC_FMT"\n"
, FUNC_ADPT_ARG(adapter), MAC_ARG(psta->cmn.mac_addr));
#endif
ret = _FAIL;
goto exit;
}
if (recv_bcast_pn_decache(precv_frame) == _FAIL) { if (recv_bcast_pn_decache(precv_frame) == _FAIL) {
#ifdef DBG_RX_DROP_FRAME #ifdef DBG_RX_DROP_FRAME
RTW_INFO("DBG_RX_DROP_FRAME "FUNC_ADPT_FMT" recv_bcast_pn_decache return _FAIL for sta="MAC_FMT"\n" RTW_INFO("DBG_RX_DROP_FRAME "FUNC_ADPT_FMT" recv_bcast_pn_decache return _FAIL for sta="MAC_FMT"\n"
@ -2398,7 +2360,6 @@ exit:
/* remove the wlanhdr and add the eth_hdr */ /* remove the wlanhdr and add the eth_hdr */
#if 1
sint wlanhdr_to_ethhdr(union recv_frame *precvframe) sint wlanhdr_to_ethhdr(union recv_frame *precvframe)
{ {
sint rmv_len; sint rmv_len;
@ -2482,126 +2443,8 @@ exiting:
} }
#else
static u8 SNAP_ETH_TYPE_APPLETALK_DDP[2] = {0x80, 0x9b};
/* Datagram Delivery Protocol */
static u8 SNAP_HDR_APPLETALK_DDP[3] = {0x08, 0x00, 0x07};
static u8 oui_8021h[] = {0x00, 0x00, 0xf8};
static u8 oui_rfc1042[] = {0x00, 0x00, 0x00};
sint wlanhdr_to_ethhdr(union recv_frame *precvframe)
{
sint rmv_len;
u16 eth_type;
u8 bsnaphdr;
u8 *psnap_type;
struct ieee80211_snap_hdr *psnap;
sint ret = _SUCCESS;
_adapter *adapter = precvframe->u.hdr.adapter;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
u8 *ptr = get_recvframe_data(precvframe) ; /* point to frame_ctrl field */
struct rx_pkt_attrib *pattrib = &precvframe->u.hdr.attrib;
struct _vlan *pvlan = NULL;
psnap = (struct ieee80211_snap_hdr *)(ptr + pattrib->hdrlen + pattrib->iv_len);
psnap_type = ptr + pattrib->hdrlen + pattrib->iv_len + SNAP_SIZE;
if (psnap->dsap == 0xaa && psnap->ssap == 0xaa && psnap->ctrl == 0x03) {
if (_rtw_memcmp(psnap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN))
bsnaphdr = _TRUE; /* wlan_pkt_format = WLAN_PKT_FORMAT_SNAP_RFC1042; */
else if (_rtw_memcmp(psnap->oui, SNAP_HDR_APPLETALK_DDP, WLAN_IEEE_OUI_LEN) &&
_rtw_memcmp(psnap_type, SNAP_ETH_TYPE_APPLETALK_DDP, 2))
bsnaphdr = _TRUE; /* wlan_pkt_format = WLAN_PKT_FORMAT_APPLETALK; */
else if (_rtw_memcmp(psnap->oui, oui_8021h, WLAN_IEEE_OUI_LEN))
bsnaphdr = _TRUE; /* wlan_pkt_format = WLAN_PKT_FORMAT_SNAP_TUNNEL; */
else {
ret = _FAIL;
goto exit;
}
} else
bsnaphdr = _FALSE; /* wlan_pkt_format = WLAN_PKT_FORMAT_OTHERS; */
rmv_len = pattrib->hdrlen + pattrib->iv_len + (bsnaphdr ? SNAP_SIZE : 0);
if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == _TRUE) {
ptr += rmv_len ;
*ptr = 0x87;
*(ptr + 1) = 0x12;
/* back to original pointer */
ptr -= rmv_len;
}
ptr += rmv_len ;
_rtw_memcpy(&eth_type, ptr, 2);
eth_type = ntohs((unsigned short)eth_type); /* pattrib->ether_type */
ptr += 2;
if (pattrib->encrypt)
recvframe_pull_tail(precvframe, pattrib->icv_len);
if (eth_type == 0x8100) { /* vlan */
pvlan = (struct _vlan *) ptr;
/* eth_type = get_vlan_encap_proto(pvlan); */
/* eth_type = pvlan->h_vlan_encapsulated_proto; */ /* ? */
rmv_len += 4;
ptr += 4;
}
if (eth_type == 0x0800) { /* ip */
/* struct iphdr* piphdr = (struct iphdr*) ptr; */
/* __u8 tos = (unsigned char)(pattrib->priority & 0xff); */
/* piphdr->tos = tos; */
} else if (eth_type == 0x8712) { /* append rx status for mp test packets */
/* ptr -= 16; */
/* _rtw_memcpy(ptr, get_rxmem(precvframe), 16); */
} else {
#ifdef PLATFORM_OS_XP
NDIS_PACKET_8021Q_INFO VlanPriInfo;
UINT32 UserPriority = precvframe->u.hdr.attrib.priority;
UINT32 VlanID = (pvlan != NULL ? get_vlan_id(pvlan) : 0);
VlanPriInfo.Value = /* Get current value. */
NDIS_PER_PACKET_INFO_FROM_PACKET(precvframe->u.hdr.pkt, Ieee8021QInfo);
VlanPriInfo.TagHeader.UserPriority = UserPriority;
VlanPriInfo.TagHeader.VlanId = VlanID ;
VlanPriInfo.TagHeader.CanonicalFormatId = 0; /* Should be zero. */
VlanPriInfo.TagHeader.Reserved = 0; /* Should be zero. */
NDIS_PER_PACKET_INFO_FROM_PACKET(precvframe->u.hdr.pkt, Ieee8021QInfo) = VlanPriInfo.Value;
#endif
}
if (eth_type == 0x8712) { /* append rx status for mp test packets */
ptr = recvframe_pull(precvframe, (rmv_len - sizeof(struct ethhdr) + 2) - 24);
_rtw_memcpy(ptr, get_rxmem(precvframe), 24);
ptr += 24;
} else
ptr = recvframe_pull(precvframe, (rmv_len - sizeof(struct ethhdr) + 2));
_rtw_memcpy(ptr, pattrib->dst, ETH_ALEN);
_rtw_memcpy(ptr + ETH_ALEN, pattrib->src, ETH_ALEN);
eth_type = htons((unsigned short)eth_type) ;
_rtw_memcpy(ptr + 12, &eth_type, 2);
exit:
return ret;
}
#endif
#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
#ifndef CONFIG_SDIO_RX_COPY
#ifdef PLATFORM_LINUX #ifdef PLATFORM_LINUX
static void recvframe_expand_pkt( static void recvframe_expand_pkt(
PADAPTER padapter, PADAPTER padapter,
@ -2655,9 +2498,10 @@ static void recvframe_expand_pkt(
pfhdr->rx_tail = skb_tail_pointer(ppkt); pfhdr->rx_tail = skb_tail_pointer(ppkt);
pfhdr->rx_end = skb_end_pointer(ppkt); pfhdr->rx_end = skb_end_pointer(ppkt);
} }
#else #else /*!= PLATFORM_LINUX*/
#warning "recvframe_expand_pkt not implement, defrag may crash system" #warning "recvframe_expand_pkt not implement, defrag may crash system"
#endif #endif
#endif /*#ifndef CONFIG_SDIO_RX_COPY*/
#endif #endif
/* perform defrag */ /* perform defrag */
@ -2914,14 +2758,12 @@ static int rtw_recv_indicatepkt_check(union recv_frame *rframe, u8 *ehdr_pos, u3
if (ntohs(ehdr->h_proto) == ETH_P_ARP) { if (ntohs(ehdr->h_proto) == ETH_P_ARP) {
if(check_fwstate(pmlmepriv, WIFI_ASOC_STATE) == _TRUE){ if(check_fwstate(pmlmepriv, WIFI_ASOC_STATE) == _TRUE){
if(_rtw_memcmp(pattrib->src, cur_network->network.MacAddress, ETH_ALEN)){
if(ehdr_pos[ETHERNET_HEADER_SIZE+LEN_ARP_OP_HDR] == 2) { if(ehdr_pos[ETHERNET_HEADER_SIZE+LEN_ARP_OP_HDR] == 2) {
RTW_INFO("%s,[DBG_ARP] Rx ARP RSP Packet with Dst= "MAC_FMT" ;SeqNum = %d !\n",
__FUNCTION__, MAC_ARG(pattrib->dst), pattrib->seq_num); RTW_INFO("%s,[DBG_ARP] Rx ARP RSP Packet;SeqNum = %d !\n",
for(i=0;i<(pkt_len -ETHERNET_HEADER_SIZE);i++) __FUNCTION__, pattrib->seq_num);
RTW_INFO("0x%x ",ehdr_pos[i+ETHERNET_HEADER_SIZE]);
RTW_INFO("\n"); dump_arp_pkt(RTW_DBGDUMP, ehdr->h_dest, ehdr->h_source, ehdr_pos + ETH_HLEN, 0);
}
} }
} }
@ -2941,6 +2783,7 @@ exit:
return ret; return ret;
} }
#ifdef CONFIG_RTW_MESH
static void recv_free_fwd_resource(_adapter *adapter, struct xmit_frame *fwd_frame, _list *b2u_list) static void recv_free_fwd_resource(_adapter *adapter, struct xmit_frame *fwd_frame, _list *b2u_list)
{ {
struct xmit_priv *xmitpriv = &adapter->xmitpriv; struct xmit_priv *xmitpriv = &adapter->xmitpriv;
@ -2948,7 +2791,6 @@ static void recv_free_fwd_resource(_adapter *adapter, struct xmit_frame *fwd_fra
if (fwd_frame) if (fwd_frame)
rtw_free_xmitframe(xmitpriv, fwd_frame); rtw_free_xmitframe(xmitpriv, fwd_frame);
#ifdef CONFIG_RTW_MESH
#if CONFIG_RTW_MESH_DATA_BMC_TO_UC #if CONFIG_RTW_MESH_DATA_BMC_TO_UC
if (!rtw_is_list_empty(b2u_list)) { if (!rtw_is_list_empty(b2u_list)) {
struct xmit_frame *b2uframe; struct xmit_frame *b2uframe;
@ -2963,10 +2805,8 @@ static void recv_free_fwd_resource(_adapter *adapter, struct xmit_frame *fwd_fra
} }
} }
#endif #endif
#endif /* CONFIG_RTW_MESH */
} }
#ifdef CONFIG_RTW_MESH
static void recv_fwd_pkt_hdl(_adapter *adapter, _pkt *pkt static void recv_fwd_pkt_hdl(_adapter *adapter, _pkt *pkt
, u8 act, struct xmit_frame *fwd_frame, _list *b2u_list) , u8 act, struct xmit_frame *fwd_frame, _list *b2u_list)
{ {
@ -3035,8 +2875,10 @@ int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
_queue *pfree_recv_queue = &(precvpriv->free_recv_queue); _queue *pfree_recv_queue = &(precvpriv->free_recv_queue);
const u8 *da, *sa; const u8 *da, *sa;
int act; int act;
#ifdef CONFIG_RTW_MESH /* TODO: move AP mode forward & b2u logic here */
struct xmit_frame *fwd_frame; struct xmit_frame *fwd_frame;
_list b2u_list; _list b2u_list;
#endif
u8 mctrl_len = 0; u8 mctrl_len = 0;
int ret = _SUCCESS; int ret = _SUCCESS;
@ -3059,9 +2901,10 @@ int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
} }
act = RTW_RX_MSDU_ACT_INDICATE; act = RTW_RX_MSDU_ACT_INDICATE;
fwd_frame = NULL;
#ifdef CONFIG_RTW_MESH #ifdef CONFIG_RTW_MESH
fwd_frame = NULL;
if (MLME_IS_MESH(padapter)) { if (MLME_IS_MESH(padapter)) {
u8 *mda = pdata, *msa = pdata + ETH_ALEN; u8 *mda = pdata, *msa = pdata + ETH_ALEN;
struct rtw_ieee80211s_hdr *mctrl = (struct rtw_ieee80211s_hdr *)(pdata + ETH_HLEN); struct rtw_ieee80211s_hdr *mctrl = (struct rtw_ieee80211s_hdr *)(pdata + ETH_HLEN);
@ -3081,8 +2924,10 @@ int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
sa = pdata + ETH_ALEN; sa = pdata + ETH_ALEN;
} }
#ifdef CONFIG_RTW_MESH
if (!act) if (!act)
goto move_to_next; goto move_to_next;
#endif
rtw_led_rx_control(padapter, da); rtw_led_rx_control(padapter, da);
@ -3094,12 +2939,14 @@ int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
RTW_INFO("DBG_RX_DROP_FRAME %s rtw_os_alloc_msdu_pkt fail\n", __func__); RTW_INFO("DBG_RX_DROP_FRAME %s rtw_os_alloc_msdu_pkt fail\n", __func__);
#endif #endif
} }
#ifdef CONFIG_RTW_MESH
if (act & RTW_RX_MSDU_ACT_FORWARD) { if (act & RTW_RX_MSDU_ACT_FORWARD) {
#ifdef DBG_TX_DROP_FRAME #ifdef DBG_TX_DROP_FRAME
RTW_INFO("DBG_TX_DROP_FRAME %s rtw_os_alloc_msdu_pkt fail\n", __func__); RTW_INFO("DBG_TX_DROP_FRAME %s rtw_os_alloc_msdu_pkt fail\n", __func__);
#endif #endif
recv_free_fwd_resource(padapter, fwd_frame, &b2u_list); recv_free_fwd_resource(padapter, fwd_frame, &b2u_list);
} }
#endif
break; break;
} }
@ -3116,7 +2963,9 @@ int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
else else
rtw_os_pkt_free(sub_pkt); rtw_os_pkt_free(sub_pkt);
#ifdef CONFIG_RTW_MESH
move_to_next: move_to_next:
#endif
/* move the data point to data content */ /* move the data point to data content */
pdata += ETH_HLEN; pdata += ETH_HLEN;
a_len -= ETH_HLEN; a_len -= ETH_HLEN;
@ -3174,10 +3023,11 @@ static int recv_process_mpdu(_adapter *padapter, union recv_frame *prframe)
} }
} else { } else {
int act = RTW_RX_MSDU_ACT_INDICATE; int act = RTW_RX_MSDU_ACT_INDICATE;
#ifdef CONFIG_RTW_MESH /* TODO: move AP mode forward & b2u logic here */
struct xmit_frame *fwd_frame = NULL; struct xmit_frame *fwd_frame = NULL;
_list b2u_list; _list b2u_list;
#ifdef CONFIG_RTW_MESH
if (MLME_IS_MESH(padapter) && pattrib->mesh_ctrl_present) { if (MLME_IS_MESH(padapter) && pattrib->mesh_ctrl_present) {
act = rtw_mesh_rx_msdu_act_check(prframe act = rtw_mesh_rx_msdu_act_check(prframe
, pattrib->mda, pattrib->msa , pattrib->mda, pattrib->msa
@ -3187,11 +3037,13 @@ static int recv_process_mpdu(_adapter *padapter, union recv_frame *prframe)
} }
#endif #endif
#ifdef CONFIG_RTW_MESH
if (!act) { if (!act) {
rtw_free_recvframe(prframe, pfree_recv_queue); rtw_free_recvframe(prframe, pfree_recv_queue);
ret = _FAIL; ret = _FAIL;
goto exit; goto exit;
} }
#endif
rtw_led_rx_control(padapter, pattrib->dst); rtw_led_rx_control(padapter, pattrib->dst);
@ -3203,12 +3055,14 @@ static int recv_process_mpdu(_adapter *padapter, union recv_frame *prframe)
, FUNC_ADPT_ARG(padapter)); , FUNC_ADPT_ARG(padapter));
#endif #endif
} }
#ifdef CONFIG_RTW_MESH
if (act & RTW_RX_MSDU_ACT_FORWARD) { if (act & RTW_RX_MSDU_ACT_FORWARD) {
#ifdef DBG_TX_DROP_FRAME #ifdef DBG_TX_DROP_FRAME
RTW_INFO("DBG_TX_DROP_FRAME %s wlanhdr_to_ethhdr fail\n", __func__); RTW_INFO("DBG_TX_DROP_FRAME %s wlanhdr_to_ethhdr fail\n", __func__);
#endif #endif
recv_free_fwd_resource(padapter, fwd_frame, &b2u_list); recv_free_fwd_resource(padapter, fwd_frame, &b2u_list);
} }
#endif
rtw_free_recvframe(prframe, pfree_recv_queue); rtw_free_recvframe(prframe, pfree_recv_queue);
goto exit; goto exit;
} }
@ -3263,7 +3117,7 @@ static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_n
PADAPTER padapter = preorder_ctrl->padapter; PADAPTER padapter = preorder_ctrl->padapter;
struct recv_priv *precvpriv = &padapter->recvpriv; struct recv_priv *precvpriv = &padapter->recvpriv;
u8 wsize = preorder_ctrl->wsize_b; u8 wsize = preorder_ctrl->wsize_b;
u16 wend = (preorder_ctrl->indicate_seq + wsize - 1) & 0xFFF; /* % 4096; */ u16 wend;
/* Rx Reorder initialize condition. */ /* Rx Reorder initialize condition. */
if (preorder_ctrl->indicate_seq == 0xFFFF) { if (preorder_ctrl->indicate_seq == 0xFFFF) {
@ -3273,6 +3127,7 @@ static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_n
, FUNC_ADPT_ARG(padapter), preorder_ctrl->tid, preorder_ctrl->indicate_seq, seq_num); , FUNC_ADPT_ARG(padapter), preorder_ctrl->tid, preorder_ctrl->indicate_seq, seq_num);
#endif #endif
} }
wend = (preorder_ctrl->indicate_seq + wsize - 1) & 0xFFF; /* % 4096; */
/* Drop out the packet which SeqNum is smaller than WinStart */ /* Drop out the packet which SeqNum is smaller than WinStart */
if (SN_LESS(seq_num, preorder_ctrl->indicate_seq)) { if (SN_LESS(seq_num, preorder_ctrl->indicate_seq)) {
@ -3522,10 +3377,21 @@ static int recv_indicatepkt_reorder(_adapter *padapter, union recv_frame *prfram
if (!pattrib->qos || !preorder_ctrl || preorder_ctrl->enable == _FALSE) if (!pattrib->qos || !preorder_ctrl || preorder_ctrl->enable == _FALSE)
goto _success_exit; goto _success_exit;
DBG_COUNTER(padapter->rx_logs.core_rx_post_indicate_reoder); DBG_COUNTER(padapter->rx_logs.core_rx_post_indicate_reoder);
_enter_critical_bh(&ppending_recvframe_queue->lock, &irql); _enter_critical_bh(&ppending_recvframe_queue->lock, &irql);
if(rtw_test_and_clear_bit(RTW_RECV_ACK_OR_TIMEOUT, &preorder_ctrl->rec_abba_rsp_ack))
preorder_ctrl->indicate_seq = 0xFFFF;
#ifdef DBG_RX_SEQ
RTW_INFO("DBG_RX_SEQ %s:preorder_ctrl->rec_abba_rsp_ack = %u,indicate_seq = %d\n"
, __func__
, preorder_ctrl->rec_abba_rsp_ack
, preorder_ctrl->indicate_seq);
#endif
/* s2. check if winstart_b(indicate_seq) needs to been updated */ /* s2. check if winstart_b(indicate_seq) needs to been updated */
if (!check_indicate_seq(preorder_ctrl, pattrib->seq_num)) { if (!check_indicate_seq(preorder_ctrl, pattrib->seq_num)) {
precvpriv->dbg_rx_ampdu_drop_count++; precvpriv->dbg_rx_ampdu_drop_count++;
@ -3604,18 +3470,23 @@ void rtw_reordering_ctrl_timeout_handler(void *pcontext)
{ {
_irqL irql; _irqL irql;
struct recv_reorder_ctrl *preorder_ctrl = (struct recv_reorder_ctrl *)pcontext; struct recv_reorder_ctrl *preorder_ctrl = (struct recv_reorder_ctrl *)pcontext;
_adapter *padapter = preorder_ctrl->padapter; _adapter *padapter = NULL;
_queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; _queue *ppending_recvframe_queue = NULL;
if (preorder_ctrl == NULL)
return;
padapter = preorder_ctrl->padapter;
if (RTW_CANNOT_RUN(padapter)) if (RTW_CANNOT_RUN(padapter))
return; return;
ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
/* RTW_INFO("+rtw_reordering_ctrl_timeout_handler()=>\n"); */ /* RTW_INFO("+rtw_reordering_ctrl_timeout_handler()=>\n"); */
_enter_critical_bh(&ppending_recvframe_queue->lock, &irql); _enter_critical_bh(&ppending_recvframe_queue->lock, &irql);
if (preorder_ctrl)
preorder_ctrl->bReorderWaiting = _FALSE; preorder_ctrl->bReorderWaiting = _FALSE;
if (recv_indicatepkts_in_order(padapter, preorder_ctrl, _TRUE) == _TRUE) if (recv_indicatepkts_in_order(padapter, preorder_ctrl, _TRUE) == _TRUE)
@ -3667,27 +3538,50 @@ int validate_mp_recv_frame(_adapter *adapter, union recv_frame *precv_frame)
struct mp_priv *pmppriv = &adapter->mppriv; struct mp_priv *pmppriv = &adapter->mppriv;
struct mp_tx *pmptx; struct mp_tx *pmptx;
unsigned char *sa , *da, *bs; unsigned char *sa , *da, *bs;
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
u32 i = 0;
u8 rtk_prefix[]={0x52, 0x65, 0x61, 0x6C, 0x4C, 0x6F, 0x76, 0x65, 0x54, 0x65, 0x6B};
u8 *prx_data;
pmptx = &pmppriv->tx; pmptx = &pmppriv->tx;
#if 0
if (1) { if (pmppriv->mplink_brx == _FALSE) {
u8 bDumpRxPkt;
u8 bDumpRxPkt = 0;
type = GetFrameType(ptr); type = GetFrameType(ptr);
subtype = get_frame_sub_type(ptr); /* bit(7)~bit(2) */ subtype = get_frame_sub_type(ptr); /* bit(7)~bit(2) */
rtw_hal_get_def_var(adapter, HAL_DEF_DBG_DUMP_RXPKT, &(bDumpRxPkt)); RTW_INFO("hdr len = %d iv_len=%d \n", pattrib->hdrlen , pattrib->iv_len);
prx_data = ptr + pattrib->hdrlen + pattrib->iv_len;
for (i = 0; i < precv_frame->u.hdr.len; i++) {
if (precv_frame->u.hdr.len < (11 + i))
break;
if (_rtw_memcmp(prx_data + i, (void *)&rtk_prefix, 11) == _FALSE) {
bDumpRxPkt = 0;
RTW_DBG("prx_data = %02X != rtk_prefix[%d] = %02X \n", *(prx_data + i), i , rtk_prefix[i]);
} else {
bDumpRxPkt = 1;
RTW_DBG("prx_data = %02X = rtk_prefix[%d] = %02X \n", *(prx_data + i), i , rtk_prefix[i]);
break;
}
}
if (bDumpRxPkt == 1) { /* dump all rx packets */ if (bDumpRxPkt == 1) { /* dump all rx packets */
int i; int i;
RTW_INFO("############ type:0x%02x subtype:0x%02x #################\n", type, subtype); RTW_INFO("############ type:0x%02x subtype:0x%02x #################\n", type, subtype);
for (i = 0; i < 64; i = i + 8) for (i = 0; i < precv_frame->u.hdr.len; i = i + 8)
RTW_INFO("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:\n", *(ptr + i), RTW_INFO("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:\n", *(ptr + i),
*(ptr + i + 1), *(ptr + i + 2) , *(ptr + i + 3) , *(ptr + i + 4), *(ptr + i + 5), *(ptr + i + 6), *(ptr + i + 7)); *(ptr + i + 1), *(ptr + i + 2) , *(ptr + i + 3) , *(ptr + i + 4), *(ptr + i + 5), *(ptr + i + 6), *(ptr + i + 7));
RTW_INFO("#############################\n"); RTW_INFO("#############################\n");
_rtw_memset(pmppriv->mplink_buf, '\0' , sizeof(pmppriv->mplink_buf));
_rtw_memcpy(pmppriv->mplink_buf, ptr, precv_frame->u.hdr.len);
pmppriv->mplink_rx_len = precv_frame->u.hdr.len;
pmppriv->mplink_brx =_TRUE;
} }
} }
#endif
if (pmppriv->bloopback) { if (pmppriv->bloopback) {
if (_rtw_memcmp(ptr + 24, pmptx->buf + 24, precv_frame->u.hdr.len - 24) == _FALSE) { if (_rtw_memcmp(ptr + 24, pmptx->buf + 24, precv_frame->u.hdr.len - 24) == _FALSE) {
RTW_INFO("Compare payload content Fail !!!\n"); RTW_INFO("Compare payload content Fail !!!\n");
@ -3852,11 +3746,9 @@ int mp_recv_frame(_adapter *padapter, union recv_frame *rframe)
break; break;
case 1: case 1:
_rtw_memcpy(pattrib->ra, pda, ETH_ALEN); _rtw_memcpy(pattrib->ra, pda, ETH_ALEN);
_rtw_memcpy(pattrib->ta, pbssid, ETH_ALEN); _rtw_memcpy(pattrib->ta, pbssid, ETH_ALEN);
ret = ap2sta_data_frame(padapter, rframe, &psta); ret = ap2sta_data_frame(padapter, rframe, &psta);
break; break;
case 2: case 2:
@ -3864,18 +3756,25 @@ int mp_recv_frame(_adapter *padapter, union recv_frame *rframe)
_rtw_memcpy(pattrib->ta, psa, ETH_ALEN); _rtw_memcpy(pattrib->ta, psa, ETH_ALEN);
ret = sta2ap_data_frame(padapter, rframe, &psta); ret = sta2ap_data_frame(padapter, rframe, &psta);
break; break;
case 3: case 3:
_rtw_memcpy(pattrib->ra, GetAddr1Ptr(ptr), ETH_ALEN); _rtw_memcpy(pattrib->ra, GetAddr1Ptr(ptr), ETH_ALEN);
_rtw_memcpy(pattrib->ta, get_addr2_ptr(ptr), ETH_ALEN); _rtw_memcpy(pattrib->ta, get_addr2_ptr(ptr), ETH_ALEN);
ret = _FAIL; ret = _FAIL;
break; break;
default: default:
ret = _FAIL; ret = _FAIL;
break; break;
} }
if (ret != _SUCCESS) {
#ifdef DBG_RX_DROP_FRAME
RTW_INFO("DBG_RX_DROP_FRAME "FUNC_ADPT_FMT" 2_data_frame fail: drop pkt\n"
, FUNC_ADPT_ARG(padapter));
#endif
ret = _FAIL;
goto exit;
}
ret = MPwlanhdr_to_ethhdr(rframe); ret = MPwlanhdr_to_ethhdr(rframe);
if (ret != _SUCCESS) { if (ret != _SUCCESS) {
@ -3883,7 +3782,6 @@ int mp_recv_frame(_adapter *padapter, union recv_frame *rframe)
RTW_INFO("DBG_RX_DROP_FRAME "FUNC_ADPT_FMT" wlanhdr_to_ethhdr: drop pkt\n" RTW_INFO("DBG_RX_DROP_FRAME "FUNC_ADPT_FMT" wlanhdr_to_ethhdr: drop pkt\n"
, FUNC_ADPT_ARG(padapter)); , FUNC_ADPT_ARG(padapter));
#endif #endif
rtw_free_recvframe(rframe, pfree_recv_queue);/* free this recv_frame */
ret = _FAIL; ret = _FAIL;
goto exit; goto exit;
} }
@ -3895,9 +3793,7 @@ int mp_recv_frame(_adapter *padapter, union recv_frame *rframe)
RTW_INFO("DBG_RX_DROP_FRAME "FUNC_ADPT_FMT" rtw_recv_indicatepkt fail!\n" RTW_INFO("DBG_RX_DROP_FRAME "FUNC_ADPT_FMT" rtw_recv_indicatepkt fail!\n"
, FUNC_ADPT_ARG(padapter)); , FUNC_ADPT_ARG(padapter));
#endif #endif
rtw_free_recvframe(rframe, pfree_recv_queue);/* free this recv_frame */
ret = _FAIL; ret = _FAIL;
goto exit; goto exit;
} }
} else { } else {
@ -3908,19 +3804,15 @@ int mp_recv_frame(_adapter *padapter, union recv_frame *rframe)
, rtw_is_surprise_removed(padapter) ? "True" : "False"); , rtw_is_surprise_removed(padapter) ? "True" : "False");
#endif #endif
ret = _FAIL; ret = _FAIL;
rtw_free_recvframe(rframe, pfree_recv_queue);/* free this recv_frame */
goto exit; goto exit;
} }
} }
} }
} }
exit:
rtw_free_recvframe(rframe, pfree_recv_queue);/* free this recv_frame */ rtw_free_recvframe(rframe, pfree_recv_queue);/* free this recv_frame */
ret = _FAIL; ret = _FAIL;
exit:
return ret; return ret;
} }
@ -4068,9 +3960,9 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe,
/* channel flags */ /* channel flags */
tmp_16bit = 0; tmp_16bit = 0;
if (pHalData->current_band_type == 0) if (pHalData->current_band_type == BAND_ON_2_4G)
tmp_16bit |= cpu_to_le16(IEEE80211_CHAN_2GHZ); tmp_16bit |= cpu_to_le16(IEEE80211_CHAN_2GHZ);
else else /*BAND_ON_5G*/
tmp_16bit |= cpu_to_le16(IEEE80211_CHAN_5GHZ); tmp_16bit |= cpu_to_le16(IEEE80211_CHAN_5GHZ);
if (pattrib->data_rate <= DESC_RATE54M) { if (pattrib->data_rate <= DESC_RATE54M) {

View File

@ -246,6 +246,26 @@ exit:
return t_cch; return t_cch;
} }
/*
* Get center channel of smaller bandwidth by @param cch, @param bw, @param opch
* @cch: the given center channel
* @bw: the given bandwidth
* @opch: the given operating channel
*
* return center channel of smaller bandiwdth if valid, or 0
*/
u8 rtw_get_scch_by_cch_opch(u8 cch, u8 bw, u8 opch)
{
u8 offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
if (opch > cch)
offset = HAL_PRIME_CHNL_OFFSET_UPPER;
else if (opch < cch)
offset = HAL_PRIME_CHNL_OFFSET_LOWER;
return rtw_get_scch_by_cch_offset(cch, bw, offset);
}
struct op_chs_ent_t { struct op_chs_ent_t {
u8 ch_num; u8 ch_num;
u8 *chs; u8 *chs;
@ -318,12 +338,12 @@ u8 rtw_get_op_chs_by_cch_bw(u8 cch, u8 bw, u8 **op_chs, u8 *op_ch_num)
u8 valid = 1; u8 valid = 1;
if (cch <= 14 if (cch <= 14
&& bw >= CHANNEL_WIDTH_20 && bw <= CHANNEL_WIDTH_40 && bw <= CHANNEL_WIDTH_40
) { ) {
c_chs_ent = &center_chs_2g_by_bw[bw]; c_chs_ent = &center_chs_2g_by_bw[bw];
op_chs_ent = &op_chs_of_cch_2g_by_bw[bw]; op_chs_ent = &op_chs_of_cch_2g_by_bw[bw];
} else if (cch >= 36 && cch <= 177 } else if (cch >= 36 && cch <= 177
&& bw >= CHANNEL_WIDTH_20 && bw <= CHANNEL_WIDTH_160 && bw <= CHANNEL_WIDTH_160
) { ) {
c_chs_ent = &center_chs_5g_by_bw[bw]; c_chs_ent = &center_chs_5g_by_bw[bw];
op_chs_ent = &op_chs_of_cch_5g_by_bw[bw]; op_chs_ent = &op_chs_of_cch_5g_by_bw[bw];
@ -530,7 +550,6 @@ const u8 _ch_width_to_bw_cap[CHANNEL_WIDTH_MAX] = {
const char *const _band_str[] = { const char *const _band_str[] = {
"2.4G", "2.4G",
"5G", "5G",
"BOTH",
"BAND_MAX", "BAND_MAX",
}; };
@ -538,7 +557,6 @@ const u8 _band_to_band_cap[] = {
BAND_CAP_2G, BAND_CAP_2G,
BAND_CAP_5G, BAND_CAP_5G,
0, 0,
0,
}; };
const u8 _rf_type_to_rf_tx_cnt[] = { const u8 _rf_type_to_rf_tx_cnt[] = {
@ -565,6 +583,186 @@ const u8 _rf_type_to_rf_rx_cnt[] = {
1, /*RF_TYPE_MAX*/ 1, /*RF_TYPE_MAX*/
}; };
const char *const _rf_type_to_rfpath_str[] = {
"RF_1T1R",
"RF_1T2R",
"RF_2T2R",
"RF_2T3R",
"RF_2T4R",
"RF_3T3R",
"RF_3T4R",
"RF_4T4R",
"RF_TYPE_MAX"
};
void rf_type_to_default_trx_bmp(enum rf_type rf, enum bb_path *tx, enum bb_path *rx)
{
switch (rf) {
case RF_1T1R:
*tx = BB_PATH_A;
*rx = BB_PATH_A;
break;
case RF_1T2R:
*tx = BB_PATH_A;
*rx = BB_PATH_AB;
break;
case RF_2T2R:
*tx = BB_PATH_AB;
*rx = BB_PATH_AB;
break;
case RF_2T3R:
*tx = BB_PATH_AB;
*rx = BB_PATH_ABC;
break;
case RF_2T4R:
*tx = BB_PATH_AB;
*rx = BB_PATH_ABCD;
break;
case RF_3T3R:
*tx = BB_PATH_ABC;
*rx = BB_PATH_ABC;
break;
case RF_3T4R:
*tx = BB_PATH_ABC;
*rx = BB_PATH_ABCD;
break;
case RF_4T4R:
*tx = BB_PATH_ABCD;
*rx = BB_PATH_ABCD;
break;
default:
*tx = BB_PATH_A;
*rx = BB_PATH_A;
break;
}
}
static const u8 _trx_num_to_rf_type[RF_PATH_MAX][RF_PATH_MAX] = {
{RF_1T1R, RF_1T2R, RF_TYPE_MAX, RF_TYPE_MAX},
{RF_TYPE_MAX, RF_2T2R, RF_2T3R, RF_2T4R},
{RF_TYPE_MAX, RF_TYPE_MAX, RF_3T3R, RF_3T4R},
{RF_TYPE_MAX, RF_TYPE_MAX, RF_TYPE_MAX, RF_4T4R},
};
enum rf_type trx_num_to_rf_type(u8 tx_num, u8 rx_num)
{
if (tx_num > 0 && tx_num <= RF_PATH_MAX && rx_num > 0 && rx_num <= RF_PATH_MAX)
return _trx_num_to_rf_type[tx_num - 1][rx_num - 1];
return RF_TYPE_MAX;
}
enum rf_type trx_bmp_to_rf_type(u8 tx_bmp, u8 rx_bmp)
{
u8 tx_num = 0;
u8 rx_num = 0;
int i;
for (i = 0; i < RF_PATH_MAX; i++) {
if (tx_bmp >> i & BIT0)
tx_num++;
if (rx_bmp >> i & BIT0)
rx_num++;
}
return trx_num_to_rf_type(tx_num, rx_num);
}
bool rf_type_is_a_in_b(enum rf_type a, enum rf_type b)
{
return rf_type_to_rf_tx_cnt(a) <= rf_type_to_rf_tx_cnt(b)
&& rf_type_to_rf_rx_cnt(a) <= rf_type_to_rf_rx_cnt(b);
}
static void rtw_path_bmp_limit_from_higher(u8 *bmp, u8 *bmp_bit_cnt, u8 bit_cnt_lmt)
{
int i;
for (i = RF_PATH_MAX - 1; *bmp_bit_cnt > bit_cnt_lmt && i >= 0; i--) {
if (*bmp & BIT(i)) {
*bmp &= ~BIT(i);
(*bmp_bit_cnt)--;
}
}
}
u8 rtw_restrict_trx_path_bmp_by_rftype(u8 trx_path_bmp, enum rf_type type, u8 *tx_num, u8 *rx_num)
{
u8 bmp_tx = (trx_path_bmp & 0xF0) >> 4;
u8 bmp_rx = trx_path_bmp & 0x0F;
u8 bmp_tx_num = 0, bmp_rx_num = 0;
u8 tx_num_lmt, rx_num_lmt;
enum rf_type ret_type = RF_TYPE_MAX;
int i, j;
for (i = 0; i < RF_PATH_MAX; i++) {
if (bmp_tx & BIT(i))
bmp_tx_num++;
if (bmp_rx & BIT(i))
bmp_rx_num++;
}
/* limit higher bit first according to input type */
tx_num_lmt = rf_type_to_rf_tx_cnt(type);
rx_num_lmt = rf_type_to_rf_rx_cnt(type);
rtw_path_bmp_limit_from_higher(&bmp_tx, &bmp_tx_num, tx_num_lmt);
rtw_path_bmp_limit_from_higher(&bmp_rx, &bmp_rx_num, rx_num_lmt);
/* search for valid rf_type (larger RX prefer) */
for (j = bmp_rx_num; j > 0; j--) {
for (i = bmp_tx_num; i > 0; i--) {
ret_type = trx_num_to_rf_type(i, j);
if (RF_TYPE_VALID(ret_type)) {
rtw_path_bmp_limit_from_higher(&bmp_tx, &bmp_tx_num, i);
rtw_path_bmp_limit_from_higher(&bmp_rx, &bmp_rx_num, j);
if (tx_num)
*tx_num = bmp_tx_num;
if (rx_num)
*rx_num = bmp_rx_num;
goto exit;
}
}
}
exit:
return RF_TYPE_VALID(ret_type) ? ((bmp_tx << 4) | bmp_rx) : 0x00;
}
/* config to non N-TX value, path with lower index prefer */
void tx_path_nss_set_default(enum bb_path txpath_nss[], u8 txpath_num_nss[], u8 txpath)
{
int i, j;
u8 cnt;
for (i = 4; i > 0; i--) {
cnt = 0;
txpath_nss[i - 1] = 0;
for (j = 0; j < RF_PATH_MAX; j++) {
if (txpath & BIT(j)) {
txpath_nss[i - 1] |= BIT(j);
if (++cnt == i)
break;
}
}
txpath_num_nss[i - 1] = i;
}
}
/* config to full N-TX value */
void tx_path_nss_set_full_tx(enum bb_path txpath_nss[], u8 txpath_num_nss[], u8 txpath)
{
u8 tx_num = 0;
int i;
for (i = 0; i < RF_PATH_MAX; i++)
if (txpath & BIT(i))
tx_num++;
for (i = 4; i > 0; i--) {
txpath_nss[i - 1] = txpath;
txpath_num_nss[i - 1] = tx_num;
}
}
const char *const _regd_str[] = { const char *const _regd_str[] = {
"NONE", "NONE",
"FCC", "FCC",
@ -574,10 +772,79 @@ const char *const _regd_str[] = {
"KCC", "KCC",
"ACMA", "ACMA",
"CHILE", "CHILE",
"MEXICO",
"WW", "WW",
}; };
#ifdef CONFIG_TXPWR_LIMIT /*
* input with txpwr value in unit of txpwr index
* return string in length 6 at least (for -xx.xx)
*/
void txpwr_idx_get_dbm_str(s8 idx, u8 txgi_max, u8 txgi_pdbm, SIZE_T cwidth, char dbm_str[], u8 dbm_str_len)
{
char fmt[16];
if (idx == txgi_max) {
snprintf(fmt, 16, "%%%zus", cwidth >= 6 ? cwidth + 1 : 6);
snprintf(dbm_str, dbm_str_len, fmt, "NA");
} else if (idx > -txgi_pdbm && idx < 0) { /* -0.xx */
snprintf(fmt, 16, "%%%zus-0.%%02d", cwidth >= 6 ? cwidth - 4 : 1);
snprintf(dbm_str, dbm_str_len, fmt, "", (rtw_abs(idx) % txgi_pdbm) * 100 / txgi_pdbm);
} else if (idx % txgi_pdbm) { /* d.xx */
snprintf(fmt, 16, "%%%zud.%%02d", cwidth >= 6 ? cwidth - 2 : 3);
snprintf(dbm_str, dbm_str_len, fmt, idx / txgi_pdbm, (rtw_abs(idx) % txgi_pdbm) * 100 / txgi_pdbm);
} else { /* d */
snprintf(fmt, 16, "%%%zud", cwidth >= 6 ? cwidth + 1 : 6);
snprintf(dbm_str, dbm_str_len, fmt, idx / txgi_pdbm);
}
}
/*
* input with txpwr value in unit of mbm
* return string in length 6 at least (for -xx.xx)
*/
void txpwr_mbm_get_dbm_str(s16 mbm, SIZE_T cwidth, char dbm_str[], u8 dbm_str_len)
{
char fmt[16];
if (mbm == UNSPECIFIED_MBM) {
snprintf(fmt, 16, "%%%zus", cwidth >= 6 ? cwidth + 1 : 6);
snprintf(dbm_str, dbm_str_len, fmt, "NA");
} else if (mbm > -MBM_PDBM && mbm < 0) { /* -0.xx */
snprintf(fmt, 16, "%%%zus-0.%%02d", cwidth >= 6 ? cwidth - 4 : 1);
snprintf(dbm_str, dbm_str_len, fmt, "", (rtw_abs(mbm) % MBM_PDBM) * 100 / MBM_PDBM);
} else if (mbm % MBM_PDBM) { /* d.xx */
snprintf(fmt, 16, "%%%zud.%%02d", cwidth >= 6 ? cwidth - 2 : 3);
snprintf(dbm_str, dbm_str_len, fmt, mbm / MBM_PDBM, (rtw_abs(mbm) % MBM_PDBM) * 100 / MBM_PDBM);
} else { /* d */
snprintf(fmt, 16, "%%%zud", cwidth >= 6 ? cwidth + 1 : 6);
snprintf(dbm_str, dbm_str_len, fmt, mbm / MBM_PDBM);
}
}
static const s16 _mb_of_ntx[] = {
0, /* 1TX */
301, /* 2TX */
477, /* 3TX */
602, /* 4TX */
699, /* 5TX */
778, /* 6TX */
845, /* 7TX */
903, /* 8TX */
};
/* get mB(100 *dB) for specifc TX count relative to 1TX */
s16 mb_of_ntx(u8 ntx)
{
if (ntx == 0 || ntx > 8) {
RTW_ERR("ntx=%u, out of range\n", ntx);
rtw_warn_on(1);
}
return _mb_of_ntx[ntx - 1];
}
#if CONFIG_TXPWR_LIMIT
void _dump_regd_exc_list(void *sel, struct rf_ctl_t *rfctl) void _dump_regd_exc_list(void *sel, struct rf_ctl_t *rfctl)
{ {
struct regd_exc_ent *ent; struct regd_exc_ent *ent;
@ -738,6 +1005,7 @@ void dump_txpwr_lmt(void *sel, _adapter *adapter)
{ {
#define TMP_STR_LEN 16 #define TMP_STR_LEN 16
struct rf_ctl_t *rfctl = adapter_to_rfctl(adapter); struct rf_ctl_t *rfctl = adapter_to_rfctl(adapter);
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
struct hal_spec_t *hal_spec = GET_HAL_SPEC(adapter); struct hal_spec_t *hal_spec = GET_HAL_SPEC(adapter);
_irqL irqL; _irqL irqL;
char fmt[16]; char fmt[16];
@ -761,10 +1029,11 @@ void dump_txpwr_lmt(void *sel, _adapter *adapter)
} }
RTW_PRINT_SEL(sel, "txpwr_lmt_2g_cck_ofdm_state:0x%02x\n", rfctl->txpwr_lmt_2g_cck_ofdm_state); RTW_PRINT_SEL(sel, "txpwr_lmt_2g_cck_ofdm_state:0x%02x\n", rfctl->txpwr_lmt_2g_cck_ofdm_state);
#ifdef CONFIG_IEEE80211_BAND_5GHZ #if CONFIG_IEEE80211_BAND_5GHZ
if (IS_HARDWARE_TYPE_JAGUAR_AND_JAGUAR2(adapter)) if (IS_HARDWARE_TYPE_JAGUAR_ALL(adapter)) {
RTW_PRINT_SEL(sel, "txpwr_lmt_5g_cck_ofdm_state:0x%02x\n", rfctl->txpwr_lmt_5g_cck_ofdm_state); RTW_PRINT_SEL(sel, "txpwr_lmt_5g_cck_ofdm_state:0x%02x\n", rfctl->txpwr_lmt_5g_cck_ofdm_state);
RTW_PRINT_SEL(sel, "txpwr_lmt_5g_20_40_ref:0x%02x\n", rfctl->txpwr_lmt_5g_20_40_ref); RTW_PRINT_SEL(sel, "txpwr_lmt_5g_20_40_ref:0x%02x\n", rfctl->txpwr_lmt_5g_20_40_ref);
}
#endif #endif
RTW_PRINT_SEL(sel, "\n"); RTW_PRINT_SEL(sel, "\n");
@ -801,14 +1070,14 @@ void dump_txpwr_lmt(void *sel, _adapter *adapter)
continue; continue;
if (bw > CHANNEL_WIDTH_40 && tlrs == TXPWR_LMT_RS_HT) if (bw > CHANNEL_WIDTH_40 && tlrs == TXPWR_LMT_RS_HT)
continue; continue;
if (tlrs == TXPWR_LMT_RS_VHT && !IS_HARDWARE_TYPE_JAGUAR_AND_JAGUAR2(adapter)) if (tlrs == TXPWR_LMT_RS_VHT && !IS_HARDWARE_TYPE_JAGUAR_ALL(adapter))
continue; continue;
for (ntx_idx = RF_1TX; ntx_idx < MAX_TX_COUNT; ntx_idx++) { for (ntx_idx = RF_1TX; ntx_idx < MAX_TX_COUNT; ntx_idx++) {
struct txpwr_lmt_ent *ent; struct txpwr_lmt_ent *ent;
_list *cur, *head; _list *cur, *head;
if (ntx_idx >= hal_spec->tx_nss_num) if (ntx_idx + 1 > hal_data->max_tx_cnt)
continue; continue;
/* bypass CCK multi-TX is not defined */ /* bypass CCK multi-TX is not defined */
@ -823,7 +1092,7 @@ void dump_txpwr_lmt(void *sel, _adapter *adapter)
if (band == BAND_ON_2_4G if (band == BAND_ON_2_4G
&& !(rfctl->txpwr_lmt_2g_cck_ofdm_state & (TXPWR_LMT_HAS_OFDM_1T << ntx_idx))) && !(rfctl->txpwr_lmt_2g_cck_ofdm_state & (TXPWR_LMT_HAS_OFDM_1T << ntx_idx)))
continue; continue;
#ifdef CONFIG_IEEE80211_BAND_5GHZ #if CONFIG_IEEE80211_BAND_5GHZ
if (band == BAND_ON_5G if (band == BAND_ON_5G
&& !(rfctl->txpwr_lmt_5g_cck_ofdm_state & (TXPWR_LMT_HAS_OFDM_1T << ntx_idx))) && !(rfctl->txpwr_lmt_5g_cck_ofdm_state & (TXPWR_LMT_HAS_OFDM_1T << ntx_idx)))
continue; continue;
@ -831,7 +1100,7 @@ void dump_txpwr_lmt(void *sel, _adapter *adapter)
} }
/* bypass 5G 20M, 40M pure reference */ /* bypass 5G 20M, 40M pure reference */
#ifdef CONFIG_IEEE80211_BAND_5GHZ #if CONFIG_IEEE80211_BAND_5GHZ
if (band == BAND_ON_5G && (bw == CHANNEL_WIDTH_20 || bw == CHANNEL_WIDTH_40)) { if (band == BAND_ON_5G && (bw == CHANNEL_WIDTH_20 || bw == CHANNEL_WIDTH_40)) {
if (rfctl->txpwr_lmt_5g_20_40_ref == TXPWR_LMT_REF_HT_FROM_VHT) { if (rfctl->txpwr_lmt_5g_20_40_ref == TXPWR_LMT_REF_HT_FROM_VHT) {
if (tlrs == TXPWR_LMT_RS_HT) if (tlrs == TXPWR_LMT_RS_HT)
@ -918,57 +1187,27 @@ void dump_txpwr_lmt(void *sel, _adapter *adapter)
break; break;
} }
/* dump limit in db */ /* dump limit in dBm */
RTW_PRINT_SEL(sel, "%3u ", ch); RTW_PRINT_SEL(sel, "%3u ", ch);
head = &rfctl->txpwr_lmt_list; head = &rfctl->txpwr_lmt_list;
cur = get_next(head); cur = get_next(head);
while ((rtw_end_of_queue_search(head, cur)) == _FALSE) { while ((rtw_end_of_queue_search(head, cur)) == _FALSE) {
ent = LIST_CONTAINOR(cur, struct txpwr_lmt_ent, list); ent = LIST_CONTAINOR(cur, struct txpwr_lmt_ent, list);
cur = get_next(cur); cur = get_next(cur);
lmt = phy_get_txpwr_lmt_abs(adapter, ent->regd_name, band, bw, tlrs, ntx_idx, ch, 0); lmt = phy_get_txpwr_lmt(adapter, ent->regd_name, band, bw, tlrs, ntx_idx, ch, 0);
if (lmt == hal_spec->txgi_max) { txpwr_idx_get_dbm_str(lmt, hal_spec->txgi_max, hal_spec->txgi_pdbm, strlen(ent->regd_name), tmp_str, TMP_STR_LEN);
sprintf(fmt, "%%%zus ", strlen(ent->regd_name) >= 6 ? strlen(ent->regd_name) + 1 : 6);
snprintf(tmp_str, TMP_STR_LEN, fmt, "NA");
_RTW_PRINT_SEL(sel, "%s", tmp_str);
} else if (lmt > -hal_spec->txgi_pdbm && lmt < 0) { /* -0.xx */
sprintf(fmt, "%%%zus-0.%%d ", strlen(ent->regd_name) >= 6 ? strlen(ent->regd_name) - 4 : 1);
snprintf(tmp_str, TMP_STR_LEN, fmt, "", (rtw_abs(lmt) % hal_spec->txgi_pdbm) * 100 / hal_spec->txgi_pdbm);
_RTW_PRINT_SEL(sel, "%s", tmp_str);
} else if (lmt % hal_spec->txgi_pdbm) { /* d.xx */
sprintf(fmt, "%%%zud.%%d ", strlen(ent->regd_name) >= 6 ? strlen(ent->regd_name) - 2 : 3);
snprintf(tmp_str, TMP_STR_LEN, fmt, lmt / hal_spec->txgi_pdbm, (rtw_abs(lmt) % hal_spec->txgi_pdbm) * 100 / hal_spec->txgi_pdbm);
_RTW_PRINT_SEL(sel, "%s", tmp_str);
} else { /* d */
sprintf(fmt, "%%%zud ", strlen(ent->regd_name) >= 6 ? strlen(ent->regd_name) + 1 : 6);
snprintf(tmp_str, TMP_STR_LEN, fmt, lmt / hal_spec->txgi_pdbm);
_RTW_PRINT_SEL(sel, "%s ", tmp_str); _RTW_PRINT_SEL(sel, "%s ", tmp_str);
} }
} lmt = phy_get_txpwr_lmt(adapter, regd_str(TXPWR_LMT_WW), band, bw, tlrs, ntx_idx, ch, 0);
lmt = phy_get_txpwr_lmt_abs(adapter, regd_str(TXPWR_LMT_WW), band, bw, tlrs, ntx_idx, ch, 0); txpwr_idx_get_dbm_str(lmt, hal_spec->txgi_max, hal_spec->txgi_pdbm, strlen(regd_str(TXPWR_LMT_WW)), tmp_str, TMP_STR_LEN);
if (lmt == hal_spec->txgi_max) {
sprintf(fmt, "%%%zus ", strlen(regd_str(TXPWR_LMT_WW)) >= 6 ? strlen(regd_str(TXPWR_LMT_WW)) + 1 : 6);
snprintf(tmp_str, TMP_STR_LEN, fmt, "NA");
_RTW_PRINT_SEL(sel, "%s ", tmp_str); _RTW_PRINT_SEL(sel, "%s ", tmp_str);
} else if (lmt > -hal_spec->txgi_pdbm && lmt < 0) { /* -0.xx */
sprintf(fmt, "%%%zus-0.%%d ", strlen(regd_str(TXPWR_LMT_WW)) >= 6 ? strlen(regd_str(TXPWR_LMT_WW)) - 4 : 1);
snprintf(tmp_str, TMP_STR_LEN, fmt, "", (rtw_abs(lmt) % hal_spec->txgi_pdbm) * 100 / hal_spec->txgi_pdbm);
_RTW_PRINT_SEL(sel, "%s", tmp_str);
} else if (lmt % hal_spec->txgi_pdbm) { /* d.xx */
sprintf(fmt, "%%%zud.%%d ", strlen(regd_str(TXPWR_LMT_WW)) >= 6 ? strlen(regd_str(TXPWR_LMT_WW)) - 2 : 3);
snprintf(tmp_str, TMP_STR_LEN, fmt, lmt / hal_spec->txgi_pdbm, (rtw_abs(lmt) % hal_spec->txgi_pdbm) * 100 / hal_spec->txgi_pdbm);
_RTW_PRINT_SEL(sel, "%s", tmp_str);
} else { /* d */
sprintf(fmt, "%%%zud ", strlen(regd_str(TXPWR_LMT_WW)) >= 6 ? strlen(regd_str(TXPWR_LMT_WW)) + 1 : 6);
snprintf(tmp_str, TMP_STR_LEN, fmt, lmt / hal_spec->txgi_pdbm);
_RTW_PRINT_SEL(sel, "%s", tmp_str);
}
/* dump limit offset of each path */ /* dump limit offset of each path */
for (path = RF_PATH_A; path < RF_PATH_MAX; path++) { for (path = RF_PATH_A; path < RF_PATH_MAX; path++) {
if (path >= rfpath_num) if (path >= rfpath_num)
break; break;
base = PHY_GetTxPowerByRateBase(adapter, band, path, rs); base = phy_get_target_txpwr(adapter, band, path, rs);
_RTW_PRINT_SEL(sel, "|"); _RTW_PRINT_SEL(sel, "|");
head = &rfctl->txpwr_lmt_list; head = &rfctl->txpwr_lmt_list;
@ -977,7 +1216,7 @@ void dump_txpwr_lmt(void *sel, _adapter *adapter)
while ((rtw_end_of_queue_search(head, cur)) == _FALSE) { while ((rtw_end_of_queue_search(head, cur)) == _FALSE) {
ent = LIST_CONTAINOR(cur, struct txpwr_lmt_ent, list); ent = LIST_CONTAINOR(cur, struct txpwr_lmt_ent, list);
cur = get_next(cur); cur = get_next(cur);
lmt_offset = phy_get_txpwr_lmt(adapter, ent->regd_name, band, bw, path, rs, ntx_idx, ch, 0); lmt_offset = phy_get_txpwr_lmt_diff(adapter, ent->regd_name, band, bw, path, rs, tlrs, ntx_idx, ch, 0);
if (lmt_offset == hal_spec->txgi_max) { if (lmt_offset == hal_spec->txgi_max) {
*(lmt_idx + i * RF_PATH_MAX + path) = hal_spec->txgi_max; *(lmt_idx + i * RF_PATH_MAX + path) = hal_spec->txgi_max;
_RTW_PRINT_SEL(sel, "%3s ", "NA"); _RTW_PRINT_SEL(sel, "%3s ", "NA");
@ -987,7 +1226,7 @@ void dump_txpwr_lmt(void *sel, _adapter *adapter)
} }
i++; i++;
} }
lmt_offset = phy_get_txpwr_lmt(adapter, regd_str(TXPWR_LMT_WW), band, bw, path, rs, ntx_idx, ch, 0); lmt_offset = phy_get_txpwr_lmt_diff(adapter, regd_str(TXPWR_LMT_WW), band, bw, path, rs, tlrs, ntx_idx, ch, 0);
if (lmt_offset == hal_spec->txgi_max) if (lmt_offset == hal_spec->txgi_max)
_RTW_PRINT_SEL(sel, "%3s ", "NA"); _RTW_PRINT_SEL(sel, "%3s ", "NA");
else else
@ -1070,7 +1309,7 @@ void rtw_txpwr_lmt_add_with_nlen(struct rf_ctl_t *rfctl, const char *regd_name,
for (m = 0; m < CENTER_CH_2G_NUM; ++m) for (m = 0; m < CENTER_CH_2G_NUM; ++m)
for (l = 0; l < MAX_TX_COUNT; ++l) for (l = 0; l < MAX_TX_COUNT; ++l)
ent->lmt_2g[j][k][m][l] = hal_spec->txgi_max; ent->lmt_2g[j][k][m][l] = hal_spec->txgi_max;
#ifdef CONFIG_IEEE80211_BAND_5GHZ #if CONFIG_IEEE80211_BAND_5GHZ
for (j = 0; j < MAX_5G_BANDWIDTH_NUM; ++j) for (j = 0; j < MAX_5G_BANDWIDTH_NUM; ++j)
for (k = 0; k < TXPWR_LMT_RS_NUM_5G; ++k) for (k = 0; k < TXPWR_LMT_RS_NUM_5G; ++k)
for (m = 0; m < CENTER_CH_5G_ALL_NUM; ++m) for (m = 0; m < CENTER_CH_5G_ALL_NUM; ++m)
@ -1085,7 +1324,7 @@ void rtw_txpwr_lmt_add_with_nlen(struct rf_ctl_t *rfctl, const char *regd_name,
chk_lmt_val: chk_lmt_val:
if (band == BAND_ON_2_4G) if (band == BAND_ON_2_4G)
pre_lmt = ent->lmt_2g[bw][tlrs][ch_idx][ntx_idx]; pre_lmt = ent->lmt_2g[bw][tlrs][ch_idx][ntx_idx];
#ifdef CONFIG_IEEE80211_BAND_5GHZ #if CONFIG_IEEE80211_BAND_5GHZ
else if (band == BAND_ON_5G) else if (band == BAND_ON_5G)
pre_lmt = ent->lmt_5g[bw][tlrs - 1][ch_idx][ntx_idx]; pre_lmt = ent->lmt_5g[bw][tlrs - 1][ch_idx][ntx_idx];
#endif #endif
@ -1100,7 +1339,7 @@ chk_lmt_val:
lmt = rtw_min(pre_lmt, lmt); lmt = rtw_min(pre_lmt, lmt);
if (band == BAND_ON_2_4G) if (band == BAND_ON_2_4G)
ent->lmt_2g[bw][tlrs][ch_idx][ntx_idx] = lmt; ent->lmt_2g[bw][tlrs][ch_idx][ntx_idx] = lmt;
#ifdef CONFIG_IEEE80211_BAND_5GHZ #if CONFIG_IEEE80211_BAND_5GHZ
else if (band == BAND_ON_5G) else if (band == BAND_ON_5G)
ent->lmt_5g[bw][tlrs - 1][ch_idx][ntx_idx] = lmt; ent->lmt_5g[bw][tlrs - 1][ch_idx][ntx_idx] = lmt;
#endif #endif
@ -1192,7 +1431,7 @@ int rtw_ch_to_bb_gain_sel(int ch)
if (ch >= 1 && ch <= 14) if (ch >= 1 && ch <= 14)
sel = BB_GAIN_2G; sel = BB_GAIN_2G;
#ifdef CONFIG_IEEE80211_BAND_5GHZ #if CONFIG_IEEE80211_BAND_5GHZ
else if (ch >= 36 && ch < 48) else if (ch >= 36 && ch < 48)
sel = BB_GAIN_5GLB1; sel = BB_GAIN_5GLB1;
else if (ch >= 52 && ch <= 64) else if (ch >= 52 && ch <= 64)
@ -1238,7 +1477,7 @@ exit:
void rtw_rf_set_tx_gain_offset(_adapter *adapter, u8 path, s8 offset) void rtw_rf_set_tx_gain_offset(_adapter *adapter, u8 path, s8 offset)
{ {
#if !defined(CONFIG_RTL8814A) && !defined(CONFIG_RTL8822B) && !defined(CONFIG_RTL8821C) #if !defined(CONFIG_RTL8814A) && !defined(CONFIG_RTL8822B) && !defined(CONFIG_RTL8821C) && !defined(CONFIG_RTL8822C)
u8 write_value; u8 write_value;
#endif #endif
u8 target_path = 0; u8 target_path = 0;
@ -1298,9 +1537,10 @@ void rtw_rf_set_tx_gain_offset(_adapter *adapter, u8 path, s8 offset)
rtw_hal_write_rfreg(adapter, target_path, 0x55, 0x0f8000, write_value); rtw_hal_write_rfreg(adapter, target_path, 0x55, 0x0f8000, write_value);
break; break;
#endif /* CONFIG_RTL8821A */ #endif /* CONFIG_RTL8821A */
#if defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8192F) #if defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8192F) || defined(CONFIG_RTL8822C)
case RTL8814A: case RTL8814A:
case RTL8822B: case RTL8822B:
case RTL8822C:
case RTL8821C: case RTL8821C:
case RTL8192F: case RTL8192F:
RTW_INFO("\nkfree by PhyDM on the sw CH. path %d\n", path); RTW_INFO("\nkfree by PhyDM on the sw CH. path %d\n", path);
@ -1343,31 +1583,6 @@ void rtw_rf_apply_tx_gain_offset(_adapter *adapter, u8 ch)
} }
} }
inline u8 rtw_is_dfs_range(u32 hi, u32 lo)
{
return rtw_is_range_overlap(hi, lo, 5720 + 10, 5260 - 10);
}
u8 rtw_is_dfs_ch(u8 ch)
{
u32 hi, lo;
if (!rtw_chbw_to_freq_range(ch, CHANNEL_WIDTH_20, HAL_PRIME_CHNL_OFFSET_DONT_CARE, &hi, &lo))
return 0;
return rtw_is_dfs_range(hi, lo);
}
u8 rtw_is_dfs_chbw(u8 ch, u8 bw, u8 offset)
{
u32 hi, lo;
if (!rtw_chbw_to_freq_range(ch, bw, offset, &hi, &lo))
return 0;
return rtw_is_dfs_range(hi, lo);
}
bool rtw_is_long_cac_range(u32 hi, u32 lo, u8 dfs_region) bool rtw_is_long_cac_range(u32 hi, u32 lo, u8 dfs_region)
{ {
return (dfs_region == PHYDM_DFS_DOMAIN_ETSI && rtw_is_range_overlap(hi, lo, 5650, 5600)) ? _TRUE : _FALSE; return (dfs_region == PHYDM_DFS_DOMAIN_ETSI && rtw_is_range_overlap(hi, lo, 5650, 5600)) ? _TRUE : _FALSE;

View File

@ -15,7 +15,10 @@
#include <drv_types.h> #include <drv_types.h>
#include <hal_data.h> #include <hal_data.h>
#ifdef CONFIG_RTW_80211K
#include "rtw_rm_fsm.h" #include "rtw_rm_fsm.h"
#include "rtw_rm_util.h"
#endif
#define pstr(s) s+strlen(s) #define pstr(s) s+strlen(s)
@ -31,19 +34,6 @@ u8 rm_post_event_hdl(_adapter *padapter, u8 *pbuf)
} }
#ifdef CONFIG_RTW_80211K #ifdef CONFIG_RTW_80211K
/* 802.11-2012 Table E-1 Operationg classes in United States */
static RT_OPERATING_CLASS RTW_OP_CLASS_US[] = {
/* 0, OP_CLASS_NULL */ { 0, 0, {}},
/* 1, OP_CLASS_1 */ {115, 4, {36, 40, 44, 48}},
/* 2, OP_CLASS_2 */ {118, 4, {52, 56, 60, 64}},
/* 3, OP_CLASS_3 */ {124, 4, {149, 153, 157, 161}},
/* 4, OP_CLASS_4 */ {121, 11, {100, 104, 108, 112, 116, 120, 124,
128, 132, 136, 140}},
/* 5, OP_CLASS_5 */ {125, 5, {149, 153, 157, 161, 165}},
/* 6, OP_CLASS_12 */ { 81, 11, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}}
};
struct cmd_meas_type_ { struct cmd_meas_type_ {
u8 id; u8 id;
char *name; char *name;
@ -198,74 +188,6 @@ int rm_en_cap_chk_and_set(struct rm_obj *prm, enum rm_cap_en en)
return _SUCCESS; return _SUCCESS;
} }
static u8 rm_get_oper_class_via_ch(u8 ch)
{
int i,j,sz;
sz = sizeof(RTW_OP_CLASS_US)/sizeof(struct _RT_OPERATING_CLASS);
for (i = 0; i < sz; i++) {
for (j = 0; j < RTW_OP_CLASS_US[i].Len; j++) {
if ( ch == RTW_OP_CLASS_US[i].Channel[j]) {
RTW_INFO("RM: ch %u in oper_calss %u\n",
ch, RTW_OP_CLASS_US[i].global_op_class);
return RTW_OP_CLASS_US[i].global_op_class;
break;
}
}
}
return 0;
}
static u8 rm_get_ch_set(
struct rtw_ieee80211_channel *pch_set, u8 op_class, u8 ch_num)
{
int i,j,sz;
u8 ch_amount = 0;
sz = sizeof(RTW_OP_CLASS_US)/sizeof(struct _RT_OPERATING_CLASS);
if (ch_num != 0) {
pch_set[0].hw_value = ch_num;
ch_amount = 1;
RTW_INFO("RM: meas_ch->hw_value = %u\n", pch_set->hw_value);
goto done;
}
for (i = 0; i < sz; i++) {
if (RTW_OP_CLASS_US[i].global_op_class == op_class) {
for (j = 0; j < RTW_OP_CLASS_US[i].Len; j++) {
pch_set[j].hw_value =
RTW_OP_CLASS_US[i].Channel[j];
RTW_INFO("RM: meas_ch[%d].hw_value = %u\n",
j, pch_set[j].hw_value);
}
ch_amount = RTW_OP_CLASS_US[i].Len;
break;
}
}
done:
return ch_amount;
}
static int is_wildcard_bssid(u8 *bssid)
{
int i;
u8 val8 = 0xff;
for (i=0;i<6;i++)
val8 &= bssid[i];
if (val8 == 0xff)
return _SUCCESS;
return _FALSE;
}
/* for caller outside rm */ /* for caller outside rm */
u8 rm_add_nb_req(_adapter *padapter, struct sta_info *psta) u8 rm_add_nb_req(_adapter *padapter, struct sta_info *psta)
{ {
@ -283,7 +205,11 @@ u8 rm_add_nb_req(_adapter *padapter, struct sta_info *psta)
prm->psta = psta; prm->psta = psta;
prm->q.category = RTW_WLAN_CATEGORY_RADIO_MEAS; prm->q.category = RTW_WLAN_CATEGORY_RADIO_MEAS;
prm->q.diag_token = pmlmeinfo->dialogToken++; do {
pmlmeinfo->dialogToken++;
} while (pmlmeinfo->dialogToken == 0);
prm->q.diag_token = pmlmeinfo->dialogToken;
prm->q.m_token = 1; prm->q.m_token = 1;
prm->rmid = psta->cmn.aid << 16 prm->rmid = psta->cmn.aid << 16
@ -312,7 +238,6 @@ u8 rm_add_nb_req(_adapter *padapter, struct sta_info *psta)
return _SUCCESS; return _SUCCESS;
} }
static u8 *build_wlan_hdr(_adapter *padapter, struct xmit_frame *pmgntframe, static u8 *build_wlan_hdr(_adapter *padapter, struct xmit_frame *pmgntframe,
struct sta_info *psta, u16 frame_type) struct sta_info *psta, u16 frame_type)
{ {
@ -493,24 +418,6 @@ int rm_sitesurvey(struct rm_obj *prm)
return _SUCCESS; return _SUCCESS;
} }
static u8 translate_percentage_to_rcpi(u32 SignalStrengthIndex)
{
s32 SignalPower; /* in dBm. */
u8 rcpi;
/* Translate to dBm (x=y-100) */
SignalPower = SignalStrengthIndex - 100;
/* RCPI = Int{(Power in dBm + 110)*2} for 0dBm > Power > -110dBm
* 0 : power <= -110.0 dBm
* 1 : power = -109.5 dBm
* 2 : power = -109.0 dBm
*/
rcpi = (SignalPower + 110)*2;
return rcpi;
}
static int rm_parse_ch_load_s_elem(struct rm_obj *prm, u8 *pbody, int req_len) static int rm_parse_ch_load_s_elem(struct rm_obj *prm, u8 *pbody, int req_len)
{ {
u8 *popt_id; u8 *popt_id;
@ -903,6 +810,102 @@ int rm_recv_radio_mens_rep(_adapter *padapter,
return ret; return ret;
} }
/* receive link measurement request */
int rm_recv_link_mens_req(_adapter *padapter,
union recv_frame *precv_frame, struct sta_info *psta)
{
struct rm_obj *prm;
struct rm_priv *prmpriv = &padapter->rmpriv;
u8 *pdiag_body = (u8 *)(precv_frame->u.hdr.rx_data +
sizeof(struct rtw_ieee80211_hdr_3addr));
u8 *pmeas_body = &pdiag_body[3];
u8 rmid, update = 0;
int i;
prm = rm_alloc_rmobj(padapter);
if (prm == NULL) {
RTW_ERR("RM: unable to alloc rm obj for requeset\n");
return _FALSE;
}
prm->psta = psta;
prm->q.action_code = pdiag_body[1];
prm->q.diag_token = pdiag_body[2];
prm->q.tx_pwr_used = pmeas_body[0];
prm->q.tx_pwr_max = pmeas_body[1];
prm->q.rx_pwr = precv_frame->u.hdr.attrib.phy_info.rx_power;
prm->q.rx_rate = hw_rate_to_m_rate(precv_frame->u.hdr.attrib.data_rate);
prm->q.rx_bw = precv_frame->u.hdr.attrib.bw;
prm->q.rx_rsni = rm_get_frame_rsni(prm, precv_frame);
prm->rmid = psta->cmn.aid << 16
| prm->q.diag_token << 8
| RM_SLAVE;
RTW_INFO("RM: rmid=%x, bssid" MAC_FMT " rx_pwr=%ddBm, rate=%s\n",
prm->rmid, MAC_ARG(prm->psta->cmn.mac_addr), prm->q.rx_pwr,
MGN_RATE_STR(prm->q.rx_rate));
#if (RM_MORE_DBG_MSG)
RTW_INFO("RM: tx_pwr_used =%d dBm\n", prm->q.tx_pwr_used);
RTW_INFO("RM: tx_pwr_max =%d dBm\n", prm->q.tx_pwr_max);
#endif
if (!update)
rm_enqueue_rmobj(padapter, prm, _FALSE);
return _SUCCESS;
}
/* receive link measurement report */
int rm_recv_link_mens_rep(_adapter *padapter,
union recv_frame *precv_frame, struct sta_info *psta)
{
int ret = _FALSE;
struct rm_obj *prm;
u32 rmid;
u8 *pdiag_body = (u8 *)(precv_frame->u.hdr.rx_data +
sizeof(struct rtw_ieee80211_hdr_3addr));
u8 *pmeas_body = pdiag_body + 3;
s8 val;
rmid = psta->cmn.aid << 16
| pdiag_body[2] << 8
| RM_MASTER;
prm = rm_get_rmobj(padapter, rmid);
if (prm == NULL) {
RTW_ERR("RM: rmid 0x%08x not found\n", rmid);
return ret;
}
RTW_INFO("RM: rmid=%x, bssid " MAC_FMT "\n", prm->rmid,
MAC_ARG(prm->psta->cmn.mac_addr));
prm->p.action_code = pdiag_body[1];
prm->p.diag_token = pdiag_body[2];
#if (RM_MORE_DBG_MSG)
RTW_INFO("RM: action_code = %d\n", prm->p.action_code);
RTW_INFO("RM: diag_token = %d\n", prm->p.diag_token);
RTW_INFO("RM: xmit_power = %d dBm\n", pmeas_body[2]);
RTW_INFO("RM: link_margin = %d dBm\n", pmeas_body[3]);
RTW_INFO("RM: xmit_ant = %d\n", pmeas_body[4]);
RTW_INFO("RM: recv_ant = %d\n", pmeas_body[5]);
RTW_INFO("RM: RCPI = %d\n", pmeas_body[6]);
RTW_INFO("RM: RSNI = %d\n", pmeas_body[7]);
#endif
RTW_INFO("RM: recv link meas report ...\n");
ret = rm_post_event(padapter, prm->rmid, RM_EV_recv_rep);
return ret;
}
int rm_radio_mens_nb_rep(_adapter *padapter, int rm_radio_mens_nb_rep(_adapter *padapter,
union recv_frame *precv_frame, struct sta_info *psta) union recv_frame *precv_frame, struct sta_info *psta)
{ {
@ -1003,10 +1006,12 @@ unsigned int rm_on_action(_adapter *padapter, union recv_frame *precv_frame)
case RM_ACT_LINK_MEAS_REQ: case RM_ACT_LINK_MEAS_REQ:
RTW_INFO("RM: RM_ACT_LINK_MEAS_REQ\n"); RTW_INFO("RM: RM_ACT_LINK_MEAS_REQ\n");
ret = rm_recv_link_mens_req(padapter, precv_frame, psta);
break; break;
case RM_ACT_LINK_MEAS_REP: case RM_ACT_LINK_MEAS_REP:
RTW_INFO("RM: RM_ACT_LINK_MEAS_REP\n"); RTW_INFO("RM: RM_ACT_LINK_MEAS_REP\n");
ret = rm_recv_link_mens_rep(padapter, precv_frame, psta);
break; break;
case RM_ACT_NB_REP_REQ: case RM_ACT_NB_REP_REQ:
@ -1141,34 +1146,6 @@ done:
return pframe; return pframe;
} }
static u8 rm_get_rcpi(struct rm_obj *prm, struct wlan_network *pnetwork)
{
return translate_percentage_to_rcpi(
pnetwork->network.PhyInfo.SignalStrength);
}
static u8 rm_get_rsni(struct rm_obj *prm, struct wlan_network *pnetwork)
{
int i;
u8 val8, snr;
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(prm->psta->padapter);
if (pnetwork->network.PhyInfo.is_cck_rate) {
/* current HW doesn't have CCK RSNI */
/* 255 indicates RSNI is unavailable */
val8 = 255;
} else {
snr = 0;
for (i = 0; i < pHalData->NumTotalRFPath; i++) {
snr += pnetwork->network.PhyInfo.rx_snr[i];
}
snr = snr / pHalData->NumTotalRFPath;
val8 = (u8)(snr + 10)*2;
}
return val8;
}
u8 rm_bcn_req_cond_mach(struct rm_obj *prm, struct wlan_network *pnetwork) u8 rm_bcn_req_cond_mach(struct rm_obj *prm, struct wlan_network *pnetwork)
{ {
u8 val8; u8 val8;
@ -1178,22 +1155,22 @@ u8 rm_bcn_req_cond_mach(struct rm_obj *prm, struct wlan_network *pnetwork)
case bcn_rep_cond_immediately: case bcn_rep_cond_immediately:
return _SUCCESS; return _SUCCESS;
case bcn_req_cond_rcpi_greater: case bcn_req_cond_rcpi_greater:
val8 = rm_get_rcpi(prm, pnetwork); val8 = rm_get_bcn_rcpi(prm, pnetwork);
if (val8 > prm->q.opt.bcn.rep_cond.threshold) if (val8 > prm->q.opt.bcn.rep_cond.threshold)
return _SUCCESS; return _SUCCESS;
break; break;
case bcn_req_cond_rcpi_less: case bcn_req_cond_rcpi_less:
val8 = rm_get_rcpi(prm, pnetwork); val8 = rm_get_bcn_rcpi(prm, pnetwork);
if (val8 < prm->q.opt.bcn.rep_cond.threshold) if (val8 < prm->q.opt.bcn.rep_cond.threshold)
return _SUCCESS; return _SUCCESS;
break; break;
case bcn_req_cond_rsni_greater: case bcn_req_cond_rsni_greater:
val8 = rm_get_rsni(prm, pnetwork); val8 = rm_get_bcn_rsni(prm, pnetwork);
if (val8 != 255 && val8 > prm->q.opt.bcn.rep_cond.threshold) if (val8 != 255 && val8 > prm->q.opt.bcn.rep_cond.threshold)
return _SUCCESS; return _SUCCESS;
break; break;
case bcn_req_cond_rsni_less: case bcn_req_cond_rsni_less:
val8 = rm_get_rsni(prm, pnetwork); val8 = rm_get_bcn_rsni(prm, pnetwork);
if (val8 != 255 && val8 < prm->q.opt.bcn.rep_cond.threshold) if (val8 != 255 && val8 < prm->q.opt.bcn.rep_cond.threshold)
return _SUCCESS; return _SUCCESS;
break; break;
@ -1205,113 +1182,6 @@ u8 rm_bcn_req_cond_mach(struct rm_obj *prm, struct wlan_network *pnetwork)
return _FALSE; return _FALSE;
} }
static u8 *rm_bcn_rep_fill_scan_resule (struct rm_obj *prm,
u8 *pframe, struct wlan_network *pnetwork, unsigned int *fr_len)
{
int snr, i;
u8 val8, *plen;
u16 val16;
u32 val32;
u64 val64;
PWLAN_BSSID_EX pbss;
unsigned int my_len;
_adapter *padapter = prm->psta->padapter;
my_len = 0;
/* meas ID */
val8 = EID_MeasureReport;
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
/* remember position form elelment length */
plen = pframe;
/* meas_rpt_len */
/* default 3 = mode + token + type but no beacon content */
val8 = 3;
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
/* meas_token */
val8 = prm->q.m_token;
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
/* meas_rpt_mode F8-141 */
val8 = prm->p.m_mode;
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
/* meas_type T8-81 */
val8 = bcn_rep;
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
if (pnetwork == NULL)
goto done;
pframe = rtw_set_fixed_ie(pframe, 1, &prm->q.op_class, &my_len);
/* channel */
pbss = &pnetwork->network;
val8 = pbss->Configuration.DSConfig;
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
/* Actual Measurement StartTime */
val64 = cpu_to_le64(prm->meas_start_time);
pframe = rtw_set_fixed_ie(pframe, 8, (u8 *)&val64, &my_len);
/* Measurement Duration */
val16 = prm->meas_end_time - prm->meas_start_time;
val16 = cpu_to_le16(val16);
pframe = rtw_set_fixed_ie(pframe, 2, (u8 *)&val16, &my_len);
/* TODO
* ReportedFrameInformation:
* 0 :beacon or probe rsp
* 1 :pilot frame
*/
val8 = 0; /* report frame info */
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
/* RCPI */
val8 = rm_get_rcpi(prm, pnetwork);
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
/* RSNI */
val8 = rm_get_rsni(prm, pnetwork);
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
/* BSSID */
pframe = rtw_set_fixed_ie(pframe, 6, (u8 *)&pbss->MacAddress, &my_len);
/*
* AntennaID
* 0: unknown
* 255: multiple antenna (Diversity)
*/
val8 = 0;
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
/* ParentTSF */
val32 = prm->meas_start_time + pnetwork->network.PhyInfo.free_cnt;
pframe = rtw_set_fixed_ie(pframe, 4, (u8 *)&val32, &my_len);
/*
* Generate Beacon detail
*/
pframe = rm_gen_bcn_detail_elem(padapter, pframe,
prm, pnetwork, &my_len);
done:
/*
* update my length
* content length does NOT include ID and LEN
*/
val8 = my_len - 2;
rtw_set_fixed_ie(plen, 1, &val8, &i);
/* update length to caller */
*fr_len += my_len;
return pframe;
}
static u8 *rm_gen_bcn_rep_ie (struct rm_obj *prm, static u8 *rm_gen_bcn_rep_ie (struct rm_obj *prm,
u8 *pframe, struct wlan_network *pnetwork, unsigned int *fr_len) u8 *pframe, struct wlan_network *pnetwork, unsigned int *fr_len)
{ {
@ -1346,11 +1216,11 @@ static u8 *rm_gen_bcn_rep_ie (struct rm_obj *prm,
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len); pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
/* RCPI */ /* RCPI */
val8 = rm_get_rcpi(prm, pnetwork); val8 = rm_get_bcn_rcpi(prm, pnetwork);
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len); pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
/* RSNI */ /* RSNI */
val8 = rm_get_rsni(prm, pnetwork); val8 = rm_get_bcn_rsni(prm, pnetwork);
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len); pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
/* BSSID */ /* BSSID */
@ -1372,7 +1242,6 @@ static u8 *rm_gen_bcn_rep_ie (struct rm_obj *prm,
/* Generate Beacon detail */ /* Generate Beacon detail */
pframe = rm_gen_bcn_detail_elem(padapter, pframe, pframe = rm_gen_bcn_detail_elem(padapter, pframe,
prm, pnetwork, &my_len); prm, pnetwork, &my_len);
done:
/* /*
* update my length * update my length
* content length does NOT include ID and LEN * content length does NOT include ID and LEN
@ -1652,6 +1521,131 @@ int issue_nb_req(struct rm_obj *prm)
return _SUCCESS; return _SUCCESS;
} }
/* issue link measurement request */
int issue_link_meas_req(struct rm_obj *prm)
{
_adapter *padapter = prm->psta->padapter;
struct sta_info *psta = prm->psta;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct xmit_frame *pmgntframe = NULL;
struct pkt_attrib *pattr = NULL;
u8 *pframe = NULL;
s8 pwr_used, path_a_pwr;
RTW_INFO("RM: %s\n", __func__);
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
if (pmgntframe == NULL) {
RTW_ERR("RM: %s alloc xmit_frame fail\n",__func__);
return _FALSE;
}
pattr = &pmgntframe->attrib;
pframe = build_wlan_hdr(padapter, pmgntframe, psta, WIFI_ACTION);
/* Category, Action code, Dialog token */
pframe = rtw_set_fixed_ie(pframe,
3, &prm->q.category, &pattr->pktlen);
/* xmit power used */
/* we don't know actual TX power due to RA may change TX rate;
* But if we fix TX rate then we can get specific tx power
*/
pattr->rate = MGN_6M;
rm_get_tx_power(padapter, RF_PATH_A, MGN_6M, &pwr_used);
pframe = rtw_set_fixed_ie(pframe,
1, &pwr_used, &pattr->pktlen);
/* Max xmit power */
rm_get_path_a_max_tx_power(padapter, &path_a_pwr);
pframe = rtw_set_fixed_ie(pframe,
1, &path_a_pwr, &pattr->pktlen);
pattr->last_txcmdsz = pattr->pktlen;
dump_mgntframe(padapter, pmgntframe);
return _SUCCESS;
}
/* issue link measurement report */
int issue_link_meas_rep(struct rm_obj *prm)
{
u8 val8;
u8 *pframe;
unsigned int my_len;
_adapter *padapter = prm->psta->padapter;
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattr;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct sta_info *psta = prm->psta;
int i;
u8 tpc[4];
s8 pwr_used;
RTW_INFO("RM: %s\n", __func__);
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
if (pmgntframe == NULL) {
RTW_ERR("RM: ERR %s alloc xmit_frame fail\n",__func__);
return _FALSE;
}
pattr = &pmgntframe->attrib;
pframe = build_wlan_hdr(padapter, pmgntframe, psta, WIFI_ACTION);
/* Category, action code, Dialog token */
pframe = rtw_set_fixed_ie(pframe, 3,
&prm->p.category, &pattr->pktlen);
my_len = 0;
/* TPC report */
rm_get_tx_power(padapter, RF_PATH_A, MGN_6M, &pwr_used);
tpc[0] = EID_TPC;
tpc[1] = 2; /* length */
/* TX power */
tpc[2] = pwr_used;
/* link margin */
rm_get_rx_sensitivity(padapter, prm->q.rx_bw, prm->q.rx_rate, &pwr_used);
tpc[3] = prm->q.rx_pwr - pwr_used; /* RX sensitivity */
pattr->rate = MGN_6M; /* use fix rate to get fixed RX sensitivity */
#if (RM_MORE_DBG_MSG)
RTW_INFO("RM: rx_pwr=%ddBm - rx_sensitivity=%ddBm = link_margin=%ddB\n",
prm->q.rx_pwr, pwr_used, tpc[3]);
#endif
pframe = rtw_set_fixed_ie(pframe, 4, tpc, &my_len);
/* RECV antenna ID */
val8 = 0; /* unknown antenna */
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
/* XMIT antenna ID */
/* Fix rate 6M(1T) always use main antenna to TX */
val8 = 1; /* main antenna */
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
/* RCPI */
val8 = translate_dbm_to_rcpi(prm->q.rx_pwr);
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
/* RSNI */
val8 = prm->q.rx_rsni;
pframe = rtw_set_fixed_ie(pframe, 1, &val8, &my_len);
/* length */
//val8 = (u8)my_len-2;
//rtw_set_fixed_ie(plen, 1, &val8, &i); /* use variable i to ignore it */
pattr->pktlen += my_len;
pattr->last_txcmdsz = pattr->pktlen;
dump_mgntframe(padapter, pmgntframe);
return _SUCCESS;
}
static u8 *rm_gen_bcn_req_s_elem(_adapter *padapter, static u8 *rm_gen_bcn_req_s_elem(_adapter *padapter,
u8 *pframe, unsigned int *fr_len) u8 *pframe, unsigned int *fr_len)
{ {
@ -1794,13 +1788,6 @@ int issue_radio_meas_req(struct rm_obj *prm)
return _SUCCESS; return _SUCCESS;
} }
/* noise histogram */
static u8 rm_get_anpi(struct rm_obj *prm, struct wlan_network *pnetwork)
{
return translate_percentage_to_rcpi(
pnetwork->network.PhyInfo.SignalStrength);
}
int rm_radio_meas_report_cond(struct rm_obj *prm) int rm_radio_meas_report_cond(struct rm_obj *prm)
{ {
u8 val8; u8 val8;
@ -1960,7 +1947,6 @@ int issue_radio_meas_rep(struct rm_obj *prm)
default: default:
break; break;
} }
done:
/* length */ /* length */
val8 = (u8)my_len-2; val8 = (u8)my_len-2;
rtw_set_fixed_ie(plen, 1, &val8, &i); /* use variable i to ignore it */ rtw_set_fixed_ie(plen, 1, &val8, &i); /* use variable i to ignore it */
@ -2079,7 +2065,7 @@ void rm_dbg_help(_adapter *padapter, char *s)
sprintf(pstr(s), "rrm list_sta\n"); sprintf(pstr(s), "rrm list_sta\n");
sprintf(pstr(s), "rrm list_meas\n"); sprintf(pstr(s), "rrm list_meas\n");
sprintf(pstr(s), "rrm add_meas <aid=1|mac=>,m=<bcn|clm|nhm|nb>,rpt=\n"); sprintf(pstr(s), "rrm add_meas <aid=1|mac=>,m=<bcn|clm|nhm|nb|link>,rpt=\n");
sprintf(pstr(s), "rrm run_meas <aid=1|evid=>\n"); sprintf(pstr(s), "rrm run_meas <aid=1|evid=>\n");
sprintf(pstr(s), "rrm del_meas\n"); sprintf(pstr(s), "rrm del_meas\n");
@ -2133,13 +2119,13 @@ static int rm_dbg_modify_meas(_adapter *padapter, char *s)
struct mlme_ext_info *pmlmeinfo = &padapter->mlmeextpriv.mlmext_info; struct mlme_ext_info *pmlmeinfo = &padapter->mlmeextpriv.mlmext_info;
struct rm_obj *prm; struct rm_obj *prm;
struct sta_info *psta; struct sta_info *psta;
char *pmac, *ptr, *paid, *prpt, *pnbp, *pclm, *pnhm, *pbcn; char *pmac, *ptr, *paid, *prpt, *pnbp, *pclm, *pnhm, *pbcn, *plnk;
unsigned val; unsigned val;
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
/* example : /* example :
* rrm add_meas <aid=1|mac=>,m=<nb|clm|nhm|bcn>,<rept=> * rrm add_meas <aid=1|mac=>,m=<nb|clm|nhm|bcn|link>,<rept=>
* rrm run_meas <aid=1|evid=> * rrm run_meas <aid=1|evid=>
*/ */
paid = strstr(s, "aid="); paid = strstr(s, "aid=");
@ -2148,6 +2134,7 @@ static int rm_dbg_modify_meas(_adapter *padapter, char *s)
pclm = strstr(s, "m=clm"); pclm = strstr(s, "m=clm");
pnhm = strstr(s, "m=nhm"); pnhm = strstr(s, "m=nhm");
pnbp = strstr(s, "m=nb"); pnbp = strstr(s, "m=nb");
plnk = strstr(s, "m=link");
prpt = strstr(s, "rpt="); prpt = strstr(s, "rpt=");
/* set all ',' to NULL (end of line) */ /* set all ',' to NULL (end of line) */
@ -2184,7 +2171,11 @@ static int rm_dbg_modify_meas(_adapter *padapter, char *s)
prm->q.diag_token = psta->rm_diag_token++; prm->q.diag_token = psta->rm_diag_token++;
#else #else
/* TODO dialog should base on sta_info */ /* TODO dialog should base on sta_info */
prm->q.diag_token = pmlmeinfo->dialogToken++; do {
pmlmeinfo->dialogToken++;
} while (pmlmeinfo->dialogToken == 0);
prm->q.diag_token = pmlmeinfo->dialogToken;
#endif #endif
prm->rmid = psta->cmn.aid << 16 prm->rmid = psta->cmn.aid << 16
| prm->q.diag_token << 8 | prm->q.diag_token << 8
@ -2201,6 +2192,8 @@ static int rm_dbg_modify_meas(_adapter *padapter, char *s)
prm->q.m_type = ch_load_req; prm->q.m_type = ch_load_req;
} else if (pnbp) { } else if (pnbp) {
prm->q.action_code = RM_ACT_NB_REP_REQ; prm->q.action_code = RM_ACT_NB_REP_REQ;
} else if (plnk) {
prm->q.action_code = RM_ACT_LINK_MEAS_REQ;
} else } else
return _FAIL; return _FAIL;
@ -2257,7 +2250,7 @@ static void rm_dbg_add_meas(_adapter *padapter, char *s)
/* example : /* example :
* rrm add_meas <aid=1|mac=>,m=<nb_req|clm_req|nhm_req> * rrm add_meas <aid=1|mac=>,m=<nb|clm|nhm|link>
* rrm run_meas <aid=1|evid=> * rrm run_meas <aid=1|evid=>
*/ */
prm = (struct rm_obj *)prmpriv->prm_sel; prm = (struct rm_obj *)prmpriv->prm_sel;
@ -2282,12 +2275,8 @@ static void rm_dbg_add_meas(_adapter *padapter, char *s)
prm->q.category = RTW_WLAN_CATEGORY_RADIO_MEAS; prm->q.category = RTW_WLAN_CATEGORY_RADIO_MEAS;
prm->q.e_id = _MEAS_REQ_IE_; /* 38 */ prm->q.e_id = _MEAS_REQ_IE_; /* 38 */
if (prm->q.action_code == RM_ACT_RADIO_MEAS_REQ)
sprintf(pstr(s), "\nAdd rmid=%x, meas_type=%s ok\n", sprintf(pstr(s), "\nAdd rmid=%x, meas_type=%s ok\n",
prm->rmid, rm_type_req_name(prm->q.m_type)); prm->rmid, rm_type_req_name(prm->q.m_type));
else if (prm->q.action_code == RM_ACT_NB_REP_REQ)
sprintf(pstr(s), "\nAdd rmid=%x, meas_type=bcn_req ok\n",
prm->rmid);
if (prm->psta) if (prm->psta)
sprintf(pstr(s), "mac="MAC_FMT"\n", sprintf(pstr(s), "mac="MAC_FMT"\n",
@ -2449,6 +2438,7 @@ void rm_dbg_cmd(_adapter *padapter, char *s)
} else if (_rtw_memcmp(s, "run_meas", 8)) { } else if (_rtw_memcmp(s, "run_meas", 8)) {
rm_dbg_run_meas(padapter, s); rm_dbg_run_meas(padapter, s);
} else if (_rtw_memcmp(s, "nb", 2)) { } else if (_rtw_memcmp(s, "nb", 2)) {
paid = strstr(s, "aid="); paid = strstr(s, "aid=");

View File

@ -15,9 +15,9 @@
#include <drv_types.h> #include <drv_types.h>
#include <hal_data.h> #include <hal_data.h>
#include "rtw_rm_fsm.h"
#ifdef CONFIG_RTW_80211K #ifdef CONFIG_RTW_80211K
#include "rtw_rm_fsm.h"
#include "rtw_rm_util.h"
struct fsm_state { struct fsm_state {
u8 *name; u8 *name;
@ -65,7 +65,7 @@ int rtw_init_rm(_adapter *padapter)
/* bit 0-7 */ /* bit 0-7 */
prmpriv->rm_en_cap_def[0] = 0 prmpriv->rm_en_cap_def[0] = 0
/*| BIT(RM_LINK_MEAS_CAP_EN)*/ | BIT(RM_LINK_MEAS_CAP_EN)
| BIT(RM_NB_REP_CAP_EN) | BIT(RM_NB_REP_CAP_EN)
/*| BIT(RM_PARAL_MEAS_CAP_EN)*/ /*| BIT(RM_PARAL_MEAS_CAP_EN)*/
| BIT(RM_REPEAT_MEAS_CAP_EN) | BIT(RM_REPEAT_MEAS_CAP_EN)
@ -501,6 +501,8 @@ static int rm_issue_meas_req(struct rm_obj *prm)
issue_nb_req(prm); issue_nb_req(prm);
break; break;
case RM_ACT_LINK_MEAS_REQ: case RM_ACT_LINK_MEAS_REQ:
issue_link_meas_req(prm);
break;
default: default:
return _FALSE; return _FALSE;
} /* action_code */ } /* action_code */
@ -555,8 +557,8 @@ static int rm_state_idle(struct rm_obj *prm, enum RM_EV_ID evid)
prm->rmid); prm->rmid);
break; break;
case RM_ACT_LINK_MEAS_REQ: case RM_ACT_LINK_MEAS_REQ:
prm->p.diag_token = prm->q.diag_token;
prm->p.action_code = RM_ACT_LINK_MEAS_REP; prm->p.action_code = RM_ACT_LINK_MEAS_REP;
rm_set_rep_mode(prm, MEAS_REP_MOD_INCAP);
RTW_INFO("RM: rmid=%x Link meas switch in\n", RTW_INFO("RM: rmid=%x Link meas switch in\n",
prm->rmid); prm->rmid);
break; break;
@ -650,6 +652,10 @@ static int rm_state_do_meas(struct rm_obj *prm, enum RM_EV_ID evid)
RM_EV_busy_timer_expire); RM_EV_busy_timer_expire);
return _SUCCESS; return _SUCCESS;
} }
} else if (prm->q.action_code == RM_ACT_LINK_MEAS_REQ) {
; /* do nothing */
rm_state_goto(prm, RM_ST_SEND_REPORT);
return _SUCCESS;
} }
_rm_post_event(padapter, prm->rmid, RM_EV_start_meas); _rm_post_event(padapter, prm->rmid, RM_EV_start_meas);
break; break;
@ -790,6 +796,7 @@ static int rm_state_send_report(struct rm_obj *prm, enum RM_EV_ID evid)
switch (evid) { switch (evid) {
case RM_EV_state_in: case RM_EV_state_in:
/* we have to issue report */ /* we have to issue report */
if (prm->q.action_code == RM_ACT_RADIO_MEAS_REQ) {
switch (prm->q.m_type) { switch (prm->q.m_type) {
case bcn_req: case bcn_req:
issue_beacon_rep(prm); issue_beacon_rep(prm);
@ -803,6 +810,16 @@ static int rm_state_send_report(struct rm_obj *prm, enum RM_EV_ID evid)
return _SUCCESS; return _SUCCESS;
} }
} else if (prm->q.action_code == RM_ACT_LINK_MEAS_REQ) {
issue_link_meas_rep(prm);
rm_state_goto(prm, RM_ST_END);
return _SUCCESS;
} else {
rm_state_goto(prm, RM_ST_END);
return _SUCCESS;
}
/* check repeat */ /* check repeat */
if (prm->p.rpt) { if (prm->p.rpt) {
RTW_INFO("RM: rmid=%x repeat=%u/%u\n", RTW_INFO("RM: rmid=%x repeat=%u/%u\n",

428
core/rtw_rm_util.c Normal file
View File

@ -0,0 +1,428 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2019 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*****************************************************************************/
#include <drv_types.h>
#include <hal_data.h>
#ifdef CONFIG_RTW_80211K
#include "rtw_rm_fsm.h"
#include "rtw_rm_util.h"
/* 802.11-2012 Table E-1 Operationg classes in United States */
static RT_OPERATING_CLASS RTW_OP_CLASS_US[] = {
/* 0, OP_CLASS_NULL */ { 0, 0, {}},
/* 1, OP_CLASS_1 */ {115, 4, {36, 40, 44, 48}},
/* 2, OP_CLASS_2 */ {118, 4, {52, 56, 60, 64}},
/* 3, OP_CLASS_3 */ {124, 4, {149, 153, 157, 161}},
/* 4, OP_CLASS_4 */ {121, 11, {100, 104, 108, 112, 116, 120, 124,
128, 132, 136, 140}},
/* 5, OP_CLASS_5 */ {125, 5, {149, 153, 157, 161, 165}},
/* 6, OP_CLASS_12 */ { 81, 11, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}}
};
u8 rm_get_ch_set(
struct rtw_ieee80211_channel *pch_set, u8 op_class, u8 ch_num)
{
int i,j,sz;
u8 ch_amount = 0;
sz = sizeof(RTW_OP_CLASS_US)/sizeof(struct _RT_OPERATING_CLASS);
if (ch_num != 0) {
pch_set[0].hw_value = ch_num;
ch_amount = 1;
RTW_INFO("RM: meas_ch->hw_value = %u\n", pch_set->hw_value);
goto done;
}
for (i = 0; i < sz; i++) {
if (RTW_OP_CLASS_US[i].global_op_class == op_class) {
for (j = 0; j < RTW_OP_CLASS_US[i].Len; j++) {
pch_set[j].hw_value =
RTW_OP_CLASS_US[i].Channel[j];
RTW_INFO("RM: meas_ch[%d].hw_value = %u\n",
j, pch_set[j].hw_value);
}
ch_amount = RTW_OP_CLASS_US[i].Len;
break;
}
}
done:
return ch_amount;
}
u8 rm_get_oper_class_via_ch(u8 ch)
{
int i,j,sz;
sz = sizeof(RTW_OP_CLASS_US)/sizeof(struct _RT_OPERATING_CLASS);
for (i = 0; i < sz; i++) {
for (j = 0; j < RTW_OP_CLASS_US[i].Len; j++) {
if ( ch == RTW_OP_CLASS_US[i].Channel[j]) {
RTW_INFO("RM: ch %u in oper_calss %u\n",
ch, RTW_OP_CLASS_US[i].global_op_class);
return RTW_OP_CLASS_US[i].global_op_class;
break;
}
}
}
return 0;
}
int is_wildcard_bssid(u8 *bssid)
{
int i;
u8 val8 = 0xff;
for (i=0;i<6;i++)
val8 &= bssid[i];
if (val8 == 0xff)
return _SUCCESS;
return _FALSE;
}
u8 translate_dbm_to_rcpi(s8 SignalPower)
{
/* RCPI = Int{(Power in dBm + 110)*2} for 0dBm > Power > -110dBm
* 0 : power <= -110.0 dBm
* 1 : power = -109.5 dBm
* 2 : power = -109.0 dBm
*/
return (SignalPower + 110)*2;
}
u8 translate_percentage_to_rcpi(u32 SignalStrengthIndex)
{
/* Translate to dBm (x=y-100) */
return translate_dbm_to_rcpi(SignalStrengthIndex - 100);
}
u8 rm_get_bcn_rcpi(struct rm_obj *prm, struct wlan_network *pnetwork)
{
return translate_percentage_to_rcpi(
pnetwork->network.PhyInfo.SignalStrength);
}
u8 rm_get_frame_rsni(struct rm_obj *prm, union recv_frame *pframe)
{
int i;
u8 val8, snr;
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(prm->psta->padapter);
if (IS_CCK_RATE((hw_rate_to_m_rate(pframe->u.hdr.attrib.data_rate))))
val8 = 255;
else {
snr = 0;
for (i = 0; i < pHalData->NumTotalRFPath; i++)
snr += pframe->u.hdr.attrib.phy_info.rx_snr[i];
snr = snr / pHalData->NumTotalRFPath;
val8 = (u8)(snr + 10)*2;
}
return val8;
}
u8 rm_get_bcn_rsni(struct rm_obj *prm, struct wlan_network *pnetwork)
{
int i;
u8 val8, snr;
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(prm->psta->padapter);
if (pnetwork->network.PhyInfo.is_cck_rate) {
/* current HW doesn't have CCK RSNI */
/* 255 indicates RSNI is unavailable */
val8 = 255;
} else {
snr = 0;
for (i = 0; i < pHalData->NumTotalRFPath; i++) {
snr += pnetwork->network.PhyInfo.rx_snr[i];
}
snr = snr / pHalData->NumTotalRFPath;
val8 = (u8)(snr + 10)*2;
}
return val8;
}
/* output: pwr (unit dBm) */
int rm_get_tx_power(PADAPTER adapter, enum rf_path path, enum MGN_RATE rate, s8 *pwr)
{
struct hal_spec_t *hal_spec = GET_HAL_SPEC(adapter);
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
int tx_num, band, bw, ch, n, rs;
u8 base;
s8 limt_offset = 127; /* max value of s8 */
s8 rate_offset;
s8 powr_offset;
int rate_pos;
band = hal_data->current_band_type;
bw = hal_data->current_channel_bw;
ch = hal_data->current_channel;
if (!HAL_SPEC_CHK_RF_PATH(hal_spec, band, path))
return -1;
if (HAL_IsLegalChannel(adapter, ch) == _FALSE) {
RTW_INFO("Illegal channel!!\n");
return -2;
}
*pwr = phy_get_tx_power_final_absolute_value(adapter, path, rate, bw, ch);
return 0;
}
int rm_get_rx_sensitivity(PADAPTER adapter, enum channel_width bw, enum MGN_RATE rate, s8 *pwr)
{
s8 rx_sensitivity = -110;
switch(rate) {
case MGN_1M:
rx_sensitivity= -101;
break;
case MGN_2M:
rx_sensitivity= -98;
break;
case MGN_5_5M:
rx_sensitivity= -92;
break;
case MGN_11M:
rx_sensitivity= -89;
break;
case MGN_6M:
case MGN_9M:
case MGN_12M:
rx_sensitivity = -92;
break;
case MGN_18M:
rx_sensitivity = -90;
break;
case MGN_24M:
rx_sensitivity = -88;
break;
case MGN_36M:
rx_sensitivity = -84;
break;
case MGN_48M:
rx_sensitivity = -79;
break;
case MGN_54M:
rx_sensitivity = -78;
break;
case MGN_MCS0:
case MGN_MCS8:
case MGN_MCS16:
case MGN_MCS24:
case MGN_VHT1SS_MCS0:
case MGN_VHT2SS_MCS0:
case MGN_VHT3SS_MCS0:
case MGN_VHT4SS_MCS0:
/* BW20 BPSK 1/2 */
rx_sensitivity = -82;
break;
case MGN_MCS1:
case MGN_MCS9:
case MGN_MCS17:
case MGN_MCS25:
case MGN_VHT1SS_MCS1:
case MGN_VHT2SS_MCS1:
case MGN_VHT3SS_MCS1:
case MGN_VHT4SS_MCS1:
/* BW20 QPSK 1/2 */
rx_sensitivity = -79;
break;
case MGN_MCS2:
case MGN_MCS10:
case MGN_MCS18:
case MGN_MCS26:
case MGN_VHT1SS_MCS2:
case MGN_VHT2SS_MCS2:
case MGN_VHT3SS_MCS2:
case MGN_VHT4SS_MCS2:
/* BW20 QPSK 3/4 */
rx_sensitivity = -77;
break;
case MGN_MCS3:
case MGN_MCS11:
case MGN_MCS19:
case MGN_MCS27:
case MGN_VHT1SS_MCS3:
case MGN_VHT2SS_MCS3:
case MGN_VHT3SS_MCS3:
case MGN_VHT4SS_MCS3:
/* BW20 16-QAM 1/2 */
rx_sensitivity = -74;
break;
case MGN_MCS4:
case MGN_MCS12:
case MGN_MCS20:
case MGN_MCS28:
case MGN_VHT1SS_MCS4:
case MGN_VHT2SS_MCS4:
case MGN_VHT3SS_MCS4:
case MGN_VHT4SS_MCS4:
/* BW20 16-QAM 3/4 */
rx_sensitivity = -70;
break;
case MGN_MCS5:
case MGN_MCS13:
case MGN_MCS21:
case MGN_MCS29:
case MGN_VHT1SS_MCS5:
case MGN_VHT2SS_MCS5:
case MGN_VHT3SS_MCS5:
case MGN_VHT4SS_MCS5:
/* BW20 64-QAM 2/3 */
rx_sensitivity = -66;
break;
case MGN_MCS6:
case MGN_MCS14:
case MGN_MCS22:
case MGN_MCS30:
case MGN_VHT1SS_MCS6:
case MGN_VHT2SS_MCS6:
case MGN_VHT3SS_MCS6:
case MGN_VHT4SS_MCS6:
/* BW20 64-QAM 3/4 */
rx_sensitivity = -65;
break;
case MGN_MCS7:
case MGN_MCS15:
case MGN_MCS23:
case MGN_MCS31:
case MGN_VHT1SS_MCS7:
case MGN_VHT2SS_MCS7:
case MGN_VHT3SS_MCS7:
case MGN_VHT4SS_MCS7:
/* BW20 64-QAM 5/6 */
rx_sensitivity = -64;
break;
case MGN_VHT1SS_MCS8:
case MGN_VHT2SS_MCS8:
case MGN_VHT3SS_MCS8:
case MGN_VHT4SS_MCS8:
/* BW20 256-QAM 3/4 */
rx_sensitivity = -59;
break;
case MGN_VHT1SS_MCS9:
case MGN_VHT2SS_MCS9:
case MGN_VHT3SS_MCS9:
case MGN_VHT4SS_MCS9:
/* BW20 256-QAM 5/6 */
rx_sensitivity = -57;
break;
default:
return -1;
break;
}
switch(bw) {
case CHANNEL_WIDTH_20:
break;
case CHANNEL_WIDTH_40:
rx_sensitivity -= 3;
break;
case CHANNEL_WIDTH_80:
rx_sensitivity -= 6;
break;
case CHANNEL_WIDTH_160:
rx_sensitivity -= 9;
break;
case CHANNEL_WIDTH_5:
case CHANNEL_WIDTH_10:
case CHANNEL_WIDTH_80_80:
default:
return -1;
break;
}
*pwr = rx_sensitivity;
return 0;
}
/* output: path_a max tx power in dBm */
int rm_get_path_a_max_tx_power(_adapter *adapter, s8 *path_a)
{
struct hal_spec_t *hal_spec = GET_HAL_SPEC(adapter);
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
int path, tx_num, band, bw, ch, n, rs;
u8 rate_num;
s8 max_pwr[RF_PATH_MAX], pwr;
band = hal_data->current_band_type;
bw = hal_data->current_channel_bw;
ch = hal_data->current_channel;
for (path = 0; path < RF_PATH_MAX; path++) {
if (!HAL_SPEC_CHK_RF_PATH(hal_spec, band, path))
break;
max_pwr[path] = -127; /* min value of s8 */
#if (RM_MORE_DBG_MSG)
RTW_INFO("RM: [%s][%c]\n", band_str(band), rf_path_char(path));
#endif
for (rs = 0; rs < RATE_SECTION_NUM; rs++) {
tx_num = rate_section_to_tx_num(rs);
if (tx_num >= hal_spec->tx_nss_num)
continue;
if (band == BAND_ON_5G && IS_CCK_RATE_SECTION(rs))
continue;
if (IS_VHT_RATE_SECTION(rs) && !IS_HARDWARE_TYPE_JAGUAR_ALL(adapter))
continue;
rate_num = rate_section_rate_num(rs);
/* get power by rate in db */
for (n = rate_num - 1; n >= 0; n--) {
pwr = phy_get_tx_power_final_absolute_value(adapter, path, rates_by_sections[rs].rates[n], bw, ch);
max_pwr[path] = MAX(max_pwr[path], pwr);
#if (RM_MORE_DBG_MSG)
RTW_INFO("RM: %9s = %2d\n",
MGN_RATE_STR(rates_by_sections[rs].rates[n]), pwr);
#endif
}
}
}
#if (RM_MORE_DBG_MSG)
RTW_INFO("RM: path_a max_pwr=%ddBm\n", max_pwr[0]);
#endif
*path_a = max_pwr[0];
return 0;
}
#endif /* CONFIG_RTW_80211K */

View File

@ -548,13 +548,6 @@ void rtw_rson_scan_cmd_hdl(_adapter *padapter, int op)
if (rtw_to_roam(padapter) != 0) { if (rtw_to_roam(padapter) != 0) {
if (rtw_dec_to_roam(padapter) == 0) { if (rtw_dec_to_roam(padapter) == 0) {
rtw_set_to_roam(padapter, 0); rtw_set_to_roam(padapter, 0);
#ifdef CONFIG_INTEL_WIDI
if (padapter->mlmepriv.widi_state == INTEL_WIDI_STATE_ROAMING) {
_rtw_memset(pmlmepriv->sa_ext, 0x00, L2SDTA_SERVICE_VE_LEN);
intel_widi_wk_cmd(padapter, INTEL_WIDI_LISTEN_WK, NULL, 0);
RTW_INFO("change to widi listen\n");
}
#endif /* CONFIG_INTEL_WIDI */
rtw_free_assoc_resources(padapter, _TRUE); rtw_free_assoc_resources(padapter, _TRUE);
rtw_indicate_disconnect(padapter, 0, _FALSE); rtw_indicate_disconnect(padapter, 0, _FALSE);
} else } else

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2015 - 2017 Realtek Corporation. * Copyright(c) 2015 - 2019 Realtek Corporation.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -35,12 +35,23 @@
*/ */
static u8 sdio_io(struct dvobj_priv *d, u32 addr, void *buf, size_t len, u8 write, u8 cmd52) static u8 sdio_io(struct dvobj_priv *d, u32 addr, void *buf, size_t len, u8 write, u8 cmd52)
{ {
#ifdef DBG_SDIO
#if (DBG_SDIO >= 3)
struct sdio_data *sdio;
#endif /* DBG_SDIO >= 3 */
#endif /* DBG_SDIO */
u32 addr_drv; /* address with driver defined bit */ u32 addr_drv; /* address with driver defined bit */
int err; int err;
u8 retry = 0; u8 retry = 0;
u8 stop_retry = _FALSE; /* flag for stopping retry or not */ u8 stop_retry = _FALSE; /* flag for stopping retry or not */
#ifdef DBG_SDIO
#if (DBG_SDIO >= 3)
sdio = &d->intf_data;
#endif /* DBG_SDIO >= 3 */
#endif /* DBG_SDIO */
if (rtw_is_surprise_removed(dvobj_get_primary_adapter(d))) { if (rtw_is_surprise_removed(dvobj_get_primary_adapter(d))) {
RTW_ERR("%s: bSurpriseRemoved, skip %s 0x%05x, %zu bytes\n", RTW_ERR("%s: bSurpriseRemoved, skip %s 0x%05x, %zu bytes\n",
__FUNCTION__, write?"write":"read", addr, len); __FUNCTION__, write?"write":"read", addr, len);
@ -70,6 +81,22 @@ static u8 sdio_io(struct dvobj_priv *d, u32 addr, void *buf, size_t len, u8 writ
__FUNCTION__, write?"write":"read", err, addr, len, __FUNCTION__, write?"write":"read", err, addr, len,
retry, ATOMIC_READ(&d->continual_io_error)); retry, ATOMIC_READ(&d->continual_io_error));
#ifdef DBG_SDIO
#if (DBG_SDIO >= 3)
if (sdio->dbg_enable) {
if (sdio->err_test && sdio->err_test_triggered)
sdio->err_test = 0;
if (sdio->err_stop) {
RTW_ERR("%s: I/O error! Set surprise remove flag ON!\n",
__FUNCTION__);
rtw_set_surprise_removed(dvobj_get_primary_adapter(d));
return _FAIL;
}
}
#endif /* DBG_SDIO >= 3 */
#endif /* DBG_SDIO */
retry++; retry++;
stop_retry = rtw_inc_and_chk_continual_io_error(d); stop_retry = rtw_inc_and_chk_continual_io_error(d);
if ((err == -1) || (stop_retry == _TRUE) || (retry > SD_IO_TRY_CNT)) { if ((err == -1) || (stop_retry == _TRUE) || (retry > SD_IO_TRY_CNT)) {

View File

@ -2133,7 +2133,7 @@ BIP_exit:
#ifndef PLATFORM_FREEBSD #ifndef PLATFORM_FREEBSD
#if defined(CONFIG_TDLS) #if defined(CONFIG_TDLS)
/* compress 512-bits */ /* compress 512-bits */
static int sha256_compress(struct rtw_sha256_state *md, unsigned char *buf) static int sha256_compress(struct sha256_state *md, unsigned char *buf)
{ {
u32 S[8], W[64], t0, t1; u32 S[8], W[64], t0, t1;
u32 t; u32 t;
@ -2181,7 +2181,7 @@ static int sha256_compress(struct rtw_sha256_state *md, unsigned char *buf)
} }
/* Initialize the hash state */ /* Initialize the hash state */
static void sha256_init(struct rtw_sha256_state *md) static void sha256_init(struct sha256_state *md)
{ {
md->curlen = 0; md->curlen = 0;
md->length = 0; md->length = 0;
@ -2202,7 +2202,7 @@ static void sha256_init(struct rtw_sha256_state *md)
@param inlen The length of the data (octets) @param inlen The length of the data (octets)
@return CRYPT_OK if successful @return CRYPT_OK if successful
*/ */
static int sha256_process(struct rtw_sha256_state *md, unsigned char *in, static int sha256_process(struct sha256_state *md, unsigned char *in,
unsigned long inlen) unsigned long inlen)
{ {
unsigned long n; unsigned long n;
@ -2243,7 +2243,7 @@ static int sha256_process(struct rtw_sha256_state *md, unsigned char *in,
@param out [out] The destination of the hash (32 bytes) @param out [out] The destination of the hash (32 bytes)
@return CRYPT_OK if successful @return CRYPT_OK if successful
*/ */
static int sha256_done(struct rtw_sha256_state *md, unsigned char *out) static int sha256_done(struct sha256_state *md, unsigned char *out)
{ {
int i; int i;
@ -2293,7 +2293,7 @@ static int sha256_done(struct rtw_sha256_state *md, unsigned char *out)
static int sha256_vector(size_t num_elem, u8 *addr[], size_t *len, static int sha256_vector(size_t num_elem, u8 *addr[], size_t *len,
u8 *mac) u8 *mac)
{ {
struct rtw_sha256_state ctx; struct sha256_state ctx;
size_t i; size_t i;
sha256_init(&ctx); sha256_init(&ctx);
@ -3083,7 +3083,7 @@ int aes_siv_decrypt(const u8 *key, const u8 *iv_crypt, size_t iv_c_len,
#endif /* CONFIG_RTW_MESH_AEK */ #endif /* CONFIG_RTW_MESH_AEK */
#ifdef CONFIG_TDLS #ifdef CONFIG_TDLS
void wpa_tdls_generate_tpk(_adapter *padapter, PVOID sta) void wpa_tdls_generate_tpk(_adapter *padapter, void *sta)
{ {
struct sta_info *psta = (struct sta_info *)sta; struct sta_info *psta = (struct sta_info *)sta;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;

View File

@ -183,6 +183,8 @@ void sreset_restore_network_station(_adapter *padapter)
rtw_hal_rcr_set_chk_bssid(padapter, MLME_STA_CONNECTING); rtw_hal_rcr_set_chk_bssid(padapter, MLME_STA_CONNECTING);
rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type)); rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
rtw_btcoex_connect_notify(padapter, join_type);
} }
Set_MSR(padapter, (pmlmeinfo->state & 0x3)); Set_MSR(padapter, (pmlmeinfo->state & 0x3));
@ -295,6 +297,9 @@ void sreset_reset(_adapter *padapter)
#ifdef CONFIG_IPS #ifdef CONFIG_IPS
_ips_enter(padapter); _ips_enter(padapter);
_ips_leave(padapter); _ips_leave(padapter);
#endif
#ifdef CONFIG_CONCURRENT_MODE
rtw_mi_ap_info_restore(padapter);
#endif #endif
rtw_mi_sreset_adapter_hdl(padapter, _TRUE);/*sreset_start_adapter*/ rtw_mi_sreset_adapter_hdl(padapter, _TRUE);/*sreset_start_adapter*/

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2007 - 2017 Realtek Corporation. * Copyright(c) 2007 - 2019 Realtek Corporation.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -16,13 +16,6 @@
#include <drv_types.h> #include <drv_types.h>
#if defined(PLATFORM_LINUX) && defined (PLATFORM_WINDOWS)
#error "Shall be Linux or Windows, but not both!\n"
#endif
bool test_st_match_rule(_adapter *adapter, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port) bool test_st_match_rule(_adapter *adapter, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port)
{ {
if (ntohs(*((u16 *)local_port)) == 5001 || ntohs(*((u16 *)remote_port)) == 5001) if (ntohs(*((u16 *)local_port)) == 5001 || ntohs(*((u16 *)remote_port)) == 5001)
@ -237,12 +230,15 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
pstapriv->padapter = adapter; pstapriv->padapter = adapter;
pstapriv->pallocated_stainfo_buf = rtw_zvmalloc(sizeof(struct sta_info) * NUM_STA + 4); pstapriv->pallocated_stainfo_buf = rtw_zvmalloc(
sizeof(struct sta_info) * NUM_STA + MEM_ALIGNMENT_OFFSET);
if (!pstapriv->pallocated_stainfo_buf) if (!pstapriv->pallocated_stainfo_buf)
goto exit; goto exit;
pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 - pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf;
((SIZE_PTR)(pstapriv->pallocated_stainfo_buf) & 3); if ((SIZE_PTR)pstapriv->pstainfo_buf & MEM_ALIGNMENT_PADDING)
pstapriv->pstainfo_buf += MEM_ALIGNMENT_OFFSET -
((SIZE_PTR)pstapriv->pstainfo_buf & MEM_ALIGNMENT_PADDING);
_rtw_init_queue(&pstapriv->free_sta_queue); _rtw_init_queue(&pstapriv->free_sta_queue);
@ -315,12 +311,21 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
rtw_pre_link_sta_ctl_init(pstapriv); rtw_pre_link_sta_ctl_init(pstapriv);
#endif #endif
#if defined(DBG_ROAMING_TEST) || defined(CONFIG_RTW_REPEATER_SON)
rtw_set_rx_chk_limit(adapter,1);
#elif defined(CONFIG_ACTIVE_KEEP_ALIVE_CHECK) && !defined(CONFIG_LPS_LCLK_WD_TIMER)
rtw_set_rx_chk_limit(adapter,4);
#else
rtw_set_rx_chk_limit(adapter,8);
#endif
ret = _SUCCESS; ret = _SUCCESS;
exit: exit:
if (ret != _SUCCESS) { if (ret != _SUCCESS) {
if (pstapriv->pallocated_stainfo_buf) if (pstapriv->pallocated_stainfo_buf)
rtw_vmfree(pstapriv->pallocated_stainfo_buf, sizeof(struct sta_info) * NUM_STA + 4); rtw_vmfree(pstapriv->pallocated_stainfo_buf,
sizeof(struct sta_info) * NUM_STA + MEM_ALIGNMENT_OFFSET);
#ifdef CONFIG_AP_MODE #ifdef CONFIG_AP_MODE
if (pstapriv->sta_aid) if (pstapriv->sta_aid)
rtw_mfree(pstapriv->sta_aid, pstapriv->max_aid * sizeof(struct sta_info *)); rtw_mfree(pstapriv->sta_aid, pstapriv->max_aid * sizeof(struct sta_info *));
@ -471,7 +476,8 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)
#endif #endif
if (pstapriv->pallocated_stainfo_buf) if (pstapriv->pallocated_stainfo_buf)
rtw_vmfree(pstapriv->pallocated_stainfo_buf, sizeof(struct sta_info) * NUM_STA + 4); rtw_vmfree(pstapriv->pallocated_stainfo_buf,
sizeof(struct sta_info) * NUM_STA + MEM_ALIGNMENT_OFFSET);
#ifdef CONFIG_AP_MODE #ifdef CONFIG_AP_MODE
if (pstapriv->sta_aid) if (pstapriv->sta_aid)
rtw_mfree(pstapriv->sta_aid, pstapriv->max_aid * sizeof(struct sta_info *)); rtw_mfree(pstapriv->sta_aid, pstapriv->max_aid * sizeof(struct sta_info *));
@ -583,6 +589,8 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, const u8 *hwaddr)
_rtw_init_queue(&preorder_ctrl->pending_recvframe_queue); _rtw_init_queue(&preorder_ctrl->pending_recvframe_queue);
rtw_init_recv_timer(preorder_ctrl); rtw_init_recv_timer(preorder_ctrl);
rtw_clear_bit(RTW_RECV_ACK_OR_TIMEOUT, &preorder_ctrl->rec_abba_rsp_ack);
} }
@ -599,6 +607,9 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, const u8 *hwaddr)
rtw_alloc_macid(pstapriv->padapter, psta); rtw_alloc_macid(pstapriv->padapter, psta);
psta->tx_q_enable = 0;
_rtw_init_queue(&psta->tx_queue);
_init_workitem(&psta->tx_q_work, rtw_xmit_dequeue_callback, NULL);
} }
exit: exit:
@ -664,6 +675,9 @@ u32 rtw_free_stainfo(_adapter *padapter , struct sta_info *psta)
/* rtw_list_delete(&psta->wakeup_list); */ /* rtw_list_delete(&psta->wakeup_list); */
rtw_free_xmitframe_queue(pxmitpriv, &psta->tx_queue);
_rtw_deinit_queue(&psta->tx_queue);
_enter_critical_bh(&pxmitpriv->lock, &irqL0); _enter_critical_bh(&pxmitpriv->lock, &irqL0);
rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q); rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q);
@ -735,6 +749,7 @@ u32 rtw_free_stainfo(_adapter *padapter , struct sta_info *psta)
_queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue; _queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue;
preorder_ctrl = &psta->recvreorder_ctrl[i]; preorder_ctrl = &psta->recvreorder_ctrl[i];
rtw_clear_bit(RTW_RECV_ACK_OR_TIMEOUT, &preorder_ctrl->rec_abba_rsp_ack);
_cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer); _cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer);

View File

@ -532,10 +532,10 @@ u8 *rtw_tdls_set_ht_cap(_adapter *padapter, u8 *pframe, struct pkt_attrib *pattr
void rtw_tdls_process_vht_cap(_adapter *padapter, struct sta_info *ptdls_sta, u8 *data, u8 Length) void rtw_tdls_process_vht_cap(_adapter *padapter, struct sta_info *ptdls_sta, u8 *data, u8 Length)
{ {
struct rf_ctl_t *rfctl = adapter_to_rfctl(padapter); struct rf_ctl_t *rfctl = adapter_to_rfctl(padapter);
struct hal_spec_t *hal_spec = GET_HAL_SPEC(padapter);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv; struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
u8 cur_ldpc_cap = 0, cur_stbc_cap = 0, cur_beamform_cap = 0, rf_type = RF_1T1R, tx_nss = 0; u8 cur_ldpc_cap = 0, cur_stbc_cap = 0, tx_nss = 0;
u16 cur_beamform_cap = 0;
u8 *pcap_mcs; u8 *pcap_mcs;
_rtw_memset(&ptdls_sta->vhtpriv, 0, sizeof(struct vht_priv)); _rtw_memset(&ptdls_sta->vhtpriv, 0, sizeof(struct vht_priv));
@ -560,8 +560,10 @@ void rtw_tdls_process_vht_cap(_adapter *padapter, struct sta_info *ptdls_sta, u8
if (ptdls_sta->flags & WLAN_STA_VHT) { if (ptdls_sta->flags & WLAN_STA_VHT) {
if (REGSTY_IS_11AC_ENABLE(&padapter->registrypriv) if (REGSTY_IS_11AC_ENABLE(&padapter->registrypriv)
&& is_supported_vht(padapter->registrypriv.wireless_mode) && is_supported_vht(padapter->registrypriv.wireless_mode)
&& (!rfctl->country_ent || COUNTRY_CHPLAN_EN_11AC(rfctl->country_ent))) && (!rfctl->country_ent || COUNTRY_CHPLAN_EN_11AC(rfctl->country_ent))) {
ptdls_sta->vhtpriv.vht_option = _TRUE; ptdls_sta->vhtpriv.vht_option = _TRUE;
ptdls_sta->cmn.ra_info.is_vht_enable = _TRUE;
}
else else
ptdls_sta->vhtpriv.vht_option = _FALSE; ptdls_sta->vhtpriv.vht_option = _FALSE;
} }
@ -596,6 +598,7 @@ void rtw_tdls_process_vht_cap(_adapter *padapter, struct sta_info *ptdls_sta, u8
GET_VHT_CAPABILITY_ELE_SU_BFER(data)) GET_VHT_CAPABILITY_ELE_SU_BFER(data))
SET_FLAG(cur_beamform_cap, BEAMFORMING_VHT_BEAMFORMER_ENABLE); SET_FLAG(cur_beamform_cap, BEAMFORMING_VHT_BEAMFORMER_ENABLE);
ptdls_sta->vhtpriv.beamform_cap = cur_beamform_cap; ptdls_sta->vhtpriv.beamform_cap = cur_beamform_cap;
ptdls_sta->cmn.bf_info.vht_beamform_cap = cur_beamform_cap;
if (cur_beamform_cap) if (cur_beamform_cap)
RTW_INFO("Current VHT Beamforming Setting = %02X\n", cur_beamform_cap); RTW_INFO("Current VHT Beamforming Setting = %02X\n", cur_beamform_cap);
#endif /*CONFIG_BEAMFORMING*/ #endif /*CONFIG_BEAMFORMING*/
@ -604,8 +607,7 @@ void rtw_tdls_process_vht_cap(_adapter *padapter, struct sta_info *ptdls_sta, u8
ptdls_sta->vhtpriv.ampdu_len = GET_VHT_CAPABILITY_ELE_MAX_RXAMPDU_FACTOR(data); ptdls_sta->vhtpriv.ampdu_len = GET_VHT_CAPABILITY_ELE_MAX_RXAMPDU_FACTOR(data);
pcap_mcs = GET_VHT_CAPABILITY_ELE_RX_MCS(data); pcap_mcs = GET_VHT_CAPABILITY_ELE_RX_MCS(data);
rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); tx_nss = GET_HAL_TX_NSS(padapter);
tx_nss = rtw_min(rf_type_to_rf_tx_cnt(rf_type), hal_spec->tx_nss_num);
rtw_vht_nss_to_mcsmap(tx_nss, ptdls_sta->vhtpriv.vht_mcs_map, pcap_mcs); rtw_vht_nss_to_mcsmap(tx_nss, ptdls_sta->vhtpriv.vht_mcs_map, pcap_mcs);
ptdls_sta->vhtpriv.vht_highest_rate = rtw_get_vht_highest_rate(ptdls_sta->vhtpriv.vht_mcs_map); ptdls_sta->vhtpriv.vht_highest_rate = rtw_get_vht_highest_rate(ptdls_sta->vhtpriv.vht_mcs_map);
} }

View File

@ -225,9 +225,7 @@ void rtw_vht_use_default_setting(_adapter *padapter)
BOOLEAN bHwSupportBeamformer = _FALSE, bHwSupportBeamformee = _FALSE; BOOLEAN bHwSupportBeamformer = _FALSE, bHwSupportBeamformee = _FALSE;
u8 mu_bfer, mu_bfee; u8 mu_bfer, mu_bfee;
#endif /* CONFIG_BEAMFORMING */ #endif /* CONFIG_BEAMFORMING */
u8 rf_type = 0;
u8 tx_nss, rx_nss; u8 tx_nss, rx_nss;
struct hal_spec_t *hal_spec = GET_HAL_SPEC(padapter);
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
pvhtpriv->sgi_80m = TEST_FLAG(pregistrypriv->short_gi, BIT2) ? _TRUE : _FALSE; pvhtpriv->sgi_80m = TEST_FLAG(pregistrypriv->short_gi, BIT2) ? _TRUE : _FALSE;
@ -318,9 +316,8 @@ void rtw_vht_use_default_setting(_adapter *padapter)
pvhtpriv->ampdu_len = pregistrypriv->ampdu_factor; pvhtpriv->ampdu_len = pregistrypriv->ampdu_factor;
rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); tx_nss = GET_HAL_TX_NSS(padapter);
tx_nss = rtw_min(rf_type_to_rf_tx_cnt(rf_type), hal_spec->tx_nss_num); rx_nss = GET_HAL_RX_NSS(padapter);
rx_nss = rtw_min(rf_type_to_rf_rx_cnt(rf_type), hal_spec->rx_nss_num);
/* for now, vhtpriv.vht_mcs_map comes from RX NSS */ /* for now, vhtpriv.vht_mcs_map comes from RX NSS */
rtw_vht_nss_to_mcsmap(rx_nss, pvhtpriv->vht_mcs_map, pregistrypriv->vht_rx_mcs_map); rtw_vht_nss_to_mcsmap(rx_nss, pvhtpriv->vht_mcs_map, pregistrypriv->vht_rx_mcs_map);
@ -390,7 +387,7 @@ void update_sta_vht_info_apmode_bf_cap(_adapter *padapter, struct sta_info *psta
} }
#endif #endif
void update_sta_vht_info_apmode(_adapter *padapter, PVOID sta) void update_sta_vht_info_apmode(_adapter *padapter, void *sta)
{ {
struct sta_info *psta = (struct sta_info *)sta; struct sta_info *psta = (struct sta_info *)sta;
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
@ -561,12 +558,11 @@ void VHT_caps_handler_infra_ap(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE
void VHT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) void VHT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
{ {
struct hal_spec_t *hal_spec = GET_HAL_SPEC(padapter);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv; struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
u8 cur_ldpc_cap = 0, cur_stbc_cap = 0, rf_type = RF_1T1R, tx_nss = 0; u8 cur_ldpc_cap = 0, cur_stbc_cap = 0, tx_nss = 0;
u16 cur_beamform_cap = 0; u16 cur_beamform_cap = 0;
u8 *pcap_mcs; u8 *pcap_mcs;
@ -667,8 +663,7 @@ void VHT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
pvhtpriv->ampdu_len = GET_VHT_CAPABILITY_ELE_MAX_RXAMPDU_FACTOR(pIE->data); pvhtpriv->ampdu_len = GET_VHT_CAPABILITY_ELE_MAX_RXAMPDU_FACTOR(pIE->data);
pcap_mcs = GET_VHT_CAPABILITY_ELE_RX_MCS(pIE->data); pcap_mcs = GET_VHT_CAPABILITY_ELE_RX_MCS(pIE->data);
rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); tx_nss = GET_HAL_TX_NSS(padapter);
tx_nss = rtw_min(rf_type_to_rf_tx_cnt(rf_type), hal_spec->tx_nss_num);
rtw_vht_nss_to_mcsmap(tx_nss, pvhtpriv->vht_mcs_map, pcap_mcs); rtw_vht_nss_to_mcsmap(tx_nss, pvhtpriv->vht_mcs_map, pcap_mcs);
pvhtpriv->vht_highest_rate = rtw_get_vht_highest_rate(pvhtpriv->vht_mcs_map); pvhtpriv->vht_highest_rate = rtw_get_vht_highest_rate(pvhtpriv->vht_mcs_map);
} }
@ -685,7 +680,7 @@ void VHT_operation_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
return; return;
} }
void rtw_process_vht_op_mode_notify(_adapter *padapter, u8 *pframe, PVOID sta) void rtw_process_vht_op_mode_notify(_adapter *padapter, u8 *pframe, void *sta)
{ {
struct sta_info *psta = (struct sta_info *)sta; struct sta_info *psta = (struct sta_info *)sta;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@ -694,16 +689,13 @@ void rtw_process_vht_op_mode_notify(_adapter *padapter, u8 *pframe, PVOID sta)
u8 target_bw; u8 target_bw;
u8 target_rxss, current_rxss; u8 target_rxss, current_rxss;
u8 update_ra = _FALSE; u8 update_ra = _FALSE;
u8 tx_nss = 0, rf_type = RF_1T1R; u8 tx_nss = 0;
struct hal_spec_t *hal_spec = GET_HAL_SPEC(padapter);
if (pvhtpriv->vht_option == _FALSE) if (pvhtpriv->vht_option == _FALSE)
return; return;
target_bw = GET_VHT_OPERATING_MODE_FIELD_CHNL_WIDTH(pframe); target_bw = GET_VHT_OPERATING_MODE_FIELD_CHNL_WIDTH(pframe);
tx_nss = GET_HAL_TX_NSS(padapter);
rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
tx_nss = rtw_min(rf_type_to_rf_tx_cnt(rf_type), hal_spec->tx_nss_num);
target_rxss = rtw_min(tx_nss, (GET_VHT_OPERATING_MODE_FIELD_RX_NSS(pframe) + 1)); target_rxss = rtw_min(tx_nss, (GET_VHT_OPERATING_MODE_FIELD_RX_NSS(pframe) + 1));
if (target_bw != psta->cmn.bw_mode) { if (target_bw != psta->cmn.bw_mode) {
@ -886,7 +878,8 @@ u32 rtw_build_vht_cap_ie(_adapter *padapter, u8 *pbuf)
/* IOT action suggested by Yu Chen 2017/3/3 */ /* IOT action suggested by Yu Chen 2017/3/3 */
#ifdef CONFIG_80211AC_VHT #ifdef CONFIG_80211AC_VHT
if ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_BROADCOM) && if ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_BROADCOM) &&
!pvhtpriv->ap_is_mu_bfer) !pvhtpriv->ap_bf_cap.is_mu_bfer &&
pvhtpriv->ap_bf_cap.su_sound_dim == 2)
rf_num = (rf_num >= 2 ? 2 : rf_num); rf_num = (rf_num >= 2 ? 2 : rf_num);
#endif #endif
/* B13 14 15 Compressed Steering Number of Beamformer Antennas Supported */ /* B13 14 15 Compressed Steering Number of Beamformer Antennas Supported */
@ -996,9 +989,9 @@ u32 rtw_restructure_vht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, uint in_le
oper_bw = rtw_min(oper_bw, max_bw); oper_bw = rtw_min(oper_bw, max_bw);
/* try downgrage bw to fit in channel plan setting */ /* try downgrage bw to fit in channel plan setting */
while (!rtw_chset_is_chbw_valid(chset, oper_ch, oper_bw, oper_offset) while (!rtw_chset_is_chbw_valid(chset, oper_ch, oper_bw, oper_offset, 1, 1)
|| (IS_DFS_SLAVE_WITH_RD(rfctl) || (IS_DFS_SLAVE_WITH_RD(rfctl)
&& !rtw_odm_dfs_domain_unknown(rfctl_to_dvobj(rfctl)) && !rtw_rfctl_dfs_domain_unknown(rfctl)
&& rtw_chset_is_chbw_non_ocp(chset, oper_ch, oper_bw, oper_offset)) && rtw_chset_is_chbw_non_ocp(chset, oper_ch, oper_bw, oper_offset))
) { ) {
oper_bw--; oper_bw--;
@ -1010,8 +1003,8 @@ u32 rtw_restructure_vht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, uint in_le
} }
} }
rtw_warn_on(!rtw_chset_is_chbw_valid(chset, oper_ch, oper_bw, oper_offset)); rtw_warn_on(!rtw_chset_is_chbw_valid(chset, oper_ch, oper_bw, oper_offset, 1, 1));
if (IS_DFS_SLAVE_WITH_RD(rfctl) && !rtw_odm_dfs_domain_unknown(rfctl_to_dvobj(rfctl))) if (IS_DFS_SLAVE_WITH_RD(rfctl) && !rtw_rfctl_dfs_domain_unknown(rfctl))
rtw_warn_on(rtw_chset_is_chbw_non_ocp(chset, oper_ch, oper_bw, oper_offset)); rtw_warn_on(rtw_chset_is_chbw_non_ocp(chset, oper_ch, oper_bw, oper_offset));
/* update VHT_OP_IE */ /* update VHT_OP_IE */

View File

@ -792,6 +792,14 @@ void rtw_wapi_return_all_sta_info(_adapter *padapter)
WAPI_TRACE(WAPI_API, "<========== %s\n", __FUNCTION__); WAPI_TRACE(WAPI_API, "<========== %s\n", __FUNCTION__);
} }
void CAM_empty_entry(
PADAPTER Adapter,
u8 ucIndex
)
{
rtw_hal_set_hwreg(Adapter, HW_VAR_CAM_EMPTY_ENTRY, (u8 *)(&ucIndex));
}
void rtw_wapi_clear_cam_entry(_adapter *padapter, u8 *pMacAddr) void rtw_wapi_clear_cam_entry(_adapter *padapter, u8 *pMacAddr)
{ {
u8 UcIndex = 0; u8 UcIndex = 0;

View File

@ -69,6 +69,28 @@ static u8 rtw_basic_rate_mix[7] = {
IEEE80211_OFDM_RATE_24MB | IEEE80211_BASIC_RATE_MASK IEEE80211_OFDM_RATE_24MB | IEEE80211_BASIC_RATE_MASK
}; };
extern u8 WIFI_CCKRATES[];
bool rtw_is_cck_rate(u8 rate)
{
int i;
for (i = 0; i < 4; i++)
if ((WIFI_CCKRATES[i] & 0x7F) == (rate & 0x7F))
return 1;
return 0;
}
extern u8 WIFI_OFDMRATES[];
bool rtw_is_ofdm_rate(u8 rate)
{
int i;
for (i = 0; i < 8; i++)
if ((WIFI_OFDMRATES[i] & 0x7F) == (rate & 0x7F))
return 1;
return 0;
}
/* test if rate is defined in rtw_basic_rate_cck */ /* test if rate is defined in rtw_basic_rate_cck */
bool rtw_is_basic_rate_cck(u8 rate) bool rtw_is_basic_rate_cck(u8 rate)
{ {
@ -133,19 +155,12 @@ int cckratesonly_included(unsigned char *rate, int ratelen)
s8 rtw_get_sta_rx_nss(_adapter *adapter, struct sta_info *psta) s8 rtw_get_sta_rx_nss(_adapter *adapter, struct sta_info *psta)
{ {
struct hal_spec_t *hal_spec = GET_HAL_SPEC(adapter);
u8 rf_type = RF_1T1R, custom_rf_type;
s8 nss = 1; s8 nss = 1;
if (!psta) if (!psta)
return nss; return nss;
custom_rf_type = adapter->registrypriv.rf_config; nss = GET_HAL_RX_NSS(adapter);
rtw_hal_get_hwreg(adapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
if (RF_TYPE_VALID(custom_rf_type))
rf_type = custom_rf_type;
nss = rtw_min(rf_type_to_rf_rx_cnt(rf_type), hal_spec->rx_nss_num);
#ifdef CONFIG_80211N_HT #ifdef CONFIG_80211N_HT
#ifdef CONFIG_80211AC_VHT #ifdef CONFIG_80211AC_VHT
@ -156,25 +171,18 @@ s8 rtw_get_sta_rx_nss(_adapter *adapter, struct sta_info *psta)
if (psta->htpriv.ht_option) if (psta->htpriv.ht_option)
nss = rtw_min(nss, rtw_ht_mcsset_to_nss(psta->htpriv.ht_cap.supp_mcs_set)); nss = rtw_min(nss, rtw_ht_mcsset_to_nss(psta->htpriv.ht_cap.supp_mcs_set));
#endif /*CONFIG_80211N_HT*/ #endif /*CONFIG_80211N_HT*/
RTW_INFO("%s: %d SS\n", __func__, nss); RTW_INFO("%s: %d ss\n", __func__, nss);
return nss; return nss;
} }
s8 rtw_get_sta_tx_nss(_adapter *adapter, struct sta_info *psta) s8 rtw_get_sta_tx_nss(_adapter *adapter, struct sta_info *psta)
{ {
struct hal_spec_t *hal_spec = GET_HAL_SPEC(adapter);
u8 rf_type = RF_1T1R, custom_rf_type;
s8 nss = 1; s8 nss = 1;
if (!psta) if (!psta)
return nss; return nss;
custom_rf_type = adapter->registrypriv.rf_config; nss = GET_HAL_TX_NSS(adapter);
rtw_hal_get_hwreg(adapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
if (RF_TYPE_VALID(custom_rf_type))
rf_type = custom_rf_type;
nss = rtw_min(rf_type_to_rf_tx_cnt(rf_type), hal_spec->tx_nss_num);
#ifdef CONFIG_80211N_HT #ifdef CONFIG_80211N_HT
#ifdef CONFIG_80211AC_VHT #ifdef CONFIG_80211AC_VHT
@ -355,8 +363,8 @@ void set_mcs_rate_by_mask(u8 *mcs_set, u32 mask)
} }
void UpdateBrateTbl( void UpdateBrateTbl(
IN PADAPTER Adapter, PADAPTER Adapter,
IN u8 *mBratesOS u8 *mBratesOS
) )
{ {
u8 i; u8 i;
@ -738,14 +746,6 @@ unsigned int decide_wait_for_beacon_timeout(unsigned int bcn_interval)
return bcn_interval << 2; return bcn_interval << 2;
} }
void CAM_empty_entry(
PADAPTER Adapter,
u8 ucIndex
)
{
rtw_hal_set_hwreg(Adapter, HW_VAR_CAM_EMPTY_ENTRY, (u8 *)(&ucIndex));
}
void invalidate_cam_all(_adapter *padapter) void invalidate_cam_all(_adapter *padapter)
{ {
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
@ -1409,7 +1409,6 @@ void flush_all_cam_entry(_adapter *padapter)
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
struct security_priv *psecpriv = &padapter->securitypriv;
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
@ -1879,7 +1878,6 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
{ {
#ifdef CONFIG_80211N_HT #ifdef CONFIG_80211N_HT
unsigned int i; unsigned int i;
u8 rf_type = RF_1T1R;
u8 max_AMPDU_len, min_MPDU_spacing; u8 max_AMPDU_len, min_MPDU_spacing;
u8 cur_ldpc_cap = 0, cur_stbc_cap = 0, cur_beamform_cap = 0, tx_nss = 0; u8 cur_ldpc_cap = 0, cur_stbc_cap = 0, cur_beamform_cap = 0, tx_nss = 0;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@ -1889,7 +1887,6 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
#ifdef CONFIG_DISABLE_MCS13TO15 #ifdef CONFIG_DISABLE_MCS13TO15
struct registry_priv *pregistrypriv = &padapter->registrypriv; struct registry_priv *pregistrypriv = &padapter->registrypriv;
#endif #endif
struct hal_spec_t *hal_spec = GET_HAL_SPEC(padapter);
if (pIE == NULL) if (pIE == NULL)
return; return;
@ -1933,8 +1930,7 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= pmlmeext->default_supported_mcs_set[i]; pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= pmlmeext->default_supported_mcs_set[i];
rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); tx_nss = GET_HAL_TX_NSS(padapter);
tx_nss = rtw_min(rf_type_to_rf_tx_cnt(rf_type), hal_spec->tx_nss_num);
switch (tx_nss) { switch (tx_nss) {
case 1: case 1:
@ -1955,7 +1951,7 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_4R); set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_4R);
break; break;
default: default:
RTW_WARN("rf_type:%d or tx_nss:%u is not expected\n", rf_type, hal_spec->tx_nss_num); RTW_WARN("rf_type:%d or tx_nss:%u is not expected\n", GET_HAL_RFPATH(padapter), tx_nss);
} }
if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
@ -2346,10 +2342,14 @@ bool rtw_validate_value(u16 EID, u8 *p, u16 len)
return _TRUE; return _TRUE;
} }
bool is_hidden_ssid(char *ssid, int len)
{
return len == 0 || is_all_null(ssid, len) == _TRUE;
}
inline bool hidden_ssid_ap(WLAN_BSSID_EX *snetwork) inline bool hidden_ssid_ap(WLAN_BSSID_EX *snetwork)
{ {
return ((snetwork->Ssid.SsidLength == 0) || return is_hidden_ssid(snetwork->Ssid.Ssid, snetwork->Ssid.SsidLength);
is_all_null(snetwork->Ssid.Ssid, snetwork->Ssid.SsidLength) == _TRUE);
} }
/* /*
@ -2361,7 +2361,7 @@ void rtw_absorb_ssid_ifneed(_adapter *padapter, WLAN_BSSID_EX *bssid, u8 *pframe
struct wlan_network *scanned = NULL; struct wlan_network *scanned = NULL;
WLAN_BSSID_EX *snetwork; WLAN_BSSID_EX *snetwork;
u8 ie_offset, *p=NULL, *next_ie=NULL, *mac = get_addr2_ptr(pframe); u8 ie_offset, *p=NULL, *next_ie=NULL, *mac = get_addr2_ptr(pframe);
sint len, ssid_len_ori; sint ssid_len_ori;
u32 remain_len = 0; u32 remain_len = 0;
u8 backupIE[MAX_IE_SZ]; u8 backupIE[MAX_IE_SZ];
u16 subtype = get_frame_sub_type(pframe); u16 subtype = get_frame_sub_type(pframe);
@ -2454,8 +2454,8 @@ void rtw_debug_rx_bcn(_adapter *adapter, u8 *pframe, u32 packet_len)
* WLAN_EID_CHANNEL_SWITCH * WLAN_EID_CHANNEL_SWITCH
* WLAN_EID_PWR_CONSTRAINT * WLAN_EID_PWR_CONSTRAINT
*/ */
int rtw_get_bcn_keys(ADAPTER *Adapter, u8 *pframe, u32 packet_len, int _rtw_get_bcn_keys(u8 *cap_info, u32 buf_len, u8 def_ch, ADAPTER *adapter
struct beacon_keys *recv_beacon) , struct beacon_keys *recv_beacon)
{ {
int left; int left;
u16 capability; u16 capability;
@ -2465,11 +2465,11 @@ int rtw_get_bcn_keys(ADAPTER *Adapter, u8 *pframe, u32 packet_len,
_rtw_memset(recv_beacon, 0, sizeof(*recv_beacon)); _rtw_memset(recv_beacon, 0, sizeof(*recv_beacon));
/* checking capabilities */ /* checking capabilities */
capability = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN + 10)); capability = le16_to_cpu(*(unsigned short *)(cap_info));
/* checking IEs */ /* checking IEs */
left = packet_len - sizeof(struct rtw_ieee80211_hdr_3addr) - _BEACON_IE_OFFSET_; left = buf_len - 2;
pos = pframe + sizeof(struct rtw_ieee80211_hdr_3addr) + _BEACON_IE_OFFSET_; pos = cap_info + 2;
if (rtw_ieee802_11_parse_elems(pos, left, &elems, 1) == ParseFailed) if (rtw_ieee802_11_parse_elems(pos, left, &elems, 1) == ParseFailed)
return _FALSE; return _FALSE;
@ -2511,11 +2511,8 @@ int rtw_get_bcn_keys(ADAPTER *Adapter, u8 *pframe, u32 packet_len,
/* check bw and channel offset */ /* check bw and channel offset */
rtw_ies_get_chbw(pos, left, &recv_beacon->ch, &recv_beacon->bw, &recv_beacon->offset, 1, 1); rtw_ies_get_chbw(pos, left, &recv_beacon->ch, &recv_beacon->bw, &recv_beacon->offset, 1, 1);
if (!recv_beacon->ch) { if (!recv_beacon->ch)
/* we don't find channel IE, so don't check it */ recv_beacon->ch = def_ch;
/* RTW_INFO("Oops: %s we don't find channel IE, so don't check it\n", __func__); */
recv_beacon->ch = Adapter->mlmeextpriv.cur_channel;
}
/* checking SSID */ /* checking SSID */
if (elems.ssid) { if (elems.ssid) {
@ -2542,18 +2539,44 @@ int rtw_get_bcn_keys(ADAPTER *Adapter, u8 *pframe, u32 packet_len,
} else if (capability & BIT(4)) } else if (capability & BIT(4))
recv_beacon->encryp_protocol = ENCRYP_PROTOCOL_WEP; recv_beacon->encryp_protocol = ENCRYP_PROTOCOL_WEP;
if (adapter) {
if (elems.tim && elems.tim_len) { if (elems.tim && elems.tim_len) {
struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
#ifdef DBG_RX_BCN #ifdef DBG_RX_BCN
_rtw_memcpy(pmlmeext->tim, elems.tim, 4); _rtw_memcpy(pmlmeext->tim, elems.tim, 4);
#endif #endif
pmlmeext->dtim = elems.tim[1]; pmlmeext->dtim = elems.tim[1];
} }
}
return _TRUE; return _TRUE;
} }
int rtw_get_bcn_keys(_adapter *adapter, u8 *whdr, u32 flen, struct beacon_keys *bcn_keys)
{
return _rtw_get_bcn_keys(
whdr + WLAN_HDR_A3_LEN + 10
, flen - WLAN_HDR_A3_LEN - 10
, adapter->mlmeextpriv.cur_channel, adapter
, bcn_keys);
}
int rtw_get_bcn_keys_from_bss(WLAN_BSSID_EX *bss, struct beacon_keys *bcn_keys)
{
return _rtw_get_bcn_keys(
bss->IEs + 10
, bss->IELength - 10
, bss->Configuration.DSConfig, NULL
, bcn_keys);
}
int rtw_update_bcn_keys_of_network(struct wlan_network *network)
{
network->bcn_keys_valid = rtw_get_bcn_keys_from_bss(&network->network, &network->bcn_keys);
return network->bcn_keys_valid;
}
void rtw_dump_bcn_keys(void *sel, struct beacon_keys *recv_beacon) void rtw_dump_bcn_keys(void *sel, struct beacon_keys *recv_beacon)
{ {
u8 ssid[IW_ESSID_MAX_SIZE + 1]; u8 ssid[IW_ESSID_MAX_SIZE + 1];
@ -2572,11 +2595,42 @@ void rtw_dump_bcn_keys(void *sel, struct beacon_keys *recv_beacon)
, recv_beacon->pairwise_cipher, recv_beacon->akm); , recv_beacon->pairwise_cipher, recv_beacon->akm);
} }
int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len) bool rtw_bcn_key_compare(struct beacon_keys *cur, struct beacon_keys *recv)
{ {
#define BCNKEY_VERIFY_PROTO_CAP 0 #define BCNKEY_VERIFY_PROTO_CAP 0
#define BCNKEY_VERIFY_WHOLE_RATE_SET 0 #define BCNKEY_VERIFY_WHOLE_RATE_SET 0
struct beacon_keys tmp;
bool ret = _FALSE;
if (!rtw_is_chbw_grouped(cur->ch, cur->bw, cur->offset
, recv->ch, recv->bw, recv->offset))
goto exit;
_rtw_memcpy(&tmp, cur, sizeof(tmp));
/* check fields excluding below */
tmp.ch = recv->ch;
tmp.bw = recv->bw;
tmp.offset = recv->offset;
if (!BCNKEY_VERIFY_PROTO_CAP)
tmp.proto_cap = recv->proto_cap;
if (!BCNKEY_VERIFY_WHOLE_RATE_SET) {
tmp.rate_num = recv->rate_num;
_rtw_memcpy(tmp.rate_set, recv->rate_set, 12);
}
if (_rtw_memcmp(&tmp, recv, sizeof(*recv)) == _FALSE)
goto exit;
ret = _TRUE;
exit:
return ret;
}
int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len)
{
u8 *pbssid = GetAddr3Ptr(pframe); u8 *pbssid = GetAddr3Ptr(pframe);
struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
struct wlan_network *cur_network = &(Adapter->mlmepriv.cur_network); struct wlan_network *cur_network = &(Adapter->mlmepriv.cur_network);
@ -2591,9 +2645,15 @@ int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len)
goto exit_success; /* parsing failed => broken IE */ goto exit_success; /* parsing failed => broken IE */
#ifdef DBG_RX_BCN #ifdef DBG_RX_BCN
rtw_debug_bcn(Adapter, pframe, packet_len); rtw_debug_rx_bcn(Adapter, pframe, packet_len);
#endif #endif
/* hidden ssid, replace with current beacon ssid directly */
if (is_hidden_ssid(recv_beacon.ssid, recv_beacon.ssid_len)) {
_rtw_memcpy(recv_beacon.ssid, cur_beacon->ssid, cur_beacon->ssid_len);
recv_beacon.ssid_len = cur_beacon->ssid_len;
}
#ifdef CONFIG_BCN_CNT_CONFIRM_HDL #ifdef CONFIG_BCN_CNT_CONFIRM_HDL
if (_rtw_memcmp(&recv_beacon, cur_beacon, sizeof(recv_beacon)) == _TRUE) if (_rtw_memcmp(&recv_beacon, cur_beacon, sizeof(recv_beacon)) == _TRUE)
pmlmepriv->new_beacon_cnts = 0; pmlmepriv->new_beacon_cnts = 0;
@ -2622,31 +2682,13 @@ int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len)
if (_rtw_memcmp(&recv_beacon, cur_beacon, sizeof(recv_beacon)) == _FALSE) if (_rtw_memcmp(&recv_beacon, cur_beacon, sizeof(recv_beacon)) == _FALSE)
#endif #endif
{ {
struct beacon_keys tmp_beacon;
RTW_INFO(FUNC_ADPT_FMT" new beacon occur!!\n", FUNC_ADPT_ARG(Adapter)); RTW_INFO(FUNC_ADPT_FMT" new beacon occur!!\n", FUNC_ADPT_ARG(Adapter));
RTW_INFO(FUNC_ADPT_FMT" cur beacon key:\n", FUNC_ADPT_ARG(Adapter)); RTW_INFO(FUNC_ADPT_FMT" cur beacon key:\n", FUNC_ADPT_ARG(Adapter));
rtw_dump_bcn_keys(RTW_DBGDUMP, cur_beacon); rtw_dump_bcn_keys(RTW_DBGDUMP, cur_beacon);
RTW_INFO(FUNC_ADPT_FMT" new beacon key:\n", FUNC_ADPT_ARG(Adapter)); RTW_INFO(FUNC_ADPT_FMT" new beacon key:\n", FUNC_ADPT_ARG(Adapter));
rtw_dump_bcn_keys(RTW_DBGDUMP, &recv_beacon); rtw_dump_bcn_keys(RTW_DBGDUMP, &recv_beacon);
if (!rtw_is_chbw_grouped(cur_beacon->ch, cur_beacon->bw, cur_beacon->offset if (rtw_bcn_key_compare(cur_beacon, &recv_beacon) == _FALSE)
, recv_beacon.ch, recv_beacon.bw, recv_beacon.offset))
goto exit;
_rtw_memcpy(&tmp_beacon, cur_beacon, sizeof(tmp_beacon));
/* check fields excluding below */
tmp_beacon.ch = recv_beacon.ch;
tmp_beacon.bw = recv_beacon.bw;
tmp_beacon.offset = recv_beacon.offset;
if (!BCNKEY_VERIFY_PROTO_CAP)
tmp_beacon.proto_cap = recv_beacon.proto_cap;
if (!BCNKEY_VERIFY_WHOLE_RATE_SET) {
tmp_beacon.rate_num = recv_beacon.rate_num;
_rtw_memcpy(tmp_beacon.rate_set, recv_beacon.rate_set, 12);
}
if (_rtw_memcmp(&tmp_beacon, &recv_beacon, sizeof(recv_beacon)) == _FALSE)
goto exit; goto exit;
_rtw_memcpy(cur_beacon, &recv_beacon, sizeof(recv_beacon)); _rtw_memcpy(cur_beacon, &recv_beacon, sizeof(recv_beacon));
@ -2716,7 +2758,7 @@ void update_beacon_info(_adapter *padapter, u8 *pframe, uint pkt_len, struct sta
} }
} }
#ifdef CONFIG_DFS #if CONFIG_DFS
void process_csa_ie(_adapter *padapter, u8 *ies, uint ies_len) void process_csa_ie(_adapter *padapter, u8 *ies, uint ies_len)
{ {
struct rf_ctl_t *rfctl = adapter_to_rfctl(padapter); struct rf_ctl_t *rfctl = adapter_to_rfctl(padapter);
@ -2753,8 +2795,6 @@ void process_csa_ie(_adapter *padapter, u8 *ies, uint ies_len)
void parsing_eapol_packet(_adapter *padapter, u8 *key_payload, struct sta_info *psta, u8 trx_type) void parsing_eapol_packet(_adapter *padapter, u8 *key_payload, struct sta_info *psta, u8 trx_type)
{ {
struct security_priv *psecuritypriv = &(padapter->securitypriv); struct security_priv *psecuritypriv = &(padapter->securitypriv);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
struct sta_priv *pstapriv = &(padapter->stapriv);
struct ieee802_1x_hdr *hdr; struct ieee802_1x_hdr *hdr;
struct wpa_eapol_key *key; struct wpa_eapol_key *key;
u16 key_info, key_data_length; u16 key_info, key_data_length;
@ -3063,10 +3103,6 @@ void update_tx_basic_rate(_adapter *padapter, u8 wirelessmode)
if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
return; return;
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
#ifdef CONFIG_INTEL_WIDI
if (padapter->mlmepriv.widi_state != INTEL_WIDI_STATE_NONE)
return;
#endif /* CONFIG_INTEL_WIDI */
_rtw_memset(supported_rates, 0, NDIS_802_11_LENGTH_RATES_EX); _rtw_memset(supported_rates, 0, NDIS_802_11_LENGTH_RATES_EX);
@ -3214,19 +3250,15 @@ void get_assoc_AP_Vendor(char *vendor, u8 assoc_AP_vendor)
#ifdef CONFIG_RTS_FULL_BW #ifdef CONFIG_RTS_FULL_BW
void rtw_parse_sta_vendor_ie_8812(_adapter *adapter, struct sta_info *sta, u8 *tlv_ies, u16 tlv_ies_len) void rtw_parse_sta_vendor_ie_8812(_adapter *adapter, struct sta_info *sta, u8 *tlv_ies, u16 tlv_ies_len)
{ {
struct mlme_priv *mlme = &adapter->mlmepriv;
unsigned char REALTEK_OUI[] = {0x00,0xe0, 0x4c}; unsigned char REALTEK_OUI[] = {0x00,0xe0, 0x4c};
u8 *p; u8 *p;
int i;
p = rtw_get_ie_ex(tlv_ies, tlv_ies_len, WLAN_EID_VENDOR_SPECIFIC, REALTEK_OUI, 3, NULL, NULL); p = rtw_get_ie_ex(tlv_ies, tlv_ies_len, WLAN_EID_VENDOR_SPECIFIC, REALTEK_OUI, 3, NULL, NULL);
if (!p) if (!p)
goto exit; goto exit;
else { else {
if(*(p+1) > 6 ) { if(*(p+1) > 6 ) {
for(i=0; i<9;i++)
RTW_INFO("p[%d]=0x%x",i,*(p+i) );
RTW_INFO("\n");
if(*(p+6) != 2) if(*(p+6) != 2)
goto exit; goto exit;
@ -3242,10 +3274,9 @@ exit:
#endif/*CONFIG_RTS_FULL_BW*/ #endif/*CONFIG_RTS_FULL_BW*/
#ifdef CONFIG_80211AC_VHT #ifdef CONFIG_80211AC_VHT
unsigned char get_vht_mu_bfer_cap(u8 *pframe, uint len) void get_vht_bf_cap(u8 *pframe, uint len, struct vht_bf_cap *bf_cap)
{ {
unsigned int i; unsigned int i;
unsigned int mu_bfer=0;
PNDIS_802_11_VARIABLE_IEs pIE; PNDIS_802_11_VARIABLE_IEs pIE;
for (i = sizeof(NDIS_802_11_FIXED_IEs); i < len;) { for (i = sizeof(NDIS_802_11_FIXED_IEs); i < len;) {
@ -3254,14 +3285,14 @@ unsigned char get_vht_mu_bfer_cap(u8 *pframe, uint len)
switch (pIE->ElementID) { switch (pIE->ElementID) {
case EID_VHTCapability: case EID_VHTCapability:
mu_bfer = GET_VHT_CAPABILITY_ELE_MU_BFER(pIE->data); bf_cap->is_mu_bfer = GET_VHT_CAPABILITY_ELE_MU_BFER(pIE->data);
bf_cap->su_sound_dim = GET_VHT_CAPABILITY_ELE_SU_BFER_SOUND_DIM_NUM(pIE->data);
break; break;
default: default:
break; break;
} }
i += (pIE->Length + 2); i += (pIE->Length + 2);
} }
return mu_bfer;
} }
#endif #endif
@ -3736,6 +3767,7 @@ inline u8 rtw_macid_get_iface_bmp(struct macid_ctl_t *macid_ctl, u8 id)
inline bool rtw_macid_is_iface_shared(struct macid_ctl_t *macid_ctl, u8 id) inline bool rtw_macid_is_iface_shared(struct macid_ctl_t *macid_ctl, u8 id)
{ {
#if CONFIG_IFACE_NUMBER >= 2
int i; int i;
u8 iface_bmp = 0; u8 iface_bmp = 0;
@ -3746,7 +3778,7 @@ inline bool rtw_macid_is_iface_shared(struct macid_ctl_t *macid_ctl, u8 id)
iface_bmp |= BIT(i); iface_bmp |= BIT(i);
} }
} }
#endif
return 0; return 0;
} }
@ -3792,7 +3824,18 @@ inline u8 rtw_iface_bcmc_id_get(_adapter *padapter)
return macid_ctl->iface_bmc[padapter->iface_id]; return macid_ctl->iface_bmc[padapter->iface_id];
} }
#if defined(DBG_CONFIG_ERROR_RESET) && defined(CONFIG_CONCURRENT_MODE)
void rtw_iface_bcmc_sec_cam_map_restore(_adapter *adapter)
{
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
struct cam_ctl_t *cam_ctl = dvobj_to_sec_camctl(dvobj);
int cam_id = -1;
cam_id = rtw_iface_bcmc_id_get(adapter);
if (cam_id != INVALID_SEC_MAC_CAM_ID)
rtw_sec_cam_map_set(&cam_ctl->used, cam_id);
}
#endif
void rtw_alloc_macid(_adapter *padapter, struct sta_info *psta) void rtw_alloc_macid(_adapter *padapter, struct sta_info *psta)
{ {
int i; int i;
@ -3840,21 +3883,22 @@ void rtw_alloc_macid(_adapter *padapter, struct sta_info *psta)
} }
#endif /* CONFIG_MCC_MODE */ #endif /* CONFIG_MCC_MODE */
if (is_bc_sta) { #ifdef CONFIG_CONCURRENT_MODE
struct cam_ctl_t *cam_ctl = dvobj_to_sec_camctl(dvobj); /* for BMC data TX with force camid */
if (is_bc_sta && rtw_sec_camid_is_used(dvobj_to_sec_camctl(dvobj), i))
continue;
#endif
if ((!rtw_macid_is_used(macid_ctl, i)) && (!rtw_sec_camid_is_used(cam_ctl, i)))
break;
} else {
if (!rtw_macid_is_used(macid_ctl, i)) if (!rtw_macid_is_used(macid_ctl, i))
break; break;
} }
}
if (i < macid_ctl->num) { if (i < macid_ctl->num) {
rtw_macid_map_set(used_map, i); rtw_macid_map_set(used_map, i);
#ifdef CONFIG_CONCURRENT_MODE
/* for BMC data TX with force camid */
if (is_bc_sta) { if (is_bc_sta) {
struct cam_ctl_t *cam_ctl = dvobj_to_sec_camctl(dvobj); struct cam_ctl_t *cam_ctl = dvobj_to_sec_camctl(dvobj);
@ -3862,6 +3906,7 @@ void rtw_alloc_macid(_adapter *padapter, struct sta_info *psta)
rtw_iface_bcmc_id_set(padapter, i); rtw_iface_bcmc_id_set(padapter, i);
rtw_sec_cam_map_set(&cam_ctl->used, i); rtw_sec_cam_map_set(&cam_ctl->used, i);
} }
#endif
rtw_macid_map_set(&macid_ctl->if_g[padapter->iface_id], i); rtw_macid_map_set(&macid_ctl->if_g[padapter->iface_id], i);
macid_ctl->sta[i] = psta; macid_ctl->sta[i] = psta;
@ -3991,16 +4036,41 @@ u8 rtw_search_max_mac_id(_adapter *padapter)
return max_mac_id; return max_mac_id;
} }
inline void rtw_macid_ctl_set_h2c_msr(struct macid_ctl_t *macid_ctl, u8 id, u8 h2c_msr) inline u8 rtw_macid_ctl_set_h2c_msr(struct macid_ctl_t *macid_ctl, u8 id, u8 h2c_msr)
{ {
u8 op_num_change_bmp = 0;
if (id >= macid_ctl->num) { if (id >= macid_ctl->num) {
rtw_warn_on(1); rtw_warn_on(1);
return; goto exit;
}
if (GET_H2CCMD_MSRRPT_PARM_OPMODE(&macid_ctl->h2c_msr[id])
&& !GET_H2CCMD_MSRRPT_PARM_OPMODE(&h2c_msr)
) {
u8 role = GET_H2CCMD_MSRRPT_PARM_ROLE(&macid_ctl->h2c_msr[id]);
if (role < H2C_MSR_ROLE_MAX) {
macid_ctl->op_num[role]--;
op_num_change_bmp |= BIT(role);
}
} else if (!GET_H2CCMD_MSRRPT_PARM_OPMODE(&macid_ctl->h2c_msr[id])
&& GET_H2CCMD_MSRRPT_PARM_OPMODE(&h2c_msr)
) {
u8 role = GET_H2CCMD_MSRRPT_PARM_ROLE(&h2c_msr);
if (role < H2C_MSR_ROLE_MAX) {
macid_ctl->op_num[role]++;
op_num_change_bmp |= BIT(role);
}
} }
macid_ctl->h2c_msr[id] = h2c_msr; macid_ctl->h2c_msr[id] = h2c_msr;
if (0) if (0)
RTW_INFO("macid:%u, h2c_msr:"H2C_MSR_FMT"\n", id, H2C_MSR_ARG(&macid_ctl->h2c_msr[id])); RTW_INFO("macid:%u, h2c_msr:"H2C_MSR_FMT"\n", id, H2C_MSR_ARG(&macid_ctl->h2c_msr[id]));
exit:
return op_num_change_bmp;
} }
inline void rtw_macid_ctl_set_bw(struct macid_ctl_t *macid_ctl, u8 id, u8 bw) inline void rtw_macid_ctl_set_bw(struct macid_ctl_t *macid_ctl, u8 id, u8 bw)
@ -4051,6 +4121,13 @@ inline void rtw_macid_ctl_set_rate_bmp1(struct macid_ctl_t *macid_ctl, u8 id, u3
RTW_INFO("macid:%u, rate_bmp1:0x%08X\n", id, macid_ctl->rate_bmp1[id]); RTW_INFO("macid:%u, rate_bmp1:0x%08X\n", id, macid_ctl->rate_bmp1[id]);
} }
#ifdef CONFIG_PROTSEL_MACSLEEP
inline void rtw_macid_ctl_init_sleep_reg(struct macid_ctl_t *macid_ctl, u16 reg_ctrl, u16 reg_info)
{
macid_ctl->reg_sleep_ctrl = reg_ctrl;
macid_ctl->reg_sleep_info = reg_info;
}
#else
inline void rtw_macid_ctl_init_sleep_reg(struct macid_ctl_t *macid_ctl, u16 m0, u16 m1, u16 m2, u16 m3) inline void rtw_macid_ctl_init_sleep_reg(struct macid_ctl_t *macid_ctl, u16 m0, u16 m1, u16 m2, u16 m3)
{ {
macid_ctl->reg_sleep_m0 = m0; macid_ctl->reg_sleep_m0 = m0;
@ -4064,6 +4141,7 @@ inline void rtw_macid_ctl_init_sleep_reg(struct macid_ctl_t *macid_ctl, u16 m0,
macid_ctl->reg_sleep_m3 = m3; macid_ctl->reg_sleep_m3 = m3;
#endif #endif
} }
#endif
inline void rtw_macid_ctl_init(struct macid_ctl_t *macid_ctl) inline void rtw_macid_ctl_init(struct macid_ctl_t *macid_ctl)
{ {
@ -4317,11 +4395,13 @@ _adapter *dvobj_get_adapter_by_addr(struct dvobj_priv *dvobj, u8 *addr)
bool rtw_wowlan_parser_pattern_cmd(u8 *input, char *pattern, bool rtw_wowlan_parser_pattern_cmd(u8 *input, char *pattern,
int *pattern_len, char *bit_mask) int *pattern_len, char *bit_mask)
{ {
char *cp = NULL, *end = NULL; char *cp = NULL;
size_t len = 0; size_t len = 0;
int pos = 0, mask_pos = 0, res = 0; int pos = 0, mask_pos = 0, res = 0;
u8 member[2] = {0};
/* To get the pattern string after "=", when we use :
* iwpriv wlanX pattern=XX:XX:..:XX
*/
cp = strchr(input, '='); cp = strchr(input, '=');
if (cp) { if (cp) {
*cp = 0; *cp = 0;
@ -4329,31 +4409,35 @@ bool rtw_wowlan_parser_pattern_cmd(u8 *input, char *pattern,
input = cp; input = cp;
} }
while (1) { /* To take off the newline character '\n'(0x0a) at the end of pattern string,
cp = strchr(input, ':'); * when we use echo xxxx > /proc/xxxx
*/
if (cp) { cp = strchr(input, '\n');
len = strlen(input) - strlen(cp); if (cp)
*cp = 0; *cp = 0;
cp++;
} else
len = 2;
if (bit_mask && (strcmp(input, "-") == 0 || while (input) {
strcmp(input, "xx") == 0 || cp = strsep((char **)(&input), ":");
strcmp(input, "--") == 0)) {
if (bit_mask && (strcmp(cp, "-") == 0 ||
strcmp(cp, "xx") == 0 ||
strcmp(cp, "--") == 0)) {
/* skip this byte and leave mask bit unset */ /* skip this byte and leave mask bit unset */
} else { } else {
u8 hex; u8 hex;
strncpy(member, input, len); if (strlen(cp) != 2) {
if (!rtw_check_pattern_valid(member, sizeof(member))) { RTW_ERR("%s:[ERROR] hex len != 2, input=[%s]\n",
RTW_INFO("%s:[ERROR] pattern is invalid!!\n", __func__, cp);
__func__); goto error;
}
if (hexstr2bin(cp, &hex, 1) < 0) {
RTW_ERR("%s:[ERROR] pattern is invalid, input=[%s]\n",
__func__, cp);
goto error; goto error;
} }
res = sscanf(member, "%02hhx", &hex);
pattern[pos] = hex; pattern[pos] = hex;
mask_pos = pos / 8; mask_pos = pos / 8;
if (bit_mask) if (bit_mask)
@ -4361,9 +4445,6 @@ bool rtw_wowlan_parser_pattern_cmd(u8 *input, char *pattern,
} }
pos++; pos++;
if (!cp)
break;
input = cp;
} }
(*pattern_len) = pos; (*pattern_len) = pos;
@ -4373,23 +4454,6 @@ error:
return _FALSE; return _FALSE;
} }
bool rtw_check_pattern_valid(u8 *input, u8 len)
{
int i = 0;
bool res = _FALSE;
if (len != 2)
goto exit;
for (i = 0 ; i < len ; i++)
if (IsHexDigit(input[i]) == _FALSE)
goto exit;
res = _SUCCESS;
exit:
return res;
}
void rtw_wow_pattern_sw_reset(_adapter *adapter) void rtw_wow_pattern_sw_reset(_adapter *adapter)
{ {
int i; int i;
@ -4810,6 +4874,7 @@ int rtw_dev_scan_info_set(_adapter *padapter, pno_ssid_t *ssid,
struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter);
struct pno_scan_info *scan_info = pwrctl->pscan_info; struct pno_scan_info *scan_info = pwrctl->pscan_info;
u8 band = ch <= 14 ? BAND_ON_2_4G : BAND_ON_5G;
int i; int i;
scan_info->channel_num = MAX_SCAN_LIST_COUNT; scan_info->channel_num = MAX_SCAN_LIST_COUNT;
@ -4826,7 +4891,7 @@ int rtw_dev_scan_info_set(_adapter *padapter, pno_ssid_t *ssid,
scan_info->ssid_channel_info[i].timeout = 100; scan_info->ssid_channel_info[i].timeout = 100;
scan_info->ssid_channel_info[i].tx_power = scan_info->ssid_channel_info[i].tx_power =
phy_get_tx_power_index(padapter, 0, 0x02, bw_mode, i + 1); phy_get_tx_power_index_ex(padapter, 0, CCK, MGN_1M, bw_mode, band, i + 1, i + 1);
scan_info->ssid_channel_info[i].channel = i + 1; scan_info->ssid_channel_info[i].channel = i + 1;
} }

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2007 - 2017 Realtek Corporation. * Copyright(c) 2007 - 2019 Realtek Corporation.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -17,11 +17,6 @@
#include <drv_types.h> #include <drv_types.h>
#include <hal_data.h> #include <hal_data.h>
#if defined(PLATFORM_LINUX) && defined (PLATFORM_WINDOWS)
#error "Shall be Linux or Windows, but not both!\n"
#endif
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
@ -467,14 +462,14 @@ u8 rtw_get_tx_bw_mode(_adapter *adapter, struct sta_info *sta)
return bw; return bw;
} }
void rtw_get_adapter_tx_rate_bmp_by_bw(_adapter *adapter, u8 bw, u16 *r_bmp_cck_ofdm, u32 *r_bmp_ht, u32 *r_bmp_vht) void rtw_get_adapter_tx_rate_bmp_by_bw(_adapter *adapter, u8 bw, u16 *r_bmp_cck_ofdm, u32 *r_bmp_ht, u64 *r_bmp_vht)
{ {
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj); struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj);
u8 fix_bw = 0xFF; u8 fix_bw = 0xFF;
u16 bmp_cck_ofdm = 0; u16 bmp_cck_ofdm = 0;
u32 bmp_ht = 0; u32 bmp_ht = 0;
u32 bmp_vht = 0; u64 bmp_vht = 0;
int i; int i;
if (adapter->fix_rate != 0xFF && adapter->fix_bw != 0xFF) if (adapter->fix_rate != 0xFF && adapter->fix_bw != 0xFF)
@ -511,12 +506,12 @@ void rtw_get_adapter_tx_rate_bmp_by_bw(_adapter *adapter, u8 bw, u16 *r_bmp_cck_
*r_bmp_vht = bmp_vht; *r_bmp_vht = bmp_vht;
} }
void rtw_get_shared_macid_tx_rate_bmp_by_bw(struct dvobj_priv *dvobj, u8 bw, u16 *r_bmp_cck_ofdm, u32 *r_bmp_ht, u32 *r_bmp_vht) void rtw_get_shared_macid_tx_rate_bmp_by_bw(struct dvobj_priv *dvobj, u8 bw, u16 *r_bmp_cck_ofdm, u32 *r_bmp_ht, u64 *r_bmp_vht)
{ {
struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj); struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj);
u16 bmp_cck_ofdm = 0; u16 bmp_cck_ofdm = 0;
u32 bmp_ht = 0; u32 bmp_ht = 0;
u32 bmp_vht = 0; u64 bmp_vht = 0;
int i; int i;
for (i = 0; i < macid_ctl->num; i++) { for (i = 0; i < macid_ctl->num; i++) {
@ -546,6 +541,38 @@ void rtw_get_shared_macid_tx_rate_bmp_by_bw(struct dvobj_priv *dvobj, u8 bw, u16
*r_bmp_vht = bmp_vht; *r_bmp_vht = bmp_vht;
} }
void rtw_get_adapter_tx_rate_bmp(_adapter *adapter, u16 r_bmp_cck_ofdm[], u32 r_bmp_ht[], u64 r_bmp_vht[])
{
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
u8 bw;
u16 bmp_cck_ofdm, tmp_cck_ofdm;
u32 bmp_ht, tmp_ht;
u64 bmp_vht, tmp_vht;
int i;
for (bw = CHANNEL_WIDTH_20; bw <= CHANNEL_WIDTH_160; bw++) {
bmp_cck_ofdm = bmp_ht = bmp_vht = 0;
if (hal_is_bw_support(adapter, bw)) {
{
rtw_get_adapter_tx_rate_bmp_by_bw(adapter, bw, &tmp_cck_ofdm, &tmp_ht, &tmp_vht);
bmp_cck_ofdm |= tmp_cck_ofdm;
bmp_ht |= tmp_ht;
bmp_vht |= tmp_vht;
}
rtw_get_shared_macid_tx_rate_bmp_by_bw(dvobj, bw, &tmp_cck_ofdm, &tmp_ht, &tmp_vht);
bmp_cck_ofdm |= tmp_cck_ofdm;
bmp_ht |= tmp_ht;
bmp_vht |= tmp_vht;
}
if (bw == CHANNEL_WIDTH_20)
r_bmp_cck_ofdm[bw] = bmp_cck_ofdm;
if (bw <= CHANNEL_WIDTH_40)
r_bmp_ht[bw] = bmp_ht;
if (bw <= CHANNEL_WIDTH_160)
r_bmp_vht[bw] = bmp_vht;
}
}
void rtw_update_tx_rate_bmp(struct dvobj_priv *dvobj) void rtw_update_tx_rate_bmp(struct dvobj_priv *dvobj)
{ {
struct rf_ctl_t *rf_ctl = dvobj_to_rfctl(dvobj); struct rf_ctl_t *rf_ctl = dvobj_to_rfctl(dvobj);
@ -554,15 +581,9 @@ void rtw_update_tx_rate_bmp(struct dvobj_priv *dvobj)
u8 bw; u8 bw;
u16 bmp_cck_ofdm, tmp_cck_ofdm; u16 bmp_cck_ofdm, tmp_cck_ofdm;
u32 bmp_ht, tmp_ht, ori_bmp_ht[2]; u32 bmp_ht, tmp_ht, ori_bmp_ht[2];
u8 ori_highest_ht_rate_bw_bmp; u64 bmp_vht, tmp_vht, ori_bmp_vht[4];
u32 bmp_vht, tmp_vht, ori_bmp_vht[4];
u8 ori_highest_vht_rate_bw_bmp;
int i; int i;
/* backup the original ht & vht highest bw bmp */
ori_highest_ht_rate_bw_bmp = rf_ctl->highest_ht_rate_bw_bmp;
ori_highest_vht_rate_bw_bmp = rf_ctl->highest_vht_rate_bw_bmp;
for (bw = CHANNEL_WIDTH_20; bw <= CHANNEL_WIDTH_160; bw++) { for (bw = CHANNEL_WIDTH_20; bw <= CHANNEL_WIDTH_160; bw++) {
/* backup the original ht & vht bmp */ /* backup the original ht & vht bmp */
if (bw <= CHANNEL_WIDTH_40) if (bw <= CHANNEL_WIDTH_40)
@ -593,16 +614,23 @@ void rtw_update_tx_rate_bmp(struct dvobj_priv *dvobj)
rf_ctl->rate_bmp_vht_by_bw[bw] = bmp_vht; rf_ctl->rate_bmp_vht_by_bw[bw] = bmp_vht;
} }
#if CONFIG_TXPWR_LIMIT
#ifndef DBG_HIGHEST_RATE_BMP_BW_CHANGE #ifndef DBG_HIGHEST_RATE_BMP_BW_CHANGE
#define DBG_HIGHEST_RATE_BMP_BW_CHANGE 0 #define DBG_HIGHEST_RATE_BMP_BW_CHANGE 0
#endif #endif
{ if (hal_data->txpwr_limit_loaded) {
u8 ori_highest_ht_rate_bw_bmp;
u8 ori_highest_vht_rate_bw_bmp;
u8 highest_rate_bw; u8 highest_rate_bw;
u8 highest_rate_bw_bmp; u8 highest_rate_bw_bmp;
u8 update_ht_rs = _FALSE; u8 update_ht_rs = _FALSE;
u8 update_vht_rs = _FALSE; u8 update_vht_rs = _FALSE;
/* backup the original ht & vht highest bw bmp */
ori_highest_ht_rate_bw_bmp = rf_ctl->highest_ht_rate_bw_bmp;
ori_highest_vht_rate_bw_bmp = rf_ctl->highest_vht_rate_bw_bmp;
highest_rate_bw_bmp = BW_CAP_20M; highest_rate_bw_bmp = BW_CAP_20M;
highest_rate_bw = CHANNEL_WIDTH_20; highest_rate_bw = CHANNEL_WIDTH_20;
for (bw = CHANNEL_WIDTH_20; bw <= CHANNEL_WIDTH_40; bw++) { for (bw = CHANNEL_WIDTH_20; bw <= CHANNEL_WIDTH_40; bw++) {
@ -621,6 +649,7 @@ void rtw_update_tx_rate_bmp(struct dvobj_priv *dvobj)
RTW_INFO("highest_ht_rate_bw_bmp:0x%02x=>0x%02x\n", ori_highest_ht_rate_bw_bmp, rf_ctl->highest_ht_rate_bw_bmp); RTW_INFO("highest_ht_rate_bw_bmp:0x%02x=>0x%02x\n", ori_highest_ht_rate_bw_bmp, rf_ctl->highest_ht_rate_bw_bmp);
RTW_INFO("rate_bmp_ht_by_bw[%u]:0x%08x=>0x%08x\n", highest_rate_bw, ori_bmp_ht[highest_rate_bw], rf_ctl->rate_bmp_ht_by_bw[highest_rate_bw]); RTW_INFO("rate_bmp_ht_by_bw[%u]:0x%08x=>0x%08x\n", highest_rate_bw, ori_bmp_ht[highest_rate_bw], rf_ctl->rate_bmp_ht_by_bw[highest_rate_bw]);
} }
if (rf_ctl->rate_bmp_ht_by_bw[highest_rate_bw])
update_ht_rs = _TRUE; update_ht_rs = _TRUE;
} }
@ -636,12 +665,13 @@ void rtw_update_tx_rate_bmp(struct dvobj_priv *dvobj)
rf_ctl->highest_vht_rate_bw_bmp = highest_rate_bw_bmp; rf_ctl->highest_vht_rate_bw_bmp = highest_rate_bw_bmp;
if (ori_highest_vht_rate_bw_bmp != rf_ctl->highest_vht_rate_bw_bmp if (ori_highest_vht_rate_bw_bmp != rf_ctl->highest_vht_rate_bw_bmp
|| largest_bit(ori_bmp_vht[highest_rate_bw]) != largest_bit(rf_ctl->rate_bmp_vht_by_bw[highest_rate_bw]) || largest_bit_64(ori_bmp_vht[highest_rate_bw]) != largest_bit_64(rf_ctl->rate_bmp_vht_by_bw[highest_rate_bw])
) { ) {
if (DBG_HIGHEST_RATE_BMP_BW_CHANGE) { if (DBG_HIGHEST_RATE_BMP_BW_CHANGE) {
RTW_INFO("highest_vht_rate_bw_bmp:0x%02x=>0x%02x\n", ori_highest_vht_rate_bw_bmp, rf_ctl->highest_vht_rate_bw_bmp); RTW_INFO("highest_vht_rate_bw_bmp:0x%02x=>0x%02x\n", ori_highest_vht_rate_bw_bmp, rf_ctl->highest_vht_rate_bw_bmp);
RTW_INFO("rate_bmp_vht_by_bw[%u]:0x%08x=>0x%08x\n", highest_rate_bw, ori_bmp_vht[highest_rate_bw], rf_ctl->rate_bmp_vht_by_bw[highest_rate_bw]); RTW_INFO("rate_bmp_vht_by_bw[%u]:0x%016llx=>0x%016llx\n", highest_rate_bw, ori_bmp_vht[highest_rate_bw], rf_ctl->rate_bmp_vht_by_bw[highest_rate_bw]);
} }
if (rf_ctl->rate_bmp_vht_by_bw[highest_rate_bw])
update_vht_rs = _TRUE; update_vht_rs = _TRUE;
} }
@ -649,27 +679,7 @@ void rtw_update_tx_rate_bmp(struct dvobj_priv *dvobj)
if (update_ht_rs == _TRUE || update_vht_rs == _TRUE) if (update_ht_rs == _TRUE || update_vht_rs == _TRUE)
rtw_hal_set_tx_power_level(dvobj_get_primary_adapter(dvobj), hal_data->current_channel); rtw_hal_set_tx_power_level(dvobj_get_primary_adapter(dvobj), hal_data->current_channel);
} }
} #endif /* CONFIG_TXPWR_LIMIT */
inline u16 rtw_get_tx_rate_bmp_cck_ofdm(struct dvobj_priv *dvobj)
{
struct rf_ctl_t *rf_ctl = dvobj_to_rfctl(dvobj);
return rf_ctl->rate_bmp_cck_ofdm;
}
inline u32 rtw_get_tx_rate_bmp_ht_by_bw(struct dvobj_priv *dvobj, u8 bw)
{
struct rf_ctl_t *rf_ctl = dvobj_to_rfctl(dvobj);
return rf_ctl->rate_bmp_ht_by_bw[bw];
}
inline u32 rtw_get_tx_rate_bmp_vht_by_bw(struct dvobj_priv *dvobj, u8 bw)
{
struct rf_ctl_t *rf_ctl = dvobj_to_rfctl(dvobj);
return rf_ctl->rate_bmp_vht_by_bw[bw];
} }
u8 rtw_get_tx_bw_bmp_of_ht_rate(struct dvobj_priv *dvobj, u8 rate, u8 max_bw) u8 rtw_get_tx_bw_bmp_of_ht_rate(struct dvobj_priv *dvobj, u8 rate, u8 max_bw)
@ -704,14 +714,14 @@ u8 rtw_get_tx_bw_bmp_of_vht_rate(struct dvobj_priv *dvobj, u8 rate, u8 max_bw)
struct rf_ctl_t *rf_ctl = dvobj_to_rfctl(dvobj); struct rf_ctl_t *rf_ctl = dvobj_to_rfctl(dvobj);
u8 bw; u8 bw;
u8 bw_bmp = 0; u8 bw_bmp = 0;
u32 rate_bmp; u64 rate_bmp;
if (!IS_VHT_RATE(rate)) { if (!IS_VHT_RATE(rate)) {
rtw_warn_on(1); rtw_warn_on(1);
goto exit; goto exit;
} }
rate_bmp = 1 << (rate - MGN_VHT1SS_MCS0); rate_bmp = 1ULL << (rate - MGN_VHT1SS_MCS0);
if (max_bw > CHANNEL_WIDTH_160) if (max_bw > CHANNEL_WIDTH_160)
max_bw = CHANNEL_WIDTH_160; max_bw = CHANNEL_WIDTH_160;
@ -726,6 +736,88 @@ exit:
return bw_bmp; return bw_bmp;
} }
s16 rtw_adapter_get_oper_txpwr_max_mbm(_adapter *adapter)
{
s16 mbm = -100 * MBM_PDBM;
if (MLME_IS_ASOC(adapter)) {
struct mlme_ext_priv *mlmeext = &adapter->mlmeextpriv;
u8 ch = mlmeext->cur_channel;
u8 bw = mlmeext->cur_bwmode;
u8 offset = mlmeext->cur_ch_offset;
u8 cch = rtw_get_center_ch(ch, bw, offset);
u8 hw_rate = MRateToHwRate(mlmeext->tx_rate);
u16 bmp_cck_ofdm_by_bw[1] = {0};
u32 bmp_ht_by_bw[2] = {0};
u64 bmp_vht_by_bw[4] = {0};
u16 bmp_cck_ofdm = 0;
u32 bmp_ht = 0;
u64 bmp_vht = 0;
int i;
rtw_get_adapter_tx_rate_bmp(adapter, bmp_cck_ofdm_by_bw, bmp_ht_by_bw, bmp_vht_by_bw);
bmp_cck_ofdm |= bmp_cck_ofdm_by_bw[0];
for (i = 0; i < 2; i++)
bmp_ht |= bmp_ht_by_bw[i];
for (i = 0; i < 4; i++)
bmp_vht |= bmp_vht_by_bw[i];
if (IS_LEGACY_HRATE(hw_rate))
bmp_cck_ofdm |= BIT(hw_rate);
else if (IS_HT_HRATE(hw_rate))
bmp_ht |= BIT(hw_rate - DESC_RATEMCS0);
else if (IS_VHT_HRATE(hw_rate))
bmp_vht |= BIT(hw_rate - DESC_RATEVHTSS1MCS0);
mbm = phy_get_txpwr_total_max_mbm(adapter
, bw, cch, ch, bmp_cck_ofdm, bmp_ht, bmp_vht);
}
return mbm;
}
s16 rtw_get_oper_txpwr_max_mbm(struct dvobj_priv *dvobj)
{
struct rf_ctl_t *rfctl = dvobj_to_rfctl(dvobj);
_adapter *adapter = dvobj_get_primary_adapter(dvobj);
s16 mbm = -100 * MBM_PDBM;
u8 ch, bw, offset;
if (rtw_mi_get_ch_setting_union(adapter, &ch, &bw, &offset)) {
u8 cch = rtw_get_center_ch(ch, bw, offset);
u16 bmp_cck_ofdm = 0;
u32 bmp_ht = 0;
u64 bmp_vht = 0;
int i;
for (i = 0; i < dvobj->iface_nums; i++) {
if (dvobj->padapters[i] && MLME_IS_ASOC(dvobj->padapters[i])) {
struct mlme_ext_priv *mlmeext = &(dvobj->padapters[i]->mlmeextpriv);
u8 hw_rate = MRateToHwRate(mlmeext->tx_rate);
if (IS_LEGACY_HRATE(hw_rate))
bmp_cck_ofdm |= BIT(hw_rate);
else if (IS_HT_HRATE(hw_rate))
bmp_ht |= BIT(hw_rate - DESC_RATEMCS0);
else if (IS_VHT_HRATE(hw_rate))
bmp_vht |= BIT(hw_rate - DESC_RATEVHTSS1MCS0);
}
}
bmp_cck_ofdm |= rfctl->rate_bmp_cck_ofdm;
for (i = 0; i < 2; i++)
bmp_ht |= rfctl->rate_bmp_ht_by_bw[i];
for (i = 0; i < 4; i++)
bmp_vht |= rfctl->rate_bmp_vht_by_bw[i];
mbm = phy_get_txpwr_total_max_mbm(adapter
, bw, cch, ch, bmp_cck_ofdm, bmp_ht, bmp_vht);
}
return mbm;
}
u8 query_ra_short_GI(struct sta_info *psta, u8 bw) u8 query_ra_short_GI(struct sta_info *psta, u8 bw)
{ {
u8 sgi = _FALSE, sgi_20m = _FALSE, sgi_40m = _FALSE, sgi_80m = _FALSE; u8 sgi = _FALSE, sgi_20m = _FALSE, sgi_40m = _FALSE, sgi_80m = _FALSE;
@ -923,8 +1015,7 @@ static void update_attrib_phy_info(_adapter *padapter, struct pkt_attrib *pattri
pattrib->triggered = 0; pattrib->triggered = 0;
pattrib->ampdu_spacing = 0; pattrib->ampdu_spacing = 0;
/* qos_en, ht_en, init rate, ,bw, ch_offset, sgi */ /* ht_en, init rate, ,bw, ch_offset, sgi */
pattrib->qos_en = psta->qos_option;
pattrib->raid = psta->cmn.ra_info.rate_id; pattrib->raid = psta->cmn.ra_info.rate_id;
@ -983,12 +1074,6 @@ static void update_attrib_phy_info(_adapter *padapter, struct pkt_attrib *pattri
#endif /* CONFIG_TDLS */ #endif /* CONFIG_TDLS */
pattrib->retry_ctrl = _FALSE; pattrib->retry_ctrl = _FALSE;
#ifdef CONFIG_AUTO_AP_MODE
if (psta->isrc && psta->pid > 0)
pattrib->pctrl = _TRUE;
#endif
} }
static s32 update_attrib_sec_info(_adapter *padapter, struct pkt_attrib *pattrib, struct sta_info *psta) static s32 update_attrib_sec_info(_adapter *padapter, struct pkt_attrib *pattrib, struct sta_info *psta)
@ -1166,21 +1251,63 @@ u8 qos_acm(u8 acm_mask, u8 priority)
return change_priority; return change_priority;
} }
static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib) /* refer to IEEE802.11-2016 Table R-3; Comply with IETF RFC4594 */
static u8 tos_to_up(u8 tos)
{
u8 up = 0;
u8 dscp;
u8 mode = CONFIG_RTW_UP_MAPPING_RULE;
/* tos precedence mapping */
if (mode == 0) {
up = tos >> 5;
return up;
}
/* refer to IEEE802.11-2016 Table R-3;
* DCSP 32(CS4) comply with IETF RFC4594
*/
dscp = (tos >> 2);
if ( dscp == 0 )
up = 0;
else if ( dscp >= 1 && dscp <= 9)
up = 1;
else if ( dscp >= 10 && dscp <= 16)
up = 2;
else if ( dscp >= 17 && dscp <= 23)
up = 3;
else if ( dscp >= 24 && dscp <= 31)
up = 4;
else if ( dscp >= 33 && dscp <= 40)
up = 5;
else if ((dscp >= 41 && dscp <= 47) || (dscp == 32))
up = 6;
else if ( dscp >= 48 && dscp <= 63)
up = 7;
return up;
}
static void set_qos(_pkt *pkt, struct pkt_attrib *pattrib)
{ {
struct ethhdr etherhdr;
struct iphdr ip_hdr;
s32 UserPriority = 0; s32 UserPriority = 0;
if (!pkt)
_rtw_open_pktfile(ppktfile->pkt, ppktfile); goto null_pkt;
_rtw_pktfile_read(ppktfile, (unsigned char *)&etherhdr, ETH_HLEN);
/* get UserPriority from IP hdr */ /* get UserPriority from IP hdr */
if (pattrib->ether_type == 0x0800) { if (pattrib->ether_type == 0x0800) {
_rtw_pktfile_read(ppktfile, (u8 *)&ip_hdr, sizeof(ip_hdr)); struct pkt_file ppktfile;
struct ethhdr etherhdr;
struct iphdr ip_hdr;
_rtw_open_pktfile(pkt, &ppktfile);
_rtw_pktfile_read(&ppktfile, (unsigned char *)&etherhdr, ETH_HLEN);
_rtw_pktfile_read(&ppktfile, (u8 *)&ip_hdr, sizeof(ip_hdr));
/* UserPriority = (ntohs(ip_hdr.tos) >> 5) & 0x3; */ /* UserPriority = (ntohs(ip_hdr.tos) >> 5) & 0x3; */
UserPriority = ip_hdr.tos >> 5; UserPriority = tos_to_up(ip_hdr.tos);
} }
/* /*
else if (pattrib->ether_type == 0x888e) { else if (pattrib->ether_type == 0x888e) {
@ -1198,6 +1325,8 @@ static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
if (pattrib->ether_type == ETH_P_ARP) if (pattrib->ether_type == ETH_P_ARP)
UserPriority = 7; UserPriority = 7;
#endif/*CONFIG_IP_R_MONITOR*/ #endif/*CONFIG_IP_R_MONITOR*/
null_pkt:
pattrib->priority = UserPriority; pattrib->priority = UserPriority;
pattrib->hdrlen = WLAN_HDR_A3_QOS_LEN; pattrib->hdrlen = WLAN_HDR_A3_QOS_LEN;
pattrib->subtype = WIFI_QOS_DATA_TYPE; pattrib->subtype = WIFI_QOS_DATA_TYPE;
@ -1259,6 +1388,8 @@ s32 update_tdls_attrib(_adapter *padapter, struct pkt_attrib *pattrib)
/* get ether_hdr_len */ /* get ether_hdr_len */
pattrib->pkt_hdrlen = ETH_HLEN; pattrib->pkt_hdrlen = ETH_HLEN;
pattrib->qos_en = psta->qos_option;
/* [TDLS] TODO: setup req/rsp should be AC_BK */ /* [TDLS] TODO: setup req/rsp should be AC_BK */
if (pqospriv->qos_option && psta->qos_option) { if (pqospriv->qos_option && psta->qos_option) {
pattrib->priority = 4; /* tdls management frame should be AC_VI */ pattrib->priority = 4; /* tdls management frame should be AC_VI */
@ -1292,7 +1423,7 @@ inline u8 rtw_get_hwseq_no(_adapter *padapter)
u8 hwseq_num = 0; u8 hwseq_num = 0;
#ifdef CONFIG_CONCURRENT_MODE #ifdef CONFIG_CONCURRENT_MODE
#if defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8822C) #if defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8822C) || defined(CONFIG_RTL8814B)
hwseq_num = padapter->iface_id; hwseq_num = padapter->iface_id;
if (hwseq_num > 3) if (hwseq_num > 3)
hwseq_num = 3; hwseq_num = 3;
@ -1431,15 +1562,16 @@ get_sta_info:
pattrib->icmp_pkt = 0; pattrib->icmp_pkt = 0;
pattrib->dhcp_pkt = 0; pattrib->dhcp_pkt = 0;
pattrib->hipriority_pkt = 0;
if (GET_IPV4_PROTOCOL(ip) == 0x01) { /* ICMP */ if (GET_IPV4_PROTOCOL(ip) == 0x01) { /* ICMP */
pattrib->icmp_pkt = 1; pattrib->icmp_pkt = 1;
DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_icmp); DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_icmp);
} else if (GET_IPV4_PROTOCOL(ip) == 0x11) { /* UDP */ } else if (GET_IPV4_PROTOCOL(ip) == 0x11) { /* UDP */
u8 udp[8]; u8 udp[24];
_rtw_pktfile_read(&pktfile, udp, 8); _rtw_pktfile_read(&pktfile, udp, 24);
if ((GET_UDP_SRC(udp) == 68 && GET_UDP_DST(udp) == 67) if ((GET_UDP_SRC(udp) == 68 && GET_UDP_DST(udp) == 67)
|| (GET_UDP_SRC(udp) == 67 && GET_UDP_DST(udp) == 68) || (GET_UDP_SRC(udp) == 67 && GET_UDP_DST(udp) == 68)
@ -1453,6 +1585,12 @@ get_sta_info:
} }
} }
/* WaveAgent packet, increase priority so that the system can read data in time */
if (((GET_UDP_SIG1(udp) == 0xcc) || (GET_UDP_SIG1(udp) == 0xdd)) &&
(GET_UDP_SIG2(udp) == 0xe2)) {
pattrib->hipriority_pkt = 1;
}
} else if (GET_IPV4_PROTOCOL(ip) == 0x06 /* TCP */ } else if (GET_IPV4_PROTOCOL(ip) == 0x06 /* TCP */
&& rtw_st_ctl_chk_reg_s_proto(&psta->st_ctl, 0x06) == _TRUE && rtw_st_ctl_chk_reg_s_proto(&psta->st_ctl, 0x06) == _TRUE
) { ) {
@ -1486,7 +1624,7 @@ get_sta_info:
} else if (0x888e == pattrib->ether_type) } else if (0x888e == pattrib->ether_type)
parsing_eapol_packet(padapter, pktfile.cur_addr, psta, 1); parsing_eapol_packet(padapter, pktfile.cur_addr, psta, 1);
#ifdef DBG_ARP_DUMP #if defined (DBG_ARP_DUMP) || defined (DBG_IP_R_MONITOR)
else if (pattrib->ether_type == ETH_P_ARP) { else if (pattrib->ether_type == ETH_P_ARP) {
u8 arp[28] = {0}; u8 arp[28] = {0};
@ -1510,9 +1648,9 @@ get_sta_info:
if (pkt_type == LPS_PT_SP) {/*packet is as SPECIAL_PACKET*/ if (pkt_type == LPS_PT_SP) {/*packet is as SPECIAL_PACKET*/
DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_active); DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_active);
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET, 1); rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET, 0);
} else if (pkt_type == LPS_PT_ICMP) } else if (pkt_type == LPS_PT_ICMP)
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 1); rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 0);
#endif /* CONFIG_LPS */ #endif /* CONFIG_LPS */
#ifdef CONFIG_BEAMFORMING #ifdef CONFIG_BEAMFORMING
@ -1526,31 +1664,19 @@ get_sta_info:
goto exit; goto exit;
} }
update_attrib_phy_info(padapter, pattrib, psta);
/* RTW_INFO("%s ==> mac_id(%d)\n",__FUNCTION__,pattrib->mac_id ); */
pattrib->psta = psta;
/* TODO:_unlock */
pattrib->pctrl = 0;
pattrib->ack_policy = 0;
/* get ether_hdr_len */ /* get ether_hdr_len */
pattrib->pkt_hdrlen = ETH_HLEN;/* (pattrib->ether_type == 0x8100) ? (14 + 4 ): 14; */ /* vlan tag */ pattrib->pkt_hdrlen = ETH_HLEN;/* (pattrib->ether_type == 0x8100) ? (14 + 4 ): 14; */ /* vlan tag */
pattrib->hdrlen = WLAN_HDR_A3_LEN; pattrib->hdrlen = WLAN_HDR_A3_LEN;
pattrib->subtype = WIFI_DATA_TYPE; pattrib->subtype = WIFI_DATA_TYPE;
pattrib->qos_en = psta->qos_option;
pattrib->priority = 0; pattrib->priority = 0;
if (bmcast)
pattrib->rate = psta->init_rate;
if (check_fwstate(pmlmepriv, WIFI_AP_STATE | WIFI_MESH_STATE if (check_fwstate(pmlmepriv, WIFI_AP_STATE | WIFI_MESH_STATE
| WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE) | WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE)
) { ) {
if (pattrib->qos_en) { if (pattrib->qos_en) {
set_qos(&pktfile, pattrib); set_qos(pkt, pattrib);
#ifdef CONFIG_RTW_MESH #ifdef CONFIG_RTW_MESH
if (MLME_IS_MESH(padapter)) if (MLME_IS_MESH(padapter))
rtw_mesh_tx_set_whdr_mctrl_len(pattrib->mesh_frame_mode, pattrib); rtw_mesh_tx_set_whdr_mctrl_len(pattrib->mesh_frame_mode, pattrib);
@ -1560,12 +1686,12 @@ get_sta_info:
#ifdef CONFIG_TDLS #ifdef CONFIG_TDLS
if (pattrib->direct_link == _TRUE) { if (pattrib->direct_link == _TRUE) {
if (pattrib->qos_en) if (pattrib->qos_en)
set_qos(&pktfile, pattrib); set_qos(pkt, pattrib);
} else } else
#endif #endif
{ {
if (pqospriv->qos_option) { if (pqospriv->qos_option) {
set_qos(&pktfile, pattrib); set_qos(pkt, pattrib);
if (pmlmepriv->acm_mask != 0) if (pmlmepriv->acm_mask != 0)
pattrib->priority = qos_acm(pmlmepriv->acm_mask, pattrib->priority); pattrib->priority = qos_acm(pmlmepriv->acm_mask, pattrib->priority);
@ -1573,6 +1699,26 @@ get_sta_info:
} }
} }
update_attrib_phy_info(padapter, pattrib, psta);
/* RTW_INFO("%s ==> mac_id(%d)\n",__FUNCTION__,pattrib->mac_id ); */
pattrib->psta = psta;
/* TODO:_unlock */
#ifdef CONFIG_AUTO_AP_MODE
if (psta->isrc && psta->pid > 0)
pattrib->pctrl = _TRUE;
else
#endif
pattrib->pctrl = 0;
pattrib->ack_policy = 0;
if (bmcast)
pattrib->rate = psta->init_rate;
#ifdef CONFIG_WMMPS_STA #ifdef CONFIG_WMMPS_STA
update_attrib_trigger_frame_info(padapter, pattrib); update_attrib_trigger_frame_info(padapter, pattrib);
#endif /* CONFIG_WMMPS_STA */ #endif /* CONFIG_WMMPS_STA */
@ -4379,8 +4525,10 @@ static void do_queue_select(_adapter *padapter, struct pkt_attrib *pattrib)
if (padapter->mcc_adapterpriv.role == MCC_ROLE_GO if (padapter->mcc_adapterpriv.role == MCC_ROLE_GO
|| padapter->mcc_adapterpriv.role == MCC_ROLE_AP) { || padapter->mcc_adapterpriv.role == MCC_ROLE_AP) {
pattrib->qsel = QSLT_VO; /* AP interface VO queue */ pattrib->qsel = QSLT_VO; /* AP interface VO queue */
pattrib->priority = QSLT_VO;
} else { } else {
pattrib->qsel = QSLT_BE; /* STA interface BE queue */ pattrib->qsel = QSLT_BE; /* STA interface BE queue */
pattrib->priority = QSLT_BE;
} }
} else } else
/* Not Under MCC */ /* Not Under MCC */
@ -4391,6 +4539,12 @@ static void do_queue_select(_adapter *padapter, struct pkt_attrib *pattrib)
#else /* !CONFIG_MCC_MODE */ #else /* !CONFIG_MCC_MODE */
pattrib->qsel = qsel; pattrib->qsel = qsel;
#endif /* CONFIG_MCC_MODE */ #endif /* CONFIG_MCC_MODE */
/* high priority packet */
if (pattrib->hipriority_pkt) {
pattrib->qsel = QSLT_VO;
pattrib->priority = QSLT_VO;
}
} }
/* /*
@ -4484,6 +4638,124 @@ fail:
} }
#endif #endif
/*
*
* Return _TRUE when frame has been put to queue, otherwise return _FALSE.
*/
static u8 xmit_enqueue(struct _ADAPTER *a, struct xmit_frame *frame)
{
struct sta_info *sta = NULL;
struct pkt_attrib *attrib = NULL;
_irqL irqL;
_list *head;
u8 ret = _TRUE;
attrib = &frame->attrib;
sta = attrib->psta;
if (!sta)
return _FALSE;
_enter_critical_bh(&sta->tx_queue.lock, &irqL);
head = get_list_head(&sta->tx_queue);
if ((rtw_is_list_empty(head) == _TRUE) && (!sta->tx_q_enable)) {
ret = _FALSE;
goto exit;
}
rtw_list_insert_tail(&frame->list, head);
RTW_INFO(FUNC_ADPT_FMT ": en-queue tx pkt for macid=%d\n",
FUNC_ADPT_ARG(a), sta->cmn.mac_id);
exit:
_exit_critical_bh(&sta->tx_queue.lock, &irqL);
return ret;
}
static void xmit_dequeue(struct sta_info *sta)
{
struct _ADAPTER *a;
_irqL irqL;
_list *head, *list;
struct xmit_frame *frame;
a = sta->padapter;
_enter_critical_bh(&sta->tx_queue.lock, &irqL);
head = get_list_head(&sta->tx_queue);
do {
if (rtw_is_list_empty(head) == _TRUE)
break;
list = get_next(head);
rtw_list_delete(list);
frame = LIST_CONTAINOR(list, struct xmit_frame, list);
RTW_INFO(FUNC_ADPT_FMT ": de-queue tx frame of macid=%d\n",
FUNC_ADPT_ARG(a), sta->cmn.mac_id);
rtw_hal_xmit(a, frame);
} while (1);
_exit_critical_bh(&sta->tx_queue.lock, &irqL);
}
void rtw_xmit_dequeue_callback(_workitem *work)
{
struct sta_info *sta;
sta = container_of(work, struct sta_info, tx_q_work);
xmit_dequeue(sta);
}
void rtw_xmit_queue_set(struct sta_info *sta)
{
_irqL irqL;
_enter_critical_bh(&sta->tx_queue.lock, &irqL);
if (sta->tx_q_enable) {
RTW_WARN(FUNC_ADPT_FMT ": duplicated set!\n",
FUNC_ADPT_ARG(sta->padapter));
goto exit;
}
sta->tx_q_enable = 1;
RTW_INFO(FUNC_ADPT_FMT ": enable queue TX for macid=%d\n",
FUNC_ADPT_ARG(sta->padapter), sta->cmn.mac_id);
exit:
_exit_critical_bh(&sta->tx_queue.lock, &irqL);
}
void rtw_xmit_queue_clear(struct sta_info *sta)
{
_irqL irqL;
_enter_critical_bh(&sta->tx_queue.lock, &irqL);
if (!sta->tx_q_enable) {
RTW_WARN(FUNC_ADPT_FMT ": tx queue for macid=%d "
"not be enabled!\n",
FUNC_ADPT_ARG(sta->padapter), sta->cmn.mac_id);
goto exit;
}
sta->tx_q_enable = 0;
RTW_INFO(FUNC_ADPT_FMT ": disable queue TX for macid=%d\n",
FUNC_ADPT_ARG(sta->padapter), sta->cmn.mac_id);
_set_workitem(&sta->tx_q_work);
exit:
_exit_critical_bh(&sta->tx_queue.lock, &irqL);
}
/* /*
* The main transmit(tx) entry post handle * The main transmit(tx) entry post handle
* *
@ -4539,6 +4811,9 @@ s32 rtw_xmit_posthandle(_adapter *padapter, struct xmit_frame *pxmitframe, _pkt
_exit_critical_bh(&pxmitpriv->lock, &irqL0); _exit_critical_bh(&pxmitpriv->lock, &irqL0);
#endif #endif
if (xmit_enqueue(padapter, pxmitframe) == _TRUE)
return 1;
/* pre_xmitframe */ /* pre_xmitframe */
if (rtw_hal_xmit(padapter, pxmitframe) == _FALSE) if (rtw_hal_xmit(padapter, pxmitframe) == _FALSE)
return 1; return 1;
@ -4853,9 +5128,9 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p
/* RTW_INFO_DUMP("enqueue, tim=", pstapriv->tim_bitmap, pstapriv->aid_bmp_len); */ /* RTW_INFO_DUMP("enqueue, tim=", pstapriv->tim_bitmap, pstapriv->aid_bmp_len); */
if (update_tim == _TRUE) { if (update_tim == _TRUE) {
if (is_broadcast_mac_addr(pattrib->ra)) if (is_broadcast_mac_addr(pattrib->ra))
_update_beacon(padapter, _TIM_IE_, NULL, _TRUE, "buffer BC"); _update_beacon(padapter, _TIM_IE_, NULL, _TRUE, 0, "buffer BC");
else else
_update_beacon(padapter, _TIM_IE_, NULL, _TRUE, "buffer MC"); _update_beacon(padapter, _TIM_IE_, NULL, _TRUE, 0, "buffer MC");
} else } else
chk_bmc_sleepq_cmd(padapter); chk_bmc_sleepq_cmd(padapter);
@ -4922,7 +5197,7 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p
if (update_tim == _TRUE) { if (update_tim == _TRUE) {
/* RTW_INFO("sleepq_len==1, update BCNTIM\n"); */ /* RTW_INFO("sleepq_len==1, update BCNTIM\n"); */
/* upate BCN for TIM IE */ /* upate BCN for TIM IE */
_update_beacon(padapter, _TIM_IE_, NULL, _TRUE, "buffer UC"); _update_beacon(padapter, _TIM_IE_, NULL, _TRUE, 0, "buffer UC");
} }
} }
@ -5207,11 +5482,11 @@ _exit:
if (update_mask) { if (update_mask) {
/* update_BCNTIM(padapter); */ /* update_BCNTIM(padapter); */
if ((update_mask & (BIT(0) | BIT(1))) == (BIT(0) | BIT(1))) if ((update_mask & (BIT(0) | BIT(1))) == (BIT(0) | BIT(1)))
_update_beacon(padapter, _TIM_IE_, NULL, _TRUE, "clear UC&BMC"); _update_beacon(padapter, _TIM_IE_, NULL, _TRUE, 0, "clear UC&BMC");
else if ((update_mask & BIT(1)) == BIT(1)) else if ((update_mask & BIT(1)) == BIT(1))
_update_beacon(padapter, _TIM_IE_, NULL, _TRUE, "clear BMC"); _update_beacon(padapter, _TIM_IE_, NULL, _TRUE, 0, "clear BMC");
else else
_update_beacon(padapter, _TIM_IE_, NULL, _TRUE, "clear UC"); _update_beacon(padapter, _TIM_IE_, NULL, _TRUE, 0, "clear UC");
} }
} }
@ -5289,7 +5564,7 @@ void xmit_delivery_enabled_frames(_adapter *padapter, struct sta_info *psta)
/* RTW_INFO_DUMP("update_BCNTIM, tim=", pstapriv->tim_bitmap, pstapriv->aid_bmp_len); */ /* RTW_INFO_DUMP("update_BCNTIM, tim=", pstapriv->tim_bitmap, pstapriv->aid_bmp_len); */
/* upate BCN for TIM IE */ /* upate BCN for TIM IE */
/* update_BCNTIM(padapter); */ /* update_BCNTIM(padapter); */
update_beacon(padapter, _TIM_IE_, NULL, _TRUE); update_beacon(padapter, _TIM_IE_, NULL, _TRUE, 0);
/* update_mask = BIT(0); */ /* update_mask = BIT(0); */
} }
@ -5382,7 +5657,6 @@ static struct xmit_buf *dequeue_pending_xmitbuf_ext(
if (_rtw_queue_empty(pqueue) == _FALSE) { if (_rtw_queue_empty(pqueue) == _FALSE) {
_list *plist, *phead; _list *plist, *phead;
u8 type = 0;
phead = get_list_head(pqueue); phead = get_list_head(pqueue);
plist = phead; plist = phead;
@ -5444,7 +5718,13 @@ thread_return rtw_xmit_thread(thread_context context)
{ {
s32 err; s32 err;
PADAPTER padapter; PADAPTER padapter;
#ifdef RTW_XMIT_THREAD_HIGH_PRIORITY
#ifdef PLATFORM_LINUX
struct sched_param param = { .sched_priority = 1 };
sched_setscheduler(current, SCHED_FIFO, &param);
#endif /* PLATFORM_LINUX */
#endif /* RTW_XMIT_THREAD_HIGH_PRIORITY */
err = _SUCCESS; err = _SUCCESS;
padapter = (PADAPTER)context; padapter = (PADAPTER)context;
@ -5544,7 +5824,7 @@ bool rtw_xmit_ac_blocked(_adapter *adapter)
#endif/* #ifdef DBG_CONFIG_ERROR_DETECT */ #endif/* #ifdef DBG_CONFIG_ERROR_DETECT */
if (rfctl->offch_state != OFFCHS_NONE if (rfctl->offch_state != OFFCHS_NONE
#ifdef CONFIG_DFS #if CONFIG_DFS
|| IS_RADAR_DETECTED(rfctl) || rfctl->csa_ch || IS_RADAR_DETECTED(rfctl) || rfctl->csa_ch
#endif #endif
) { ) {
@ -5787,6 +6067,61 @@ u8 rtw_get_tx_desc_backup(_adapter *padapter, u8 hwq, struct rtw_tx_desc_backup
} }
#endif #endif
#ifdef CONFIG_PCI_TX_POLLING
void rtw_tx_poll_init(_adapter *padapter)
{
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
_timer* timer = &pxmitpriv->tx_poll_timer;
if (!is_primary_adapter(padapter))
return;
if (timer->function != NULL) {
RTW_INFO("tx polling timer has been init.\n");
return;
}
rtw_init_timer(timer, padapter, rtw_tx_poll_timeout_handler, padapter);
rtw_tx_poll_timer_set(padapter, 1);
RTW_INFO("Tx poll timer init!\n");
}
void rtw_tx_poll_timeout_handler(void *FunctionContext)
{
_adapter *adapter = (_adapter *)FunctionContext;
rtw_tx_poll_timer_set(adapter, 1);
if (adapter->hal_func.tx_poll_handler)
adapter->hal_func.tx_poll_handler(adapter);
else
RTW_WARN("hal ops: tx_poll_handler is NULL\n");
}
void rtw_tx_poll_timer_set(_adapter *padapter, u32 delay)
{
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
_timer* timer = NULL;
timer = &pxmitpriv->tx_poll_timer;
_set_timer(timer, delay);
}
void rtw_tx_poll_timer_cancel(_adapter *padapter)
{
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
_timer* timer = NULL;
if (!is_primary_adapter(padapter))
return;
timer = &pxmitpriv->tx_poll_timer;
_cancel_timer_ex(timer);
timer->function = NULL;
RTW_INFO("Tx poll timer cancel !\n");
}
#endif /* CONFIG_PCI_TX_POLLING */
void rtw_sctx_init(struct submit_ctx *sctx, int timeout_ms) void rtw_sctx_init(struct submit_ctx *sctx, int timeout_ms)
{ {
sctx->timeout_ms = timeout_ms; sctx->timeout_ms = timeout_ms;

53
hal/btc/btc_basic_types.h Normal file
View File

@ -0,0 +1,53 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2017 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*****************************************************************************/
#ifndef __BTC_BASIC_TYPES_H__
#define __BTC_BASIC_TYPES_H__
#define IN
#define OUT
#define VOID void
typedef void *PVOID;
#define u1Byte u8
#define pu1Byte u8*
#define u2Byte u16
#define pu2Byte u16*
#define u4Byte u32
#define pu4Byte u32*
#define u8Byte u64
#define pu8Byte u64*
#define s1Byte s8
#define ps1Byte s8*
#define s2Byte s16
#define ps2Byte s16*
#define s4Byte s32
#define ps4Byte s32*
#define s8Byte s64
#define ps8Byte s64*
#define UCHAR u8
#define USHORT u16
#define UINT u32
#define ULONG u32
#define PULONG u32*
#endif /* __BTC_BASIC_TYPES_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -78,6 +78,8 @@ enum bt_info_src_8822b_1ant {
BT_8822B_1ANT_INFO_SRC_WIFI_FW = 0x0, BT_8822B_1ANT_INFO_SRC_WIFI_FW = 0x0,
BT_8822B_1ANT_INFO_SRC_BT_RSP = 0x1, BT_8822B_1ANT_INFO_SRC_BT_RSP = 0x1,
BT_8822B_1ANT_INFO_SRC_BT_ACT = 0x2, BT_8822B_1ANT_INFO_SRC_BT_ACT = 0x2,
BT_8822B_1ANT_INFO_SRC_BT_IQK = 0x3,
BT_8822B_1ANT_INFO_SRC_BT_SCBD = 0x4,
BT_8822B_1ANT_INFO_SRC_MAX BT_8822B_1ANT_INFO_SRC_MAX
}; };
@ -168,7 +170,9 @@ enum bt_8822b_1ant_scoreboard {
BT_8822B_1ANT_SCBD_RXGAIN = BIT(4), BT_8822B_1ANT_SCBD_RXGAIN = BIT(4),
BT_8822B_1ANT_SCBD_WLBUSY = BIT(6), BT_8822B_1ANT_SCBD_WLBUSY = BIT(6),
BT_8822B_1ANT_SCBD_EXTFEM = BIT(8), BT_8822B_1ANT_SCBD_EXTFEM = BIT(8),
BT_8822B_1ANT_SCBD_CQDDR = BIT(10) BT_8822B_1ANT_SCBD_TDMA = BIT(9),
BT_8822B_1ANT_SCBD_CQDDR = BIT(10),
BT_8822B_1ANT_SCBD_ALL = 0xffff
}; };
enum bt_8822b_1ant_RUNREASON { enum bt_8822b_1ant_RUNREASON {
@ -252,6 +256,7 @@ struct coex_sta_8822b_1ant {
boolean hid_exist; boolean hid_exist;
boolean pan_exist; boolean pan_exist;
boolean msft_mr_exist; boolean msft_mr_exist;
boolean bt_a2dp_active;
u8 num_of_profile; u8 num_of_profile;
boolean under_lps; boolean under_lps;
@ -309,7 +314,7 @@ struct coex_sta_8822b_1ant {
u8 isolation_btween_wb; /* 0~ 50 */ u8 isolation_btween_wb; /* 0~ 50 */
u8 a2dp_bit_pool; u8 a2dp_bit_pool;
u8 cut_version; u8 kt_ver;
boolean acl_busy; boolean acl_busy;
boolean bt_create_connection; boolean bt_create_connection;
@ -324,6 +329,8 @@ struct coex_sta_8822b_1ant {
boolean is_A2DP_3M; boolean is_A2DP_3M;
boolean voice_over_HOGP; boolean voice_over_HOGP;
boolean bt_418_hid_exist;
boolean bt_ble_hid_exist;
u8 forbidden_slot; u8 forbidden_slot;
u8 hid_busy_num; u8 hid_busy_num;
u8 hid_pair_cnt; u8 hid_pair_cnt;
@ -334,6 +341,7 @@ struct coex_sta_8822b_1ant {
u32 cnt_ign_wlan_act; u32 cnt_ign_wlan_act;
u32 cnt_page; u32 cnt_page;
u32 cnt_role_switch; u32 cnt_role_switch;
u32 cnt_wl_fw_notify;
u16 bt_reg_vendor_ac; u16 bt_reg_vendor_ac;
u16 bt_reg_vendor_ae; u16 bt_reg_vendor_ae;
@ -344,12 +352,9 @@ struct coex_sta_8822b_1ant {
u8 bt_afh_map[10]; u8 bt_afh_map[10];
u8 bt_relink_downcount; u8 bt_relink_downcount;
boolean is_tdma_btautoslot; boolean is_tdma_btautoslot;
boolean is_tdma_btautoslot_hang;
u8 switch_band_notify_to; u8 switch_band_notify_to;
boolean is_rf_state_off;
boolean is_hid_low_pri_tx_overhead;
boolean is_bt_multi_link; boolean is_bt_multi_link;
boolean is_bt_a2dp_sink; boolean is_bt_a2dp_sink;
@ -364,10 +369,13 @@ struct coex_sta_8822b_1ant {
u8 wl_tx_macid; u8 wl_tx_macid;
u8 wl_tx_retry_ratio; u8 wl_tx_retry_ratio;
boolean is_2g_freerun;
u16 score_board_WB; u16 score_board_WB;
boolean is_hid_rcu; boolean is_hid_rcu;
u8 bt_a2dp_vendor_id; u8 bt_a2dp_vendor_id;
u32 bt_a2dp_device_name; u32 bt_a2dp_device_name;
u32 bt_a2dp_flush_time;
boolean is_ble_scan_en; boolean is_ble_scan_en;
boolean is_bt_opp_exist; boolean is_bt_opp_exist;
@ -394,6 +402,10 @@ struct coex_sta_8822b_1ant {
boolean wl_rxagg_limit_en; boolean wl_rxagg_limit_en;
u8 wl_rxagg_size; u8 wl_rxagg_size;
u8 coex_run_reason; u8 coex_run_reason;
u8 tdma_timer_base;
boolean wl_slot_toggle;
boolean wl_slot_toggle_change; /* if toggle to no-toggle */
}; };
struct rfe_type_8822b_1ant { struct rfe_type_8822b_1ant {
@ -410,6 +422,7 @@ struct wifi_link_info_8822b_1ant {
boolean is_all_under_5g; boolean is_all_under_5g;
boolean is_mcc_25g; boolean is_mcc_25g;
boolean is_p2p_connected; boolean is_p2p_connected;
boolean is_connected;
}; };
/* ******************************************* /* *******************************************

File diff suppressed because it is too large Load Diff

View File

@ -100,6 +100,8 @@ enum bt_info_src_8822b_2ant {
BT_8822B_2ANT_INFO_SRC_WIFI_FW = 0x0, BT_8822B_2ANT_INFO_SRC_WIFI_FW = 0x0,
BT_8822B_2ANT_INFO_SRC_BT_RSP = 0x1, BT_8822B_2ANT_INFO_SRC_BT_RSP = 0x1,
BT_8822B_2ANT_INFO_SRC_BT_ACT = 0x2, BT_8822B_2ANT_INFO_SRC_BT_ACT = 0x2,
BT_8822B_2ANT_INFO_SRC_BT_IQK = 0x3,
BT_8822B_2ANT_INFO_SRC_BT_SCBD = 0x4,
BT_8822B_2ANT_INFO_SRC_MAX BT_8822B_2ANT_INFO_SRC_MAX
}; };
@ -179,7 +181,9 @@ enum bt_8822b_2ant_scoreboard {
BT_8822B_2ANT_SCBD_RXGAIN = BIT(4), BT_8822B_2ANT_SCBD_RXGAIN = BIT(4),
BT_8822B_2ANT_SCBD_WLBUSY = BIT(6), BT_8822B_2ANT_SCBD_WLBUSY = BIT(6),
BT_8822B_2ANT_SCBD_EXTFEM = BIT(8), BT_8822B_2ANT_SCBD_EXTFEM = BIT(8),
BT_8822B_2ANT_SCBD_CQDDR = BIT(10) BT_8822B_2ANT_SCBD_TDMA = BIT(9),
BT_8822B_2ANT_SCBD_CQDDR = BIT(10),
BT_8822B_2ANT_SCBD_ALL = 0xffff
}; };
enum bt_8822b_2ant_RUNREASON { enum bt_8822b_2ant_RUNREASON {
@ -247,11 +251,9 @@ struct coex_dm_8822b_2ant {
u8 cur_lps; u8 cur_lps;
u8 cur_rpwm; u8 cur_rpwm;
boolean is_switch_to_1dot5_ant;
u32 arp_cnt; u32 arp_cnt;
u32 cur_ext_ant_switch_status; u32 cur_switch_status;
u32 setting_tdma; u32 setting_tdma;
}; };
@ -263,6 +265,7 @@ struct coex_sta_8822b_2ant {
boolean hid_exist; boolean hid_exist;
boolean pan_exist; boolean pan_exist;
boolean msft_mr_exist; boolean msft_mr_exist;
boolean bt_a2dp_active;
boolean under_lps; boolean under_lps;
boolean under_ips; boolean under_ips;
@ -310,7 +313,7 @@ struct coex_sta_8822b_2ant {
u8 dis_ver_info_cnt; u8 dis_ver_info_cnt;
u8 a2dp_bit_pool; u8 a2dp_bit_pool;
u8 cut_version; u8 kt_ver;
boolean concurrent_rx_mode_on; boolean concurrent_rx_mode_on;
@ -338,6 +341,8 @@ struct coex_sta_8822b_2ant {
boolean is_A2DP_3M; boolean is_A2DP_3M;
boolean voice_over_HOGP; boolean voice_over_HOGP;
boolean bt_418_hid_exist;
boolean bt_ble_hid_exist;
boolean is_autoslot; boolean is_autoslot;
u8 forbidden_slot; u8 forbidden_slot;
u8 hid_busy_num; u8 hid_busy_num;
@ -349,6 +354,7 @@ struct coex_sta_8822b_2ant {
u32 cnt_ign_wlan_act; u32 cnt_ign_wlan_act;
u32 cnt_page; u32 cnt_page;
u32 cnt_role_switch; u32 cnt_role_switch;
u32 cnt_wl_fw_notify;
u16 bt_reg_vendor_ac; u16 bt_reg_vendor_ac;
u16 bt_reg_vendor_ae; u16 bt_reg_vendor_ae;
@ -360,13 +366,10 @@ struct coex_sta_8822b_2ant {
u8 bt_afh_map[10]; u8 bt_afh_map[10];
u8 bt_relink_downcount; u8 bt_relink_downcount;
boolean is_tdma_btautoslot; boolean is_tdma_btautoslot;
boolean is_tdma_btautoslot_hang;
boolean is_esco_mode; boolean is_esco_mode;
u8 switch_band_notify_to; u8 switch_band_notify_to;
boolean is_rf_state_off;
boolean is_hid_low_pri_tx_overhead;
boolean is_bt_multi_link; boolean is_bt_multi_link;
boolean is_bt_a2dp_sink; boolean is_bt_a2dp_sink;
@ -387,6 +390,7 @@ struct coex_sta_8822b_2ant {
boolean is_hid_rcu; boolean is_hid_rcu;
u8 bt_a2dp_vendor_id; u8 bt_a2dp_vendor_id;
u32 bt_a2dp_device_name; u32 bt_a2dp_device_name;
u32 bt_a2dp_flush_time;
boolean is_ble_scan_en; boolean is_ble_scan_en;
boolean is_bt_opp_exist; boolean is_bt_opp_exist;
@ -413,6 +417,10 @@ struct coex_sta_8822b_2ant {
boolean wl_rxagg_limit_en; boolean wl_rxagg_limit_en;
u8 wl_rxagg_size; u8 wl_rxagg_size;
u8 coex_run_reason; u8 coex_run_reason;
u8 tdma_timer_base;
boolean wl_slot_toggle;
boolean wl_slot_toggle_change; /* if toggle to no-toggle */
}; };
#define BT_8822B_2ANT_EXT_BAND_SWITCH_USE_DPDT 0 #define BT_8822B_2ANT_EXT_BAND_SWITCH_USE_DPDT 0
@ -441,6 +449,7 @@ struct wifi_link_info_8822b_2ant {
boolean is_all_under_5g; boolean is_all_under_5g;
boolean is_mcc_25g; boolean is_mcc_25g;
boolean is_p2p_connected; boolean is_p2p_connected;
boolean is_connected;
}; };
/* ******************************************* /* *******************************************

View File

@ -35,9 +35,6 @@ ex_hal8822b_wifi_only_hw_config(
/*gnt_wl=1 , gnt_bt=0*/ /*gnt_wl=1 , gnt_bt=0*/
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1704, 0xffffffff, 0x7700); halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1704, 0xffffffff, 0x7700);
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1700, 0xffffffff, 0xc00f0038); halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1700, 0xffffffff, 0xc00f0038);
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x6c0, 0xffffffff, 0xaaaaaaaa);
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x6c4, 0xffffffff, 0xaaaaaaaa);
} }
VOID VOID
@ -67,6 +64,7 @@ ex_hal8822b_wifi_only_connectnotify(
hal8822b_wifi_only_switch_antenna(pwifionlycfg, is_5g); hal8822b_wifi_only_switch_antenna(pwifionlycfg, is_5g);
} }
VOID VOID
hal8822b_wifi_only_switch_antenna(IN struct wifi_only_cfg *pwifionlycfg, hal8822b_wifi_only_switch_antenna(IN struct wifi_only_cfg *pwifionlycfg,
IN u1Byte is_5g IN u1Byte is_5g

View File

@ -116,6 +116,7 @@ enum {
BTC_MULTIPORT_MAX BTC_MULTIPORT_MAX
}; };
#define BTC_COEX_8822B_COMMON_CODE 0
#define BTC_COEX_OFFLOAD 0 #define BTC_COEX_OFFLOAD 0
#define BTC_TMP_BUF_SHORT 20 #define BTC_TMP_BUF_SHORT 20
@ -204,6 +205,13 @@ typedef enum _BTC_CHIP_TYPE {
BTC_CHIP_RTL8723A = 3, BTC_CHIP_RTL8723A = 3,
BTC_CHIP_RTL8821 = 4, BTC_CHIP_RTL8821 = 4,
BTC_CHIP_RTL8723B = 5, BTC_CHIP_RTL8723B = 5,
BTC_CHIP_RTL8822B = 6,
BTC_CHIP_RTL8822C = 7,
BTC_CHIP_RTL8821C = 8,
BTC_CHIP_RTL8821A = 9,
BTC_CHIP_RTL8723D = 10,
BTC_CHIP_RTL8703B = 11,
BTC_CHIP_RTL8725A = 12,
BTC_CHIP_MAX BTC_CHIP_MAX
} BTC_CHIP_TYPE, *PBTC_CHIP_TYPE; } BTC_CHIP_TYPE, *PBTC_CHIP_TYPE;
@ -219,6 +227,397 @@ typedef enum _BTC_CHIP_TYPE {
#define CL_PRINTF DCMD_Printf #define CL_PRINTF DCMD_Printf
#define CL_STRNCAT(dst, dst_size, src, src_size) rstrncat(dst, src, src_size) #define CL_STRNCAT(dst, dst_size, src, src_size) rstrncat(dst, src, src_size)
static const char *const glbt_info_src[] = {
"BT Info[wifi fw]",
"BT Info[bt rsp]",
"BT Info[bt auto report]",
};
#define TDMA_4SLOT BIT(8)
#define BTC_INFO_FTP BIT(7)
#define BTC_INFO_A2DP BIT(6)
#define BTC_INFO_HID BIT(5)
#define BTC_INFO_SCO_BUSY BIT(4)
#define BTC_INFO_ACL_BUSY BIT(3)
#define BTC_INFO_INQ_PAGE BIT(2)
#define BTC_INFO_SCO_ESCO BIT(1)
#define BTC_INFO_CONNECTION BIT(0)
#define BTC_BTINFO_LENGTH_MAX 10
enum btc_gnt_setup_state {
BTC_GNT_SET_SW_LOW = 0x0,
BTC_GNT_SET_SW_HIGH = 0x1,
BTC_GNT_SET_HW_PTA = 0x2,
BTC_GNT_SET_MAX
};
enum btc_gnt_setup_state_2 {
BTC_GNT_SW_LOW = 0x0,
BTC_GNT_SW_HIGH = 0x1,
BTC_GNT_HW_PTA = 0x2,
BTC_GNT_MAX
};
enum btc_path_ctrl_owner {
BTC_OWNER_BT = 0x0,
BTC_OWNER_WL = 0x1,
BTC_OWNER_MAX
};
enum btc_gnt_ctrl_type {
BTC_GNT_CTRL_BY_PTA = 0x0,
BTC_GNT_CTRL_BY_SW = 0x1,
BTC_GNT_CTRL_MAX
};
enum btc_gnt_ctrl_block {
BTC_GNT_BLOCK_RFC_BB = 0x0,
BTC_GNT_BLOCK_RFC = 0x1,
BTC_GNT_BLOCK_BB = 0x2,
BTC_GNT_BLOCK_MAX
};
enum btc_lte_coex_table_type {
BTC_CTT_WL_VS_LTE = 0x0,
BTC_CTT_BT_VS_LTE = 0x1,
BTC_CTT_MAX
};
enum btc_lte_break_table_type {
BTC_LBTT_WL_BREAK_LTE = 0x0,
BTC_LBTT_BT_BREAK_LTE = 0x1,
BTC_LBTT_LTE_BREAK_WL = 0x2,
BTC_LBTT_LTE_BREAK_BT = 0x3,
BTC_LBTT_MAX
};
enum btc_btinfo_src {
BTC_BTINFO_SRC_WL_FW = 0x0,
BTC_BTINFO_SRC_BT_RSP = 0x1,
BTC_BTINFO_SRC_BT_ACT = 0x2,
BTC_BTINFO_SRC_BT_IQK = 0x3,
BTC_BTINFO_SRC_BT_SCBD = 0x4,
BTC_BTINFO_SRC_H2C60 = 0x5,
BTC_BTINFO_SRC_MAX
};
enum btc_bt_profile {
BTC_BTPROFILE_NONE = 0,
BTC_BTPROFILE_HFP = BIT(0),
BTC_BTPROFILE_HID = BIT(1),
BTC_BTPROFILE_A2DP = BIT(2),
BTC_BTPROFILE_PAN = BIT(3),
BTC_BTPROFILE_MAX = 0xf
};
static const char *const bt_profile_string[] = {
"None",
"HFP",
"HID",
"HID + HFP",
"A2DP",
"A2DP + HFP",
"A2DP + HID",
"PAN + HID + HFP",
"PAN",
"PAN + HFP",
"PAN + HID",
"PAN + HID + HFP",
"PAN + A2DP",
"PAN + A2DP + HFP",
"PAN + A2DP + HID",
"PAN + A2DP + HID + HFP"
};
enum btc_bt_status {
BTC_BTSTATUS_NCON_IDLE = 0x0,
BTC_BTSTATUS_CON_IDLE = 0x1,
BTC_BTSTATUS_INQ_PAGE = 0x2,
BTC_BTSTATUS_ACL_BUSY = 0x3,
BTC_BTSTATUS_SCO_BUSY = 0x4,
BTC_BTSTATUS_ACL_SCO_BUSY = 0x5,
BTC_BTSTATUS_MAX
};
static const char *const bt_status_string[] = {
"BT Non-Connected-idle",
"BT Connected-idle",
"BT Inq-page",
"BT ACL-busy",
"BT SCO-busy",
"BT ACL-SCO-busy",
"BT Non-Defined-state"
};
enum btc_coex_algo {
BTC_COEX_NOPROFILE = 0x0,
BTC_COEX_HFP = 0x1,
BTC_COEX_HID = 0x2,
BTC_COEX_A2DP = 0x3,
BTC_COEX_PAN = 0x4,
BTC_COEX_A2DP_HID = 0x5,
BTC_COEX_A2DP_PAN = 0x6,
BTC_COEX_PAN_HID = 0x7,
BTC_COEX_A2DP_PAN_HID = 0x8,
BTC_COEX_MAX
};
static const char *const coex_algo_string[] = {
"No Profile",
"HFP",
"HID",
"A2DP",
"PAN",
"A2DP + HID",
"A2DP + PAN",
"PAN + HID",
"A2DP + PAN + HID"
};
enum btc_ext_ant_switch_type {
BTC_SWITCH_NONE = 0x0,
BTC_SWITCH_SPDT = 0x1,
BTC_SWITCH_SP3T = 0x2,
BTC_SWITCH_ANTMAX
};
enum btc_ext_ant_switch_ctrl_type {
BTC_SWITCH_CTRL_BY_BBSW = 0x0,
BTC_SWITCH_CTRL_BY_PTA = 0x1,
BTC_SWITCH_CTRL_BY_ANTDIV = 0x2,
BTC_SWITCH_CTRL_BY_MAC = 0x3,
BTC_SWITCH_CTRL_BY_BT = 0x4,
BTC_SWITCH_CTRL_BY_FW = 0x5,
BTC_SWITCH_CTRL_MAX
};
enum btc_ext_ant_switch_pos_type {
BTC_SWITCH_TO_BT = 0x0,
BTC_SWITCH_TO_WLG = 0x1,
BTC_SWITCH_TO_WLA = 0x2,
BTC_SWITCH_TO_NOCARE = 0x3,
BTC_SWITCH_TO_WLG_BT = 0x4,
BTC_SWITCH_TO_MAX
};
enum btx_set_ant_phase {
BTC_ANT_INIT = 0x0,
BTC_ANT_WONLY = 0x1,
BTC_ANT_WOFF = 0x2,
BTC_ANT_2G = 0x3,
BTC_ANT_5G = 0x4,
BTC_ANT_BTMP = 0x5,
BTC_ANT_POWERON = 0x6,
BTC_ANT_2G_WL = 0x7,
BTC_ANT_2G_BT = 0x8,
BTC_ANT_MCC = 0x9,
BTC_ANT_2G_WLBT = 0xa,
BTC_ANT_2G_FREERUN = 0xb,
BTC_ANT_MAX
};
/*ADD SCOREBOARD TO FIX BT LPS 32K ISSUE WHILE WL BUSY*/
enum btc_wl2bt_scoreboard {
BTC_SCBD_ACTIVE = BIT(0),
BTC_SCBD_ON = BIT(1),
BTC_SCBD_SCAN = BIT(2),
BTC_SCBD_UNDERTEST = BIT(3),
BTC_SCBD_RXGAIN = BIT(4),
BTC_SCBD_WLBUSY = BIT(7),
BTC_SCBD_EXTFEM = BIT(8),
BTC_SCBD_TDMA = BIT(9),
BTC_SCBD_FIX2M = BIT(10),
BTC_SCBD_ALL = 0xffff
};
enum btc_bt2wl_scoreboard {
BTC_SCBD_BT_ONOFF = BIT(1),
BTC_SCBD_BT_LPS = BIT(7)
};
enum btc_runreason {
BTC_RSN_2GSCANSTART = 0x0,
BTC_RSN_5GSCANSTART = 0x1,
BTC_RSN_SCANFINISH = 0x2,
BTC_RSN_2GSWITCHBAND = 0x3,
BTC_RSN_5GSWITCHBAND = 0x4,
BTC_RSN_2GCONSTART = 0x5,
BTC_RSN_5GCONSTART = 0x6,
BTC_RSN_2GCONFINISH = 0x7,
BTC_RSN_5GCONFINISH = 0x8,
BTC_RSN_2GMEDIA = 0x9,
BTC_RSN_5GMEDIA = 0xa,
BTC_RSN_MEDIADISCON = 0xb,
BTC_RSN_2GSPECIALPKT = 0xc,
BTC_RSN_5GSPECIALPKT = 0xd,
BTC_RSN_BTINFO = 0xe,
BTC_RSN_PERIODICAL = 0xf,
BTC_RSN_PNP = 0x10,
BTC_RSN_LPS = 0x11,
BTC_RSN_TIMERUP = 0x12,
BTC_RSN_WLSTATUS = 0x13,
BTC_RSN_MAX
};
static const char *const run_reason_string[] = {
"2G_SCAN_START",
"5G_SCAN_START",
"SCAN_FINISH",
"2G_SWITCH_BAND",
"5G_SWITCH_BAND",
"2G_CONNECT_START",
"5G_CONNECT_START",
"2G_CONNECT_FINISH",
"5G_CONNECT_FINISH",
"2G_MEDIA_STATUS",
"5G_MEDIA_STATUS",
"MEDIA_DISCONNECT",
"2G_SPECIALPKT",
"5G_SPECIALPKT",
"BTINFO",
"PERIODICAL",
"PNPNotify",
"LPSNotify",
"TimerUp",
"WL_STATUS_CHANGE",
};
enum btc_wl_link_mode {
BTC_WLINK_2G1PORT = 0x0,
BTC_WLINK_2GMPORT = 0x1,
BTC_WLINK_25GMPORT = 0x2,
BTC_WLINK_5G = 0x3,
BTC_WLINK_2GGO = 0x4,
BTC_WLINK_2GGC = 0x5,
BTC_WLINK_BTMR = 0x6,
BTC_WLINK_MAX
};
static const char *const coex_mode_string[] = {
"2G-SP",
"2G-MP",
"25G-MP",
"5G",
"2G-P2P-GO",
"2G-P2P-GC",
"BT-MR"
};
enum btc_bt_state_cnt {
BTC_CNT_BT_RETRY = 0x0,
BTC_CNT_BT_REINIT = 0x1,
BTC_CNT_BT_POPEVENT = 0x2,
BTC_CNT_BT_SETUPLINK = 0x3,
BTC_CNT_BT_IGNWLANACT = 0x4,
BTC_CNT_BT_INQ = 0x5,
BTC_CNT_BT_PAGE = 0x6,
BTC_CNT_BT_ROLESWITCH = 0x7,
BTC_CNT_BT_AFHUPDATE = 0x8,
BTC_CNT_BT_DISABLE = 0x9,
BTC_CNT_BT_INFOUPDATE = 0xa,
BTC_CNT_BT_IQK = 0xb,
BTC_CNT_BT_IQKFAIL = 0xc,
BTC_CNT_BT_MAX
};
enum btc_wl_state_cnt {
BTC_CNT_WL_SCANAP = 0x0,
BTC_CNT_WL_ARP = 0x1,
BTC_CNT_WL_GNTERR = 0x2,
BTC_CNT_WL_PSFAIL = 0x3,
BTC_CNT_WL_COEXRUN = 0x4,
BTC_CNT_WL_COEXINFO1 = 0x5,
BTC_CNT_WL_COEXINFO2 = 0x6,
BTC_CNT_WL_AUTOSLOT_HANG = 0x7,
BTC_CNT_WL_NOISY0 = 0x8,
BTC_CNT_WL_NOISY1 = 0x9,
BTC_CNT_WL_NOISY2 = 0xa,
BTC_CNT_WL_ACTIVEPORT = 0xb,
BTC_CNT_WL_5MS_NOEXTEND = 0xc,
BTC_CNT_WL_FW_NOTIFY = 0xd,
BTC_CNT_WL_MAX
};
enum btc_wl_crc_cnt {
BTC_WLCRC_11BOK = 0x0,
BTC_WLCRC_11GOK = 0x1,
BTC_WLCRC_11NOK = 0x2,
BTC_WLCRC_11VHTOK = 0x3,
BTC_WLCRC_11BERR = 0x4,
BTC_WLCRC_11GERR = 0x5,
BTC_WLCRC_11NERR = 0x6,
BTC_WLCRC_11VHTERR = 0x7,
BTC_WLCRC_MAX
};
enum btc_timer_cnt {
BTC_TIMER_WL_STAYBUSY = 0x0,
BTC_TIMER_WL_COEXFREEZE = 0x1,
BTC_TIMER_WL_SPECPKT = 0x2,
BTC_TIMER_WL_CONNPKT = 0x3,
BTC_TIMER_WL_PNPWAKEUP = 0x4,
BTC_TIMER_WL_CCKLOCK = 0x5,
BTC_TIMER_WL_FWDBG = 0x6,
BTC_TIMER_BT_RELINK = 0x7,
BTC_TIMER_BT_REENABLE = 0x8,
BTC_TIMER_BT_MULTILINK = 0x9,
BTC_TIMER_MAX
};
enum btc_wl_status_change {
BTC_WLSTATUS_CHANGE_TOIDLE = 0x0,
BTC_WLSTATUS_CHANGE_TOBUSY = 0x1,
BTC_WLSTATUS_CHANGE_RSSI = 0x2,
BTC_WLSTATUS_CHANGE_LINKINFO = 0x3,
BTC_WLSTATUS_CHANGE_DIR = 0x4,
BTC_WLSTATUS_CHANGE_NOISY = 0x5,
BTC_WLSTATUS_CHANGE_MAX
};
enum btc_commom_chip_setup {
BTC_CSETUP_INIT_HW = 0x0,
BTC_CSETUP_ANT_SWITCH = 0x1,
BTC_CSETUP_GNT_FIX = 0x2,
BTC_CSETUP_GNT_DEBUG = 0x3,
BTC_CSETUP_RFE_TYPE = 0x4,
BTC_CSETUP_COEXINFO_HW = 0x5,
BTC_CSETUP_WL_TX_POWER = 0x6,
BTC_CSETUP_WL_RX_GAIN = 0x7,
BTC_CSETUP_WLAN_ACT_IPS = 0x8,
BTC_CSETUP_MAX
};
enum btc_indirect_reg_type {
BTC_INDIRECT_1700 = 0x0,
BTC_INDIRECT_7C0 = 0x1,
BTC_INDIRECT_MAX
};
enum btc_pstdma_type {
BTC_PSTDMA_FORCE_LPSOFF = 0x0,
BTC_PSTDMA_FORCE_LPSON = 0x1,
BTC_PSTDMA_MAX
};
enum btc_btrssi_type {
BTC_BTRSSI_RATIO = 0x0,
BTC_BTRSSI_DBM = 0x1,
BTC_BTRSSI_MAX
};
enum btc_wl_priority_mask {
BTC_WLPRI_RX_RSP = 2,
BTC_WLPRI_TX_RSP = 3,
BTC_WLPRI_TX_BEACON = 4,
BTC_WLPRI_TX_OFDM = 11,
BTC_WLPRI_TX_CCK = 12,
BTC_WLPRI_TX_BEACONQ = 27,
BTC_WLPRI_RX_CCK = 28,
BTC_WLPRI_RX_OFDM = 29,
BTC_WLPRI_MAX
};
struct btc_board_info { struct btc_board_info {
/* The following is some board information */ /* The following is some board information */
u8 bt_chip_type; u8 bt_chip_type;
@ -239,6 +638,231 @@ struct btc_board_info {
u32 antdetval; u32 antdetval;
u8 customerID; u8 customerID;
u8 customer_id; u8 customer_id;
u8 ant_distance; /* WL-BT antenna space for non-shared antenna */
};
struct btc_coex_dm {
boolean cur_ignore_wlan_act;
boolean cur_ps_tdma_on;
boolean cur_low_penalty_ra;
boolean cur_wl_rx_low_gain_en;
u8 bt_rssi_state[4];
u8 wl_rssi_state[4];
u8 cur_ps_tdma;
u8 ps_tdma_para[5];
u8 fw_tdma_para[5];
u8 cur_lps;
u8 cur_rpwm;
u8 cur_bt_pwr_lvl;
u8 cur_bt_lna_lvl;
u8 cur_wl_pwr_lvl;
u8 cur_algorithm;
u8 bt_status;
u8 wl_chnl_info[3];
u8 cur_toggle_para[6];
u8 cur_val0x6cc;
u32 cur_val0x6c0;
u32 cur_val0x6c4;
u32 cur_val0x6c8;
u32 cur_ant_pos_type;
u32 cur_switch_status;
u32 setting_tdma;
};
struct btc_coex_sta {
boolean coex_freeze;
boolean coex_freerun;
boolean tdma_bt_autoslot;
boolean rf4ce_en;
boolean is_no_wl_5ms_extend;
boolean bt_disabled;
boolean bt_disabled_pre;
boolean bt_link_exist;
boolean bt_whck_test;
boolean bt_inq_page;
boolean bt_inq;
boolean bt_page;
boolean bt_ble_voice;
boolean bt_ble_exist;
boolean bt_hfp_exist;
boolean bt_a2dp_exist;
boolean bt_hid_exist;
boolean bt_pan_exist; // PAN or OPP
boolean bt_opp_exist; //OPP only
boolean bt_msft_mr_exist;
boolean bt_acl_busy;
boolean bt_fix_2M;
boolean bt_setup_link;
boolean bt_multi_link;
boolean bt_multi_link_pre;
boolean bt_multi_link_remain;
boolean bt_a2dp_sink;
boolean bt_reenable;
boolean bt_ble_scan_en;
boolean bt_slave;
boolean bt_a2dp_active;
boolean bt_slave_latency;
boolean bt_init_scan;
boolean bt_418_hid_exist;
boolean bt_ble_hid_exist;
boolean bt_mesh;
boolean wl_under_lps;
boolean wl_under_ips;
boolean wl_under_4way;
boolean wl_hi_pri_task1;
boolean wl_hi_pri_task2;
boolean wl_cck_lock;
boolean wl_cck_lock_pre;
boolean wl_cck_lock_ever;
boolean wl_force_lps_ctrl;
boolean wl_busy_pre;
boolean wl_gl_busy;
boolean wl_gl_busy_pre;
boolean wl_linkscan_proc;
boolean wl_mimo_ps;
boolean wl_ps_state_fail;
boolean wl_cck_dead_lock_ap;
boolean wl_tx_limit_en;
boolean wl_ampdu_limit_en;
boolean wl_rxagg_limit_en;
boolean wl_connecting;
boolean wl_pnp_wakeup;
boolean wl_slot_toggle;
boolean wl_slot_toggle_change; /* if toggle to no-toggle */
u8 coex_table_type;
u8 coex_run_reason;
u8 tdma_byte4_modify_pre;
u8 kt_ver;
u8 gnt_workaround_state;
u8 tdma_timer_base;
u8 bt_rssi;
u8 bt_profile_num;
u8 bt_profile_num_pre;
u8 bt_info_c2h[BTC_BTINFO_SRC_MAX][BTC_BTINFO_LENGTH_MAX];
u8 bt_info_lb2;
u8 bt_info_lb3;
u8 bt_info_hb0;
u8 bt_info_hb1;
u8 bt_info_hb2;
u8 bt_info_hb3;
u8 bt_ble_scan_type;
u8 bt_afh_map[10];
u8 bt_a2dp_vendor_id;
u8 bt_hid_pair_num;
u8 bt_hid_slot;
u8 bt_a2dp_bitpool;
u8 bt_iqk_state;
u8 bt_sut_pwr_lvl[4];
u8 bt_golden_rx_shift[4];
u8 bt_ext_autoslot_thres;
u8 wl_pnp_state_pre;
u8 wl_noisy_level;
u8 wl_fw_dbg_info[10];
u8 wl_fw_dbg_info_pre[10];
u8 wl_rx_rate;
u8 wl_tx_rate;
u8 wl_rts_rx_rate;
u8 wl_center_ch;
u8 wl_tx_macid;
u8 wl_tx_retry_ratio;
u8 wl_coex_mode;
u8 wl_iot_peer;
u8 wl_ra_thres;
u8 wl_ampdulen_backup;
u8 wl_rxagg_size;
u8 wl_toggle_para[6];
u16 score_board_BW;
u16 score_board_WB;
u16 bt_reg_vendor_ac;
u16 bt_reg_vendor_ae;
u16 bt_reg_modem_a;
u16 bt_reg_rf_2;
u16 wl_txlimit_backup;
u32 hi_pri_tx;
u32 hi_pri_rx;
u32 lo_pri_tx;
u32 lo_pri_rx;
u32 bt_supported_feature;
u32 bt_supported_version;
u32 bt_ble_scan_para[3];
u32 bt_a2dp_device_name;
u32 wl_arfb1_backup;
u32 wl_arfb2_backup;
u32 wl_traffic_dir;
u32 wl_bw;
u32 cnt_bt_info_c2h[BTC_BTINFO_SRC_MAX];
u32 cnt_bt[BTC_CNT_BT_MAX];
u32 cnt_wl[BTC_CNT_WL_MAX];
u32 cnt_timer[BTC_TIMER_MAX];
};
struct btc_rfe_type {
boolean ant_switch_exist;
boolean ant_switch_diversity; /* If diversity on */
boolean ant_switch_with_bt; /* If WL_2G/BT use ext-switch at shared-ant */
u8 rfe_module_type;
u8 ant_switch_type;
u8 ant_switch_polarity;
boolean band_switch_exist;
u8 band_switch_type; /* 0:DPDT, 1:SPDT */
u8 band_switch_polarity;
/* If TRUE: WLG at BTG, If FALSE: WLG at WLAG */
boolean wlg_at_btg;
};
struct btc_wifi_link_info_ext {
boolean is_all_under_5g;
boolean is_mcc_25g;
boolean is_p2p_connected;
boolean is_ap_mode;
boolean is_scan;
boolean is_link;
boolean is_roam;
boolean is_4way;
boolean is_32k;
boolean is_connected;
u8 num_of_active_port;
u32 port_connect_status;
u32 traffic_dir;
u32 wifi_bw;
};
struct btc_coex_table_para {
u32 bt; //0x6c0
u32 wl; //0x6c4
};
struct btc_tdma_para {
u8 para[5];
};
struct btc_reg_byte_modify {
u32 addr;
u8 bitmask;
u8 val;
};
struct btc_5g_afh_map {
u32 wl_5g_ch;
u8 bt_skip_ch;
u8 bt_skip_span;
};
struct btc_rf_para {
u8 wl_pwr_dec_lvl;
u8 bt_pwr_dec_lvl;
boolean wl_low_gain_en;
u8 bt_lna_lvl;
}; };
typedef enum _BTC_DBG_OPCODE { typedef enum _BTC_DBG_OPCODE {
@ -383,7 +1007,9 @@ typedef enum _BTC_GET_TYPE {
/* type u4Byte */ /* type u4Byte */
BTC_GET_U4_WIFI_BW, BTC_GET_U4_WIFI_BW,
BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION,
BTC_GET_U4_WIFI_TRAFFIC_DIR,
BTC_GET_U4_WIFI_FW_VER, BTC_GET_U4_WIFI_FW_VER,
BTC_GET_U4_WIFI_PHY_VER,
BTC_GET_U4_WIFI_LINK_STATUS, BTC_GET_U4_WIFI_LINK_STATUS,
BTC_GET_U4_BT_PATCH_VER, BTC_GET_U4_BT_PATCH_VER,
BTC_GET_U4_VENDOR, BTC_GET_U4_VENDOR,
@ -391,6 +1017,7 @@ typedef enum _BTC_GET_TYPE {
BTC_GET_U4_SUPPORTED_FEATURE, BTC_GET_U4_SUPPORTED_FEATURE,
BTC_GET_U4_BT_DEVICE_INFO, BTC_GET_U4_BT_DEVICE_INFO,
BTC_GET_U4_BT_FORBIDDEN_SLOT_VAL, BTC_GET_U4_BT_FORBIDDEN_SLOT_VAL,
BTC_GET_U4_BT_A2DP_FLUSH_VAL,
BTC_GET_U4_WIFI_IQK_TOTAL, BTC_GET_U4_WIFI_IQK_TOTAL,
BTC_GET_U4_WIFI_IQK_OK, BTC_GET_U4_WIFI_IQK_OK,
BTC_GET_U4_WIFI_IQK_FAIL, BTC_GET_U4_WIFI_IQK_FAIL,
@ -428,6 +1055,7 @@ typedef enum _BTC_SET_TYPE {
BTC_SET_BL_BT_TX_RX_MASK, BTC_SET_BL_BT_TX_RX_MASK,
BTC_SET_BL_MIRACAST_PLUS_BT, BTC_SET_BL_MIRACAST_PLUS_BT,
BTC_SET_BL_BT_LNA_CONSTRAIN_LEVEL, BTC_SET_BL_BT_LNA_CONSTRAIN_LEVEL,
BTC_SET_BL_BT_GOLDEN_RX_RANGE,
/* type u1Byte */ /* type u1Byte */
BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON,
@ -460,6 +1088,7 @@ typedef enum _BTC_SET_TYPE {
BTC_SET_ACT_CTRL_BT_INFO, BTC_SET_ACT_CTRL_BT_INFO,
BTC_SET_ACT_CTRL_BT_COEX, BTC_SET_ACT_CTRL_BT_COEX,
BTC_SET_ACT_CTRL_8723B_ANT, BTC_SET_ACT_CTRL_8723B_ANT,
BTC_SET_RESET_COEX_VAR,
/*=================*/ /*=================*/
BTC_SET_MAX BTC_SET_MAX
} BTC_SET_TYPE, *PBTC_SET_TYPE; } BTC_SET_TYPE, *PBTC_SET_TYPE;
@ -675,6 +1304,7 @@ struct btc_wifi_link_info {
BOOLEAN bhotspot; BOOLEAN bhotspot;
}; };
#if 0
typedef enum _BTC_MULTI_PORT_TDMA_MODE { typedef enum _BTC_MULTI_PORT_TDMA_MODE {
BTC_MULTI_PORT_TDMA_MODE_NONE=0, BTC_MULTI_PORT_TDMA_MODE_NONE=0,
BTC_MULTI_PORT_TDMA_MODE_2G_SCC_GO, BTC_MULTI_PORT_TDMA_MODE_2G_SCC_GO,
@ -687,6 +1317,22 @@ typedef struct btc_multi_port_tdma_info {
u1Byte start_time_from_bcn; u1Byte start_time_from_bcn;
u1Byte bt_time; u1Byte bt_time;
} BTC_MULTI_PORT_TDMA_INFO, *PBTC_MULTI_PORT_TDMA_INFO; } BTC_MULTI_PORT_TDMA_INFO, *PBTC_MULTI_PORT_TDMA_INFO;
#endif
typedef enum _btc_concurrent_mode {
btc_concurrent_mode_none = 0,
btc_concurrent_mode_2g_go_miracast,
btc_concurrent_mode_2g_go_hotspot,
btc_concurrent_mode_2g_scc_go_miracast_sta,
btc_concurrent_mode_2g_scc_go_hotspot_sta,
btc_concurrent_mode_2g_gc,
} btc_concurrent_mode, *pbtc_concurrent_mode;
struct btc_concurrent_setting {
btc_concurrent_mode btc_concurrent_mode;
u1Byte start_time_from_bcn;
u1Byte bt_time;
};
typedef u1Byte typedef u1Byte
(*BFP_BTC_R1)( (*BFP_BTC_R1)(
@ -734,6 +1380,29 @@ typedef VOID
IN u4Byte RegAddr, IN u4Byte RegAddr,
IN u1Byte Data IN u1Byte Data
); );
typedef u4Byte
(*BFP_BTC_R_LINDIRECT)(
IN PVOID pBtcContext,
IN u2Byte reg_addr
);
typedef VOID
(*BFP_BTC_R_SCBD)(
IN PVOID pBtcContext,
IN pu2Byte score_board_val
);
typedef VOID
(*BFP_BTC_W_SCBD)(
IN PVOID pBtcContext,
IN u2Byte bitpos,
IN BOOLEAN state
);
typedef VOID
(*BFP_BTC_W_LINDIRECT)(
IN PVOID pBtcContext,
IN u2Byte reg_addr,
IN u4Byte bit_mask,
IN u4Byte reg_value
);
typedef VOID typedef VOID
(*BFP_BTC_SET_BB_REG)( (*BFP_BTC_SET_BB_REG)(
IN PVOID pBtcContext, IN PVOID pBtcContext,
@ -839,6 +1508,13 @@ typedef u4Byte
IN PVOID pBtcContext IN PVOID pBtcContext
); );
typedef u1Byte
(*BFP_BTC_SET_TIMER) (
IN PVOID pBtcContext,
IN u4Byte type,
IN u4Byte val
);
typedef u4Byte typedef u4Byte
(*BFP_BTC_SET_ATOMIC) ( (*BFP_BTC_SET_ATOMIC) (
IN PVOID pBtcContext, IN PVOID pBtcContext,
@ -860,6 +1536,12 @@ typedef u4Byte
IN u1Byte info_type IN u1Byte info_type
); );
typedef VOID
(*BTC_REDUCE_WL_TX_POWER)(
IN PVOID pDM_Odm,
IN s1Byte tx_power
);
typedef VOID typedef VOID
(*BTC_PHYDM_MODIFY_ANTDIV_HWSW)( (*BTC_PHYDM_MODIFY_ANTDIV_HWSW)(
IN PVOID pDM_Odm, IN PVOID pDM_Odm,
@ -906,8 +1588,7 @@ struct btc_bt_info {
boolean bt_busy; boolean bt_busy;
boolean limited_dig; boolean limited_dig;
u16 bt_hci_ver; u16 bt_hci_ver;
u16 bt_real_fw_ver; u32 bt_real_fw_ver;
u8 bt_fw_ver;
u32 get_bt_fw_ver_cnt; u32 get_bt_fw_ver_cnt;
u32 bt_get_fw_ver; u32 bt_get_fw_ver;
boolean miracast_plus_bt; boolean miracast_plus_bt;
@ -989,6 +1670,11 @@ struct btc_coexist {
struct btc_stack_info stack_info; struct btc_stack_info stack_info;
struct btc_bt_link_info bt_link_info; struct btc_bt_link_info bt_link_info;
struct btc_wifi_link_info wifi_link_info; struct btc_wifi_link_info wifi_link_info;
struct btc_wifi_link_info_ext wifi_link_info_ext;
struct btc_coex_dm coex_dm;
struct btc_coex_sta coex_sta;
struct btc_rfe_type rfe_type;
const struct btc_chip_para *chip_para;
#ifdef CONFIG_RF4CE_COEXIST #ifdef CONFIG_RF4CE_COEXIST
struct btc_rf4ce_info rf4ce_info; struct btc_rf4ce_info rf4ce_info;
@ -1005,6 +1691,8 @@ struct btc_coexist {
u1Byte pwrModeVal[10]; u1Byte pwrModeVal[10];
BOOLEAN dbg_mode; BOOLEAN dbg_mode;
BOOLEAN auto_report; BOOLEAN auto_report;
u8 chip_type;
BOOLEAN wl_rf_state_off;
/* function pointers */ /* function pointers */
/* io related */ /* io related */
@ -1016,6 +1704,10 @@ struct btc_coexist {
BFP_BTC_R4 btc_read_4byte; BFP_BTC_R4 btc_read_4byte;
BFP_BTC_W4 btc_write_4byte; BFP_BTC_W4 btc_write_4byte;
BFP_BTC_LOCAL_REG_W1 btc_write_local_reg_1byte; BFP_BTC_LOCAL_REG_W1 btc_write_local_reg_1byte;
BFP_BTC_R_LINDIRECT btc_read_linderct;
BFP_BTC_W_LINDIRECT btc_write_linderct;
BFP_BTC_R_SCBD btc_read_scbd;
BFP_BTC_W_SCBD btc_write_scbd;
/* read/write bb related */ /* read/write bb related */
BFP_BTC_SET_BB_REG btc_set_bb_reg; BFP_BTC_SET_BB_REG btc_set_bb_reg;
BFP_BTC_GET_BB_REG btc_get_bb_reg; BFP_BTC_GET_BB_REG btc_get_bb_reg;
@ -1042,9 +1734,11 @@ struct btc_coexist {
BFP_BTC_GET_BT_COEX_SUPPORTED_FEATURE btc_get_bt_coex_supported_feature; BFP_BTC_GET_BT_COEX_SUPPORTED_FEATURE btc_get_bt_coex_supported_feature;
BFP_BTC_GET_BT_COEX_SUPPORTED_VERSION btc_get_bt_coex_supported_version; BFP_BTC_GET_BT_COEX_SUPPORTED_VERSION btc_get_bt_coex_supported_version;
BFP_BTC_GET_PHYDM_VERSION btc_get_bt_phydm_version; BFP_BTC_GET_PHYDM_VERSION btc_get_bt_phydm_version;
BFP_BTC_SET_TIMER btc_set_timer;
BFP_BTC_SET_ATOMIC btc_set_atomic; BFP_BTC_SET_ATOMIC btc_set_atomic;
BTC_PHYDM_MODIFY_RA_PCR_THRESHLOD btc_phydm_modify_RA_PCR_threshold; BTC_PHYDM_MODIFY_RA_PCR_THRESHLOD btc_phydm_modify_RA_PCR_threshold;
BTC_PHYDM_CMNINFOQUERY btc_phydm_query_PHY_counter; BTC_PHYDM_CMNINFOQUERY btc_phydm_query_PHY_counter;
BTC_REDUCE_WL_TX_POWER btc_reduce_wl_tx_power;
BTC_PHYDM_MODIFY_ANTDIV_HWSW btc_phydm_modify_antdiv_hwsw; BTC_PHYDM_MODIFY_ANTDIV_HWSW btc_phydm_modify_antdiv_hwsw;
BFP_BTC_GET_ANT_DET_VAL_FROM_BT btc_get_ant_det_val_from_bt; BFP_BTC_GET_ANT_DET_VAL_FROM_BT btc_get_ant_det_val_from_bt;
BFP_BTC_GET_BLE_SCAN_TYPE_FROM_BT btc_get_ble_scan_type_from_bt; BFP_BTC_GET_BLE_SCAN_TYPE_FROM_BT btc_get_ble_scan_type_from_bt;
@ -1108,6 +1802,49 @@ typedef struct btc_coexist *PBTC_COEXIST;
extern struct btc_coexist GLBtCoexist; extern struct btc_coexist GLBtCoexist;
typedef void
(*BFP_BTC_CHIP_SETUP)(
IN PBTC_COEXIST pBtCoexist,
IN u1Byte setType
);
struct btc_chip_para {
const char *chip_name;
u32 para_ver_date;
u32 para_ver;
u32 bt_desired_ver;
boolean scbd_support;
boolean mailbox_support;
boolean lte_indirect_access;
boolean new_scbd10_def; /* TRUE: 1:fix 2M(8822c) */
u8 indirect_type; /* 0:17xx, 1:7cx */
u8 pstdma_type; /* 0: LPSoff, 1:LPSon */
u8 bt_rssi_type;
u8 ant_isolation;
u8 rssi_tolerance;
u8 rx_path_num;
u8 wl_rssi_step_num;
const u8 *wl_rssi_step;
u8 bt_rssi_step_num;
const u8 *bt_rssi_step;
u8 table_sant_num;
const struct btc_coex_table_para *table_sant;
u8 table_nsant_num;
const struct btc_coex_table_para *table_nsant;
u8 tdma_sant_num;
const struct btc_tdma_para *tdma_sant;
u8 tdma_nsant_num;
const struct btc_tdma_para *tdma_nsant;
u8 wl_rf_para_tx_num;
const struct btc_rf_para *wl_rf_para_tx;
const struct btc_rf_para *wl_rf_para_rx;
u8 bt_afh_span_bw20;
u8 bt_afh_span_bw40;
u8 afh_5g_num;
const struct btc_5g_afh_map *afh_5g;
BFP_BTC_CHIP_SETUP chip_setup;
};
BOOLEAN BOOLEAN
EXhalbtcoutsrc_InitlizeVariables( EXhalbtcoutsrc_InitlizeVariables(
IN PVOID Adapter IN PVOID Adapter
@ -1175,6 +1912,14 @@ EXhalbtcoutsrc_RfStatusNotify(
IN PBTC_COEXIST pBtCoexist, IN PBTC_COEXIST pBtCoexist,
IN u1Byte type IN u1Byte type
); );
u4Byte
EXhalbtcoutsrc_CoexTimerCheck(
IN PBTC_COEXIST pBtCoexist
);
u4Byte
EXhalbtcoutsrc_WLStatusCheck(
IN PBTC_COEXIST pBtCoexist
);
VOID VOID
EXhalbtcoutsrc_WlFwDbgInfoNotify( EXhalbtcoutsrc_WlFwDbgInfoNotify(
IN PBTC_COEXIST pBtCoexist, IN PBTC_COEXIST pBtCoexist,
@ -1202,6 +1947,16 @@ EXhalbtcoutsrc_PnpNotify(
IN u1Byte pnpState IN u1Byte pnpState
); );
VOID VOID
EXhalbtcoutsrc_TimerNotify(
IN PBTC_COEXIST pBtCoexist,
IN u4Byte timer_type
);
VOID
EXhalbtcoutsrc_WLStatusChangeNotify(
IN PBTC_COEXIST pBtCoexist,
IN u4Byte change_type
);
VOID
EXhalbtcoutsrc_CoexDmSwitch( EXhalbtcoutsrc_CoexDmSwitch(
IN PBTC_COEXIST pBtCoexist IN PBTC_COEXIST pBtCoexist
); );

View File

@ -17,6 +17,7 @@
#include <drv_types.h> #include <drv_types.h>
#include <hal_data.h> #include <hal_data.h>
#include "btc_basic_types.h"
#define BT_TMP_BUF_SIZE 100 #define BT_TMP_BUF_SIZE 100
@ -111,6 +112,24 @@ struct btc_coexist;
#include "halbtc8821c2ant.h" #include "halbtc8821c2ant.h"
#endif #endif
#ifdef CONFIG_RTL8814A
#include "halbtc8814a2ant.h"
#endif
#if (CONFIG_BTCOEX_SUPPORT_BTC_CMN == 1)
#include "halbtccommon.h"
#ifdef CONFIG_RTL8822C
#include "halbtc8822cwifionly.h"
#include "halbtc8822c.h"
#endif
#ifdef CONFIG_RTL8192F
#include "halbtc8192f.h"
#endif
#endif
#include "halbtcoutsrc.h" #include "halbtcoutsrc.h"
#else /* CONFIG_BT_COEXIST */ #else /* CONFIG_BT_COEXIST */
@ -127,6 +146,14 @@ struct btc_coexist;
#include "halbtc8821cwifionly.h" #include "halbtc8821cwifionly.h"
#endif #endif
#ifdef CONFIG_RTL8822C
#include "halbtc8822cwifionly.h"
#endif
#ifdef CONFIG_RTL8814B
#include "halbtc8814bwifionly.h"
#endif
#endif /* CONFIG_BT_COEXIST */ #endif /* CONFIG_BT_COEXIST */
#endif /* __MP_PRECOMP_H__ */ #endif /* __MP_PRECOMP_H__ */

View File

@ -70,6 +70,12 @@
#if defined(CONFIG_RTL8192F) #if defined(CONFIG_RTL8192F)
#include "rtl8192f/HalEfuseMask8192F_USB.h" #include "rtl8192f/HalEfuseMask8192F_USB.h"
#endif #endif
#if defined(CONFIG_RTL8822C)
#include "rtl8822c/HalEfuseMask8822C_USB.h"
#endif
#if defined(CONFIG_RTL8814B)
#include "rtl8814b/HalEfuseMask8814B_USB.h"
#endif
#endif /*CONFIG_USB_HCI*/ #endif /*CONFIG_USB_HCI*/
#ifdef CONFIG_PCI_HCI #ifdef CONFIG_PCI_HCI
@ -115,6 +121,12 @@
#if defined(CONFIG_RTL8192F) #if defined(CONFIG_RTL8192F)
#include "rtl8192f/HalEfuseMask8192F_PCIE.h" #include "rtl8192f/HalEfuseMask8192F_PCIE.h"
#endif #endif
#if defined(CONFIG_RTL8822C)
#include "rtl8822c/HalEfuseMask8822C_PCIE.h"
#endif
#if defined(CONFIG_RTL8814B)
#include "rtl8814b/HalEfuseMask8814B_PCIE.h"
#endif
#endif /*CONFIG_PCI_HCI*/ #endif /*CONFIG_PCI_HCI*/
#ifdef CONFIG_SDIO_HCI #ifdef CONFIG_SDIO_HCI
#if defined(CONFIG_RTL8723B) #if defined(CONFIG_RTL8723B)
@ -161,4 +173,9 @@
#include "rtl8192f/HalEfuseMask8192F_SDIO.h" #include "rtl8192f/HalEfuseMask8192F_SDIO.h"
#endif #endif
#if defined(CONFIG_RTL8822C)
#include "rtl8822c/HalEfuseMask8822C_SDIO.h"
#endif
#endif /*CONFIG_SDIO_HCI*/ #endif /*CONFIG_SDIO_HCI*/

View File

@ -20,7 +20,7 @@
* MPCIE.TXT * MPCIE.TXT
******************************************************************************/ ******************************************************************************/
u1Byte Array_MP_8822B_MPCIE[] = { u8 Array_MP_8822B_MPCIE[] = {
0xFF, 0xFF,
0xF7, 0xF7,
0xEF, 0xEF,
@ -72,23 +72,23 @@ u1Byte Array_MP_8822B_MPCIE[] = {
}; };
u2Byte u16
EFUSE_GetArrayLen_MP_8822B_MPCIE(VOID) EFUSE_GetArrayLen_MP_8822B_MPCIE(void)
{ {
return sizeof(Array_MP_8822B_MPCIE) / sizeof(u1Byte); return sizeof(Array_MP_8822B_MPCIE) / sizeof(u8);
} }
VOID void
EFUSE_GetMaskArray_MP_8822B_MPCIE(pu1Byte Array) EFUSE_GetMaskArray_MP_8822B_MPCIE(u8 *Array)
{ {
u2Byte len = EFUSE_GetArrayLen_MP_8822B_MPCIE(), i = 0; u16 len = EFUSE_GetArrayLen_MP_8822B_MPCIE(), i = 0;
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
Array[i] = Array_MP_8822B_MPCIE[i]; Array[i] = Array_MP_8822B_MPCIE[i];
} }
BOOLEAN BOOLEAN
EFUSE_IsAddressMasked_MP_8822B_MPCIE(u2Byte Offset) EFUSE_IsAddressMasked_MP_8822B_MPCIE(u16 Offset)
{ {
int r = Offset / 16; int r = Offset / 16;
int c = (Offset % 16) / 2; int c = (Offset % 16) / 2;

View File

@ -19,8 +19,8 @@
******************************************************************************/ ******************************************************************************/
u2Byte EFUSE_GetArrayLen_MP_8822B_MPCIE(VOID); u16 EFUSE_GetArrayLen_MP_8822B_MPCIE(void);
VOID EFUSE_GetMaskArray_MP_8822B_MPCIE(pu1Byte Array); void EFUSE_GetMaskArray_MP_8822B_MPCIE(u8 *Array);
BOOLEAN EFUSE_IsAddressMasked_MP_8822B_MPCIE(u2Byte Offset); BOOLEAN EFUSE_IsAddressMasked_MP_8822B_MPCIE(u16 Offset);

View File

@ -20,7 +20,7 @@
* MSDIO.TXT * MSDIO.TXT
******************************************************************************/ ******************************************************************************/
u1Byte Array_MP_8822B_MSDIO[] = { u8 Array_MP_8822B_MSDIO[] = {
0xFF, 0xFF,
0xF7, 0xF7,
0xEF, 0xEF,
@ -72,20 +72,20 @@ u1Byte Array_MP_8822B_MSDIO[] = {
}; };
u2Byte EFUSE_GetArrayLen_MP_8822B_MSDIO(VOID) u16 EFUSE_GetArrayLen_MP_8822B_MSDIO(void)
{ {
return sizeof(Array_MP_8822B_MSDIO) / sizeof(u1Byte); return sizeof(Array_MP_8822B_MSDIO) / sizeof(u8);
} }
VOID EFUSE_GetMaskArray_MP_8822B_MSDIO(pu1Byte Array) void EFUSE_GetMaskArray_MP_8822B_MSDIO(u8 *Array)
{ {
u2Byte len = EFUSE_GetArrayLen_MP_8822B_MSDIO(), i = 0; u16 len = EFUSE_GetArrayLen_MP_8822B_MSDIO(), i = 0;
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
Array[i] = Array_MP_8822B_MSDIO[i]; Array[i] = Array_MP_8822B_MSDIO[i];
} }
BOOLEAN EFUSE_IsAddressMasked_MP_8822B_MSDIO(u2Byte Offset) BOOLEAN EFUSE_IsAddressMasked_MP_8822B_MSDIO(u16 Offset)
{ {
int r = Offset / 16; int r = Offset / 16;
int c = (Offset % 16) / 2; int c = (Offset % 16) / 2;

View File

@ -20,8 +20,8 @@
******************************************************************************/ ******************************************************************************/
u2Byte EFUSE_GetArrayLen_MP_8822B_MSDIO(VOID); u16 EFUSE_GetArrayLen_MP_8822B_MSDIO(void);
VOID EFUSE_GetMaskArray_MP_8822B_MSDIO(pu1Byte Array); void EFUSE_GetMaskArray_MP_8822B_MSDIO(u8 *Array);
BOOLEAN EFUSE_IsAddressMasked_MP_8822B_MSDIO(u2Byte Offset); BOOLEAN EFUSE_IsAddressMasked_MP_8822B_MSDIO(u16 Offset);

View File

@ -20,7 +20,7 @@
* MUSB.TXT * MUSB.TXT
******************************************************************************/ ******************************************************************************/
u1Byte Array_MP_8822B_MUSB[] = { u8 Array_MP_8822B_MUSB[] = {
0xFF, 0xFF,
0xF7, 0xF7,
0xEF, 0xEF,
@ -71,20 +71,20 @@ u1Byte Array_MP_8822B_MUSB[] = {
0x00, 0x00,
}; };
u2Byte EFUSE_GetArrayLen_MP_8822B_MUSB(VOID) u16 EFUSE_GetArrayLen_MP_8822B_MUSB(void)
{ {
return sizeof(Array_MP_8822B_MUSB) / sizeof(u1Byte); return sizeof(Array_MP_8822B_MUSB) / sizeof(u8);
} }
VOID EFUSE_GetMaskArray_MP_8822B_MUSB(pu1Byte Array) void EFUSE_GetMaskArray_MP_8822B_MUSB(u8 *Array)
{ {
u2Byte len = EFUSE_GetArrayLen_MP_8822B_MUSB(), i = 0; u16 len = EFUSE_GetArrayLen_MP_8822B_MUSB(), i = 0;
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
Array[i] = Array_MP_8822B_MUSB[i]; Array[i] = Array_MP_8822B_MUSB[i];
} }
BOOLEAN EFUSE_IsAddressMasked_MP_8822B_MUSB(u2Byte Offset) BOOLEAN EFUSE_IsAddressMasked_MP_8822B_MUSB(u16 Offset)
{ {
int r = Offset / 16; int r = Offset / 16;
int c = (Offset % 16) / 2; int c = (Offset % 16) / 2;

View File

@ -20,8 +20,8 @@
******************************************************************************/ ******************************************************************************/
u2Byte EFUSE_GetArrayLen_MP_8822B_MUSB(VOID); u16 EFUSE_GetArrayLen_MP_8822B_MUSB(void);
VOID EFUSE_GetMaskArray_MP_8822B_MUSB(pu1Byte Array); void EFUSE_GetMaskArray_MP_8822B_MUSB(u8 *Array);
BOOLEAN EFUSE_IsAddressMasked_MP_8822B_MUSB(u2Byte Offset); BOOLEAN EFUSE_IsAddressMasked_MP_8822B_MUSB(u16 Offset);

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@
struct wifi_only_cfg GLBtCoexistWifiOnly; struct wifi_only_cfg GLBtCoexistWifiOnly;
void halwifionly_write1byte(PVOID pwifionlyContext, u32 RegAddr, u8 Data) void halwifionly_write1byte(void *pwifionlyContext, u32 RegAddr, u8 Data)
{ {
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext; struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
PADAPTER Adapter = pwifionlycfg->Adapter; PADAPTER Adapter = pwifionlycfg->Adapter;
@ -28,7 +28,7 @@ void halwifionly_write1byte(PVOID pwifionlyContext, u32 RegAddr, u8 Data)
rtw_write8(Adapter, RegAddr, Data); rtw_write8(Adapter, RegAddr, Data);
} }
void halwifionly_write2byte(PVOID pwifionlyContext, u32 RegAddr, u16 Data) void halwifionly_write2byte(void *pwifionlyContext, u32 RegAddr, u16 Data)
{ {
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext; struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
PADAPTER Adapter = pwifionlycfg->Adapter; PADAPTER Adapter = pwifionlycfg->Adapter;
@ -36,7 +36,7 @@ void halwifionly_write2byte(PVOID pwifionlyContext, u32 RegAddr, u16 Data)
rtw_write16(Adapter, RegAddr, Data); rtw_write16(Adapter, RegAddr, Data);
} }
void halwifionly_write4byte(PVOID pwifionlyContext, u32 RegAddr, u32 Data) void halwifionly_write4byte(void *pwifionlyContext, u32 RegAddr, u32 Data)
{ {
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext; struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
PADAPTER Adapter = pwifionlycfg->Adapter; PADAPTER Adapter = pwifionlycfg->Adapter;
@ -44,7 +44,7 @@ void halwifionly_write4byte(PVOID pwifionlyContext, u32 RegAddr, u32 Data)
rtw_write32(Adapter, RegAddr, Data); rtw_write32(Adapter, RegAddr, Data);
} }
u8 halwifionly_read1byte(PVOID pwifionlyContext, u32 RegAddr) u8 halwifionly_read1byte(void *pwifionlyContext, u32 RegAddr)
{ {
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext; struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
PADAPTER Adapter = pwifionlycfg->Adapter; PADAPTER Adapter = pwifionlycfg->Adapter;
@ -52,7 +52,7 @@ u8 halwifionly_read1byte(PVOID pwifionlyContext, u32 RegAddr)
return rtw_read8(Adapter, RegAddr); return rtw_read8(Adapter, RegAddr);
} }
u16 halwifionly_read2byte(PVOID pwifionlyContext, u32 RegAddr) u16 halwifionly_read2byte(void * pwifionlyContext, u32 RegAddr)
{ {
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext; struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
PADAPTER Adapter = pwifionlycfg->Adapter; PADAPTER Adapter = pwifionlycfg->Adapter;
@ -60,7 +60,7 @@ u16 halwifionly_read2byte(PVOID pwifionlyContext, u32 RegAddr)
return rtw_read16(Adapter, RegAddr); return rtw_read16(Adapter, RegAddr);
} }
u32 halwifionly_read4byte(PVOID pwifionlyContext, u32 RegAddr) u32 halwifionly_read4byte(void *pwifionlyContext, u32 RegAddr)
{ {
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext; struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
PADAPTER Adapter = pwifionlycfg->Adapter; PADAPTER Adapter = pwifionlycfg->Adapter;
@ -68,7 +68,7 @@ u32 halwifionly_read4byte(PVOID pwifionlyContext, u32 RegAddr)
return rtw_read32(Adapter, RegAddr); return rtw_read32(Adapter, RegAddr);
} }
void halwifionly_bitmaskwrite1byte(PVOID pwifionlyContext, u32 regAddr, u8 bitMask, u8 data) void halwifionly_bitmaskwrite1byte(void *pwifionlyContext, u32 regAddr, u8 bitMask, u8 data)
{ {
u8 originalValue, bitShift = 0; u8 originalValue, bitShift = 0;
u8 i; u8 i;
@ -88,7 +88,7 @@ void halwifionly_bitmaskwrite1byte(PVOID pwifionlyContext, u32 regAddr, u8 bitMa
rtw_write8(Adapter, regAddr, data); rtw_write8(Adapter, regAddr, data);
} }
void halwifionly_phy_set_rf_reg(PVOID pwifionlyContext, enum rf_path eRFPath, u32 RegAddr, u32 BitMask, u32 Data) void halwifionly_phy_set_rf_reg(void *pwifionlyContext, enum rf_path eRFPath, u32 RegAddr, u32 BitMask, u32 Data)
{ {
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext; struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
PADAPTER Adapter = pwifionlycfg->Adapter; PADAPTER Adapter = pwifionlycfg->Adapter;
@ -96,7 +96,7 @@ void halwifionly_phy_set_rf_reg(PVOID pwifionlyContext, enum rf_path eRFPath, u3
phy_set_rf_reg(Adapter, eRFPath, RegAddr, BitMask, Data); phy_set_rf_reg(Adapter, eRFPath, RegAddr, BitMask, Data);
} }
void halwifionly_phy_set_bb_reg(PVOID pwifionlyContext, u32 RegAddr, u32 BitMask, u32 Data) void halwifionly_phy_set_bb_reg(void *pwifionlyContext, u32 RegAddr, u32 BitMask, u32 Data)
{ {
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext; struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
PADAPTER Adapter = pwifionlycfg->Adapter; PADAPTER Adapter = pwifionlycfg->Adapter;
@ -122,6 +122,16 @@ void hal_btcoex_wifionly_switchband_notify(PADAPTER padapter)
else if (IS_HARDWARE_TYPE_8821C(padapter)) else if (IS_HARDWARE_TYPE_8821C(padapter))
ex_hal8821c_wifi_only_switchbandnotify(&GLBtCoexistWifiOnly, is_5g); ex_hal8821c_wifi_only_switchbandnotify(&GLBtCoexistWifiOnly, is_5g);
#endif #endif
#ifdef CONFIG_RTL8822C
else if (IS_HARDWARE_TYPE_8822C(padapter))
ex_hal8822c_wifi_only_switchbandnotify(&GLBtCoexistWifiOnly, is_5g);
#endif
#ifdef CONFIG_RTL8814B
else if (IS_HARDWARE_TYPE_8814B(padapter))
ex_hal8814b_wifi_only_switchbandnotify(&GLBtCoexistWifiOnly, is_5g);
#endif
} }
void hal_btcoex_wifionly_scan_notify(PADAPTER padapter) void hal_btcoex_wifionly_scan_notify(PADAPTER padapter)
@ -142,6 +152,16 @@ void hal_btcoex_wifionly_scan_notify(PADAPTER padapter)
else if (IS_HARDWARE_TYPE_8821C(padapter)) else if (IS_HARDWARE_TYPE_8821C(padapter))
ex_hal8821c_wifi_only_scannotify(&GLBtCoexistWifiOnly, is_5g); ex_hal8821c_wifi_only_scannotify(&GLBtCoexistWifiOnly, is_5g);
#endif #endif
#ifdef CONFIG_RTL8822C
else if (IS_HARDWARE_TYPE_8822C(padapter))
ex_hal8822c_wifi_only_scannotify(&GLBtCoexistWifiOnly, is_5g);
#endif
#ifdef CONFIG_RTL8814B
else if (IS_HARDWARE_TYPE_8814B(padapter))
ex_hal8814b_wifi_only_scannotify(&GLBtCoexistWifiOnly, is_5g);
#endif
} }
void hal_btcoex_wifionly_connect_notify(PADAPTER padapter) void hal_btcoex_wifionly_connect_notify(PADAPTER padapter)
@ -162,6 +182,16 @@ void hal_btcoex_wifionly_connect_notify(PADAPTER padapter)
else if (IS_HARDWARE_TYPE_8821C(padapter)) else if (IS_HARDWARE_TYPE_8821C(padapter))
ex_hal8821c_wifi_only_connectnotify(&GLBtCoexistWifiOnly, is_5g); ex_hal8821c_wifi_only_connectnotify(&GLBtCoexistWifiOnly, is_5g);
#endif #endif
#ifdef CONFIG_RTL8822C
else if (IS_HARDWARE_TYPE_8822C(padapter))
ex_hal8822c_wifi_only_connectnotify(&GLBtCoexistWifiOnly, is_5g);
#endif
#ifdef CONFIG_RTL8814B
else if (IS_HARDWARE_TYPE_8814B(padapter))
ex_hal8814b_wifi_only_connectnotify(&GLBtCoexistWifiOnly, is_5g);
#endif
} }
void hal_btcoex_wifionly_hw_config(PADAPTER padapter) void hal_btcoex_wifionly_hw_config(PADAPTER padapter)
@ -183,6 +213,16 @@ void hal_btcoex_wifionly_hw_config(PADAPTER padapter)
else if (IS_HARDWARE_TYPE_8821C(padapter)) else if (IS_HARDWARE_TYPE_8821C(padapter))
ex_hal8821c_wifi_only_hw_config(pwifionlycfg); ex_hal8821c_wifi_only_hw_config(pwifionlycfg);
#endif #endif
#ifdef CONFIG_RTL8822C
else if (IS_HARDWARE_TYPE_8822C(padapter))
ex_hal8822c_wifi_only_hw_config(pwifionlycfg);
#endif
#ifdef CONFIG_RTL8814B
else if (IS_HARDWARE_TYPE_8814B(padapter))
ex_hal8814b_wifi_only_hw_config(pwifionlycfg);
#endif
} }
void hal_btcoex_wifionly_initlizevariables(PADAPTER padapter) void hal_btcoex_wifionly_initlizevariables(PADAPTER padapter)

File diff suppressed because it is too large Load Diff

View File

@ -100,6 +100,8 @@ int c2h_mac_hidden_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
#define MAC_HIDDEN_RPT_2_LEN 5 #define MAC_HIDDEN_RPT_2_LEN 5
int c2h_mac_hidden_rpt_2_hdl(_adapter *adapter, u8 *data, u8 len); int c2h_mac_hidden_rpt_2_hdl(_adapter *adapter, u8 *data, u8 len);
int hal_read_mac_hidden_rpt(_adapter *adapter); int hal_read_mac_hidden_rpt(_adapter *adapter);
#else
#define hal_read_mac_hidden_rpt(adapter) _SUCCESS
#endif /* CONFIG_RTW_MAC_HIDDEN_RPT */ #endif /* CONFIG_RTW_MAC_HIDDEN_RPT */
/* C2H_DEFEATURE_DBG, 0x22 */ /* C2H_DEFEATURE_DBG, 0x22 */
@ -126,5 +128,4 @@ int c2h_per_rate_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
#define LPS_STATUS_RPT_LEN 2 #define LPS_STATUS_RPT_LEN 2
int c2h_lps_status_rpt(PADAPTER adapter, u8 *data, u8 len); int c2h_lps_status_rpt(PADAPTER adapter, u8 *data, u8 len);
#endif /* CONFIG_LPS_ACK */ #endif /* CONFIG_LPS_ACK */
#endif /* __COMMON_C2H_H__ */ #endif /* __COMMON_C2H_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -77,9 +77,16 @@ void rtw_hal_update_iqk_fw_offload_cap(_adapter *adapter)
phydm_fwoffload_ability_clear(p_dm_odm, PHYDM_RF_IQK_OFFLOAD); phydm_fwoffload_ability_clear(p_dm_odm, PHYDM_RF_IQK_OFFLOAD);
RTW_INFO("IQK FW offload:%s\n", hal->RegIQKFWOffload ? "enable" : "disable"); RTW_INFO("IQK FW offload:%s\n", hal->RegIQKFWOffload ? "enable" : "disable");
if (rtw_mi_check_status(adapter, MI_LINKED)) {
#ifdef CONFIG_LPS
LPS_Leave(adapter, "SWITCH_IQK_OFFLOAD");
#endif
halrf_iqk_trigger(p_dm_odm, _FALSE);
}
} }
#if ((RTL8822B_SUPPORT == 1) || (RTL8821C_SUPPORT == 1) || (RTL8814B_SUPPORT == 1)) #if ((RTL8822B_SUPPORT == 1) || (RTL8821C_SUPPORT == 1) || (RTL8814B_SUPPORT == 1) || (RTL8822C_SUPPORT == 1))
void rtw_phydm_iqk_trigger(_adapter *adapter) void rtw_phydm_iqk_trigger(_adapter *adapter)
{ {
struct dm_struct *p_dm_odm = adapter_to_phydm(adapter); struct dm_struct *p_dm_odm = adapter_to_phydm(adapter);
@ -87,10 +94,15 @@ void rtw_phydm_iqk_trigger(_adapter *adapter)
u8 segment = _FALSE; u8 segment = _FALSE;
u8 rfk_forbidden = _FALSE; u8 rfk_forbidden = _FALSE;
/*segment = _rtw_phydm_iqk_segment_chk(adapter);*/
halrf_cmn_info_set(p_dm_odm, HALRF_CMNINFO_RFK_FORBIDDEN, rfk_forbidden); halrf_cmn_info_set(p_dm_odm, HALRF_CMNINFO_RFK_FORBIDDEN, rfk_forbidden);
#if (RTL8822C_SUPPORT == 1) || (RTL8814B_SUPPORT == 1)
/* halrf_cmn_info_set(p_dm_odm, HALRF_CMNINFO_IQK_SEGMENT, segment); to do */
halrf_rf_k_connect_trigger(p_dm_odm, _TRUE, SEGMENT_FREE);
#else
/*segment = _rtw_phydm_iqk_segment_chk(adapter);*/
halrf_cmn_info_set(p_dm_odm, HALRF_CMNINFO_IQK_SEGMENT, segment); halrf_cmn_info_set(p_dm_odm, HALRF_CMNINFO_IQK_SEGMENT, segment);
halrf_segment_iqk_trigger(p_dm_odm, clear, segment); halrf_segment_iqk_trigger(p_dm_odm, clear, segment);
#endif
} }
#endif #endif
@ -98,7 +110,7 @@ void rtw_phydm_iqk_trigger_dbg(_adapter *adapter, bool recovery, bool clear, boo
{ {
struct dm_struct *p_dm_odm = adapter_to_phydm(adapter); struct dm_struct *p_dm_odm = adapter_to_phydm(adapter);
#if ((RTL8822B_SUPPORT == 1) || (RTL8821C_SUPPORT == 1) || (RTL8814B_SUPPORT == 1)) #if ((RTL8822B_SUPPORT == 1) || (RTL8821C_SUPPORT == 1) || (RTL8814B_SUPPORT == 1) || (RTL8822C_SUPPORT == 1))
halrf_segment_iqk_trigger(p_dm_odm, clear, segment); halrf_segment_iqk_trigger(p_dm_odm, clear, segment);
#else #else
halrf_iqk_trigger(p_dm_odm, recovery); halrf_iqk_trigger(p_dm_odm, recovery);
@ -229,6 +241,11 @@ void rtw_phydm_fill_desc_dpt(void *dm, u8 *desc, u8 dpt_lv)
break; break;
#endif #endif
*/ */
#ifdef CONFIG_RTL8822B
case RTL8822B :
SET_TX_DESC_TXPWR_OFSET_8822B(desc, dpt_lv);
break;
#endif
#ifdef CONFIG_RTL8821C #ifdef CONFIG_RTL8821C
case RTL8821C : case RTL8821C :
@ -249,15 +266,34 @@ void rtw_phydm_set_dyntxpwr(_adapter *adapter, u8 *desc, u8 mac_id)
} }
#endif #endif
#ifdef CONFIG_RTW_TX_2PATH_EN #ifdef CONFIG_TDMADIG
void rtw_phydm_tx_2path_en(_adapter *adapter) void rtw_phydm_tdmadig(_adapter *adapter, u8 state)
{ {
struct registry_priv *pregistrypriv = &adapter->registrypriv;
struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
struct dm_struct *dm = adapter_to_phydm(adapter); struct dm_struct *dm = adapter_to_phydm(adapter);
u8 tdma_dig_en;
phydm_tx_2path(dm); switch (state) {
case TDMADIG_INIT:
phydm_tdma_dig_para_upd(dm, ENABLE_TDMA, pregistrypriv->tdmadig_en);
phydm_tdma_dig_para_upd(dm, MODE_DECISION, pregistrypriv->tdmadig_mode);
break;
case TDMADIG_NON_INIT:
if(pregistrypriv->tdmadig_dynamic) {
if(pmlmepriv->LinkDetectInfo.bBusyTraffic == _TRUE)
tdma_dig_en = 0;
else
tdma_dig_en = pregistrypriv->tdmadig_en;
phydm_tdma_dig_para_upd(dm, ENABLE_TDMA, tdma_dig_en);
} }
#endif break;
default:
break;
}
}
#endif/*CONFIG_TDMADIG*/
void rtw_phydm_ops_func_init(struct dm_struct *p_phydm) void rtw_phydm_ops_func_init(struct dm_struct *p_phydm)
{ {
struct ra_table *p_ra_t = &p_phydm->dm_ra_table; struct ra_table *p_ra_t = &p_phydm->dm_ra_table;
@ -334,7 +370,7 @@ void Init_ODM_ComInfo(_adapter *adapter)
rtw_hal_set_odm_var(adapter, HAL_ODM_REGULATION, NULL, _TRUE); rtw_hal_set_odm_var(adapter, HAL_ODM_REGULATION, NULL, _TRUE);
#ifdef CONFIG_DFS_MASTER #ifdef CONFIG_DFS_MASTER
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_DFS_REGION_DOMAIN, adapter->registrypriv.dfs_region_domain); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_DFS_REGION_DOMAIN, adapter_to_rfctl(adapter)->dfs_region_domain);
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_DFS_MASTER_ENABLE, &(adapter_to_rfctl(adapter)->radar_detect_enabled)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_DFS_MASTER_ENABLE, &(adapter_to_rfctl(adapter)->radar_detect_enabled));
#endif #endif
@ -360,6 +396,8 @@ void Init_ODM_ComInfo(_adapter *adapter)
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_EFUSE0X3D7, pHalData->efuse0x3d7); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_EFUSE0X3D7, pHalData->efuse0x3d7);
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_EFUSE0X3D8, pHalData->efuse0x3d8); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_EFUSE0X3D8, pHalData->efuse0x3d8);
/* waiting for PhyDMV034 support*/
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_MANUAL_SUPPORTABILITY, &(adapter->registrypriv.phydm_ability));
/*Add by YuChen for adaptivity init*/ /*Add by YuChen for adaptivity init*/
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_ADAPTIVITY, &(adapter->registrypriv.adaptivity_en)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_ADAPTIVITY, &(adapter->registrypriv.adaptivity_en));
phydm_adaptivity_info_init(pDM_Odm, PHYDM_ADAPINFO_CARRIER_SENSE_ENABLE, (adapter->registrypriv.adaptivity_mode != 0) ? TRUE : FALSE); phydm_adaptivity_info_init(pDM_Odm, PHYDM_ADAPINFO_CARRIER_SENSE_ENABLE, (adapter->registrypriv.adaptivity_mode != 0) ? TRUE : FALSE);
@ -395,6 +433,13 @@ void Init_ODM_ComInfo(_adapter *adapter)
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_SEC_CHNL_OFFSET, &(pHalData->nCur40MhzPrimeSC)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_SEC_CHNL_OFFSET, &(pHalData->nCur40MhzPrimeSC));
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_SEC_MODE, &(adapter->securitypriv.dot11PrivacyAlgrthm)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_SEC_MODE, &(adapter->securitypriv.dot11PrivacyAlgrthm));
#ifdef CONFIG_NARROWBAND_SUPPORTING
if ((adapter->registrypriv.rtw_nb_config == RTW_NB_CONFIG_WIDTH_10)
|| (adapter->registrypriv.rtw_nb_config == RTW_NB_CONFIG_WIDTH_5)) {
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_BW, &(adapter->registrypriv.rtw_nb_config));
}
else
#endif
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_BW, &(pHalData->current_channel_bw)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_BW, &(pHalData->current_channel_bw));
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_CHNL, &(pHalData->current_channel)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_CHNL, &(pHalData->current_channel));
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_NET_CLOSED, &(adapter->net_closed)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_NET_CLOSED, &(adapter->net_closed));
@ -416,8 +461,14 @@ void Init_ODM_ComInfo(_adapter *adapter)
#ifdef CONFIG_DYNAMIC_SOML #ifdef CONFIG_DYNAMIC_SOML
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_ADAPTIVE_SOML, &(adapter->registrypriv.dyn_soml_en)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_ADAPTIVE_SOML, &(adapter->registrypriv.dyn_soml_en));
#endif #endif
#ifdef CONFIG_RTW_PATH_DIV
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_PATH_DIV, &(adapter->registrypriv.path_div));
#endif
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_FCS_MODE, &(pHalData->multi_ch_switch_mode));
/*halrf info hook*/ /*halrf info hook*/
/* waiting for PhyDMV034 support*/
halrf_cmn_info_hook(pDM_Odm, HALRF_CMNINFO_MANUAL_RF_SUPPORTABILITY, &(adapter->registrypriv.halrf_ability));
#ifdef CONFIG_MP_INCLUDED #ifdef CONFIG_MP_INCLUDED
halrf_cmn_info_hook(pDM_Odm, HALRF_CMNINFO_CON_TX, &(adapter->mppriv.mpt_ctx.is_start_cont_tx)); halrf_cmn_info_hook(pDM_Odm, HALRF_CMNINFO_CON_TX, &(adapter->mppriv.mpt_ctx.is_start_cont_tx));
halrf_cmn_info_hook(pDM_Odm, HALRF_CMNINFO_SINGLE_TONE, &(adapter->mppriv.mpt_ctx.is_single_tone)); halrf_cmn_info_hook(pDM_Odm, HALRF_CMNINFO_SINGLE_TONE, &(adapter->mppriv.mpt_ctx.is_single_tone));
@ -425,10 +476,10 @@ void Init_ODM_ComInfo(_adapter *adapter)
halrf_cmn_info_hook(pDM_Odm, HALRF_CMNINFO_MP_RATE_INDEX, &(adapter->mppriv.mpt_ctx.mpt_rate_index)); halrf_cmn_info_hook(pDM_Odm, HALRF_CMNINFO_MP_RATE_INDEX, &(adapter->mppriv.mpt_ctx.mpt_rate_index));
#endif/*CONFIG_MP_INCLUDED*/ #endif/*CONFIG_MP_INCLUDED*/
for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++)
odm_cmn_info_ptr_array_hook(pDM_Odm, ODM_CMNINFO_STA_STATUS, i, NULL); phydm_cmn_sta_info_hook(pDM_Odm, i, NULL);
phydm_init_debug_setting(pDM_Odm);
rtw_phydm_ops_func_init(pDM_Odm); rtw_phydm_ops_func_init(pDM_Odm);
phydm_dm_early_init(pDM_Odm);
/* TODO */ /* TODO */
/* odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_BT_OPERATION, _FALSE); */ /* odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_BT_OPERATION, _FALSE); */
/* odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_BT_DISABLE_EDCA, _FALSE); */ /* odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_BT_DISABLE_EDCA, _FALSE); */
@ -630,7 +681,8 @@ void rtw_hal_turbo_edca(_adapter *adapter)
if (interface_type == RTW_PCIE && if (interface_type == RTW_PCIE &&
((ic_type == RTL8822B) ((ic_type == RTL8822B)
|| (ic_type == RTL8814A))) { || (ic_type == RTL8822C)
|| (ic_type == RTL8814A) || (ic_type == RTL8814B))) {
EDCA_BE_UL = 0x6ea42b; EDCA_BE_UL = 0x6ea42b;
EDCA_BE_DL = 0x6ea42b; EDCA_BE_DL = 0x6ea42b;
} }
@ -749,6 +801,26 @@ void rtw_hal_turbo_edca(_adapter *adapter)
} }
s8 rtw_dm_get_min_rssi(_adapter *adapter)
{
struct macid_ctl_t *macid_ctl = adapter_to_macidctl(adapter);
struct sta_info *sta;
s8 min_rssi = 127, rssi;
int i;
for (i = 0; i < MACID_NUM_SW_LIMIT; i++) {
sta = macid_ctl->sta[i];
if (!sta || !GET_H2CCMD_MSRRPT_PARM_OPMODE(macid_ctl->h2c_msr + i)
|| is_broadcast_mac_addr(sta->cmn.mac_addr))
continue;
rssi = sta->cmn.rssi_stat.rssi;
if (rssi >= 0 && min_rssi > rssi)
min_rssi = rssi;
}
return min_rssi == 127 ? 0 : min_rssi;
}
s8 rtw_phydm_get_min_rssi(_adapter *adapter) s8 rtw_phydm_get_min_rssi(_adapter *adapter)
{ {
struct dm_struct *phydm = adapter_to_phydm(adapter); struct dm_struct *phydm = adapter_to_phydm(adapter);
@ -767,6 +839,15 @@ u8 rtw_phydm_get_cur_igi(_adapter *adapter)
return cur_igi; return cur_igi;
} }
bool rtw_phydm_get_edcca_flag(_adapter *adapter)
{
struct dm_struct *phydm = adapter_to_phydm(adapter);
bool cur_edcca_flag = 0;
cur_edcca_flag = phydm_cmn_info_query(phydm, (enum phydm_info_query) PHYDM_INFO_EDCCA_FLAG);
return cur_edcca_flag;
}
u32 rtw_phydm_get_phy_cnt(_adapter *adapter, enum phy_cnt cnt) u32 rtw_phydm_get_phy_cnt(_adapter *adapter, enum phy_cnt cnt)
{ {
struct dm_struct *phydm = adapter_to_phydm(adapter); struct dm_struct *phydm = adapter_to_phydm(adapter);
@ -821,7 +902,7 @@ u8 rtw_phydm_is_iqk_in_progress(_adapter *adapter)
void SetHalODMVar( void SetHalODMVar(
PADAPTER Adapter, PADAPTER Adapter,
HAL_ODM_VARIABLE eVariable, HAL_ODM_VARIABLE eVariable,
PVOID pValue1, void *pValue1,
BOOLEAN bSet) BOOLEAN bSet)
{ {
struct dm_struct *podmpriv = adapter_to_phydm(Adapter); struct dm_struct *podmpriv = adapter_to_phydm(Adapter);
@ -832,14 +913,12 @@ void SetHalODMVar(
if (bSet) { if (bSet) {
RTW_INFO("### Set STA_(%d) info ###\n", psta->cmn.mac_id); RTW_INFO("### Set STA_(%d) info ###\n", psta->cmn.mac_id);
odm_cmn_info_ptr_array_hook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->cmn.mac_id, psta);
psta->cmn.dm_ctrl = STA_DM_CTRL_ACTIVE; psta->cmn.dm_ctrl = STA_DM_CTRL_ACTIVE;
phydm_cmn_sta_info_hook(podmpriv, psta->cmn.mac_id, &(psta->cmn)); phydm_cmn_sta_info_hook(podmpriv, psta->cmn.mac_id, &(psta->cmn));
} else { } else {
RTW_INFO("### Clean STA_(%d) info ###\n", psta->cmn.mac_id); RTW_INFO("### Clean STA_(%d) info ###\n", psta->cmn.mac_id);
/* _enter_critical_bh(&pHalData->odm_stainfo_lock, &irqL); */ /* _enter_critical_bh(&pHalData->odm_stainfo_lock, &irqL); */
psta->cmn.dm_ctrl = 0; psta->cmn.dm_ctrl = 0;
odm_cmn_info_ptr_array_hook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->cmn.mac_id, NULL);
phydm_cmn_sta_info_hook(podmpriv, psta->cmn.mac_id, NULL); phydm_cmn_sta_info_hook(podmpriv, psta->cmn.mac_id, NULL);
/* _exit_critical_bh(&pHalData->odm_stainfo_lock, &irqL); */ /* _exit_critical_bh(&pHalData->odm_stainfo_lock, &irqL); */
@ -880,7 +959,8 @@ void SetHalODMVar(
rssi_min = rtw_phydm_get_min_rssi(Adapter); rssi_min = rtw_phydm_get_min_rssi(Adapter);
_RTW_PRINT_SEL(sel, "============ Rx Info dump ===================\n"); _RTW_PRINT_SEL(sel, "============ Rx Info dump ===================\n");
_RTW_PRINT_SEL(sel, "is_linked = %d, rssi_min = %d(%%), current_igi = 0x%x\n", podmpriv->is_linked, rssi_min, cur_igi); _RTW_PRINT_SEL(sel, "is_linked = %d, rssi_min = %d(%%)(%d(%%)), current_igi = 0x%x\n"
, podmpriv->is_linked, rssi_min, rtw_dm_get_min_rssi(Adapter), cur_igi);
_RTW_PRINT_SEL(sel, "cnt_cck_fail = %d, cnt_ofdm_fail = %d, Total False Alarm = %d\n", _RTW_PRINT_SEL(sel, "cnt_cck_fail = %d, cnt_ofdm_fail = %d, Total False Alarm = %d\n",
rtw_phydm_get_phy_cnt(Adapter, FA_CCK), rtw_phydm_get_phy_cnt(Adapter, FA_CCK),
rtw_phydm_get_phy_cnt(Adapter, FA_OFDM), rtw_phydm_get_phy_cnt(Adapter, FA_OFDM),
@ -931,8 +1011,8 @@ void SetHalODMVar(
void GetHalODMVar( void GetHalODMVar(
PADAPTER Adapter, PADAPTER Adapter,
HAL_ODM_VARIABLE eVariable, HAL_ODM_VARIABLE eVariable,
PVOID pValue1, void *pValue1,
PVOID pValue2) void *pValue2)
{ {
struct dm_struct *podmpriv = adapter_to_phydm(Adapter); struct dm_struct *podmpriv = adapter_to_phydm(Adapter);
@ -1081,11 +1161,8 @@ void rtw_phydm_wd_lps_lclk_hdl(_adapter *adapter)
{ {
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(adapter); PHAL_DATA_TYPE pHalData = GET_HAL_DATA(adapter);
struct dm_struct *podmpriv = &(pHalData->odmpriv);
struct sta_priv *pstapriv = &adapter->stapriv; struct sta_priv *pstapriv = &adapter->stapriv;
struct sta_info *psta = NULL; struct sta_info *psta = NULL;
u8 rssi_min = 0;
u32 rssi_rpt = 0;
bool is_linked = _FALSE; bool is_linked = _FALSE;
if (!rtw_is_hw_init_completed(adapter)) if (!rtw_is_hw_init_completed(adapter))
@ -1110,21 +1187,14 @@ void rtw_phydm_watchdog_in_lps_lclk(_adapter *adapter)
{ {
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
struct sta_priv *pstapriv = &adapter->stapriv; struct sta_priv *pstapriv = &adapter->stapriv;
struct sta_info *psta = NULL;
u8 cur_igi = 0; u8 cur_igi = 0;
s8 min_rssi = 0; s8 min_rssi = 0;
if (!rtw_is_hw_init_completed(adapter)) if (!rtw_is_hw_init_completed(adapter))
return; return;
psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv));
if (psta == NULL)
return;
cur_igi = rtw_phydm_get_cur_igi(adapter); cur_igi = rtw_phydm_get_cur_igi(adapter);
min_rssi = rtw_phydm_get_min_rssi(adapter); min_rssi = rtw_dm_get_min_rssi(adapter);
if (min_rssi <= 0)
min_rssi = psta->cmn.rssi_stat.rssi;
/*RTW_INFO("%s "ADPT_FMT" cur_ig_value=%d, min_rssi = %d\n", __func__, ADPT_ARG(adapter), cur_igi, min_rssi);*/ /*RTW_INFO("%s "ADPT_FMT" cur_ig_value=%d, min_rssi = %d\n", __func__, ADPT_ARG(adapter), cur_igi, min_rssi);*/
if (min_rssi <= 0) if (min_rssi <= 0)
@ -1287,11 +1357,148 @@ static void init_phydm_info(_adapter *adapter)
odm_cmn_info_init(phydm, ODM_CMNINFO_FW_VER, hal_data->firmware_version); odm_cmn_info_init(phydm, ODM_CMNINFO_FW_VER, hal_data->firmware_version);
odm_cmn_info_init(phydm, ODM_CMNINFO_FW_SUB_VER, hal_data->firmware_sub_version); odm_cmn_info_init(phydm, ODM_CMNINFO_FW_SUB_VER, hal_data->firmware_sub_version);
} }
#ifdef CONFIG_CTRL_TXSS_BY_TP
void rtw_phydm_trx_cfg(_adapter *adapter, bool tx_1ss)
{
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
enum bb_path txpath = BB_PATH_AB;
enum bb_path rxpath = BB_PATH_AB;
/*is_2tx = _FALSE for 8822B, or BB_PATH_AUTO for PATH_DIVERSITY for 8822B*/
enum bb_path txpath_1ss = BB_PATH_A;
rtw_hal_get_trx_path(adapter_to_dvobj(adapter), NULL, &txpath, &rxpath);
txpath = (tx_1ss) ? BB_PATH_A : txpath;
if (phydm_api_trx_mode(adapter_to_phydm(adapter), txpath, rxpath, txpath_1ss) == FALSE)
RTW_ERR("%s failed\n", __func__);
}
#endif
/*
* trx_mode init - 8822B / 8822C / 8192F
* 1ssNTx - 8192E / 8812A / 8822B / 8822C / 8192F
* Path-diversity - 8822B / 8822C / 8192F
* PHYDM API - phydm_api_trx_mode
*/
static u8 rtw_phydm_config_trx_path(_adapter *adapter)
{
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
enum bb_path txpath;
enum bb_path rxpath;
int i;
u8 rst = _FAIL;
rtw_hal_get_trx_path(adapter_to_dvobj(adapter), NULL, &txpath, &rxpath);
if (!txpath) {
RTW_ERR("%s tx_path_bmp is empty\n", __func__);
rtw_warn_on(1);
goto exit;
}
if (!rxpath) {
RTW_ERR("%s rx_path_bmp is empty\n", __func__);
rtw_warn_on(1);
goto exit;
}
tx_path_nss_set_default(hal_data->txpath_nss, hal_data->txpath_num_nss
, GET_HAL_TX_PATH_BMP(adapter));
#if defined(CONFIG_RTL8192F) || defined(CONFIG_RTL8822B) ||defined(CONFIG_RTL8822C)
{
enum bb_path txpath_1ss;
if (txpath == BB_PATH_AB) {
switch (hal_data->max_tx_cnt) {
case 2:
#ifdef CONFIG_RTW_TX_NPATH_EN
if (adapter->registrypriv.tx_npath == 1)
txpath_1ss = BB_PATH_AB;
else
#endif
#ifdef CONFIG_RTW_PATH_DIV
if (adapter->registrypriv.path_div == 1) /* path diversity, support 2sts TX */
txpath_1ss = BB_PATH_AUTO;
else
#endif
txpath_1ss = BB_PATH_A;
break;
case 1:
#ifdef CONFIG_RTW_PATH_DIV
if (adapter->registrypriv.path_div == 1) /* path diversity, no support 2sts TX */
txpath = txpath_1ss = BB_PATH_AUTO;
else
#endif
txpath = txpath_1ss = BB_PATH_A;
break;
default:
RTW_ERR("%s invalid max_tx_cnt:%u\n", __func__
, hal_data->max_tx_cnt);
rtw_warn_on(1);
goto exit;
}
} else
txpath_1ss = txpath;
if (phydm_api_trx_mode(adapter_to_phydm(adapter), txpath, rxpath, txpath_1ss) == FALSE) {
RTW_ERR("%s txpath=0x%x, rxpath=0x%x, txpath_1ss=0x%x fail\n", __func__
, txpath, rxpath, txpath_1ss);
rtw_warn_on(1);
goto exit;
}
if (hal_data->txpath_nss[0] != txpath_1ss) {
hal_data->txpath_nss[0] = txpath_1ss;
if (txpath_1ss == BB_PATH_AUTO)
hal_data->txpath_num_nss[0] = 1;
else {
hal_data->txpath_num_nss[0] = 0;
for (i = 0; i < RF_PATH_MAX; i++) {
if (txpath_1ss & BIT(i))
hal_data->txpath_num_nss[0]++;
}
}
}
}
#elif defined(CONFIG_RTL8814B)
{
if (config_phydm_trx_mode_8814b(adapter_to_phydm(adapter), txpath, rxpath) == FALSE) {
RTW_ERR("%s txpath=0x%x, rxpath=0x%x fail\n", __func__
, txpath, rxpath);
rtw_warn_on(1);
goto exit;
}
/* 8814B is always full-TX */
tx_path_nss_set_full_tx(hal_data->txpath_nss, hal_data->txpath_num_nss, txpath);
}
#elif defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8192E)
{
#ifdef CONFIG_RTW_TX_NPATH_EN
if (adapter->registrypriv.tx_npath == 1) {
phydm_tx_2path(adapter_to_phydm(adapter));
tx_path_nss_set_full_tx(hal_data->txpath_nss, hal_data->txpath_num_nss, txpath);
}
#endif
}
#endif
hal_data->txpath = txpath;
hal_data->rxpath = rxpath;
dump_hal_runtime_trx_mode(RTW_DBGDUMP, adapter);
rst = _SUCCESS;
exit:
return rst;
}
void rtw_phydm_init(_adapter *adapter) void rtw_phydm_init(_adapter *adapter)
{ {
PHAL_DATA_TYPE hal_data = GET_HAL_DATA(adapter); PHAL_DATA_TYPE hal_data = GET_HAL_DATA(adapter);
struct dm_struct *phydm = &(hal_data->odmpriv); struct dm_struct *phydm = &(hal_data->odmpriv);
rtw_phydm_config_trx_path(adapter);
init_phydm_info(adapter); init_phydm_info(adapter);
odm_dm_init(phydm); odm_dm_init(phydm);
#ifdef CONFIG_CUSTOMER01_SMART_ANTENNA #ifdef CONFIG_CUSTOMER01_SMART_ANTENNA
@ -1299,6 +1506,14 @@ void rtw_phydm_init(_adapter *adapter)
#endif #endif
} }
bool rtw_phydm_set_crystal_cap(_adapter *adapter, u8 crystal_cap)
{
PHAL_DATA_TYPE hal_data = GET_HAL_DATA(adapter);
struct dm_struct *phydm = &(hal_data->odmpriv);
return phydm_set_crystal_cap_reg(phydm, crystal_cap);
}
#ifdef CONFIG_LPS_PG #ifdef CONFIG_LPS_PG
/* /*
static void _lps_pg_state_update(_adapter *adapter) static void _lps_pg_state_update(_adapter *adapter)
@ -1387,7 +1602,7 @@ static u8 _rtw_phydm_rfk_condition_check(_adapter *adapter, u8 is_scaning, u8 if
return rfk_allowed; return rfk_allowed;
} }
#if ((RTL8822B_SUPPORT == 1) || (RTL8821C_SUPPORT == 1) || (RTL8814B_SUPPORT == 1)) #if ((RTL8822B_SUPPORT == 1) || (RTL8821C_SUPPORT == 1) || (RTL8814B_SUPPORT == 1) || (RTL8822C_SUPPORT == 1))
static u8 _rtw_phydm_iqk_segment_chk(_adapter *adapter, u8 ifs_linked) static u8 _rtw_phydm_iqk_segment_chk(_adapter *adapter, u8 ifs_linked)
{ {
u8 iqk_sgt = _FALSE; u8 iqk_sgt = _FALSE;
@ -1412,7 +1627,9 @@ static u8 _rtw_phydm_pwr_tracking_rate_check(_adapter *adapter)
u8 if_tx_rate = 0xFF; u8 if_tx_rate = 0xFF;
u8 tx_rate = 0xFF; u8 tx_rate = 0xFF;
struct mlme_ext_priv *pmlmeext = NULL; struct mlme_ext_priv *pmlmeext = NULL;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(adapter);
for (i = 0; i < dvobj->iface_nums; i++) { for (i = 0; i < dvobj->iface_nums; i++) {
iface = dvobj->padapters[i]; iface = dvobj->padapters[i];
@ -1424,12 +1641,24 @@ static u8 _rtw_phydm_pwr_tracking_rate_check(_adapter *adapter)
else else
#endif #endif
if_tx_rate = pmlmeext->tx_rate; if_tx_rate = pmlmeext->tx_rate;
if(if_tx_rate < tx_rate)
tx_rate = if_tx_rate;
RTW_DBG("%s i=%d tx_rate =0x%x\n", __func__, i, if_tx_rate); if (if_tx_rate < tx_rate) {
/*5G limit ofdm rate*/
if (pHalData->current_channel > 14) {
if (!IS_CCK_RATE(if_tx_rate))
tx_rate = if_tx_rate;
} else {
tx_rate = if_tx_rate;
} }
} }
RTW_DBG("%s i=%d if_tx_rate =0x%x\n", __func__, i, if_tx_rate);
}
}
/*suggest by RF James,unlinked setting ofdm rate*/
if (tx_rate == 0xFF)
tx_rate = IEEE80211_OFDM_RATE_6MB;
RTW_DBG("%s tx_low_rate (unlinked to any AP)=0x%x\n", __func__, tx_rate); RTW_DBG("%s tx_low_rate (unlinked to any AP)=0x%x\n", __func__, tx_rate);
return tx_rate; return tx_rate;
} }
@ -1481,7 +1710,15 @@ void rtw_dyn_soml_config(_adapter *adapter)
} }
#endif #endif
void rtw_phydm_set_rrsr(_adapter *adapter, u32 rrsr_value, bool write_rrsr)
{
struct dm_struct *phydm = adapter_to_phydm(adapter);
odm_cmn_info_update(phydm, ODM_CMNINFO_RRSR_VAL, rrsr_value);
if(write_rrsr)
phydm_rrsr_set_register(phydm, rrsr_value);
}
void rtw_phydm_read_efuse(_adapter *adapter) void rtw_phydm_read_efuse(_adapter *adapter)
{ {
PHAL_DATA_TYPE hal_data = GET_HAL_DATA(adapter); PHAL_DATA_TYPE hal_data = GET_HAL_DATA(adapter);
@ -1516,7 +1753,7 @@ void rtw_phydm_watchdog(_adapter *adapter, bool in_lps)
u8 bsta_state = _FALSE; u8 bsta_state = _FALSE;
u8 bBtDisabled = _TRUE; u8 bBtDisabled = _TRUE;
u8 rfk_forbidden = _FALSE; u8 rfk_forbidden = _FALSE;
#if ((RTL8822B_SUPPORT == 1) || (RTL8821C_SUPPORT == 1) || (RTL8814B_SUPPORT == 1)) #if ((RTL8822B_SUPPORT == 1) || (RTL8821C_SUPPORT == 1) || (RTL8814B_SUPPORT == 1) || (RTL8822C_SUPPORT == 1))
u8 segment_iqk = _FALSE; u8 segment_iqk = _FALSE;
#endif #endif
u8 tx_unlinked_low_rate = 0xFF; u8 tx_unlinked_low_rate = 0xFF;
@ -1542,14 +1779,16 @@ void rtw_phydm_watchdog(_adapter *adapter, bool in_lps)
#ifdef CONFIG_BT_COEXIST #ifdef CONFIG_BT_COEXIST
bBtDisabled = rtw_btcoex_IsBtDisabled(adapter); bBtDisabled = rtw_btcoex_IsBtDisabled(adapter);
#endif /* CONFIG_BT_COEXIST */
odm_cmn_info_update(&pHalData->odmpriv, ODM_CMNINFO_BT_ENABLED, odm_cmn_info_update(&pHalData->odmpriv, ODM_CMNINFO_BT_ENABLED,
(bBtDisabled == _TRUE) ? _FALSE : _TRUE); (bBtDisabled == _TRUE) ? _FALSE : _TRUE);
#else
odm_cmn_info_update(&pHalData->odmpriv, ODM_CMNINFO_BT_ENABLED, _FALSE);
#endif /* CONFIG_BT_COEXIST */
rfk_forbidden = (_rtw_phydm_rfk_condition_check(adapter, pHalData->bScanInProcess, bLinked) == _TRUE) ? _FALSE : _TRUE; rfk_forbidden = (_rtw_phydm_rfk_condition_check(adapter, pHalData->bScanInProcess, bLinked) == _TRUE) ? _FALSE : _TRUE;
halrf_cmn_info_set(&pHalData->odmpriv, HALRF_CMNINFO_RFK_FORBIDDEN, rfk_forbidden); halrf_cmn_info_set(&pHalData->odmpriv, HALRF_CMNINFO_RFK_FORBIDDEN, rfk_forbidden);
#if ((RTL8822B_SUPPORT == 1) || (RTL8821C_SUPPORT == 1) || (RTL8814B_SUPPORT == 1)) #if ((RTL8822B_SUPPORT == 1) || (RTL8821C_SUPPORT == 1) || (RTL8814B_SUPPORT == 1) || (RTL8822C_SUPPORT == 1))
segment_iqk = _rtw_phydm_iqk_segment_chk(adapter, bLinked); segment_iqk = _rtw_phydm_iqk_segment_chk(adapter, bLinked);
halrf_cmn_info_set(&pHalData->odmpriv, HALRF_CMNINFO_IQK_SEGMENT, segment_iqk); halrf_cmn_info_set(&pHalData->odmpriv, HALRF_CMNINFO_IQK_SEGMENT, segment_iqk);
#endif #endif
@ -1570,6 +1809,10 @@ void rtw_phydm_watchdog(_adapter *adapter, bool in_lps)
goto _exit; goto _exit;
}*/ }*/
#ifdef CONFIG_TDMADIG
rtw_phydm_tdmadig(adapter, TDMADIG_NON_INIT);
#endif/*CONFIG_TDMADIG*/
if (in_lps) if (in_lps)
phydm_watchdog_lps(&pHalData->odmpriv); phydm_watchdog_lps(&pHalData->odmpriv);
else else
@ -1579,7 +1822,7 @@ void rtw_phydm_watchdog(_adapter *adapter, bool in_lps)
rtw_acs_update_current_info(adapter); rtw_acs_update_current_info(adapter);
#endif #endif
_exit:
return; return;
} }

View File

@ -17,7 +17,9 @@
#define adapter_to_phydm(adapter) (&(GET_HAL_DATA(adapter)->odmpriv)) #define adapter_to_phydm(adapter) (&(GET_HAL_DATA(adapter)->odmpriv))
#define dvobj_to_phydm(dvobj) adapter_to_phydm(dvobj_get_primary_adapter(dvobj)) #define dvobj_to_phydm(dvobj) adapter_to_phydm(dvobj_get_primary_adapter(dvobj))
#ifdef CONFIG_TDMADIG
void rtw_phydm_tdmadig(_adapter *adapter, u8 state);
#endif
void rtw_phydm_priv_init(_adapter *adapter); void rtw_phydm_priv_init(_adapter *adapter);
void Init_ODM_ComInfo(_adapter *adapter); void Init_ODM_ComInfo(_adapter *adapter);
void rtw_phydm_init(_adapter *adapter); void rtw_phydm_init(_adapter *adapter);
@ -28,12 +30,12 @@ u8 rtw_phydm_is_iqk_in_progress(_adapter *adapter);
void GetHalODMVar( void GetHalODMVar(
PADAPTER Adapter, PADAPTER Adapter,
HAL_ODM_VARIABLE eVariable, HAL_ODM_VARIABLE eVariable,
PVOID pValue1, void *pValue1,
PVOID pValue2); void *pValue2);
void SetHalODMVar( void SetHalODMVar(
PADAPTER Adapter, PADAPTER Adapter,
HAL_ODM_VARIABLE eVariable, HAL_ODM_VARIABLE eVariable,
PVOID pValue1, void *pValue1,
BOOLEAN bSet); BOOLEAN bSet);
void rtw_phydm_ra_registed(_adapter *adapter, struct sta_info *psta); void rtw_phydm_ra_registed(_adapter *adapter, struct sta_info *psta);
@ -44,6 +46,7 @@ void rtw_dyn_soml_para_set(_adapter *adapter, u8 train_num, u8 intvl,
u8 period, u8 delay); u8 period, u8 delay);
void rtw_dyn_soml_config(_adapter *adapter); void rtw_dyn_soml_config(_adapter *adapter);
#endif #endif
void rtw_phydm_set_rrsr(_adapter *adapter, u32 rrsr_value, bool write_rrsr);
void rtw_phydm_watchdog(_adapter *adapter, bool in_lps); void rtw_phydm_watchdog(_adapter *adapter, bool in_lps);
void rtw_hal_update_iqk_fw_offload_cap(_adapter *adapter); void rtw_hal_update_iqk_fw_offload_cap(_adapter *adapter);
@ -55,8 +58,10 @@ void rtw_hal_iqk_test(_adapter *adapter, bool recovery, bool clear, bool segment
void rtw_hal_lck_test(_adapter *adapter); void rtw_hal_lck_test(_adapter *adapter);
#endif #endif
s8 rtw_dm_get_min_rssi(_adapter *adapter);
s8 rtw_phydm_get_min_rssi(_adapter *adapter); s8 rtw_phydm_get_min_rssi(_adapter *adapter);
u8 rtw_phydm_get_cur_igi(_adapter *adapter); u8 rtw_phydm_get_cur_igi(_adapter *adapter);
bool rtw_phydm_get_edcca_flag(_adapter *adapter);
#ifdef CONFIG_LPS_LCLK_WD_TIMER #ifdef CONFIG_LPS_LCLK_WD_TIMER
@ -65,7 +70,12 @@ extern void phydm_rssi_monitor_check(void *p_dm_void);
void rtw_phydm_wd_lps_lclk_hdl(_adapter *adapter); void rtw_phydm_wd_lps_lclk_hdl(_adapter *adapter);
void rtw_phydm_watchdog_in_lps_lclk(_adapter *adapter); void rtw_phydm_watchdog_in_lps_lclk(_adapter *adapter);
#endif #endif
#ifdef CONFIG_TDMADIG
enum rtw_tdmadig_state{
TDMADIG_INIT,
TDMADIG_NON_INIT,
};
#endif
enum phy_cnt { enum phy_cnt {
FA_OFDM, FA_OFDM,
FA_CCK, FA_CCK,
@ -83,17 +93,16 @@ enum phy_cnt {
CRC32_ERROR_CCK, CRC32_ERROR_CCK,
}; };
u32 rtw_phydm_get_phy_cnt(_adapter *adapter, enum phy_cnt cnt); u32 rtw_phydm_get_phy_cnt(_adapter *adapter, enum phy_cnt cnt);
#if ((RTL8822B_SUPPORT == 1) || (RTL8821C_SUPPORT == 1) || (RTL8814B_SUPPORT == 1)) #if ((RTL8822B_SUPPORT == 1) || (RTL8821C_SUPPORT == 1) || (RTL8814B_SUPPORT == 1) || (RTL8822C_SUPPORT == 1))
void rtw_phydm_iqk_trigger(_adapter *adapter); void rtw_phydm_iqk_trigger(_adapter *adapter);
#endif #endif
void rtw_phydm_read_efuse(_adapter *adapter); void rtw_phydm_read_efuse(_adapter *adapter);
bool rtw_phydm_set_crystal_cap(_adapter *adapter, u8 crystal_cap);
#ifdef CONFIG_SUPPORT_DYNAMIC_TXPWR #ifdef CONFIG_SUPPORT_DYNAMIC_TXPWR
void rtw_phydm_set_dyntxpwr(_adapter *adapter, u8 *desc, u8 mac_id); void rtw_phydm_set_dyntxpwr(_adapter *adapter, u8 *desc, u8 mac_id);
#endif #endif
#ifdef CONFIG_RTW_TX_2PATH_EN
void rtw_phydm_tx_2path_en(_adapter *adapter);
#endif
#ifdef CONFIG_LPS_PG #ifdef CONFIG_LPS_PG
void rtw_phydm_lps_pg_hdl(_adapter *adapter, struct sta_info *sta, bool in_lpspg); void rtw_phydm_lps_pg_hdl(_adapter *adapter, struct sta_info *sta, bool in_lpspg);
#endif #endif
@ -101,4 +110,8 @@ void rtw_phydm_lps_pg_hdl(_adapter *adapter, struct sta_info *sta, bool in_lpspg
void rtw_phydm_pwr_tracking_directly(_adapter *adapter); void rtw_phydm_pwr_tracking_directly(_adapter *adapter);
#endif #endif
#ifdef CONFIG_CTRL_TXSS_BY_TP
void rtw_phydm_trx_cfg(_adapter *adapter, bool tx_1ss);
#endif
#endif /* __HAL_DM_H__ */ #endif /* __HAL_DM_H__ */

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2015 - 2018 Realtek Corporation. * Copyright(c) 2015 - 2019 Realtek Corporation.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -310,7 +310,7 @@ static u8 _halmac_reg_read_8(void *p, u32 offset)
d = (struct dvobj_priv *)p; d = (struct dvobj_priv *)p;
adapter = dvobj_get_primary_adapter(d); adapter = dvobj_get_primary_adapter(d);
return rtw_read8(adapter, offset); return _rtw_read8(adapter, offset);
} }
static u16 _halmac_reg_read_16(void *p, u32 offset) static u16 _halmac_reg_read_16(void *p, u32 offset)
@ -322,7 +322,7 @@ static u16 _halmac_reg_read_16(void *p, u32 offset)
d = (struct dvobj_priv *)p; d = (struct dvobj_priv *)p;
adapter = dvobj_get_primary_adapter(d); adapter = dvobj_get_primary_adapter(d);
return rtw_read16(adapter, offset); return _rtw_read16(adapter, offset);
} }
static u32 _halmac_reg_read_32(void *p, u32 offset) static u32 _halmac_reg_read_32(void *p, u32 offset)
@ -334,7 +334,7 @@ static u32 _halmac_reg_read_32(void *p, u32 offset)
d = (struct dvobj_priv *)p; d = (struct dvobj_priv *)p;
adapter = dvobj_get_primary_adapter(d); adapter = dvobj_get_primary_adapter(d);
return rtw_read32(adapter, offset); return _rtw_read32(adapter, offset);
} }
static void _halmac_reg_write_8(void *p, u32 offset, u8 val) static void _halmac_reg_write_8(void *p, u32 offset, u8 val)
@ -347,7 +347,7 @@ static void _halmac_reg_write_8(void *p, u32 offset, u8 val)
d = (struct dvobj_priv *)p; d = (struct dvobj_priv *)p;
adapter = dvobj_get_primary_adapter(d); adapter = dvobj_get_primary_adapter(d);
err = rtw_write8(adapter, offset, val); err = _rtw_write8(adapter, offset, val);
if (err == _FAIL) if (err == _FAIL)
RTW_ERR("%s: I/O FAIL!\n", __FUNCTION__); RTW_ERR("%s: I/O FAIL!\n", __FUNCTION__);
} }
@ -362,7 +362,7 @@ static void _halmac_reg_write_16(void *p, u32 offset, u16 val)
d = (struct dvobj_priv *)p; d = (struct dvobj_priv *)p;
adapter = dvobj_get_primary_adapter(d); adapter = dvobj_get_primary_adapter(d);
err = rtw_write16(adapter, offset, val); err = _rtw_write16(adapter, offset, val);
if (err == _FAIL) if (err == _FAIL)
RTW_ERR("%s: I/O FAIL!\n", __FUNCTION__); RTW_ERR("%s: I/O FAIL!\n", __FUNCTION__);
} }
@ -377,12 +377,32 @@ static void _halmac_reg_write_32(void *p, u32 offset, u32 val)
d = (struct dvobj_priv *)p; d = (struct dvobj_priv *)p;
adapter = dvobj_get_primary_adapter(d); adapter = dvobj_get_primary_adapter(d);
err = rtw_write32(adapter, offset, val); err = _rtw_write32(adapter, offset, val);
if (err == _FAIL) if (err == _FAIL)
RTW_ERR("%s: I/O FAIL!\n", __FUNCTION__); RTW_ERR("%s: I/O FAIL!\n", __FUNCTION__);
} }
#endif /* !CONFIG_SDIO_HCI */ #endif /* !CONFIG_SDIO_HCI */
#ifdef DBG_IO
static void _halmac_reg_read_monitor(void *p, u32 addr, u32 len, u32 val
, const char *caller, const u32 line)
{
struct dvobj_priv *d = (struct dvobj_priv *)p;
_adapter *adapter = dvobj_get_primary_adapter(d);
dbg_rtw_reg_read_monitor(adapter, addr, len, val, caller, line);
}
static void _halmac_reg_write_monitor(void *p, u32 addr, u32 len, u32 val
, const char *caller, const u32 line)
{
struct dvobj_priv *d = (struct dvobj_priv *)p;
_adapter *adapter = dvobj_get_primary_adapter(d);
dbg_rtw_reg_write_monitor(adapter, addr, len, val, caller, line);
}
#endif
static u8 _halmac_mfree(void *p, void *buffer, u32 size) static u8 _halmac_mfree(void *p, void *buffer, u32 size)
{ {
rtw_mfree(buffer, size); rtw_mfree(buffer, size);
@ -538,7 +558,10 @@ const char *const RTW_HALMAC_FEATURE_NAME[] = {
"HALMAC_FEATURE_CFG_PARA", "HALMAC_FEATURE_CFG_PARA",
"HALMAC_FEATURE_DUMP_PHYSICAL_EFUSE", "HALMAC_FEATURE_DUMP_PHYSICAL_EFUSE",
"HALMAC_FEATURE_DUMP_LOGICAL_EFUSE", "HALMAC_FEATURE_DUMP_LOGICAL_EFUSE",
"HALMAC_FEATURE_DUMP_LOGICAL_EFUSE_MASK",
"HALMAC_FEATURE_UPDATE_PACKET", "HALMAC_FEATURE_UPDATE_PACKET",
"HALMAC_FEATURE_SEND_SCAN_PACKET",
"HALMAC_FEATURE_DROP_SCAN_PACKET",
"HALMAC_FEATURE_UPDATE_DATAPACK", "HALMAC_FEATURE_UPDATE_DATAPACK",
"HALMAC_FEATURE_RUN_DATAPACK", "HALMAC_FEATURE_RUN_DATAPACK",
"HALMAC_FEATURE_CHANNEL_SWITCH", "HALMAC_FEATURE_CHANNEL_SWITCH",
@ -760,6 +783,11 @@ struct halmac_platform_api rtw_halmac_platform_api = {
.REG_WRITE_32 = _halmac_reg_write_32, .REG_WRITE_32 = _halmac_reg_write_32,
#endif /* CONFIG_USB_HCI || CONFIG_PCI_HCI */ #endif /* CONFIG_USB_HCI || CONFIG_PCI_HCI */
#ifdef DBG_IO
.READ_MONITOR = _halmac_reg_read_monitor,
.WRITE_MONITOR = _halmac_reg_write_monitor,
#endif
/* Write data */ /* Write data */
#if 0 #if 0
/* impletement in HAL-IC level */ /* impletement in HAL-IC level */
@ -1049,12 +1077,15 @@ static int init_write_rsvd_page_size(struct dvobj_priv *d)
size = MAX_CMDBUF_SZ - TXDESC_OFFSET; size = MAX_CMDBUF_SZ - TXDESC_OFFSET;
#elif defined(CONFIG_SDIO_HCI) #elif defined(CONFIG_SDIO_HCI)
size = 0x7000; /* 28KB */ size = 0x7000; /* 28KB */
#else
/* Use HALMAC default setting and don't call any function */
return 0;
#endif #endif
#if 0 /* Fail to pass coverity DEADCODE check */
/* If size==0, use HALMAC default setting and don't call any function */ /* If size==0, use HALMAC default setting and don't call any function */
if (!size) if (!size)
return 0; return 0;
#endif
err = rtw_halmac_set_max_dl_fw_size(d, size); err = rtw_halmac_set_max_dl_fw_size(d, size);
if (err) { if (err) {
RTW_ERR("%s: Fail to set max download fw size!\n", __FUNCTION__); RTW_ERR("%s: Fail to set max download fw size!\n", __FUNCTION__);
@ -1401,7 +1432,7 @@ int rtw_halmac_get_hw_value(struct dvobj_priv *d, enum halmac_hw_id hw_id, void
* *
* Get TX FIFO size(byte) from HALMAC. * Get TX FIFO size(byte) from HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_get_tx_fifo_size(struct dvobj_priv *d, u32 *size) int rtw_halmac_get_tx_fifo_size(struct dvobj_priv *d, u32 *size)
{ {
@ -1430,7 +1461,7 @@ int rtw_halmac_get_tx_fifo_size(struct dvobj_priv *d, u32 *size)
* *
* Get RX FIFO size(byte) from HALMAC. * Get RX FIFO size(byte) from HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_get_rx_fifo_size(struct dvobj_priv *d, u32 *size) int rtw_halmac_get_rx_fifo_size(struct dvobj_priv *d, u32 *size)
{ {
@ -1459,7 +1490,7 @@ int rtw_halmac_get_rx_fifo_size(struct dvobj_priv *d, u32 *size)
* *
* Get reserve page boundary of driver from HALMAC. * Get reserve page boundary of driver from HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_get_rsvd_drv_pg_bndy(struct dvobj_priv *d, u16 *bndy) int rtw_halmac_get_rsvd_drv_pg_bndy(struct dvobj_priv *d, u16 *bndy)
{ {
@ -1488,7 +1519,7 @@ int rtw_halmac_get_rsvd_drv_pg_bndy(struct dvobj_priv *d, u16 *bndy)
* *
* Get TX/RX page size(byte) from HALMAC. * Get TX/RX page size(byte) from HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_get_page_size(struct dvobj_priv *d, u32 *size) int rtw_halmac_get_page_size(struct dvobj_priv *d, u32 *size)
{ {
@ -1517,7 +1548,7 @@ int rtw_halmac_get_page_size(struct dvobj_priv *d, u32 *size)
* *
* Get TX aggregation align size(byte) from HALMAC. * Get TX aggregation align size(byte) from HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_get_tx_agg_align_size(struct dvobj_priv *d, u16 *size) int rtw_halmac_get_tx_agg_align_size(struct dvobj_priv *d, u16 *size)
{ {
@ -1546,7 +1577,7 @@ int rtw_halmac_get_tx_agg_align_size(struct dvobj_priv *d, u16 *size)
* *
* Get RX aggregation align size(byte) from HALMAC. * Get RX aggregation align size(byte) from HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_get_rx_agg_align_size(struct dvobj_priv *d, u8 *size) int rtw_halmac_get_rx_agg_align_size(struct dvobj_priv *d, u8 *size)
{ {
@ -1588,7 +1619,7 @@ int rtw_halmac_get_rx_agg_align_size(struct dvobj_priv *d, u8 *size)
* d pointer to struct dvobj_priv of driver * d pointer to struct dvobj_priv of driver
* sz rx driver info size in bytes. * sz rx driver info size in bytes.
* *
* Rteurn: * Return:
* 0 Success * 0 Success
* other Fail * other Fail
*/ */
@ -1614,7 +1645,7 @@ int rtw_halmac_get_rx_drv_info_sz(struct dvobj_priv *d, u8 *sz)
* *
* Get TX descriptor size(byte) from HALMAC. * Get TX descriptor size(byte) from HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_get_tx_desc_size(struct dvobj_priv *d, u32 *size) int rtw_halmac_get_tx_desc_size(struct dvobj_priv *d, u32 *size)
{ {
@ -1643,7 +1674,7 @@ int rtw_halmac_get_tx_desc_size(struct dvobj_priv *d, u32 *size)
* *
* Get RX descriptor size(byte) from HALMAC. * Get RX descriptor size(byte) from HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_get_rx_desc_size(struct dvobj_priv *d, u32 *size) int rtw_halmac_get_rx_desc_size(struct dvobj_priv *d, u32 *size)
{ {
@ -1665,6 +1696,83 @@ int rtw_halmac_get_rx_desc_size(struct dvobj_priv *d, u32 *size)
return 0; return 0;
} }
/**
* rtw_halmac_get_tx_dma_ch_map() - Get TX DMA channel Map for tx desc
* @d: struct dvobj_priv*
* @dma_ch_map: return map of QSEL to DMA channel
* @map_size: size of dma_ch_map
* Suggest size to be last valid QSEL(QSLT_CMD)+1 or full QSLT
* size(0x20)
*
* 8814B would need this to get mapping of QSEL to DMA channel for TX desc.
*
* Return 0 for OK, otherwise fail.
*/
int rtw_halmac_get_tx_dma_ch_map(struct dvobj_priv *d, u8 *dma_ch_map, u8 map_size)
{
struct halmac_adapter *halmac;
struct halmac_api *api;
enum halmac_ret_status status;
struct halmac_rqpn_ch_map map;
enum halmac_dma_ch channel = HALMAC_DMA_CH_UNDEFINE;
u8 qsel;
halmac = dvobj_to_halmac(d);
api = HALMAC_GET_API(halmac);
status = api->halmac_get_hw_value(halmac, HALMAC_HW_RQPN_CH_MAPPING, &map);
if (status != HALMAC_RET_SUCCESS)
return -1;
for (qsel = 0; qsel < map_size; qsel++) {
switch (qsel) {
/*case QSLT_VO:*/
case 0x06:
case 0x07:
channel = map.dma_map_vo;
break;
/*case QSLT_VI:*/
case 0x04:
case 0x05:
channel = map.dma_map_vi;
break;
/*case QSLT_BE:*/
case 0x00:
case 0x03:
channel = map.dma_map_be;
break;
/*case QSLT_BK:*/
case 0x01:
case 0x02:
channel = map.dma_map_bk;
break;
/*case QSLT_BEACON:*/
case 0x10:
channel = HALMAC_DMA_CH_BCN;
break;
/*case QSLT_HIGH:*/
case 0x11:
channel = map.dma_map_hi;
break;
/*case QSLT_MGNT:*/
case 0x12:
channel = map.dma_map_mg;
break;
/*case QSLT_CMD:*/
case 0x13:
channel = HALMAC_DMA_CH_H2C;
break;
default:
/*RTW_ERR("%s: invalid qsel=0x%x\n", __FUNCTION__, qsel);*/
channel = HALMAC_DMA_CH_UNDEFINE;
break;
}
dma_ch_map[qsel] = (u8)channel;
}
return 0;
}
/** /**
* rtw_halmac_get_fw_max_size() - Firmware MAX size * rtw_halmac_get_fw_max_size() - Firmware MAX size
@ -1673,7 +1781,7 @@ int rtw_halmac_get_rx_desc_size(struct dvobj_priv *d, u32 *size)
* *
* Get Firmware MAX size(byte) from HALMAC. * Get Firmware MAX size(byte) from HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
static int rtw_halmac_get_fw_max_size(struct dvobj_priv *d, u32 *size) static int rtw_halmac_get_fw_max_size(struct dvobj_priv *d, u32 *size)
{ {
@ -1702,7 +1810,7 @@ static int rtw_halmac_get_fw_max_size(struct dvobj_priv *d, u32 *size)
* *
* Get original H2C MAX size(byte) from HALMAC. * Get original H2C MAX size(byte) from HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_get_ori_h2c_size(struct dvobj_priv *d, u32 *size) int rtw_halmac_get_ori_h2c_size(struct dvobj_priv *d, u32 *size)
{ {
@ -1776,7 +1884,7 @@ int rtw_halmac_get_ac_queue_number(struct dvobj_priv *d, u8 *num)
* *
* Get MAC address of specific port from HALMAC. * Get MAC address of specific port from HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_get_mac_address(struct dvobj_priv *d, enum _hw_port hwport, u8 *addr) int rtw_halmac_get_mac_address(struct dvobj_priv *d, enum _hw_port hwport, u8 *addr)
{ {
@ -1815,7 +1923,7 @@ out:
* *
* Get network type of specific port from HALMAC. * Get network type of specific port from HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_get_network_type(struct dvobj_priv *d, enum _hw_port hwport, u8 *type) int rtw_halmac_get_network_type(struct dvobj_priv *d, enum _hw_port hwport, u8 *type)
{ {
@ -1900,7 +2008,7 @@ out:
* *
* Get beacon control setting of specific port from HALMAC. * Get beacon control setting of specific port from HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_get_bcn_ctrl(struct dvobj_priv *d, enum _hw_port hwport, int rtw_halmac_get_bcn_ctrl(struct dvobj_priv *d, enum _hw_port hwport,
struct rtw_halmac_bcn_ctrl *bcn_ctrl) struct rtw_halmac_bcn_ctrl *bcn_ctrl)
@ -1949,6 +2057,9 @@ int rtw_halmac_config_rx_info(struct dvobj_priv *d, enum halmac_drv_info info)
err = 0; err = 0;
out: out:
/* Sync driver RCR cache with register setting */
rtw_hal_get_hwreg(dvobj_get_primary_adapter(d), HW_VAR_RCR, NULL);
return err; return err;
} }
@ -2003,7 +2114,7 @@ int rtw_halmac_set_max_dl_fw_size(struct dvobj_priv *d, u32 size)
* *
* Set self mac address of specific port to HALMAC. * Set self mac address of specific port to HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_set_mac_address(struct dvobj_priv *d, enum _hw_port hwport, u8 *addr) int rtw_halmac_set_mac_address(struct dvobj_priv *d, enum _hw_port hwport, u8 *addr)
{ {
@ -2039,7 +2150,7 @@ out:
* *
* Set BSSID of specific port to HALMAC. * Set BSSID of specific port to HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_set_bssid(struct dvobj_priv *d, enum _hw_port hwport, u8 *addr) int rtw_halmac_set_bssid(struct dvobj_priv *d, enum _hw_port hwport, u8 *addr)
{ {
@ -2074,7 +2185,7 @@ out:
* *
* Set transmitter address of specific port to HALMAC. * Set transmitter address of specific port to HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_set_tx_address(struct dvobj_priv *d, enum _hw_port hwport, u8 *addr) int rtw_halmac_set_tx_address(struct dvobj_priv *d, enum _hw_port hwport, u8 *addr)
{ {
@ -2109,7 +2220,7 @@ out:
* *
* Set network type of specific port to HALMAC. * Set network type of specific port to HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_set_network_type(struct dvobj_priv *d, enum _hw_port hwport, u8 type) int rtw_halmac_set_network_type(struct dvobj_priv *d, enum _hw_port hwport, u8 type)
{ {
@ -2143,7 +2254,7 @@ out:
* Notice HALMAC to reset timing synchronization function(TSF) timer of * Notice HALMAC to reset timing synchronization function(TSF) timer of
* specific port. * specific port.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_reset_tsf(struct dvobj_priv *d, enum _hw_port hwport) int rtw_halmac_reset_tsf(struct dvobj_priv *d, enum _hw_port hwport)
{ {
@ -2175,7 +2286,7 @@ out:
* *
* Set beacon interval of specific port to HALMAC. * Set beacon interval of specific port to HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_set_bcn_interval(struct dvobj_priv *d, enum _hw_port hwport, int rtw_halmac_set_bcn_interval(struct dvobj_priv *d, enum _hw_port hwport,
u32 interval) u32 interval)
@ -2208,7 +2319,7 @@ out:
* *
* Set beacon control setting of specific port to HALMAC. * Set beacon control setting of specific port to HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_set_bcn_ctrl(struct dvobj_priv *d, enum _hw_port hwport, int rtw_halmac_set_bcn_ctrl(struct dvobj_priv *d, enum _hw_port hwport,
struct rtw_halmac_bcn_ctrl *bcn_ctrl) struct rtw_halmac_bcn_ctrl *bcn_ctrl)
@ -2244,7 +2355,7 @@ out:
* *
* Set association identifier(AID) of specific port to HALMAC. * Set association identifier(AID) of specific port to HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_set_aid(struct dvobj_priv *d, enum _hw_port hwport, u16 aid) int rtw_halmac_set_aid(struct dvobj_priv *d, enum _hw_port hwport, u16 aid)
{ {
@ -2949,10 +3060,13 @@ static int _send_general_info(struct dvobj_priv *d)
_rtw_memset(&info, 0, sizeof(info)); _rtw_memset(&info, 0, sizeof(info));
info.rfe_type = (u8)hal->rfe_type; info.rfe_type = (u8)hal->rfe_type;
rtw_hal_get_rf_path(d, &rf, &txpath, &rxpath); rtw_hal_get_trx_path(d, &rf, &txpath, &rxpath);
info.rf_type = _rf_type_drv2halmac(rf); info.rf_type = _rf_type_drv2halmac(rf);
info.tx_ant_status = (u8)txpath; info.tx_ant_status = (u8)txpath;
info.rx_ant_status = (u8)rxpath; info.rx_ant_status = (u8)rxpath;
info.ext_pa = 0; /* 2.4G or 5G? format not known */
info.package_type = hal->PackageType;
info.mp_mode = adapter->registrypriv.mp_mode;
status = api->halmac_send_general_info(halmac, &info); status = api->halmac_send_general_info(halmac, &info);
switch (status) { switch (status) {
@ -2961,7 +3075,7 @@ static int _send_general_info(struct dvobj_priv *d)
case HALMAC_RET_NO_DLFW: case HALMAC_RET_NO_DLFW:
RTW_WARN("%s: halmac_send_general_info() fail because fw not dl!\n", RTW_WARN("%s: halmac_send_general_info() fail because fw not dl!\n",
__FUNCTION__); __FUNCTION__);
/* go through */ /* fall through */
default: default:
return -1; return -1;
} }
@ -2985,6 +3099,7 @@ static int _cfg_drv_rsvd_pg_num(struct dvobj_priv *d)
enum halmac_drv_rsvd_pg_num rsvd_page_number; enum halmac_drv_rsvd_pg_num rsvd_page_number;
enum halmac_ret_status status; enum halmac_ret_status status;
u16 drv_rsvd_num; u16 drv_rsvd_num;
int ret = 0;
a = dvobj_get_primary_adapter(d); a = dvobj_get_primary_adapter(d);
@ -2995,15 +3110,21 @@ static int _cfg_drv_rsvd_pg_num(struct dvobj_priv *d)
drv_rsvd_num = rtw_hal_get_rsvd_page_num(a); drv_rsvd_num = rtw_hal_get_rsvd_page_num(a);
rsvd_page_number = _rsvd_page_num_drv2halmac(drv_rsvd_num); rsvd_page_number = _rsvd_page_num_drv2halmac(drv_rsvd_num);
status = api->halmac_cfg_drv_rsvd_pg_num(halmac, rsvd_page_number); status = api->halmac_cfg_drv_rsvd_pg_num(halmac, rsvd_page_number);
if (status != HALMAC_RET_SUCCESS) if (status != HALMAC_RET_SUCCESS) {
return -1; ret = -1;
goto exit;
}
hal->drv_rsvd_page_number = _rsvd_page_num_halmac2drv(rsvd_page_number); hal->drv_rsvd_page_number = _rsvd_page_num_halmac2drv(rsvd_page_number);
if (drv_rsvd_num != hal->drv_rsvd_page_number) exit:
RTW_INFO("%s: request %d pages, but allocate %d pages\n", #ifndef DBG_RSVD_PAGE_CFG
__FUNCTION__, drv_rsvd_num, hal->drv_rsvd_page_number); if (drv_rsvd_num != _rsvd_page_num_halmac2drv(rsvd_page_number))
#endif
RTW_INFO("%s: request %d pages => halmac %d pages %s\n"
, __FUNCTION__, drv_rsvd_num, _rsvd_page_num_halmac2drv(rsvd_page_number)
, ret ? "fail" : "success");
return 0; return ret;
} }
static void _debug_dlfw_fail(struct dvobj_priv *d) static void _debug_dlfw_fail(struct dvobj_priv *d)
@ -3011,7 +3132,6 @@ static void _debug_dlfw_fail(struct dvobj_priv *d)
struct _ADAPTER *a; struct _ADAPTER *a;
u32 addr; u32 addr;
u32 v32, i, n; u32 v32, i, n;
u8 data[0x100] = {0};
a = dvobj_get_primary_adapter(d); a = dvobj_get_primary_adapter(d);
@ -3058,34 +3178,13 @@ static void _debug_dlfw_fail(struct dvobj_priv *d)
__FUNCTION__, addr, v32, i, n); __FUNCTION__, addr, v32, i, n);
} }
/* 0x00~0xFF, 0x1000~0x10FF */ mac_reg_dump(NULL, a);
addr = 0; #ifdef CONFIG_SDIO_HCI
n = 0x100; RTW_PRINT("======= SDIO Local REG =======\n");
for (i = 0; i < n; i+=4) sdio_local_reg_dump(NULL, a);
*(u32*)&data[i] = cpu_to_le32(rtw_read32(a, addr+i)); RTW_PRINT("======= SDIO CCCR REG =======\n");
for (i = 0; i < n; i++) { sd_f0_reg_dump(NULL, a);
if (i % 16 == 0) #endif /* CONFIG_SDIO_HCI */
RTW_PRINT("0x%04x\t", addr+i);
_RTW_PRINT("0x%02x", data[i]);
if (i % 16 == 15)
_RTW_PRINT("\n");
else
_RTW_PRINT(" ");
}
addr = 0x1000;
n = 0x100;
for (i = 0; i < n; i+=4)
*(u32*)&data[i] = cpu_to_le32(rtw_read32(a, addr+i));
for (i = 0; i < n; i++) {
if (i % 16 == 0)
RTW_PRINT("0x%04x\t", addr+i);
_RTW_PRINT("0x%02x", data[i]);
if (i % 16 == 15)
_RTW_PRINT("\n");
else
_RTW_PRINT(" ");
}
/* read 0x80 after 10 secs */ /* read 0x80 after 10 secs */
rtw_msleep_os(10000); rtw_msleep_os(10000);
@ -3129,7 +3228,7 @@ static enum halmac_ret_status _enter_cpu_sleep_mode(struct dvobj_priv *d)
* @timeout: time limit of wait, unit is ms * @timeout: time limit of wait, unit is ms
* 0 for no limit * 0 for no limit
* *
* Rteurn 0 for CPU in sleep mode, otherwise fail to enter sleep mode. * Return 0 for CPU in sleep mode, otherwise fail to enter sleep mode.
* Error codes definition are as follow: * Error codes definition are as follow:
* -1 HALMAC enter sleep return fail * -1 HALMAC enter sleep return fail
* -2 HALMAC get CPU mode return fail * -2 HALMAC get CPU mode return fail
@ -3344,10 +3443,15 @@ static int init_mac_flow(struct dvobj_priv *d)
goto out; goto out;
#endif #endif
#if 0 /* It is not necessary to call this in normal driver */ #ifdef DBG_LA_MODE
status = api->halmac_cfg_la_mode(halmac, HALMAC_LA_MODE_DISABLE); if (dvobj_to_regsty(d)->la_mode_en) {
if (status != HALMAC_RET_SUCCESS) status = api->halmac_cfg_la_mode(halmac, HALMAC_LA_MODE_PARTIAL);
if (status != HALMAC_RET_SUCCESS) {
RTW_ERR("%s: Fail to enable LA mode!\n", __FUNCTION__);
goto out; goto out;
}
RTW_PRINT("%s: Enable LA mode OK.\n", __FUNCTION__);
}
#endif #endif
err = _cfg_drv_rsvd_pg_num(d); err = _cfg_drv_rsvd_pg_num(d);
@ -3364,7 +3468,13 @@ static int init_mac_flow(struct dvobj_priv *d)
status = api->halmac_init_mac_cfg(halmac, trx_mode); status = api->halmac_init_mac_cfg(halmac, trx_mode);
if (status != HALMAC_RET_SUCCESS) if (status != HALMAC_RET_SUCCESS)
goto out; goto out;
/* Driver insert flow: Sync driver setting with register */
/* Sync driver RCR cache with register setting */
rtw_hal_get_hwreg(dvobj_get_primary_adapter(d), HW_VAR_RCR, NULL);
_init_trx_cfg_drv(d); _init_trx_cfg_drv(d);
/* Driver inser flow end */
err = rtw_halmac_rx_agg_switch(d, _TRUE); err = rtw_halmac_rx_agg_switch(d, _TRUE);
if (err) if (err)
@ -3413,10 +3523,12 @@ static int _drv_enable_trx(struct dvobj_priv *d)
/* /*
* Notices: * Notices:
* Make sure * Make sure following information
* 1. rtw_hal_get_hwreg(HW_VAR_RF_TYPE) * 1. GET_HAL_RFPATH
* 2. HAL_DATA_TYPE.rfe_type * 2. GET_HAL_DATA(dvobj_get_primary_adapter(d))->rfe_type
* already ready for use before calling this function. * 3. GET_HAL_DATA(dvobj_get_primary_adapter(d))->PackageType
* 4. dvobj_get_primary_adapter(d)->registrypriv.mp_mode
* are all ready before calling this function.
*/ */
static int _halmac_init_hal(struct dvobj_priv *d, u8 *fw, u32 fwsize) static int _halmac_init_hal(struct dvobj_priv *d, u8 *fw, u32 fwsize)
{ {
@ -3512,10 +3624,12 @@ int rtw_halmac_init_hal(struct dvobj_priv *d)
/* /*
* Notices: * Notices:
* Make sure * Make sure following information
* 1. rtw_hal_get_hwreg(HW_VAR_RF_TYPE) * 1. GET_HAL_RFPATH
* 2. HAL_DATA_TYPE.rfe_type * 2. GET_HAL_DATA(dvobj_get_primary_adapter(d))->rfe_type
* already ready for use before calling this function. * 3. GET_HAL_DATA(dvobj_get_primary_adapter(d))->PackageType
* 4. dvobj_get_primary_adapter(d)->registrypriv.mp_mode
* are all ready before calling this function.
*/ */
int rtw_halmac_init_hal_fw(struct dvobj_priv *d, u8 *fw, u32 fwsize) int rtw_halmac_init_hal_fw(struct dvobj_priv *d, u8 *fw, u32 fwsize)
{ {
@ -3524,10 +3638,12 @@ int rtw_halmac_init_hal_fw(struct dvobj_priv *d, u8 *fw, u32 fwsize)
/* /*
* Notices: * Notices:
* Make sure * Make sure following information
* 1. rtw_hal_get_hwreg(HW_VAR_RF_TYPE) * 1. GET_HAL_RFPATH
* 2. HAL_DATA_TYPE.rfe_type * 2. GET_HAL_DATA(dvobj_get_primary_adapter(d))->rfe_type
* already ready for use before calling this function. * 3. GET_HAL_DATA(dvobj_get_primary_adapter(d))->PackageType
* 4. dvobj_get_primary_adapter(d)->registrypriv.mp_mode
* are all ready before calling this function.
*/ */
int rtw_halmac_init_hal_fw_file(struct dvobj_priv *d, u8 *fwpath) int rtw_halmac_init_hal_fw_file(struct dvobj_priv *d, u8 *fwpath)
{ {
@ -3638,7 +3754,7 @@ static u8 rtw_halmac_txfifo_is_empty(struct dvobj_priv *d)
* *
* Wait TX FIFO to be emtpy. * Wait TX FIFO to be emtpy.
* *
* Rteurn 0 for TX FIFO is empty, otherwise not empty. * Return 0 for TX FIFO is empty, otherwise not empty.
*/ */
int rtw_halmac_txfifo_wait_empty(struct dvobj_priv *d, u32 timeout) int rtw_halmac_txfifo_wait_empty(struct dvobj_priv *d, u32 timeout)
{ {
@ -4598,7 +4714,7 @@ int rtw_halmac_p2pps(struct dvobj_priv *dvobj, struct hal_p2p_ps_para *pp2p_ps_p
* *
* Process IQ Calibration(IQK). * Process IQ Calibration(IQK).
* *
* Rteurn: 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_iqk(struct dvobj_priv *d, u8 clear, u8 segment) int rtw_halmac_iqk(struct dvobj_priv *d, u8 clear, u8 segment)
{ {
@ -4843,7 +4959,7 @@ static enum halmac_wlled_mode _led_mode_drv2halmac(u8 drv_mode)
* If want to change LED mode after enabled, need to disable LED first and * If want to change LED mode after enabled, need to disable LED first and
* enable again to set new mode. * enable again to set new mode.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_led_cfg(struct dvobj_priv *d, u8 enable, u8 mode) int rtw_halmac_led_cfg(struct dvobj_priv *d, u8 enable, u8 mode)
{ {
@ -4927,7 +5043,7 @@ void rtw_halmac_led_switch(struct dvobj_priv *d, u8 on)
* *
* Configure pinmux to allow BT to control BT wake host pin. * Configure pinmux to allow BT to control BT wake host pin.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_bt_wake_cfg(struct dvobj_priv *d, u8 enable) int rtw_halmac_bt_wake_cfg(struct dvobj_priv *d, u8 enable)
{ {
@ -4971,7 +5087,7 @@ int rtw_halmac_bt_wake_cfg(struct dvobj_priv *d, u8 enable)
* *
* Switch Channel and Send Porbe Request Offloaded by FW * Switch Channel and Send Porbe Request Offloaded by FW
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
static int _halmac_scanoffload(struct dvobj_priv *d, u32 enable, u8 nlo, static int _halmac_scanoffload(struct dvobj_priv *d, u32 enable, u8 nlo,
u8 *ssid, u8 ssid_len) u8 *ssid, u8 ssid_len)
@ -5151,7 +5267,7 @@ static int _halmac_scanoffload(struct dvobj_priv *d, u32 enable, u8 nlo,
* Switch firmware scan AP function for PNO(prefer network offload) or * Switch firmware scan AP function for PNO(prefer network offload) or
* NLO(network list offload). * NLO(network list offload).
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_pno_scanoffload(struct dvobj_priv *d, u32 enable) int rtw_halmac_pno_scanoffload(struct dvobj_priv *d, u32 enable)
{ {
@ -5168,7 +5284,7 @@ int rtw_halmac_pno_scanoffload(struct dvobj_priv *d, u32 enable)
* Parameter: * Parameter:
* d pointer to struct dvobj_priv of driver * d pointer to struct dvobj_priv of driver
* *
* Rteurn: * Return:
* 0 Success, "page" is valid. * 0 Success, "page" is valid.
* others Fail, "page" is invalid. * others Fail, "page" is invalid.
*/ */
@ -5261,7 +5377,7 @@ int rtw_halmac_query_tx_page_num(struct dvobj_priv *d)
* queue target queue to query, VO/VI/BE/BK/.../TXCMD_QUEUE_INX * queue target queue to query, VO/VI/BE/BK/.../TXCMD_QUEUE_INX
* page return allocated page number * page return allocated page number
* *
* Rteurn: * Return:
* 0 Success, "page" is valid. * 0 Success, "page" is valid.
* others Fail, "page" is invalid. * others Fail, "page" is invalid.
*/ */
@ -5324,6 +5440,22 @@ u32 rtw_halmac_sdio_get_rx_addr(struct dvobj_priv *d, u8 *seq)
(*seq)++; (*seq)++;
return RTW_SDIO_ADDR_RX_RX0FF_GEN(id); return RTW_SDIO_ADDR_RX_RX0FF_GEN(id);
} }
int rtw_halmac_sdio_set_tx_format(struct dvobj_priv *d, enum halmac_sdio_tx_format format)
{
struct halmac_adapter *mac;
struct halmac_api *api;
enum halmac_ret_status status;
mac = dvobj_to_halmac(d);
api = HALMAC_GET_API(mac);
status = api->halmac_set_hw_value(mac, HALMAC_HW_SDIO_TX_FORMAT, &format);
if (HALMAC_RET_SUCCESS != status)
return -1;
return 0;
}
#endif /* CONFIG_SDIO_HCI */ #endif /* CONFIG_SDIO_HCI */
#ifdef CONFIG_USB_HCI #ifdef CONFIG_USB_HCI
@ -5352,7 +5484,7 @@ u8 rtw_halmac_usb_get_bulkout_id(struct dvobj_priv *d, u8 *buf, u32 size)
* *
* Get MAX descriptor number in one bulk out from HALMAC. * Get MAX descriptor number in one bulk out from HALMAC.
* *
* Rteurn 0 for OK, otherwise fail. * Return 0 for OK, otherwise fail.
*/ */
int rtw_halmac_usb_get_txagg_desc_num(struct dvobj_priv *d, u8 *num) int rtw_halmac_usb_get_txagg_desc_num(struct dvobj_priv *d, u8 *num)
{ {
@ -5496,9 +5628,33 @@ int rtw_halmac_bf_del_sounding(struct dvobj_priv *d,
return 0; return 0;
} }
int rtw_halmac_bf_cfg_csi_rate(struct dvobj_priv *d, /**
u8 rssi, u8 current_rate, u8 fixrate_en, * rtw_halmac_bf_cfg_csi_rate() - Config data rate for CSI report frame by RSSI
u8 *new_rate) * @d: struct dvobj_priv*
* @rssi: RSSI vlaue, unit is percentage (0~100).
* @current_rate: Current CSI frame rate
* Valid value example
* 0 CCK 1M
* 3 CCK 11M
* 4 OFDM 6M
* and so on
* @fixrate_en: Enable to fix CSI frame in VHT rate, otherwise legacy OFDM rate.
* The value "0" for disable, otheriwse enable.
* @new_rate: Return new data rate, and value range is the same as
* current_rate
* @bmp_ofdm54: Return to suggest enabling OFDM 54M for CSI report frame or not,
* The valid values and meanings are:
* 0x00 disable
* 0x01 enable
* 0xFF Keep current setting
*
* According RSSI to config data rate for CSI report frame of Beamforming.
*
* Return 0 for OK, otherwise fail.
*/
int rtw_halmac_bf_cfg_csi_rate(struct dvobj_priv *d, u8 rssi,
u8 current_rate, u8 fixrate_en, u8 *new_rate,
u8 *bmp_ofdm54)
{ {
struct halmac_adapter *mac; struct halmac_adapter *mac;
struct halmac_api *api; struct halmac_api *api;
@ -5509,7 +5665,8 @@ int rtw_halmac_bf_cfg_csi_rate(struct dvobj_priv *d,
api = HALMAC_GET_API(mac); api = HALMAC_GET_API(mac);
status = api->halmac_cfg_csi_rate(mac, status = api->halmac_cfg_csi_rate(mac,
rssi, current_rate, fixrate_en, new_rate); rssi, current_rate, fixrate_en, new_rate,
bmp_ofdm54);
if (status != HALMAC_RET_SUCCESS) if (status != HALMAC_RET_SUCCESS)
return -1; return -1;

View File

@ -131,6 +131,7 @@ int rtw_halmac_get_rx_agg_align_size(struct dvobj_priv *d, u8 *size);
int rtw_halmac_get_rx_drv_info_sz(struct dvobj_priv *, u8 *sz); int rtw_halmac_get_rx_drv_info_sz(struct dvobj_priv *, u8 *sz);
int rtw_halmac_get_tx_desc_size(struct dvobj_priv *d, u32 *size); int rtw_halmac_get_tx_desc_size(struct dvobj_priv *d, u32 *size);
int rtw_halmac_get_rx_desc_size(struct dvobj_priv *d, u32 *size); int rtw_halmac_get_rx_desc_size(struct dvobj_priv *d, u32 *size);
int rtw_halmac_get_tx_dma_ch_map(struct dvobj_priv *d, u8 *dma_ch_map, u8 map_size);
int rtw_halmac_get_ori_h2c_size(struct dvobj_priv *d, u32 *size); int rtw_halmac_get_ori_h2c_size(struct dvobj_priv *d, u32 *size);
int rtw_halmac_get_oqt_size(struct dvobj_priv *d, u8 *size); int rtw_halmac_get_oqt_size(struct dvobj_priv *d, u8 *size);
int rtw_halmac_get_ac_queue_number(struct dvobj_priv *d, u8 *num); int rtw_halmac_get_ac_queue_number(struct dvobj_priv *d, u8 *num);
@ -208,6 +209,7 @@ int rtw_halmac_get_tx_queue_page_num(struct dvobj_priv *, u8 queue, u32 *page);
u32 rtw_halmac_sdio_get_tx_addr(struct dvobj_priv *, u8 *desc, u32 size); u32 rtw_halmac_sdio_get_tx_addr(struct dvobj_priv *, u8 *desc, u32 size);
int rtw_halmac_sdio_tx_allowed(struct dvobj_priv *, u8 *buf, u32 size); int rtw_halmac_sdio_tx_allowed(struct dvobj_priv *, u8 *buf, u32 size);
u32 rtw_halmac_sdio_get_rx_addr(struct dvobj_priv *, u8 *seq); u32 rtw_halmac_sdio_get_rx_addr(struct dvobj_priv *, u8 *seq);
int rtw_halmac_sdio_set_tx_format(struct dvobj_priv *d, enum halmac_sdio_tx_format format);
#endif /* CONFIG_SDIO_HCI */ #endif /* CONFIG_SDIO_HCI */
#ifdef CONFIG_USB_HCI #ifdef CONFIG_USB_HCI
@ -231,7 +233,7 @@ int rtw_halmac_bf_cfg_sounding(struct dvobj_priv *d, enum halmac_snd_role role,
int rtw_halmac_bf_del_sounding(struct dvobj_priv *d, enum halmac_snd_role role); int rtw_halmac_bf_del_sounding(struct dvobj_priv *d, enum halmac_snd_role role);
int rtw_halmac_bf_cfg_csi_rate(struct dvobj_priv *d, u8 rssi, u8 current_rate, int rtw_halmac_bf_cfg_csi_rate(struct dvobj_priv *d, u8 rssi, u8 current_rate,
u8 fixrate_en, u8 *new_rate); u8 fixrate_en, u8 *new_rate, u8 *bmp_ofdm54);
int rtw_halmac_bf_cfg_mu_mimo(struct dvobj_priv *d, enum halmac_snd_role role, int rtw_halmac_bf_cfg_mu_mimo(struct dvobj_priv *d, enum halmac_snd_role role,
u8 *sounding_sts, u16 grouping_bitmap, u8 mu_tx_en, u8 *sounding_sts, u16 grouping_bitmap, u8 mu_tx_en,

View File

@ -34,6 +34,8 @@ const u32 _chip_type_to_odm_ic_type[] = {
ODM_RTL8821C, ODM_RTL8821C,
ODM_RTL8710B, ODM_RTL8710B,
ODM_RTL8192F, ODM_RTL8192F,
ODM_RTL8822C,
ODM_RTL8814B,
0, 0,
}; };
@ -129,16 +131,6 @@ void rtw_hal_def_value_init(_adapter *padapter)
adapter_to_dvobj(padapter)->p0_tsf.offset = 0; adapter_to_dvobj(padapter)->p0_tsf.offset = 0;
#endif #endif
{
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
struct hal_spec_t *hal_spec = GET_HAL_SPEC(padapter);
/* hal_spec is ready here */
dvobj->macid_ctl.num = rtw_min(hal_spec->macid_num, MACID_NUM_SW_LIMIT);
dvobj->cam_ctl.sec_cap = hal_spec->sec_cap;
dvobj->cam_ctl.num = rtw_min(hal_spec->sec_cam_ent_num, SEC_CAM_ENT_NUM_SW_LIMIT);
}
GET_HAL_DATA(padapter)->rx_tsf_addr_filter_config = 0; GET_HAL_DATA(padapter)->rx_tsf_addr_filter_config = 0;
} }
} }
@ -185,6 +177,10 @@ void rtw_hal_dm_init(_adapter *padapter)
_rtw_spinlock_init(&pHalData->IQKSpinLock); _rtw_spinlock_init(&pHalData->IQKSpinLock);
#ifdef CONFIG_TXPWR_PG_WITH_PWR_IDX
if (pHalData->txpwr_pg_mode == TXPWR_PG_WITH_PWR_IDX)
hal_load_txpwr_info(padapter);
#endif
phy_load_tx_power_ext_info(padapter, 1); phy_load_tx_power_ext_info(padapter, 1);
} }
} }
@ -199,6 +195,229 @@ void rtw_hal_dm_deinit(_adapter *padapter)
} }
} }
enum rf_type rtw_chip_rftype_to_hal_rftype(_adapter *adapter, u8 limit)
{
PHAL_DATA_TYPE hal_data = GET_HAL_DATA(adapter);
u8 tx_num = 0, rx_num = 0;
/*get RF PATH from version_id.RF_TYPE */
if (IS_1T1R(hal_data->version_id)) {
tx_num = 1;
rx_num = 1;
} else if (IS_1T2R(hal_data->version_id)) {
tx_num = 1;
rx_num = 2;
} else if (IS_2T2R(hal_data->version_id)) {
tx_num = 2;
rx_num = 2;
} else if (IS_2T3R(hal_data->version_id)) {
tx_num = 2;
rx_num = 3;
} else if (IS_2T4R(hal_data->version_id)) {
tx_num = 2;
rx_num = 4;
} else if (IS_3T3R(hal_data->version_id)) {
tx_num = 3;
rx_num = 3;
} else if (IS_3T4R(hal_data->version_id)) {
tx_num = 3;
rx_num = 4;
} else if (IS_4T4R(hal_data->version_id)) {
tx_num = 4;
rx_num = 4;
}
if (limit) {
tx_num = rtw_min(tx_num, limit);
rx_num = rtw_min(rx_num, limit);
}
return trx_num_to_rf_type(tx_num, rx_num);
}
void dump_hal_runtime_trx_mode(void *sel, _adapter *adapter)
{
struct registry_priv *regpriv = &adapter->registrypriv;
PHAL_DATA_TYPE hal_data = GET_HAL_DATA(adapter);
int i;
RTW_PRINT_SEL(sel, "txpath=0x%x, rxpath=0x%x\n", hal_data->txpath, hal_data->rxpath);
for (i = 0; i < hal_data->tx_nss; i++)
RTW_PRINT_SEL(sel, "txpath_%uss:0x%x, num:%u\n"
, i + 1, hal_data->txpath_nss[i]
, hal_data->txpath_num_nss[i]);
}
void dump_hal_trx_mode(void *sel, _adapter *adapter)
{
struct registry_priv *regpriv = &adapter->registrypriv;
PHAL_DATA_TYPE hal_data = GET_HAL_DATA(adapter);
RTW_PRINT_SEL(sel, "trx_path_bmp:0x%02x(%s), NumTotalRFPath:%u, max_tx_cnt:%u\n"
, hal_data->trx_path_bmp
, rf_type_to_rfpath_str(hal_data->rf_type)
, hal_data->NumTotalRFPath
, hal_data->max_tx_cnt
);
RTW_PRINT_SEL(sel, "tx_nss:%u, rx_nss:%u\n"
, hal_data->tx_nss, hal_data->rx_nss);
RTW_PRINT_SEL(sel, "\n");
dump_hal_runtime_trx_mode(sel, adapter);
}
void _dump_rf_path(void *sel, _adapter *adapter)
{
struct registry_priv *regpriv = &adapter->registrypriv;
PHAL_DATA_TYPE hal_data = GET_HAL_DATA(adapter);
RTW_PRINT_SEL(sel, "[RF_PATH] ver_id.RF_TYPE:%s, rf_reg_path_num:%u, max_tx_cnt:%u\n"
, rf_type_to_rfpath_str(rtw_chip_rftype_to_hal_rftype(adapter, 0))
, GET_HAL_SPEC(adapter)->rf_reg_path_num
, GET_HAL_SPEC(adapter)->max_tx_cnt);
RTW_PRINT_SEL(sel, "[RF_PATH] PG's trx_path_bmp:0x%02x, max_tx_cnt:%u\n"
, hal_data->eeprom_trx_path_bmp, hal_data->eeprom_max_tx_cnt);
RTW_PRINT_SEL(sel, "[RF_PATH] Registry's RF PATH:%s\n"
, rf_type_to_rfpath_str(regpriv->rf_path));
RTW_PRINT_SEL(sel, "[RF_PATH] HALDATA's trx_path_bmp:0x%02x, max_tx_cnt:%u\n"
, hal_data->trx_path_bmp, hal_data->max_tx_cnt);
RTW_PRINT_SEL(sel, "[RF_PATH] HALDATA's rf_type:%s\n"
, rf_type_to_rfpath_str(hal_data->rf_type));
RTW_PRINT_SEL(sel, "[RF_PATH] NumTotalRFPath:%d\n"
, hal_data->NumTotalRFPath);
}
#ifdef CONFIG_RTL8814A
extern enum rf_type rtl8814a_rfpath_decision(_adapter *adapter);
#endif
u8 rtw_hal_rfpath_init(_adapter *adapter)
{
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
struct hal_spec_t *hal_spec = GET_HAL_SPEC(adapter);
#ifdef CONFIG_RTL8814A
if (IS_HARDWARE_TYPE_8814A(adapter)) {
enum bb_path tx_bmp, rx_bmp;
hal_data->rf_type = rtl8814a_rfpath_decision(adapter);
rf_type_to_default_trx_bmp(hal_data->rf_type, &tx_bmp, &rx_bmp);
hal_data->trx_path_bmp = (tx_bmp << 4) | rx_bmp;
hal_data->NumTotalRFPath = 4;
hal_data->max_tx_cnt = hal_spec->max_tx_cnt;
hal_data->max_tx_cnt = rtw_min(hal_data->max_tx_cnt, rf_type_to_rf_tx_cnt(hal_data->rf_type));
} else
#endif
{
struct registry_priv *regpriv = &adapter->registrypriv;
enum rf_type ic_cap;
enum rf_type type;
u8 tx_path_num;
u8 rx_path_num;
int i;
ic_cap = rtw_chip_rftype_to_hal_rftype(adapter, hal_spec->rf_reg_path_num);
if (!RF_TYPE_VALID(ic_cap)) {
RTW_ERR("%s rtw_chip_rftype_to_hal_rftype failed\n", __func__);
return _FAIL;
}
type = ic_cap;
if (RF_TYPE_VALID(regpriv->rf_path)) {
if (rf_type_is_a_in_b(regpriv->rf_path, ic_cap))
type = regpriv->rf_path;
else
RTW_WARN("%s invalid regpriv:%s > ic_cap:%s\n", __func__
, rf_type_to_rfpath_str(regpriv->rf_path)
, rf_type_to_rfpath_str(ic_cap));
}
if (hal_data->eeprom_trx_path_bmp != 0x00) {
/* specific trx path is defined, restrict it with rftype(TX and RX num) */
u8 trx_path_bmp = rtw_restrict_trx_path_bmp_by_rftype(
hal_data->eeprom_trx_path_bmp, type, &tx_path_num, &rx_path_num);
if (!trx_path_bmp) {
RTW_ERR("%s rtw_restrict_trx_path_bmp_by_rftype(0x%x, %s) failed\n"
, __func__, hal_data->eeprom_trx_path_bmp
, rf_type_to_rfpath_str(type));
return _FAIL;
}
hal_data->trx_path_bmp = trx_path_bmp;
hal_data->rf_type = trx_bmp_to_rf_type((trx_path_bmp & 0xF0) >> 4
, trx_path_bmp & 0x0F);
} else {
/* no specific trx path is defined, use default trx_bmp */
enum bb_path tx_bmp, rx_bmp;
rf_type_to_default_trx_bmp(type, &tx_bmp, &rx_bmp);
hal_data->trx_path_bmp = (tx_bmp << 4) | rx_bmp;
hal_data->rf_type = type;
tx_path_num = rf_type_to_rf_tx_cnt(hal_data->rf_type);
rx_path_num = rf_type_to_rf_rx_cnt(hal_data->rf_type);
}
hal_data->NumTotalRFPath = tx_path_num;
if (hal_data->NumTotalRFPath < rx_path_num)
hal_data->NumTotalRFPath = rx_path_num;
hal_data->max_tx_cnt = hal_spec->max_tx_cnt;
hal_data->max_tx_cnt = rtw_min(hal_data->max_tx_cnt, tx_path_num);
if (hal_data->eeprom_max_tx_cnt)
hal_data->max_tx_cnt = rtw_min(hal_data->max_tx_cnt, hal_data->eeprom_max_tx_cnt);
if (1)
_dump_rf_path(RTW_DBGDUMP, adapter);
}
RTW_INFO("%s trx_path_bmp:0x%02x(%s), NumTotalRFPath:%u, max_tx_cnt:%u\n"
, __func__
, hal_data->trx_path_bmp
, rf_type_to_rfpath_str(hal_data->rf_type)
, hal_data->NumTotalRFPath
, hal_data->max_tx_cnt);
return _SUCCESS;
}
void _dump_trx_nss(void *sel, _adapter *adapter)
{
struct registry_priv *regpriv = &adapter->registrypriv;
struct hal_spec_t *hal_spec = GET_HAL_SPEC(adapter);
RTW_PRINT_SEL(sel, "[TRX_Nss] HALSPEC - tx_nss :%d, rx_nss:%d\n", hal_spec->tx_nss_num, hal_spec->rx_nss_num);
RTW_PRINT_SEL(sel, "[TRX_Nss] Registry - tx_nss :%d, rx_nss:%d\n", regpriv->tx_nss, regpriv->rx_nss);
RTW_PRINT_SEL(sel, "[TRX_Nss] HALDATA - tx_nss :%d, rx_nss:%d\n", GET_HAL_TX_NSS(adapter), GET_HAL_RX_NSS(adapter));
}
#define NSS_VALID(nss) (nss > 0)
u8 rtw_hal_trxnss_init(_adapter *adapter)
{
struct registry_priv *regpriv = &adapter->registrypriv;
struct hal_spec_t *hal_spec = GET_HAL_SPEC(adapter);
PHAL_DATA_TYPE hal_data = GET_HAL_DATA(adapter);
enum rf_type rf_path = GET_HAL_RFPATH(adapter);
hal_data->tx_nss = hal_spec->tx_nss_num;
hal_data->rx_nss = hal_spec->rx_nss_num;
if (NSS_VALID(regpriv->tx_nss))
hal_data->tx_nss = rtw_min(hal_data->tx_nss, regpriv->tx_nss);
hal_data->tx_nss = rtw_min(hal_data->tx_nss, hal_data->max_tx_cnt);
if (NSS_VALID(regpriv->rx_nss))
hal_data->rx_nss = rtw_min(hal_data->rx_nss, regpriv->rx_nss);
hal_data->rx_nss = rtw_min(hal_data->rx_nss, rf_type_to_rf_rx_cnt(rf_path));
if (1)
_dump_trx_nss(RTW_DBGDUMP, adapter);
RTW_INFO("%s tx_nss:%u, rx_nss:%u\n", __func__
, hal_data->tx_nss, hal_data->rx_nss);
return _SUCCESS;
}
#ifdef CONFIG_RTW_SW_LED #ifdef CONFIG_RTW_SW_LED
void rtw_hal_sw_led_init(_adapter *padapter) void rtw_hal_sw_led_init(_adapter *padapter)
{ {
@ -251,6 +470,11 @@ void rtw_hal_power_off(_adapter *padapter)
struct macid_ctl_t *macid_ctl = &padapter->dvobj->macid_ctl; struct macid_ctl_t *macid_ctl = &padapter->dvobj->macid_ctl;
_rtw_memset(macid_ctl->h2c_msr, 0, MACID_NUM_SW_LIMIT); _rtw_memset(macid_ctl->h2c_msr, 0, MACID_NUM_SW_LIMIT);
_rtw_memset(macid_ctl->op_num, 0, H2C_MSR_ROLE_MAX);
#ifdef CONFIG_LPS_1T1R
GET_HAL_DATA(padapter)->lps_1t1r = 0;
#endif
#ifdef CONFIG_BT_COEXIST #ifdef CONFIG_BT_COEXIST
rtw_btcoex_PowerOffSetting(padapter); rtw_btcoex_PowerOffSetting(padapter);
@ -304,6 +528,8 @@ uint rtw_hal_init(_adapter *padapter)
{ {
uint status = _SUCCESS; uint status = _SUCCESS;
halrf_set_rfsupportability(adapter_to_phydm(padapter));
status = padapter->hal_func.hal_init(padapter); status = padapter->hal_func.hal_init(padapter);
if (status == _SUCCESS) { if (status == _SUCCESS) {
@ -327,9 +553,9 @@ uint rtw_hal_init(_adapter *padapter)
rtw_dyn_soml_config(padapter); rtw_dyn_soml_config(padapter);
#endif #endif
#endif #endif
#ifdef CONFIG_RTW_TX_2PATH_EN #ifdef CONFIG_TDMADIG
rtw_phydm_tx_2path_en(padapter); rtw_phydm_tdmadig(padapter, TDMADIG_INIT);
#endif #endif/*CONFIG_TDMADIG*/
} else { } else {
rtw_set_hw_init_completed(padapter, _FALSE); rtw_set_hw_init_completed(padapter, _FALSE);
RTW_ERR("%s: hal_init fail\n", __func__); RTW_ERR("%s: hal_init fail\n", __func__);
@ -343,6 +569,8 @@ uint rtw_hal_init(_adapter *padapter)
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
int i; int i;
halrf_set_rfsupportability(adapter_to_phydm(padapter));
status = padapter->hal_func.hal_init(padapter); status = padapter->hal_func.hal_init(padapter);
if (status == _SUCCESS) { if (status == _SUCCESS) {
@ -376,10 +604,10 @@ uint rtw_hal_init(_adapter *padapter)
rtw_dyn_soml_config(padapter); rtw_dyn_soml_config(padapter);
#endif #endif
#endif #endif
#ifdef CONFIG_TDMADIG
rtw_phydm_tdmadig(padapter, TDMADIG_INIT);
#endif/*CONFIG_TDMADIG*/
#ifdef CONFIG_RTW_TX_2PATH_EN
rtw_phydm_tx_2path_en(padapter);
#endif
} else { } else {
rtw_set_hw_init_completed(padapter, _FALSE); rtw_set_hw_init_completed(padapter, _FALSE);
RTW_ERR("%s: fail\n", __func__); RTW_ERR("%s: fail\n", __func__);
@ -394,8 +622,6 @@ uint rtw_hal_init(_adapter *padapter)
uint rtw_hal_deinit(_adapter *padapter) uint rtw_hal_deinit(_adapter *padapter)
{ {
uint status = _SUCCESS; uint status = _SUCCESS;
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
int i;
status = padapter->hal_func.hal_deinit(padapter); status = padapter->hal_func.hal_deinit(padapter);
@ -419,20 +645,20 @@ void rtw_hal_get_hwreg(_adapter *padapter, u8 variable, u8 *val)
padapter->hal_func.GetHwRegHandler(padapter, variable, val); padapter->hal_func.GetHwRegHandler(padapter, variable, val);
} }
u8 rtw_hal_set_def_var(_adapter *padapter, HAL_DEF_VARIABLE eVariable, PVOID pValue) u8 rtw_hal_set_def_var(_adapter *padapter, HAL_DEF_VARIABLE eVariable, void *pValue)
{ {
return padapter->hal_func.SetHalDefVarHandler(padapter, eVariable, pValue); return padapter->hal_func.SetHalDefVarHandler(padapter, eVariable, pValue);
} }
u8 rtw_hal_get_def_var(_adapter *padapter, HAL_DEF_VARIABLE eVariable, PVOID pValue) u8 rtw_hal_get_def_var(_adapter *padapter, HAL_DEF_VARIABLE eVariable, void *pValue)
{ {
return padapter->hal_func.get_hal_def_var_handler(padapter, eVariable, pValue); return padapter->hal_func.get_hal_def_var_handler(padapter, eVariable, pValue);
} }
void rtw_hal_set_odm_var(_adapter *padapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1, BOOLEAN bSet) void rtw_hal_set_odm_var(_adapter *padapter, HAL_ODM_VARIABLE eVariable, void *pValue1, BOOLEAN bSet)
{ {
padapter->hal_func.SetHalODMVarHandler(padapter, eVariable, pValue1, bSet); padapter->hal_func.SetHalODMVarHandler(padapter, eVariable, pValue1, bSet);
} }
void rtw_hal_get_odm_var(_adapter *padapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1, PVOID pValue2) void rtw_hal_get_odm_var(_adapter *padapter, HAL_ODM_VARIABLE eVariable, void *pValue1, void *pValue2)
{ {
padapter->hal_func.GetHalODMVarHandler(padapter, eVariable, pValue1, pValue2); padapter->hal_func.GetHalODMVarHandler(padapter, eVariable, pValue1, pValue2);
} }
@ -467,7 +693,15 @@ u8 rtw_hal_check_ips_status(_adapter *padapter)
s32 rtw_hal_fw_dl(_adapter *padapter, u8 wowlan) s32 rtw_hal_fw_dl(_adapter *padapter, u8 wowlan)
{ {
return padapter->hal_func.fw_dl(padapter, wowlan); s32 ret;
ret = padapter->hal_func.fw_dl(padapter, wowlan);
#ifdef CONFIG_LPS_1T1R
GET_HAL_DATA(padapter)->lps_1t1r = 0;
#endif
return ret;
} }
#ifdef RTW_HALMAC #ifdef RTW_HALMAC
@ -610,7 +844,6 @@ s32 rtw_hal_mgnt_xmit(_adapter *padapter, struct xmit_frame *pmgntframe)
rtw_mgmt_xmitframe_coalesce(padapter, pmgntframe->pkt, pmgntframe); rtw_mgmt_xmitframe_coalesce(padapter, pmgntframe->pkt, pmgntframe);
#endif #endif
no_mgmt_coalesce:
ret = padapter->hal_func.mgnt_xmit(padapter, pmgntframe); ret = padapter->hal_func.mgnt_xmit(padapter, pmgntframe);
return ret; return ret;
} }
@ -635,7 +868,6 @@ void rtw_hal_free_recv_priv(_adapter *padapter)
void rtw_sta_ra_registed(_adapter *padapter, struct sta_info *psta) void rtw_sta_ra_registed(_adapter *padapter, struct sta_info *psta)
{ {
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(padapter); HAL_DATA_TYPE *hal_data = GET_HAL_DATA(padapter);
if (psta == NULL) { if (psta == NULL) {
@ -714,10 +946,12 @@ u32 rtw_hal_read_rfreg(_adapter *padapter, enum rf_path eRFPath, u32 RegAddr, u3
if (padapter->hal_func.read_rfreg) { if (padapter->hal_func.read_rfreg) {
data = padapter->hal_func.read_rfreg(padapter, eRFPath, RegAddr, BitMask); data = padapter->hal_func.read_rfreg(padapter, eRFPath, RegAddr, BitMask);
if (match_rf_read_sniff_ranges(eRFPath, RegAddr, BitMask)) { #ifdef DBG_IO
if (match_rf_read_sniff_ranges(padapter, eRFPath, RegAddr, BitMask)) {
RTW_INFO("DBG_IO rtw_hal_read_rfreg(%u, 0x%04x, 0x%08x) read:0x%08x(0x%08x)\n" RTW_INFO("DBG_IO rtw_hal_read_rfreg(%u, 0x%04x, 0x%08x) read:0x%08x(0x%08x)\n"
, eRFPath, RegAddr, BitMask, (data << PHY_CalculateBitShift(BitMask)), data); , eRFPath, RegAddr, BitMask, (data << PHY_CalculateBitShift(BitMask)), data);
} }
#endif
} }
return data; return data;
@ -727,10 +961,12 @@ void rtw_hal_write_rfreg(_adapter *padapter, enum rf_path eRFPath, u32 RegAddr,
{ {
if (padapter->hal_func.write_rfreg) { if (padapter->hal_func.write_rfreg) {
if (match_rf_write_sniff_ranges(eRFPath, RegAddr, BitMask)) { #ifdef DBG_IO
if (match_rf_write_sniff_ranges(padapter, eRFPath, RegAddr, BitMask)) {
RTW_INFO("DBG_IO rtw_hal_write_rfreg(%u, 0x%04x, 0x%08x) write:0x%08x(0x%08x)\n" RTW_INFO("DBG_IO rtw_hal_write_rfreg(%u, 0x%04x, 0x%08x) write:0x%08x(0x%08x)\n"
, eRFPath, RegAddr, BitMask, (Data << PHY_CalculateBitShift(BitMask)), Data); , eRFPath, RegAddr, BitMask, (Data << PHY_CalculateBitShift(BitMask)), Data);
} }
#endif
padapter->hal_func.write_rfreg(padapter, eRFPath, RegAddr, BitMask, Data); padapter->hal_func.write_rfreg(padapter, eRFPath, RegAddr, BitMask, Data);
@ -781,7 +1017,7 @@ void rtw_hal_interrupt_handler(_adapter *padapter, u16 pkt_len, u8 *pbuf)
void rtw_hal_set_chnl_bw(_adapter *padapter, u8 channel, enum channel_width Bandwidth, u8 Offset40, u8 Offset80) void rtw_hal_set_chnl_bw(_adapter *padapter, u8 channel, enum channel_width Bandwidth, u8 Offset40, u8 Offset80)
{ {
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter); PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter);
u8 cch_160 = Bandwidth == CHANNEL_WIDTH_160 ? channel : 0; /*u8 cch_160 = Bandwidth == CHANNEL_WIDTH_160 ? channel : 0;*/
u8 cch_80 = Bandwidth == CHANNEL_WIDTH_80 ? channel : 0; u8 cch_80 = Bandwidth == CHANNEL_WIDTH_80 ? channel : 0;
u8 cch_40 = Bandwidth == CHANNEL_WIDTH_40 ? channel : 0; u8 cch_40 = Bandwidth == CHANNEL_WIDTH_40 ? channel : 0;
u8 cch_20 = Bandwidth == CHANNEL_WIDTH_20 ? channel : 0; u8 cch_20 = Bandwidth == CHANNEL_WIDTH_20 ? channel : 0;
@ -816,27 +1052,11 @@ void rtw_hal_set_chnl_bw(_adapter *padapter, u8 channel, enum channel_width Band
padapter->hal_func.set_chnl_bw_handler(padapter, channel, Bandwidth, Offset40, Offset80); padapter->hal_func.set_chnl_bw_handler(padapter, channel, Bandwidth, Offset40, Offset80);
} }
void rtw_hal_set_tx_power_level(_adapter *padapter, u8 channel)
{
if (padapter->hal_func.set_tx_power_level_handler)
padapter->hal_func.set_tx_power_level_handler(padapter, channel);
}
void rtw_hal_get_tx_power_level(_adapter *padapter, s32 *powerlevel)
{
if (padapter->hal_func.get_tx_power_level_handler)
padapter->hal_func.get_tx_power_level_handler(padapter, powerlevel);
}
void rtw_hal_dm_watchdog(_adapter *padapter) void rtw_hal_dm_watchdog(_adapter *padapter)
{ {
rtw_hal_turbo_edca(padapter); rtw_hal_turbo_edca(padapter);
padapter->hal_func.hal_dm_watchdog(padapter); padapter->hal_func.hal_dm_watchdog(padapter);
#ifdef CONFIG_PCI_DYNAMIC_ASPM
rtw_pci_aspm_config_dynamic_l1_ilde_time(padapter);
#endif
} }
#ifdef CONFIG_LPS_LCLK_WD_TIMER #ifdef CONFIG_LPS_LCLK_WD_TIMER
@ -937,7 +1157,6 @@ void rtw_hal_notch_filter(_adapter *adapter, bool enable)
inline bool rtw_hal_c2h_valid(_adapter *adapter, u8 *buf) inline bool rtw_hal_c2h_valid(_adapter *adapter, u8 *buf)
{ {
HAL_DATA_TYPE *HalData = GET_HAL_DATA(adapter); HAL_DATA_TYPE *HalData = GET_HAL_DATA(adapter);
HAL_VERSION *hal_ver = &HalData->version_id;
bool ret = _FAIL; bool ret = _FAIL;
ret = C2H_ID_88XX(buf) || C2H_PLEN_88XX(buf); ret = C2H_ID_88XX(buf) || C2H_PLEN_88XX(buf);
@ -948,7 +1167,6 @@ inline bool rtw_hal_c2h_valid(_adapter *adapter, u8 *buf)
inline s32 rtw_hal_c2h_evt_read(_adapter *adapter, u8 *buf) inline s32 rtw_hal_c2h_evt_read(_adapter *adapter, u8 *buf)
{ {
HAL_DATA_TYPE *HalData = GET_HAL_DATA(adapter); HAL_DATA_TYPE *HalData = GET_HAL_DATA(adapter);
HAL_VERSION *hal_ver = &HalData->version_id;
s32 ret = _FAIL; s32 ret = _FAIL;
ret = c2h_evt_read_88xx(adapter, buf); ret = c2h_evt_read_88xx(adapter, buf);
@ -959,7 +1177,6 @@ inline s32 rtw_hal_c2h_evt_read(_adapter *adapter, u8 *buf)
bool rtw_hal_c2h_reg_hdr_parse(_adapter *adapter, u8 *buf, u8 *id, u8 *seq, u8 *plen, u8 **payload) bool rtw_hal_c2h_reg_hdr_parse(_adapter *adapter, u8 *buf, u8 *id, u8 *seq, u8 *plen, u8 **payload)
{ {
HAL_DATA_TYPE *HalData = GET_HAL_DATA(adapter); HAL_DATA_TYPE *HalData = GET_HAL_DATA(adapter);
HAL_VERSION *hal_ver = &HalData->version_id;
bool ret = _FAIL; bool ret = _FAIL;
*id = C2H_ID_88XX(buf); *id = C2H_ID_88XX(buf);
@ -976,7 +1193,6 @@ bool rtw_hal_c2h_reg_hdr_parse(_adapter *adapter, u8 *buf, u8 *id, u8 *seq, u8 *
bool rtw_hal_c2h_pkt_hdr_parse(_adapter *adapter, u8 *buf, u16 len, u8 *id, u8 *seq, u8 *plen, u8 **payload) bool rtw_hal_c2h_pkt_hdr_parse(_adapter *adapter, u8 *buf, u16 len, u8 *id, u8 *seq, u8 *plen, u8 **payload)
{ {
HAL_DATA_TYPE *HalData = GET_HAL_DATA(adapter); HAL_DATA_TYPE *HalData = GET_HAL_DATA(adapter);
HAL_VERSION *hal_ver = &HalData->version_id;
bool ret = _FAIL; bool ret = _FAIL;
if (!buf || len > 256 || len < 3) if (!buf || len > 256 || len < 3)
@ -1077,14 +1293,13 @@ s32 c2h_handler(_adapter *adapter, u8 id, u8 seq, u8 plen, u8 *payload)
case C2H_EXTEND: case C2H_EXTEND:
sub_id = payload[0]; sub_id = payload[0];
/* no handle, goto default */ /* no handle, goto default */
/* fall through */
default: default:
if (phydm_c2H_content_parsing(adapter_to_phydm(adapter), id, plen, payload) != TRUE) if (phydm_c2H_content_parsing(adapter_to_phydm(adapter), id, plen, payload) != TRUE)
ret = _FAIL; ret = _FAIL;
break; break;
} }
exit:
if (ret != _SUCCESS) { if (ret != _SUCCESS) {
if (id == C2H_EXTEND) if (id == C2H_EXTEND)
RTW_WARN("%s: unknown C2H(0x%02x, 0x%02x)\n", __func__, id, sub_id); RTW_WARN("%s: unknown C2H(0x%02x, 0x%02x)\n", __func__, id, sub_id);
@ -1130,6 +1345,74 @@ s32 rtw_hal_is_disable_sw_channel_plan(PADAPTER padapter)
return GET_HAL_DATA(padapter)->bDisableSWChannelPlan; return GET_HAL_DATA(padapter)->bDisableSWChannelPlan;
} }
#ifdef CONFIG_PROTSEL_MACSLEEP
static s32 _rtw_hal_macid_sleep(_adapter *adapter, u8 macid, u8 sleep)
{
struct macid_ctl_t *macid_ctl = adapter_to_macidctl(adapter);
u16 reg_sleep_info = macid_ctl->reg_sleep_info;
u16 reg_sleep_ctrl = macid_ctl->reg_sleep_ctrl;
const u32 sel_mask_sel = BIT(0) | BIT(1) | BIT(2);
u8 bit_shift;
u32 val32;
s32 ret = _FAIL;
if (macid >= macid_ctl->num) {
RTW_ERR(ADPT_FMT" %s invalid macid(%u)\n"
, ADPT_ARG(adapter), sleep ? "sleep" : "wakeup" , macid);
goto exit;
}
if (macid < 32) {
bit_shift = macid;
#if (MACID_NUM_SW_LIMIT > 32)
} else if (macid < 64) {
bit_shift = macid - 32;
#endif
#if (MACID_NUM_SW_LIMIT > 64)
} else if (macid < 96) {
bit_shift = macid - 64;
#endif
#if (MACID_NUM_SW_LIMIT > 96)
} else if (macid < 128) {
bit_shift = macid - 96;
#endif
} else {
rtw_warn_on(1);
goto exit;
}
if (!reg_sleep_ctrl || !reg_sleep_info) {
rtw_warn_on(1);
goto exit;
}
val32 = rtw_read32(adapter, reg_sleep_ctrl);
val32 = (val32 &~sel_mask_sel) | ((macid / 32) & sel_mask_sel);
rtw_write32(adapter, reg_sleep_ctrl, val32);
val32 = rtw_read32(adapter, reg_sleep_info);
RTW_INFO(ADPT_FMT" %s macid=%d, ori reg_0x%03x=0x%08x\n"
, ADPT_ARG(adapter), sleep ? "sleep" : "wakeup"
, macid, reg_sleep_info, val32);
ret = _SUCCESS;
if (sleep) {
if (val32 & BIT(bit_shift))
goto exit;
val32 |= BIT(bit_shift);
} else {
if (!(val32 & BIT(bit_shift)))
goto exit;
val32 &= ~BIT(bit_shift);
}
rtw_write32(adapter, reg_sleep_info, val32);
exit:
return ret;
}
#else
static s32 _rtw_hal_macid_sleep(_adapter *adapter, u8 macid, u8 sleep) static s32 _rtw_hal_macid_sleep(_adapter *adapter, u8 macid, u8 sleep)
{ {
struct macid_ctl_t *macid_ctl = adapter_to_macidctl(adapter); struct macid_ctl_t *macid_ctl = adapter_to_macidctl(adapter);
@ -1194,6 +1477,7 @@ static s32 _rtw_hal_macid_sleep(_adapter *adapter, u8 macid, u8 sleep)
exit: exit:
return ret; return ret;
} }
#endif
inline s32 rtw_hal_macid_sleep(_adapter *adapter, u8 macid) inline s32 rtw_hal_macid_sleep(_adapter *adapter, u8 macid)
{ {
@ -1205,6 +1489,73 @@ inline s32 rtw_hal_macid_wakeup(_adapter *adapter, u8 macid)
return _rtw_hal_macid_sleep(adapter, macid, 0); return _rtw_hal_macid_sleep(adapter, macid, 0);
} }
#ifdef CONFIG_PROTSEL_MACSLEEP
static s32 _rtw_hal_macid_bmp_sleep(_adapter *adapter, struct macid_bmp *bmp, u8 sleep)
{
struct macid_ctl_t *macid_ctl = adapter_to_macidctl(adapter);
u16 reg_sleep_info = macid_ctl->reg_sleep_info;
u16 reg_sleep_ctrl = macid_ctl->reg_sleep_ctrl;
const u32 sel_mask_sel = BIT(0) | BIT(1) | BIT(2);
u32 m;
u8 mid = 0;
u32 val32;
do {
if (mid == 0) {
m = bmp->m0;
#if (MACID_NUM_SW_LIMIT > 32)
} else if (mid == 1) {
m = bmp->m1;
#endif
#if (MACID_NUM_SW_LIMIT > 64)
} else if (mid == 2) {
m = bmp->m2;
#endif
#if (MACID_NUM_SW_LIMIT > 96)
} else if (mid == 3) {
m = bmp->m3;
#endif
} else {
rtw_warn_on(1);
break;
}
if (m == 0)
goto move_next;
if (!reg_sleep_ctrl || !reg_sleep_info) {
rtw_warn_on(1);
break;
}
val32 = rtw_read32(adapter, reg_sleep_ctrl);
val32 = (val32 &~sel_mask_sel) | (mid & sel_mask_sel);
rtw_write32(adapter, reg_sleep_ctrl, val32);
val32 = rtw_read32(adapter, reg_sleep_info);
RTW_INFO(ADPT_FMT" %s m%u=0x%08x, ori reg_0x%03x=0x%08x\n"
, ADPT_ARG(adapter), sleep ? "sleep" : "wakeup"
, mid, m, reg_sleep_info, val32);
if (sleep) {
if ((val32 & m) == m)
goto move_next;
val32 |= m;
} else {
if ((val32 & m) == 0)
goto move_next;
val32 &= ~m;
}
rtw_write32(adapter, reg_sleep_info, val32);
move_next:
mid++;
} while (mid * 32 < MACID_NUM_SW_LIMIT);
return _SUCCESS;
}
#else
static s32 _rtw_hal_macid_bmp_sleep(_adapter *adapter, struct macid_bmp *bmp, u8 sleep) static s32 _rtw_hal_macid_bmp_sleep(_adapter *adapter, struct macid_bmp *bmp, u8 sleep)
{ {
struct macid_ctl_t *macid_ctl = adapter_to_macidctl(adapter); struct macid_ctl_t *macid_ctl = adapter_to_macidctl(adapter);
@ -1268,6 +1619,7 @@ move_next:
return _SUCCESS; return _SUCCESS;
} }
#endif
inline s32 rtw_hal_macid_sleep_all_used(_adapter *adapter) inline s32 rtw_hal_macid_sleep_all_used(_adapter *adapter)
{ {
@ -1350,14 +1702,53 @@ void rtw_hal_fw_correct_bcn(_adapter *padapter)
} }
#endif #endif
void rtw_hal_set_tx_power_index(PADAPTER padapter, u32 powerindex, enum rf_path rfpath, u8 rate) void rtw_hal_set_tx_power_level(_adapter *adapter, u8 channel)
{ {
return padapter->hal_func.set_tx_power_index_handler(padapter, powerindex, rfpath, rate); if (phy_chk_ch_setting_consistency(adapter, channel) != _SUCCESS)
return;
adapter->hal_func.set_tx_power_level_handler(adapter, channel);
rtw_hal_set_txpwr_done(adapter);
} }
u8 rtw_hal_get_tx_power_index(PADAPTER padapter, enum rf_path rfpath, u8 rate, u8 bandwidth, u8 channel, struct txpwr_idx_comp *tic) void rtw_hal_update_txpwr_level(_adapter *adapter)
{ {
return padapter->hal_func.get_tx_power_index_handler(padapter, rfpath, rate, bandwidth, channel, tic); HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
rtw_hal_set_tx_power_level(adapter, hal_data->current_channel);
}
void rtw_hal_set_txpwr_done(_adapter *adapter)
{
if (adapter->hal_func.set_txpwr_done)
adapter->hal_func.set_txpwr_done(adapter);
}
void rtw_hal_set_tx_power_index(_adapter *adapter, u32 powerindex
, enum rf_path rfpath, u8 rate)
{
adapter->hal_func.set_tx_power_index_handler(adapter, powerindex, rfpath, rate);
}
u8 rtw_hal_get_tx_power_index(_adapter *adapter, enum rf_path rfpath
, RATE_SECTION rs, enum MGN_RATE rate, enum channel_width bw, BAND_TYPE band, u8 cch, u8 opch
, struct txpwr_idx_comp *tic)
{
return adapter->hal_func.get_tx_power_index_handler(adapter, rfpath
, rs, rate, bw, band, cch, opch, tic);
}
s8 rtw_hal_get_txpwr_target_extra_bias(_adapter *adapter, enum rf_path rfpath
, RATE_SECTION rs, enum MGN_RATE rate, enum channel_width bw, BAND_TYPE band, u8 cch)
{
s8 val = 0;
if (adapter->hal_func.get_txpwr_target_extra_bias) {
val = adapter->hal_func.get_txpwr_target_extra_bias(adapter
, rfpath, rs, rate, bw, band, cch);
}
return val;
} }
#ifdef RTW_HALMAC #ifdef RTW_HALMAC
@ -1634,13 +2025,6 @@ u8 rtw_hal_ops_check(_adapter *padapter)
ret = _FAIL; ret = _FAIL;
} }
#if defined(RTW_HALMAC) && defined(CONFIG_LPS_PG)
if (NULL == padapter->hal_func.fw_mem_dl) {
rtw_hal_error_msg("fw_mem_dl");
ret = _FAIL;
}
#endif
#ifdef CONFIG_FW_CORRECT_BCN #ifdef CONFIG_FW_CORRECT_BCN
if (IS_HARDWARE_TYPE_8814A(padapter) if (IS_HARDWARE_TYPE_8814A(padapter)
&& NULL == padapter->hal_func.fw_correct_bcn) { && NULL == padapter->hal_func.fw_correct_bcn) {
@ -1649,6 +2033,10 @@ u8 rtw_hal_ops_check(_adapter *padapter)
} }
#endif #endif
if (!padapter->hal_func.set_tx_power_level_handler) {
rtw_hal_error_msg("set_tx_power_level_handler");
ret = _FAIL;
}
if (!padapter->hal_func.set_tx_power_index_handler) { if (!padapter->hal_func.set_tx_power_index_handler) {
rtw_hal_error_msg("set_tx_power_index_handler"); rtw_hal_error_msg("set_tx_power_index_handler");
ret = _FAIL; ret = _FAIL;

File diff suppressed because it is too large Load Diff

View File

@ -78,17 +78,16 @@ u8 MgntQuery_NssTxRate(u16 Rate)
void hal_mpt_SwitchRfSetting(PADAPTER pAdapter) void hal_mpt_SwitchRfSetting(PADAPTER pAdapter)
{ {
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx);
u8 ChannelToSw = pMptCtx->MptChannelToSw; u8 ChannelToSw = pMptCtx->MptChannelToSw;
ULONG ulRateIdx = pMptCtx->mpt_rate_index; u32 ulRateIdx = pMptCtx->mpt_rate_index;
ULONG ulbandwidth = pMptCtx->MptBandWidth; u32 ulbandwidth = pMptCtx->MptBandWidth;
/* <20120525, Kordan> Dynamic mechanism for APK, asked by Dennis.*/ /* <20120525, Kordan> Dynamic mechanism for APK, asked by Dennis.*/
if (IS_HARDWARE_TYPE_8188ES(pAdapter) && (1 <= ChannelToSw && ChannelToSw <= 11) && if (IS_HARDWARE_TYPE_8188ES(pAdapter) && (1 <= ChannelToSw && ChannelToSw <= 11) &&
(ulRateIdx == MPT_RATE_MCS0 || ulRateIdx == MPT_RATE_1M || ulRateIdx == MPT_RATE_6M)) { (ulRateIdx == MPT_RATE_MCS0 || ulRateIdx == MPT_RATE_1M || ulRateIdx == MPT_RATE_6M)) {
pMptCtx->backup0x52_RF_A = (u1Byte)phy_query_rf_reg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0); pMptCtx->backup0x52_RF_A = (u8)phy_query_rf_reg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0);
pMptCtx->backup0x52_RF_B = (u1Byte)phy_query_rf_reg(pAdapter, RF_PATH_B, RF_0x52, 0x000F0); pMptCtx->backup0x52_RF_B = (u8)phy_query_rf_reg(pAdapter, RF_PATH_B, RF_0x52, 0x000F0);
if ((PlatformEFIORead4Byte(pAdapter, 0xF4) & BIT29) == BIT29) { if ((PlatformEFIORead4Byte(pAdapter, 0xF4) & BIT29) == BIT29) {
phy_set_rf_reg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0, 0xB); phy_set_rf_reg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0, 0xB);
@ -149,13 +148,13 @@ void hal_mpt_CCKTxPowerAdjust(PADAPTER Adapter, BOOLEAN bInCH14)
u8 i; u8 i;
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);
u1Byte u1Channel = pHalData->current_channel; u8 u1Channel = pHalData->current_channel;
ULONG ulRateIdx = pMptCtx->mpt_rate_index; u32 ulRateIdx = pMptCtx->mpt_rate_index;
u1Byte DataRate = 0xFF; u8 DataRate = 0xFF;
/* Do not modify CCK TX filter parameters for 8822B*/ /* Do not modify CCK TX filter parameters for 8822B*/
if(IS_HARDWARE_TYPE_8822B(Adapter) || IS_HARDWARE_TYPE_8821C(Adapter) || if(IS_HARDWARE_TYPE_8822B(Adapter) || IS_HARDWARE_TYPE_8821C(Adapter) ||
IS_HARDWARE_TYPE_8723D(Adapter) || IS_HARDWARE_TYPE_8192F(Adapter)) IS_HARDWARE_TYPE_8723D(Adapter) || IS_HARDWARE_TYPE_8192F(Adapter) || IS_HARDWARE_TYPE_8822C(Adapter))
return; return;
DataRate = mpt_to_mgnt_rate(ulRateIdx); DataRate = mpt_to_mgnt_rate(ulRateIdx);
@ -318,9 +317,7 @@ void hal_mpt_CCKTxPowerAdjust(PADAPTER Adapter, BOOLEAN bInCH14)
void hal_mpt_SetChannel(PADAPTER pAdapter) void hal_mpt_SetChannel(PADAPTER pAdapter)
{ {
enum rf_path eRFPath;
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
struct dm_struct *pDM_Odm = &(pHalData->odmpriv);
struct mp_priv *pmp = &pAdapter->mppriv; struct mp_priv *pmp = &pAdapter->mppriv;
u8 channel = pmp->channel; u8 channel = pmp->channel;
u8 bandwidth = pmp->bandwidth; u8 bandwidth = pmp->bandwidth;
@ -330,13 +327,11 @@ void hal_mpt_SetChannel(PADAPTER pAdapter)
pHalData->bSwChnl = _TRUE; pHalData->bSwChnl = _TRUE;
pHalData->bSetChnlBW = _TRUE; pHalData->bSetChnlBW = _TRUE;
#ifdef CONFIG_RTL8822B
if (bandwidth == 2) { if (bandwidth == 2) {
rtw_hal_set_chnl_bw(pAdapter, channel, bandwidth, HAL_PRIME_CHNL_OFFSET_LOWER, HAL_PRIME_CHNL_OFFSET_UPPER); rtw_hal_set_chnl_bw(pAdapter, channel, bandwidth, HAL_PRIME_CHNL_OFFSET_LOWER, HAL_PRIME_CHNL_OFFSET_UPPER);
} else if (bandwidth == 1) { } else if (bandwidth == 1) {
rtw_hal_set_chnl_bw(pAdapter, channel, bandwidth, HAL_PRIME_CHNL_OFFSET_UPPER, 0); rtw_hal_set_chnl_bw(pAdapter, channel, bandwidth, HAL_PRIME_CHNL_OFFSET_UPPER, 0);
} else } else
#endif
rtw_hal_set_chnl_bw(pAdapter, channel, bandwidth, pmp->prime_channel_offset, 0); rtw_hal_set_chnl_bw(pAdapter, channel, bandwidth, pmp->prime_channel_offset, 0);
hal_mpt_CCKTxPowerAdjust(pAdapter, pHalData->bCCKinCH14); hal_mpt_CCKTxPowerAdjust(pAdapter, pHalData->bCCKinCH14);
@ -359,13 +354,11 @@ void hal_mpt_SetBandwidth(PADAPTER pAdapter)
pHalData->bSwChnl = _TRUE; pHalData->bSwChnl = _TRUE;
pHalData->bSetChnlBW = _TRUE; pHalData->bSetChnlBW = _TRUE;
#ifdef CONFIG_RTL8822B
if (bandwidth == 2) { if (bandwidth == 2) {
rtw_hal_set_chnl_bw(pAdapter, channel, bandwidth, HAL_PRIME_CHNL_OFFSET_LOWER, HAL_PRIME_CHNL_OFFSET_UPPER); rtw_hal_set_chnl_bw(pAdapter, channel, bandwidth, HAL_PRIME_CHNL_OFFSET_LOWER, HAL_PRIME_CHNL_OFFSET_UPPER);
} else if (bandwidth == 1) { } else if (bandwidth == 1) {
rtw_hal_set_chnl_bw(pAdapter, channel, bandwidth, HAL_PRIME_CHNL_OFFSET_UPPER, 0); rtw_hal_set_chnl_bw(pAdapter, channel, bandwidth, HAL_PRIME_CHNL_OFFSET_UPPER, 0);
} else } else
#endif
rtw_hal_set_chnl_bw(pAdapter, channel, bandwidth, pmp->prime_channel_offset, 0); rtw_hal_set_chnl_bw(pAdapter, channel, bandwidth, pmp->prime_channel_offset, 0);
hal_mpt_SwitchRfSetting(pAdapter); hal_mpt_SwitchRfSetting(pAdapter);
@ -377,8 +370,7 @@ void mpt_SetTxPower_Old(PADAPTER pAdapter, MPT_TXPWR_DEF Rate, u8 *pTxPower)
{ {
switch (Rate) { switch (Rate) {
case MPT_CCK: { case MPT_CCK: {
u4Byte TxAGC = 0, pwr = 0; u32 TxAGC = 0, pwr = 0;
u1Byte rf;
pwr = pTxPower[RF_PATH_A]; pwr = pTxPower[RF_PATH_A];
if (pwr < 0x3f) { if (pwr < 0x3f) {
@ -396,8 +388,8 @@ void mpt_SetTxPower_Old(PADAPTER pAdapter, MPT_TXPWR_DEF Rate, u8 *pTxPower)
break; break;
case MPT_OFDM_AND_HT: { case MPT_OFDM_AND_HT: {
u4Byte TxAGC = 0; u32 TxAGC = 0;
u1Byte pwr = 0, rf; u8 pwr = 0;
pwr = pTxPower[0]; pwr = pTxPower[0];
if (pwr < 0x3f) { if (pwr < 0x3f) {
@ -435,15 +427,15 @@ void
mpt_SetTxPower( mpt_SetTxPower(
PADAPTER pAdapter, PADAPTER pAdapter,
MPT_TXPWR_DEF Rate, MPT_TXPWR_DEF Rate,
pu1Byte pTxPower u8 *pTxPower
) )
{ {
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
u1Byte path = 0 , i = 0, MaxRate = MGN_6M; u8 path = 0 , i = 0, MaxRate = MGN_6M;
u1Byte StartPath = RF_PATH_A, EndPath = RF_PATH_B; u8 StartPath = RF_PATH_A, EndPath = RF_PATH_B;
if (IS_HARDWARE_TYPE_8814A(pAdapter)) if (IS_HARDWARE_TYPE_8814A(pAdapter) || IS_HARDWARE_TYPE_8814B(pAdapter))
EndPath = RF_PATH_D; EndPath = RF_PATH_D;
else if (IS_HARDWARE_TYPE_8188F(pAdapter) || IS_HARDWARE_TYPE_8188GTV(pAdapter) else if (IS_HARDWARE_TYPE_8188F(pAdapter) || IS_HARDWARE_TYPE_8188GTV(pAdapter)
|| IS_HARDWARE_TYPE_8723D(pAdapter) || IS_HARDWARE_TYPE_8821C(pAdapter)) || IS_HARDWARE_TYPE_8723D(pAdapter) || IS_HARDWARE_TYPE_8821C(pAdapter))
@ -451,7 +443,7 @@ mpt_SetTxPower(
switch (Rate) { switch (Rate) {
case MPT_CCK: { case MPT_CCK: {
u1Byte rate[] = {MGN_1M, MGN_2M, MGN_5_5M, MGN_11M}; u8 rate[] = {MGN_1M, MGN_2M, MGN_5_5M, MGN_11M};
for (path = StartPath; path <= EndPath; path++) for (path = StartPath; path <= EndPath; path++)
for (i = 0; i < sizeof(rate); ++i) for (i = 0; i < sizeof(rate); ++i)
@ -459,7 +451,7 @@ mpt_SetTxPower(
} }
break; break;
case MPT_OFDM: { case MPT_OFDM: {
u1Byte rate[] = { u8 rate[] = {
MGN_6M, MGN_9M, MGN_12M, MGN_18M, MGN_6M, MGN_9M, MGN_12M, MGN_18M,
MGN_24M, MGN_36M, MGN_48M, MGN_54M, MGN_24M, MGN_36M, MGN_48M, MGN_54M,
}; };
@ -470,7 +462,7 @@ mpt_SetTxPower(
} }
break; break;
case MPT_HT: { case MPT_HT: {
u1Byte rate[] = { u8 rate[] = {
MGN_MCS0, MGN_MCS1, MGN_MCS2, MGN_MCS3, MGN_MCS4, MGN_MCS0, MGN_MCS1, MGN_MCS2, MGN_MCS3, MGN_MCS4,
MGN_MCS5, MGN_MCS6, MGN_MCS7, MGN_MCS8, MGN_MCS9, MGN_MCS5, MGN_MCS6, MGN_MCS7, MGN_MCS8, MGN_MCS9,
MGN_MCS10, MGN_MCS11, MGN_MCS12, MGN_MCS13, MGN_MCS14, MGN_MCS10, MGN_MCS11, MGN_MCS12, MGN_MCS13, MGN_MCS14,
@ -495,7 +487,7 @@ mpt_SetTxPower(
} }
break; break;
case MPT_VHT: { case MPT_VHT: {
u1Byte rate[] = { u8 rate[] = {
MGN_VHT1SS_MCS0, MGN_VHT1SS_MCS1, MGN_VHT1SS_MCS2, MGN_VHT1SS_MCS3, MGN_VHT1SS_MCS4, MGN_VHT1SS_MCS0, MGN_VHT1SS_MCS1, MGN_VHT1SS_MCS2, MGN_VHT1SS_MCS3, MGN_VHT1SS_MCS4,
MGN_VHT1SS_MCS5, MGN_VHT1SS_MCS6, MGN_VHT1SS_MCS7, MGN_VHT1SS_MCS8, MGN_VHT1SS_MCS9, MGN_VHT1SS_MCS5, MGN_VHT1SS_MCS6, MGN_VHT1SS_MCS7, MGN_VHT1SS_MCS8, MGN_VHT1SS_MCS9,
MGN_VHT2SS_MCS0, MGN_VHT2SS_MCS1, MGN_VHT2SS_MCS2, MGN_VHT2SS_MCS3, MGN_VHT2SS_MCS4, MGN_VHT2SS_MCS0, MGN_VHT2SS_MCS1, MGN_VHT2SS_MCS2, MGN_VHT2SS_MCS3, MGN_VHT2SS_MCS4,
@ -541,7 +533,6 @@ void hal_mpt_SetTxPower(PADAPTER pAdapter)
IS_HARDWARE_TYPE_8188F(pAdapter) || IS_HARDWARE_TYPE_8188F(pAdapter) ||
IS_HARDWARE_TYPE_8188GTV(pAdapter) IS_HARDWARE_TYPE_8188GTV(pAdapter)
) { ) {
u8 path = (pHalData->antenna_tx_path == ANTENNA_A) ? (RF_PATH_A) : (RF_PATH_B);
RTW_INFO("===> MPT_ProSetTxPower: Old\n"); RTW_INFO("===> MPT_ProSetTxPower: Old\n");
@ -553,11 +544,13 @@ void hal_mpt_SetTxPower(PADAPTER pAdapter)
mpt_SetTxPower(pAdapter, MPT_CCK, pMptCtx->TxPwrLevel); mpt_SetTxPower(pAdapter, MPT_CCK, pMptCtx->TxPwrLevel);
mpt_SetTxPower(pAdapter, MPT_OFDM, pMptCtx->TxPwrLevel); mpt_SetTxPower(pAdapter, MPT_OFDM, pMptCtx->TxPwrLevel);
mpt_SetTxPower(pAdapter, MPT_HT, pMptCtx->TxPwrLevel); mpt_SetTxPower(pAdapter, MPT_HT, pMptCtx->TxPwrLevel);
if(IS_HARDWARE_TYPE_JAGUAR(pAdapter)||IS_HARDWARE_TYPE_JAGUAR2(pAdapter)) { if(IS_HARDWARE_TYPE_JAGUAR_ALL(pAdapter)) {
RTW_INFO("===> MPT_ProSetTxPower: Jaguar/Jaguar2\n"); RTW_INFO("===> MPT_ProSetTxPower: Jaguar/Jaguar2\n");
mpt_SetTxPower(pAdapter, MPT_VHT, pMptCtx->TxPwrLevel); mpt_SetTxPower(pAdapter, MPT_VHT, pMptCtx->TxPwrLevel);
} }
} }
rtw_hal_set_txpwr_done(pAdapter);
} else } else
RTW_INFO("RFChipID < RF_CHIP_MAX, the RF chip is not supported - %d\n", pHalData->rf_chip); RTW_INFO("RFChipID < RF_CHIP_MAX, the RF chip is not supported - %d\n", pHalData->rf_chip);
@ -603,12 +596,12 @@ void hal_mpt_SetDataRate(PADAPTER pAdapter)
#define RF_PATH_AB 22 #define RF_PATH_AB 22
#ifdef CONFIG_RTL8814A #ifdef CONFIG_RTL8814A
VOID mpt_ToggleIG_8814A(PADAPTER pAdapter) void mpt_ToggleIG_8814A(PADAPTER pAdapter)
{ {
u1Byte Path = 0; u8 Path;
u4Byte IGReg = rA_IGI_Jaguar, IGvalue = 0; u32 IGReg = rA_IGI_Jaguar, IGvalue = 0;
for (Path; Path <= RF_PATH_D; Path++) { for (Path = 0; Path <= RF_PATH_D; Path++) {
switch (Path) { switch (Path) {
case RF_PATH_B: case RF_PATH_B:
IGReg = rB_IGI_Jaguar; IGReg = rB_IGI_Jaguar;
@ -630,7 +623,7 @@ VOID mpt_ToggleIG_8814A(PADAPTER pAdapter)
} }
} }
VOID mpt_SetRFPath_8814A(PADAPTER pAdapter) void mpt_SetRFPath_8814A(PADAPTER pAdapter)
{ {
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
@ -861,18 +854,19 @@ VOID mpt_SetRFPath_8814A(PADAPTER pAdapter)
mpt_ToggleIG_8814A(pAdapter); mpt_ToggleIG_8814A(pAdapter);
} }
#endif /* CONFIG_RTL8814A */ #endif /* CONFIG_RTL8814A */
#if defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) #if defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8822C) || defined(CONFIG_RTL8814B)
VOID void
mpt_SetSingleTone_8814A( mpt_SetSingleTone_8814A(
IN PADAPTER pAdapter, PADAPTER pAdapter,
IN BOOLEAN bSingleTone, BOOLEAN bSingleTone,
IN BOOLEAN bEnPMacTx) BOOLEAN bEnPMacTx)
{ {
PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx);
u1Byte StartPath = RF_PATH_A, EndPath = RF_PATH_A; u8 StartPath = RF_PATH_A, EndPath = RF_PATH_A, path;
static u4Byte regIG0 = 0, regIG1 = 0, regIG2 = 0, regIG3 = 0; static u32 regIG0 = 0, regIG1 = 0, regIG2 = 0, regIG3 = 0;
if (bSingleTone) { if (bSingleTone) {
regIG0 = phy_query_bb_reg(pAdapter, rA_TxScale_Jaguar, bMaskDWord); /*/ 0xC1C[31:21]*/ regIG0 = phy_query_bb_reg(pAdapter, rA_TxScale_Jaguar, bMaskDWord); /*/ 0xC1C[31:21]*/
@ -914,11 +908,11 @@ mpt_SetSingleTone_8814A(
phy_set_bb_reg(pAdapter, rCCAonSec_Jaguar, BIT1, 0x1); /*/ Disable CCA*/ phy_set_bb_reg(pAdapter, rCCAonSec_Jaguar, BIT1, 0x1); /*/ Disable CCA*/
for (StartPath; StartPath <= EndPath; StartPath++) { for (path = StartPath; path <= EndPath; path++) {
phy_set_rf_reg(pAdapter, StartPath, RF_AC_Jaguar, 0xF0000, 0x2); /*/ Tx mode: RF0x00[19:16]=4'b0010 */ phy_set_rf_reg(pAdapter, path, RF_AC_Jaguar, 0xF0000, 0x2); /*/ Tx mode: RF0x00[19:16]=4'b0010 */
phy_set_rf_reg(pAdapter, StartPath, RF_AC_Jaguar, 0x1F, 0x0); /*/ Lowest RF gain index: RF_0x0[4:0] = 0*/ phy_set_rf_reg(pAdapter, path, RF_AC_Jaguar, 0x1F, 0x0); /*/ Lowest RF gain index: RF_0x0[4:0] = 0*/
phy_set_rf_reg(pAdapter, StartPath, lna_low_gain_3, BIT1, 0x1); /*/ RF LO enabled*/ phy_set_rf_reg(pAdapter, path, lna_low_gain_3, BIT1, 0x1); /*/ RF LO enabled*/
} }
phy_set_bb_reg(pAdapter, rA_TxScale_Jaguar, 0xFFE00000, 0); /*/ 0xC1C[31:21]*/ phy_set_bb_reg(pAdapter, rA_TxScale_Jaguar, 0xFFE00000, 0); /*/ 0xC1C[31:21]*/
@ -952,13 +946,21 @@ mpt_SetSingleTone_8814A(
EndPath = RF_PATH_D; EndPath = RF_PATH_D;
break; break;
} }
for (StartPath; StartPath <= EndPath; StartPath++) for (path = StartPath; path <= EndPath; path++)
phy_set_rf_reg(pAdapter, StartPath, lna_low_gain_3, BIT1, 0x0); /* RF LO disabled */ phy_set_rf_reg(pAdapter, path, lna_low_gain_3, BIT1, 0x0); /* RF LO disabled */
phy_set_bb_reg(pAdapter, rCCAonSec_Jaguar, BIT1, 0x0); /* Enable CCA*/ phy_set_bb_reg(pAdapter, rCCAonSec_Jaguar, BIT1, 0x0); /* Enable CCA*/
if (bEnPMacTx == FALSE) if (bEnPMacTx == FALSE) {
if(IS_HARDWARE_TYPE_JAGUAR3(pAdapter)) {
#ifdef PHYDM_MP_SUPPORT
phydm_stop_ofdm_cont_tx(pAdapter);
pMptCtx->bCckContTx = FALSE;
pMptCtx->bOfdmContTx = FALSE;
#endif
} else
hal_mpt_SetContinuousTx(pAdapter, _FALSE); hal_mpt_SetContinuousTx(pAdapter, _FALSE);
}
phy_set_bb_reg(pAdapter, rA_TxScale_Jaguar, bMaskDWord, regIG0); /* 0xC1C[31:21]*/ phy_set_bb_reg(pAdapter, rA_TxScale_Jaguar, bMaskDWord, regIG0); /* 0xC1C[31:21]*/
phy_set_bb_reg(pAdapter, rB_TxScale_Jaguar, bMaskDWord, regIG1); /* 0xE1C[31:21]*/ phy_set_bb_reg(pAdapter, rB_TxScale_Jaguar, bMaskDWord, regIG1); /* 0xE1C[31:21]*/
@ -979,6 +981,7 @@ void mpt_SetRFPath_8812A(PADAPTER pAdapter)
u8 bandwidth = pmp->bandwidth; u8 bandwidth = pmp->bandwidth;
u8 eLNA_2g = pHalData->ExternalLNA_2G; u8 eLNA_2g = pHalData->ExternalLNA_2G;
u32 ulAntennaTx, ulAntennaRx; u32 ulAntennaTx, ulAntennaRx;
u32 reg0xC50 = 0;
ulAntennaTx = pHalData->antenna_tx_path; ulAntennaTx = pHalData->antenna_tx_path;
ulAntennaRx = pHalData->AntennaRxPath; ulAntennaRx = pHalData->AntennaRxPath;
@ -1009,7 +1012,6 @@ void mpt_SetRFPath_8812A(PADAPTER pAdapter)
} }
switch (ulAntennaRx) { switch (ulAntennaRx) {
u32 reg0xC50 = 0;
case ANTENNA_A: case ANTENNA_A:
phy_set_bb_reg(pAdapter, rRxPath_Jaguar, bMaskByte0, 0x11); phy_set_bb_reg(pAdapter, rRxPath_Jaguar, bMaskByte0, 0x11);
phy_set_rf_reg(pAdapter, RF_PATH_B, RF_AC_Jaguar, 0xF0000, 0x1); /*/ RF_B_0x0[19:16] = 1, Standby mode*/ phy_set_rf_reg(pAdapter, RF_PATH_B, RF_AC_Jaguar, 0xF0000, 0x1); /*/ RF_B_0x0[19:16] = 1, Standby mode*/
@ -1096,6 +1098,7 @@ void mpt_SetRFPath_8723B(PADAPTER pAdapter)
PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx);
struct dm_struct *pDM_Odm = &pHalData->odmpriv; struct dm_struct *pDM_Odm = &pHalData->odmpriv;
struct dm_rf_calibration_struct *pRFCalibrateInfo = &(pDM_Odm->rf_calibrate_info); struct dm_rf_calibration_struct *pRFCalibrateInfo = &(pDM_Odm->rf_calibrate_info);
u8 i;
ulAntennaTx = pHalData->antenna_tx_path; ulAntennaTx = pHalData->antenna_tx_path;
ulAntennaRx = pHalData->AntennaRxPath; ulAntennaRx = pHalData->AntennaRxPath;
@ -1106,15 +1109,14 @@ void mpt_SetRFPath_8723B(PADAPTER pAdapter)
} }
switch (pAdapter->mppriv.antenna_tx) { switch (pAdapter->mppriv.antenna_tx) {
u8 p = 0, i = 0;
case ANTENNA_A: { /*/ Actually path S1 (Wi-Fi)*/ case ANTENNA_A: { /*/ Actually path S1 (Wi-Fi)*/
pMptCtx->mpt_rf_path = RF_PATH_A; pMptCtx->mpt_rf_path = RF_PATH_A;
phy_set_bb_reg(pAdapter, rS0S1_PathSwitch, BIT9 | BIT8 | BIT7, 0x0); phy_set_bb_reg(pAdapter, rS0S1_PathSwitch, BIT9 | BIT8 | BIT7, 0x0);
phy_set_bb_reg(pAdapter, 0xB2C, BIT31, 0x0); /* AGC Table Sel*/ phy_set_bb_reg(pAdapter, 0xB2C, BIT31, 0x0); /* AGC Table Sel*/
for (i = 0; i < 3; ++i) { for (i = 0; i < 3; ++i) {
u4Byte offset = pRFCalibrateInfo->tx_iqc_8723b[RF_PATH_A][i][0]; u32 offset = pRFCalibrateInfo->tx_iqc_8723b[RF_PATH_A][i][0];
u4Byte data = pRFCalibrateInfo->tx_iqc_8723b[RF_PATH_A][i][1]; u32 data = pRFCalibrateInfo->tx_iqc_8723b[RF_PATH_A][i][1];
if (offset != 0) { if (offset != 0) {
phy_set_bb_reg(pAdapter, offset, bMaskDWord, data); phy_set_bb_reg(pAdapter, offset, bMaskDWord, data);
@ -1122,8 +1124,8 @@ void mpt_SetRFPath_8723B(PADAPTER pAdapter)
} }
} }
for (i = 0; i < 2; ++i) { for (i = 0; i < 2; ++i) {
u4Byte offset = pRFCalibrateInfo->rx_iqc_8723b[RF_PATH_A][i][0]; u32 offset = pRFCalibrateInfo->rx_iqc_8723b[RF_PATH_A][i][0];
u4Byte data = pRFCalibrateInfo->rx_iqc_8723b[RF_PATH_A][i][1]; u32 data = pRFCalibrateInfo->rx_iqc_8723b[RF_PATH_A][i][1];
if (offset != 0) { if (offset != 0) {
phy_set_bb_reg(pAdapter, offset, bMaskDWord, data); phy_set_bb_reg(pAdapter, offset, bMaskDWord, data);
@ -1133,8 +1135,8 @@ void mpt_SetRFPath_8723B(PADAPTER pAdapter)
} }
break; break;
case ANTENNA_B: { /*/ Actually path S0 (BT)*/ case ANTENNA_B: { /*/ Actually path S0 (BT)*/
u4Byte offset; u32 offset;
u4Byte data; u32 data;
pMptCtx->mpt_rf_path = RF_PATH_B; pMptCtx->mpt_rf_path = RF_PATH_B;
phy_set_bb_reg(pAdapter, rS0S1_PathSwitch, BIT9 | BIT8 | BIT7, 0x5); phy_set_bb_reg(pAdapter, rS0S1_PathSwitch, BIT9 | BIT8 | BIT7, 0x5);
@ -1171,10 +1173,11 @@ void mpt_SetRFPath_8723B(PADAPTER pAdapter)
void mpt_SetRFPath_8703B(PADAPTER pAdapter) void mpt_SetRFPath_8703B(PADAPTER pAdapter)
{ {
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
u4Byte ulAntennaTx, ulAntennaRx; u32 ulAntennaTx, ulAntennaRx;
PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx);
struct dm_struct *pDM_Odm = &pHalData->odmpriv; struct dm_struct *pDM_Odm = &pHalData->odmpriv;
struct dm_rf_calibration_struct *pRFCalibrateInfo = &(pDM_Odm->rf_calibrate_info); struct dm_rf_calibration_struct *pRFCalibrateInfo = &(pDM_Odm->rf_calibrate_info);
u8 i;
ulAntennaTx = pHalData->antenna_tx_path; ulAntennaTx = pHalData->antenna_tx_path;
ulAntennaRx = pHalData->AntennaRxPath; ulAntennaRx = pHalData->AntennaRxPath;
@ -1185,16 +1188,14 @@ void mpt_SetRFPath_8703B(PADAPTER pAdapter)
} }
switch (pAdapter->mppriv.antenna_tx) { switch (pAdapter->mppriv.antenna_tx) {
u1Byte p = 0, i = 0;
case ANTENNA_A: { /* Actually path S1 (Wi-Fi) */ case ANTENNA_A: { /* Actually path S1 (Wi-Fi) */
pMptCtx->mpt_rf_path = RF_PATH_A; pMptCtx->mpt_rf_path = RF_PATH_A;
phy_set_bb_reg(pAdapter, rS0S1_PathSwitch, BIT9 | BIT8 | BIT7, 0x0); phy_set_bb_reg(pAdapter, rS0S1_PathSwitch, BIT9 | BIT8 | BIT7, 0x0);
phy_set_bb_reg(pAdapter, 0xB2C, BIT31, 0x0); /* AGC Table Sel*/ phy_set_bb_reg(pAdapter, 0xB2C, BIT31, 0x0); /* AGC Table Sel*/
for (i = 0; i < 3; ++i) { for (i = 0; i < 3; ++i) {
u4Byte offset = pRFCalibrateInfo->tx_iqc_8703b[i][0]; u32 offset = pRFCalibrateInfo->tx_iqc_8703b[i][0];
u4Byte data = pRFCalibrateInfo->tx_iqc_8703b[i][1]; u32 data = pRFCalibrateInfo->tx_iqc_8703b[i][1];
if (offset != 0) { if (offset != 0) {
phy_set_bb_reg(pAdapter, offset, bMaskDWord, data); phy_set_bb_reg(pAdapter, offset, bMaskDWord, data);
@ -1203,8 +1204,8 @@ void mpt_SetRFPath_8703B(PADAPTER pAdapter)
} }
for (i = 0; i < 2; ++i) { for (i = 0; i < 2; ++i) {
u4Byte offset = pRFCalibrateInfo->rx_iqc_8703b[i][0]; u32 offset = pRFCalibrateInfo->rx_iqc_8703b[i][0];
u4Byte data = pRFCalibrateInfo->rx_iqc_8703b[i][1]; u32 data = pRFCalibrateInfo->rx_iqc_8703b[i][1];
if (offset != 0) { if (offset != 0) {
phy_set_bb_reg(pAdapter, offset, bMaskDWord, data); phy_set_bb_reg(pAdapter, offset, bMaskDWord, data);
@ -1219,8 +1220,8 @@ void mpt_SetRFPath_8703B(PADAPTER pAdapter)
phy_set_bb_reg(pAdapter, 0xB2C, BIT31, 0x1); /* AGC Table Sel */ phy_set_bb_reg(pAdapter, 0xB2C, BIT31, 0x1); /* AGC Table Sel */
for (i = 0; i < 3; ++i) { for (i = 0; i < 3; ++i) {
u4Byte offset = pRFCalibrateInfo->tx_iqc_8703b[i][0]; u32 offset = pRFCalibrateInfo->tx_iqc_8703b[i][0];
u4Byte data = pRFCalibrateInfo->tx_iqc_8703b[i][1]; u32 data = pRFCalibrateInfo->tx_iqc_8703b[i][1];
if (pRFCalibrateInfo->tx_iqc_8703b[i][0] != 0) { if (pRFCalibrateInfo->tx_iqc_8703b[i][0] != 0) {
phy_set_bb_reg(pAdapter, offset, bMaskDWord, data); phy_set_bb_reg(pAdapter, offset, bMaskDWord, data);
@ -1228,8 +1229,8 @@ void mpt_SetRFPath_8703B(PADAPTER pAdapter)
} }
} }
for (i = 0; i < 2; ++i) { for (i = 0; i < 2; ++i) {
u4Byte offset = pRFCalibrateInfo->rx_iqc_8703b[i][0]; u32 offset = pRFCalibrateInfo->rx_iqc_8703b[i][0];
u4Byte data = pRFCalibrateInfo->rx_iqc_8703b[i][1]; u32 data = pRFCalibrateInfo->rx_iqc_8703b[i][1];
if (pRFCalibrateInfo->rx_iqc_8703b[i][0] != 0) { if (pRFCalibrateInfo->rx_iqc_8703b[i][0] != 0) {
phy_set_bb_reg(pAdapter, offset, bMaskDWord, data); phy_set_bb_reg(pAdapter, offset, bMaskDWord, data);
@ -1250,8 +1251,8 @@ void mpt_SetRFPath_8703B(PADAPTER pAdapter)
void mpt_SetRFPath_8723D(PADAPTER pAdapter) void mpt_SetRFPath_8723D(PADAPTER pAdapter)
{ {
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
u1Byte p = 0, i = 0; u8 p = 0, i = 0;
u4Byte ulAntennaTx, ulAntennaRx, offset = 0, data = 0, val32 = 0; u32 ulAntennaTx, ulAntennaRx, offset = 0, data = 0, val32 = 0;
PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx);
struct dm_struct *pDM_Odm = &pHalData->odmpriv; struct dm_struct *pDM_Odm = &pHalData->odmpriv;
struct dm_rf_calibration_struct *pRFCalibrateInfo = &(pDM_Odm->rf_calibrate_info); struct dm_rf_calibration_struct *pRFCalibrateInfo = &(pDM_Odm->rf_calibrate_info);
@ -1285,16 +1286,16 @@ void mpt_SetRFPath_8723D(PADAPTER pAdapter)
} }
#endif #endif
VOID mpt_SetRFPath_819X(PADAPTER pAdapter) void mpt_SetRFPath_819X(PADAPTER pAdapter)
{ {
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx);
u4Byte ulAntennaTx, ulAntennaRx; u32 ulAntennaTx, ulAntennaRx;
R_ANTENNA_SELECT_OFDM *p_ofdm_tx; /* OFDM Tx register */ R_ANTENNA_SELECT_OFDM *p_ofdm_tx; /* OFDM Tx register */
R_ANTENNA_SELECT_CCK *p_cck_txrx; R_ANTENNA_SELECT_CCK *p_cck_txrx;
u1Byte r_rx_antenna_ofdm = 0, r_ant_select_cck_val = 0; u8 r_rx_antenna_ofdm = 0, r_ant_select_cck_val = 0;
u1Byte chgTx = 0, chgRx = 0; u8 chgTx = 0, chgRx = 0;
u4Byte r_ant_sel_cck_val = 0, r_ant_select_ofdm_val = 0, r_ofdm_tx_en_val = 0; u32 r_ant_sel_cck_val = 0, r_ant_select_ofdm_val = 0, r_ofdm_tx_en_val = 0;
ulAntennaTx = pHalData->antenna_tx_path; ulAntennaTx = pHalData->antenna_tx_path;
ulAntennaRx = pHalData->AntennaRxPath; ulAntennaRx = pHalData->AntennaRxPath;
@ -1454,8 +1455,8 @@ void mpt_set_rfpath_8192f(PADAPTER pAdapter)
u16 ForcedDataRate = mpt_to_mgnt_rate(pMptCtx->mpt_rate_index); u16 ForcedDataRate = mpt_to_mgnt_rate(pMptCtx->mpt_rate_index);
u8 NssforRate, odmNssforRate; u8 NssforRate, odmNssforRate;
u32 ulAntennaTx, ulAntennaRx; u32 ulAntennaTx, ulAntennaRx;
u8 RxAntToPhyDm; enum bb_path RxAntToPhyDm;
u8 TxAntToPhyDm; enum bb_path TxAntToPhyDm;
ulAntennaTx = pHalData->antenna_tx_path; ulAntennaTx = pHalData->antenna_tx_path;
ulAntennaRx = pHalData->AntennaRxPath; ulAntennaRx = pHalData->AntennaRxPath;
@ -1498,7 +1499,7 @@ void mpt_set_rfpath_8192f(PADAPTER pAdapter)
break; break;
} }
config_phydm_trx_mode_8192f(GET_PDM_ODM(pAdapter), TxAntToPhyDm, RxAntToPhyDm, FALSE); phydm_api_trx_mode(GET_PDM_ODM(pAdapter), TxAntToPhyDm, RxAntToPhyDm, TxAntToPhyDm);
} }
@ -1508,6 +1509,12 @@ void hal_mpt_SetAntenna(PADAPTER pAdapter)
{ {
RTW_INFO("Do %s\n", __func__); RTW_INFO("Do %s\n", __func__);
#ifdef CONFIG_RTL8822C
if (IS_HARDWARE_TYPE_8822C(pAdapter)) {
rtl8822c_mp_config_rfpath(pAdapter);
return;
}
#endif
#ifdef CONFIG_RTL8814A #ifdef CONFIG_RTL8814A
if (IS_HARDWARE_TYPE_8814A(pAdapter)) { if (IS_HARDWARE_TYPE_8814A(pAdapter)) {
mpt_SetRFPath_8814A(pAdapter); mpt_SetRFPath_8814A(pAdapter);
@ -1560,6 +1567,13 @@ void hal_mpt_SetAntenna(PADAPTER pAdapter)
} }
#endif #endif
#ifdef CONFIG_RTL8814B
if (IS_HARDWARE_TYPE_8814B(pAdapter)) {
rtl8814b_mp_config_rfpath(pAdapter);
return;
}
#endif
/* else if (IS_HARDWARE_TYPE_8821B(pAdapter)) /* else if (IS_HARDWARE_TYPE_8821B(pAdapter))
mpt_SetRFPath_8821B(pAdapter); mpt_SetRFPath_8821B(pAdapter);
Prepare for 8822B Prepare for 8822B
@ -1583,12 +1597,7 @@ s32 hal_mpt_SetThermalMeter(PADAPTER pAdapter, u8 target_ther)
return _FAIL; return _FAIL;
} }
target_ther &= 0xff; target_ther &= 0xff;
if (target_ther < 0x07)
target_ther = 0x07;
else if (target_ther > 0x1d)
target_ther = 0x1d;
pHalData->eeprom_thermal_meter = target_ther; pHalData->eeprom_thermal_meter = target_ther;
@ -1598,20 +1607,33 @@ s32 hal_mpt_SetThermalMeter(PADAPTER pAdapter, u8 target_ther)
void hal_mpt_TriggerRFThermalMeter(PADAPTER pAdapter) void hal_mpt_TriggerRFThermalMeter(PADAPTER pAdapter)
{ {
if (IS_HARDWARE_TYPE_JAGUAR3(pAdapter)) {
phy_set_rf_reg(pAdapter, RF_PATH_A, 0x42, BIT19, 0x1);
phy_set_rf_reg(pAdapter, RF_PATH_A, 0x42, BIT19, 0x0);
phy_set_rf_reg(pAdapter, RF_PATH_A, 0x42, BIT19, 0x1);
} else
phy_set_rf_reg(pAdapter, RF_PATH_A, 0x42, BIT17 | BIT16, 0x03); phy_set_rf_reg(pAdapter, RF_PATH_A, 0x42, BIT17 | BIT16, 0x03);
} }
u8 hal_mpt_ReadRFThermalMeter(PADAPTER pAdapter) u8 hal_mpt_ReadRFThermalMeter(PADAPTER pAdapter, u8 rf_path)
{ {
struct dm_struct *p_dm_odm = adapter_to_phydm(pAdapter); struct dm_struct *p_dm_odm = adapter_to_phydm(pAdapter);
u32 ThermalValue = 0; u32 ThermalValue = 0;
s32 thermal_value_temp = 0; s32 thermal_value_temp = 0;
s8 thermal_offset = 0; s8 thermal_offset = 0;
u32 thermal_reg_mask = 0;
if (IS_8822C_SERIES(GET_HAL_DATA(pAdapter)->version_id))
thermal_reg_mask = 0x007e; /*0x42: RF Reg[6:1], 35332(themal K & bias k & power trim) & 35325(tssi )*/
else
thermal_reg_mask = 0xfc00; /*0x42: RF Reg[15:10]*/
ThermalValue = (u8)phy_query_rf_reg(pAdapter, rf_path, 0x42, thermal_reg_mask);
ThermalValue = (u1Byte)phy_query_rf_reg(pAdapter, RF_PATH_A, 0x42, 0xfc00); /*0x42: RF Reg[15:10]*/
thermal_offset = phydm_get_thermal_offset(p_dm_odm); thermal_offset = phydm_get_thermal_offset(p_dm_odm);
thermal_value_temp = ThermalValue + thermal_offset; thermal_value_temp = ThermalValue + thermal_offset;
@ -1627,7 +1649,7 @@ u8 hal_mpt_ReadRFThermalMeter(PADAPTER pAdapter)
} }
void hal_mpt_GetThermalMeter(PADAPTER pAdapter, u8 *value) void hal_mpt_GetThermalMeter(PADAPTER pAdapter, u8 rfpath, u8 *value)
{ {
#if 0 #if 0
fw_cmd(pAdapter, IOCMD_GET_THERMAL_METER); fw_cmd(pAdapter, IOCMD_GET_THERMAL_METER);
@ -1637,7 +1659,7 @@ void hal_mpt_GetThermalMeter(PADAPTER pAdapter, u8 *value)
#else #else
hal_mpt_TriggerRFThermalMeter(pAdapter); hal_mpt_TriggerRFThermalMeter(pAdapter);
rtw_msleep_os(1000); rtw_msleep_os(1000);
*value = hal_mpt_ReadRFThermalMeter(pAdapter); *value = hal_mpt_ReadRFThermalMeter(pAdapter, rfpath);
#endif #endif
} }
@ -1663,7 +1685,7 @@ void hal_mpt_SetSingleCarrierTx(PADAPTER pAdapter, u8 bStart)
/*/ 4. Turn On Continue Tx and turn off the other test modes.*/ /*/ 4. Turn On Continue Tx and turn off the other test modes.*/
#if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) #if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C)
if (IS_HARDWARE_TYPE_JAGUAR_AND_JAGUAR2(pAdapter)) if (IS_HARDWARE_TYPE_JAGUAR_ALL(pAdapter))
phy_set_bb_reg(pAdapter, rSingleTone_ContTx_Jaguar, BIT18 | BIT17 | BIT16, OFDM_SingleCarrier); phy_set_bb_reg(pAdapter, rSingleTone_ContTx_Jaguar, BIT18 | BIT17 | BIT16, OFDM_SingleCarrier);
else else
#endif /* CONFIG_RTL8812A || CONFIG_RTL8821A || CONFIG_RTL8814A || CONFIG_RTL8822B || CONFIG_RTL8821C */ #endif /* CONFIG_RTL8812A || CONFIG_RTL8821A || CONFIG_RTL8814A || CONFIG_RTL8822B || CONFIG_RTL8821C */
@ -1674,7 +1696,7 @@ void hal_mpt_SetSingleCarrierTx(PADAPTER pAdapter, u8 bStart)
/*/ Stop Single Carrier.*/ /*/ Stop Single Carrier.*/
/*/ Turn off all test modes.*/ /*/ Turn off all test modes.*/
#if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) #if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C)
if (IS_HARDWARE_TYPE_JAGUAR_AND_JAGUAR2(pAdapter)) if (IS_HARDWARE_TYPE_JAGUAR_ALL(pAdapter))
phy_set_bb_reg(pAdapter, rSingleTone_ContTx_Jaguar, BIT18 | BIT17 | BIT16, OFDM_ALL_OFF); phy_set_bb_reg(pAdapter, rSingleTone_ContTx_Jaguar, BIT18 | BIT17 | BIT16, OFDM_ALL_OFF);
else else
#endif /* CONFIG_RTL8812A || CONFIG_RTL8821A || CONFIG_RTL8814A || CONFIG_RTL8822B || CONFIG_RTL8821C */ #endif /* CONFIG_RTL8812A || CONFIG_RTL8821A || CONFIG_RTL8814A || CONFIG_RTL8822B || CONFIG_RTL8821C */
@ -1693,10 +1715,32 @@ void hal_mpt_SetSingleToneTx(PADAPTER pAdapter, u8 bStart)
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx);
struct dm_struct *pDM_Odm = &pHalData->odmpriv; struct dm_struct *pDM_Odm = &pHalData->odmpriv;
u4Byte ulAntennaTx = pHalData->antenna_tx_path; u32 ulAntennaTx = pHalData->antenna_tx_path;
static u4Byte regRF = 0, regBB0 = 0, regBB1 = 0, regBB2 = 0, regBB3 = 0; static u32 regRF = 0, regBB0 = 0, regBB1 = 0, regBB2 = 0, regBB3 = 0;
u8 rfPath; u8 rfPath;
if (IS_HARDWARE_TYPE_JAGUAR3(pAdapter)) {
#ifdef PHYDM_MP_SUPPORT
#ifdef CONFIG_RTL8814B
if(pHalData->current_channel_bw == CHANNEL_WIDTH_80_80)
{
/* @Tx mode: RF0x00[19:16]=4'b0010 */
config_phydm_write_rf_syn_8814b(pDM_Odm, RF_SYN0, RF_0x0, 0xF0000, 0x2);
/* @Lowest RF gain index: RF_0x0[4:0] = 0*/
config_phydm_write_rf_syn_8814b(pDM_Odm, RF_SYN0, RF_0x0, 0x1F, 0x0);
/* @RF LO enabled */
config_phydm_write_rf_syn_8814b(pDM_Odm, RF_SYN0, RF_0x58, BIT(1), 0x1);
/* @SYN1 */
config_phydm_write_rf_syn_8814b(pDM_Odm, RF_SYN1, RF_0x0, 0xF0000, 0x2);
config_phydm_write_rf_syn_8814b(pDM_Odm, RF_SYN1, RF_0x0, 0x1F, 0x0);
config_phydm_write_rf_syn_8814b(pDM_Odm, RF_SYN1, RF_0x58, BIT(1), 0x1);
}
#endif
phydm_mp_set_single_tone(pDM_Odm, bStart, pMptCtx->mpt_rf_path);
#endif
return;
}
switch (ulAntennaTx) { switch (ulAntennaTx) {
case ANTENNA_B: case ANTENNA_B:
rfPath = RF_PATH_B; rfPath = RF_PATH_B;
@ -1771,7 +1815,7 @@ void hal_mpt_SetSingleToneTx(PADAPTER pAdapter, u8 bStart)
} }
} else if (IS_HARDWARE_TYPE_JAGUAR(pAdapter) || IS_HARDWARE_TYPE_8822B(pAdapter) || IS_HARDWARE_TYPE_8821C(pAdapter)) { } else if (IS_HARDWARE_TYPE_JAGUAR(pAdapter) || IS_HARDWARE_TYPE_8822B(pAdapter) || IS_HARDWARE_TYPE_8821C(pAdapter)) {
#if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) #if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C)
u1Byte p = RF_PATH_A; u8 p = RF_PATH_A;
regRF = phy_query_rf_reg(pAdapter, RF_PATH_A, RF_AC_Jaguar, bRFRegOffsetMask); regRF = phy_query_rf_reg(pAdapter, RF_PATH_A, RF_AC_Jaguar, bRFRegOffsetMask);
regBB0 = phy_query_bb_reg(pAdapter, rA_RFE_Pinmux_Jaguar, bMaskDWord); regBB0 = phy_query_bb_reg(pAdapter, rA_RFE_Pinmux_Jaguar, bMaskDWord);
@ -1893,7 +1937,7 @@ void hal_mpt_SetSingleToneTx(PADAPTER pAdapter, u8 bStart)
} }
} else if (IS_HARDWARE_TYPE_JAGUAR(pAdapter) || IS_HARDWARE_TYPE_8822B(pAdapter) || IS_HARDWARE_TYPE_8821C(pAdapter)) { } else if (IS_HARDWARE_TYPE_JAGUAR(pAdapter) || IS_HARDWARE_TYPE_8822B(pAdapter) || IS_HARDWARE_TYPE_8821C(pAdapter)) {
#if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) #if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C)
u1Byte p = RF_PATH_A; u8 p = RF_PATH_A;
phy_set_bb_reg(pAdapter, rOFDMCCKEN_Jaguar, BIT29 | BIT28, 0x3); /*/ Disable CCK and OFDM*/ phy_set_bb_reg(pAdapter, rOFDMCCKEN_Jaguar, BIT29 | BIT28, 0x3); /*/ Disable CCK and OFDM*/
@ -1939,10 +1983,19 @@ void hal_mpt_SetSingleToneTx(PADAPTER pAdapter, u8 bStart)
void hal_mpt_SetCarrierSuppressionTx(PADAPTER pAdapter, u8 bStart) void hal_mpt_SetCarrierSuppressionTx(PADAPTER pAdapter, u8 bStart)
{ {
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
struct dm_struct *pdm_odm = &pHalData->odmpriv;
u8 Rate; u8 Rate;
pAdapter->mppriv.mpt_ctx.is_carrier_suppression = bStart; pAdapter->mppriv.mpt_ctx.is_carrier_suppression = bStart;
if (IS_HARDWARE_TYPE_JAGUAR3(pAdapter)) {
#ifdef PHYDM_MP_SUPPORT
phydm_mp_set_carrier_supp(pdm_odm, bStart, pAdapter->mppriv.rateidx);
#endif
return;
}
Rate = HwRateToMPTRate(pAdapter->mppriv.rateidx); Rate = HwRateToMPTRate(pAdapter->mppriv.rateidx);
if (bStart) {/* Start Carrier Suppression.*/ if (bStart) {/* Start Carrier Suppression.*/
if (Rate <= MPT_RATE_11M) { if (Rate <= MPT_RATE_11M) {
@ -1951,7 +2004,7 @@ void hal_mpt_SetCarrierSuppressionTx(PADAPTER pAdapter, u8 bStart)
write_bbreg(pAdapter, rFPGA0_RFMOD, bCCKEn, bEnable);/*set CCK block on*/ write_bbreg(pAdapter, rFPGA0_RFMOD, bCCKEn, bEnable);/*set CCK block on*/
/*/Turn Off All Test Mode*/ /*/Turn Off All Test Mode*/
if (IS_HARDWARE_TYPE_JAGUAR(pAdapter) || IS_HARDWARE_TYPE_8814A(pAdapter) /*|| IS_HARDWARE_TYPE_8822B(pAdapter)*/) if (IS_HARDWARE_TYPE_JAGUAR_ALL(pAdapter))
phy_set_bb_reg(pAdapter, 0x914, BIT18 | BIT17 | BIT16, OFDM_ALL_OFF); /* rSingleTone_ContTx_Jaguar*/ phy_set_bb_reg(pAdapter, 0x914, BIT18 | BIT17 | BIT16, OFDM_ALL_OFF); /* rSingleTone_ContTx_Jaguar*/
else else
phy_set_bb_reg(pAdapter, rOFDM1_LSTF, BIT30 | BIT29 | BIT28, OFDM_ALL_OFF); phy_set_bb_reg(pAdapter, rOFDM1_LSTF, BIT30 | BIT29 | BIT28, OFDM_ALL_OFF);
@ -1988,12 +2041,26 @@ u32 hal_mpt_query_phytxok(PADAPTER pAdapter)
{ {
PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx);
RT_PMAC_TX_INFO PMacTxInfo = pMptCtx->PMacTxInfo; RT_PMAC_TX_INFO PMacTxInfo = pMptCtx->PMacTxInfo;
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
u16 count = 0; u16 count = 0;
#ifdef PHYDM_MP_SUPPORT
struct dm_struct *dm = (struct dm_struct *)&pHalData->odmpriv;
struct phydm_mp *mp = &dm->dm_mp_table;
if (IS_HARDWARE_TYPE_JAGUAR3(pAdapter)) {
phydm_mp_get_tx_ok(&pHalData->odmpriv, pAdapter->mppriv.rateidx);
count = mp->tx_phy_ok_cnt;
} else
#endif
{
if (IS_MPT_CCK_RATE(PMacTxInfo.TX_RATE)) if (IS_MPT_CCK_RATE(PMacTxInfo.TX_RATE))
count = phy_query_bb_reg(pAdapter, 0xF50, bMaskLWord); /* [15:0]*/ count = phy_query_bb_reg(pAdapter, 0xF50, bMaskLWord); /* [15:0]*/
else else
count = phy_query_bb_reg(pAdapter, 0xF50, bMaskHWord); /* [31:16]*/ count = phy_query_bb_reg(pAdapter, 0xF50, bMaskHWord); /* [31:16]*/
}
if (count > 50000) { if (count > 50000) {
rtw_reset_phy_trx_ok_counters(pAdapter); rtw_reset_phy_trx_ok_counters(pAdapter);
@ -2005,13 +2072,13 @@ u32 hal_mpt_query_phytxok(PADAPTER pAdapter)
} }
static VOID mpt_StopCckContTx( static void mpt_StopCckContTx(
PADAPTER pAdapter PADAPTER pAdapter
) )
{ {
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx);
u1Byte u1bReg; u8 u1bReg;
pMptCtx->bCckContTx = FALSE; pMptCtx->bCckContTx = FALSE;
pMptCtx->bOfdmContTx = FALSE; pMptCtx->bOfdmContTx = FALSE;
@ -2019,7 +2086,7 @@ static VOID mpt_StopCckContTx(
phy_set_bb_reg(pAdapter, rCCK0_System, bCCKBBMode, 0x0); /*normal mode*/ phy_set_bb_reg(pAdapter, rCCK0_System, bCCKBBMode, 0x0); /*normal mode*/
phy_set_bb_reg(pAdapter, rCCK0_System, bCCKScramble, 0x1); /*turn on scramble setting*/ phy_set_bb_reg(pAdapter, rCCK0_System, bCCKScramble, 0x1); /*turn on scramble setting*/
if (!IS_HARDWARE_TYPE_JAGUAR2(pAdapter)) { if (!IS_HARDWARE_TYPE_JAGUAR_ALL(pAdapter)) {
phy_set_bb_reg(pAdapter, 0xa14, 0x300, 0x0); /* 0xa15[1:0] = 2b00*/ phy_set_bb_reg(pAdapter, 0xa14, 0x300, 0x0); /* 0xa15[1:0] = 2b00*/
phy_set_bb_reg(pAdapter, rOFDM0_TRMuxPar, 0x10000, 0x0); /* 0xc08[16] = 0*/ phy_set_bb_reg(pAdapter, rOFDM0_TRMuxPar, 0x10000, 0x0); /* 0xc08[16] = 0*/
@ -2032,32 +2099,41 @@ static VOID mpt_StopCckContTx(
phy_set_bb_reg(pAdapter, rPMAC_Reset, bBBResetB, 0x0); phy_set_bb_reg(pAdapter, rPMAC_Reset, bBBResetB, 0x0);
phy_set_bb_reg(pAdapter, rPMAC_Reset, bBBResetB, 0x1); phy_set_bb_reg(pAdapter, rPMAC_Reset, bBBResetB, 0x1);
if (!IS_HARDWARE_TYPE_JAGUAR_ALL(pAdapter)) {
phy_set_bb_reg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000100); phy_set_bb_reg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000100);
phy_set_bb_reg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000100); phy_set_bb_reg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000100);
}
if (IS_HARDWARE_TYPE_8188E(pAdapter) || IS_HARDWARE_TYPE_8723B(pAdapter) ||
IS_HARDWARE_TYPE_8703B(pAdapter) || IS_HARDWARE_TYPE_8188F(pAdapter) ||
IS_HARDWARE_TYPE_8723D(pAdapter) || IS_HARDWARE_TYPE_8192F(pAdapter) ||
IS_HARDWARE_TYPE_8821C(pAdapter) || IS_HARDWARE_TYPE_8188GTV(pAdapter)) {
phy_set_bb_reg(pAdapter, 0xA70, BIT(14), bDisable);/* patch Count CCK adjust Rate*/
}
} /* mpt_StopCckContTx */ } /* mpt_StopCckContTx */
static VOID mpt_StopOfdmContTx( static void mpt_StopOfdmContTx(
PADAPTER pAdapter PADAPTER pAdapter
) )
{ {
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx);
u1Byte u1bReg; u8 u1bReg;
u4Byte data; u32 data;
pMptCtx->bCckContTx = FALSE; pMptCtx->bCckContTx = FALSE;
pMptCtx->bOfdmContTx = FALSE; pMptCtx->bOfdmContTx = FALSE;
if (IS_HARDWARE_TYPE_JAGUAR(pAdapter) || IS_HARDWARE_TYPE_JAGUAR2(pAdapter)) if (IS_HARDWARE_TYPE_JAGUAR_ALL(pAdapter))
phy_set_bb_reg(pAdapter, 0x914, BIT18 | BIT17 | BIT16, OFDM_ALL_OFF); phy_set_bb_reg(pAdapter, 0x914, BIT18 | BIT17 | BIT16, OFDM_ALL_OFF);
else else
phy_set_bb_reg(pAdapter, rOFDM1_LSTF, BIT30 | BIT29 | BIT28, OFDM_ALL_OFF); phy_set_bb_reg(pAdapter, rOFDM1_LSTF, BIT30 | BIT29 | BIT28, OFDM_ALL_OFF);
rtw_mdelay_os(10); rtw_mdelay_os(10);
if (!IS_HARDWARE_TYPE_JAGUAR(pAdapter) && !IS_HARDWARE_TYPE_JAGUAR2(pAdapter)) { if (!IS_HARDWARE_TYPE_JAGUAR_ALL(pAdapter)){
phy_set_bb_reg(pAdapter, 0xa14, 0x300, 0x0); /* 0xa15[1:0] = 0*/ phy_set_bb_reg(pAdapter, 0xa14, 0x300, 0x0); /* 0xa15[1:0] = 0*/
phy_set_bb_reg(pAdapter, rOFDM0_TRMuxPar, 0x10000, 0x0); /* 0xc08[16] = 0*/ phy_set_bb_reg(pAdapter, rOFDM0_TRMuxPar, 0x10000, 0x0); /* 0xc08[16] = 0*/
} }
@ -2066,25 +2142,27 @@ static VOID mpt_StopOfdmContTx(
phy_set_bb_reg(pAdapter, rPMAC_Reset, bBBResetB, 0x0); phy_set_bb_reg(pAdapter, rPMAC_Reset, bBBResetB, 0x0);
phy_set_bb_reg(pAdapter, rPMAC_Reset, bBBResetB, 0x1); phy_set_bb_reg(pAdapter, rPMAC_Reset, bBBResetB, 0x1);
if (!IS_HARDWARE_TYPE_JAGUAR_ALL(pAdapter)) {
phy_set_bb_reg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000100); phy_set_bb_reg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000100);
phy_set_bb_reg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000100); phy_set_bb_reg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000100);
}
} /* mpt_StopOfdmContTx */ } /* mpt_StopOfdmContTx */
static VOID mpt_StartCckContTx( static void mpt_StartCckContTx(
PADAPTER pAdapter PADAPTER pAdapter
) )
{ {
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx);
u4Byte cckrate; u32 cckrate;
/* 1. if CCK block on */ /* 1. if CCK block on */
if (!phy_query_bb_reg(pAdapter, rFPGA0_RFMOD, bCCKEn)) if (!phy_query_bb_reg(pAdapter, rFPGA0_RFMOD, bCCKEn))
phy_set_bb_reg(pAdapter, rFPGA0_RFMOD, bCCKEn, 1);/*set CCK block on*/ phy_set_bb_reg(pAdapter, rFPGA0_RFMOD, bCCKEn, 1);/*set CCK block on*/
/*Turn Off All Test Mode*/ /*Turn Off All Test Mode*/
if (IS_HARDWARE_TYPE_JAGUAR_AND_JAGUAR2(pAdapter)) if (IS_HARDWARE_TYPE_JAGUAR_ALL(pAdapter))
phy_set_bb_reg(pAdapter, 0x914, BIT18 | BIT17 | BIT16, OFDM_ALL_OFF); phy_set_bb_reg(pAdapter, 0x914, BIT18 | BIT17 | BIT16, OFDM_ALL_OFF);
else else
phy_set_bb_reg(pAdapter, rOFDM1_LSTF, BIT30 | BIT29 | BIT28, OFDM_ALL_OFF); phy_set_bb_reg(pAdapter, rOFDM1_LSTF, BIT30 | BIT29 | BIT28, OFDM_ALL_OFF);
@ -2096,7 +2174,7 @@ static VOID mpt_StartCckContTx(
phy_set_bb_reg(pAdapter, rCCK0_System, bCCKBBMode, 0x2); /*transmit mode*/ phy_set_bb_reg(pAdapter, rCCK0_System, bCCKBBMode, 0x2); /*transmit mode*/
phy_set_bb_reg(pAdapter, rCCK0_System, bCCKScramble, 0x1); /*turn on scramble setting*/ phy_set_bb_reg(pAdapter, rCCK0_System, bCCKScramble, 0x1); /*turn on scramble setting*/
if (!IS_HARDWARE_TYPE_JAGUAR_AND_JAGUAR2(pAdapter)) { if (!IS_HARDWARE_TYPE_JAGUAR_ALL(pAdapter)) {
phy_set_bb_reg(pAdapter, 0xa14, 0x300, 0x3); /* 0xa15[1:0] = 11 force cck rxiq = 0*/ phy_set_bb_reg(pAdapter, 0xa14, 0x300, 0x3); /* 0xa15[1:0] = 11 force cck rxiq = 0*/
phy_set_bb_reg(pAdapter, rOFDM0_TRMuxPar, 0x10000, 0x1); /* 0xc08[16] = 1 force ofdm rxiq = ofdm txiq*/ phy_set_bb_reg(pAdapter, rOFDM0_TRMuxPar, 0x10000, 0x1); /* 0xc08[16] = 1 force ofdm rxiq = ofdm txiq*/
phy_set_bb_reg(pAdapter, rFPGA0_XA_HSSIParameter2, BIT14, 1); phy_set_bb_reg(pAdapter, rFPGA0_XA_HSSIParameter2, BIT14, 1);
@ -2104,8 +2182,20 @@ static VOID mpt_StartCckContTx(
phy_set_bb_reg(pAdapter, 0x0B34, BIT14, 1); phy_set_bb_reg(pAdapter, 0x0B34, BIT14, 1);
} }
if (!IS_HARDWARE_TYPE_JAGUAR_ALL(pAdapter)) {
phy_set_bb_reg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000500); phy_set_bb_reg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000500);
phy_set_bb_reg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000500); phy_set_bb_reg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000500);
}
if (IS_HARDWARE_TYPE_8188E(pAdapter) || IS_HARDWARE_TYPE_8723B(pAdapter) ||
IS_HARDWARE_TYPE_8703B(pAdapter) || IS_HARDWARE_TYPE_8188F(pAdapter) ||
IS_HARDWARE_TYPE_8723D(pAdapter) || IS_HARDWARE_TYPE_8192F(pAdapter) ||
IS_HARDWARE_TYPE_8821C(pAdapter) || IS_HARDWARE_TYPE_8188GTV(pAdapter)) {
if (pAdapter->mppriv.rateidx == MPT_RATE_1M) /* patch Count CCK adjust Rate*/
phy_set_bb_reg(pAdapter, 0xA70, BIT(14), bDisable);
else
phy_set_bb_reg(pAdapter, 0xA70, BIT(14), bEnable);
}
pMptCtx->bCckContTx = TRUE; pMptCtx->bCckContTx = TRUE;
pMptCtx->bOfdmContTx = FALSE; pMptCtx->bOfdmContTx = FALSE;
@ -2113,7 +2203,7 @@ static VOID mpt_StartCckContTx(
} /* mpt_StartCckContTx */ } /* mpt_StartCckContTx */
static VOID mpt_StartOfdmContTx( static void mpt_StartOfdmContTx(
PADAPTER pAdapter PADAPTER pAdapter
) )
{ {
@ -2130,33 +2220,67 @@ static VOID mpt_StartOfdmContTx(
/* 3. turn on scramble setting*/ /* 3. turn on scramble setting*/
phy_set_bb_reg(pAdapter, rCCK0_System, bCCKScramble, 1); phy_set_bb_reg(pAdapter, rCCK0_System, bCCKScramble, 1);
if (!IS_HARDWARE_TYPE_JAGUAR(pAdapter) && !IS_HARDWARE_TYPE_JAGUAR2(pAdapter)) { if (!IS_HARDWARE_TYPE_JAGUAR_ALL(pAdapter)) {
phy_set_bb_reg(pAdapter, 0xa14, 0x300, 0x3); /* 0xa15[1:0] = 2b'11*/ phy_set_bb_reg(pAdapter, 0xa14, 0x300, 0x3); /* 0xa15[1:0] = 2b'11*/
phy_set_bb_reg(pAdapter, rOFDM0_TRMuxPar, 0x10000, 0x1); /* 0xc08[16] = 1*/ phy_set_bb_reg(pAdapter, rOFDM0_TRMuxPar, 0x10000, 0x1); /* 0xc08[16] = 1*/
} }
/* 4. Turn On Continue Tx and turn off the other test modes.*/ /* 4. Turn On Continue Tx and turn off the other test modes.*/
if (IS_HARDWARE_TYPE_JAGUAR(pAdapter) || IS_HARDWARE_TYPE_JAGUAR2(pAdapter)) if (IS_HARDWARE_TYPE_JAGUAR_ALL(pAdapter))
phy_set_bb_reg(pAdapter, 0x914, BIT18 | BIT17 | BIT16, OFDM_ContinuousTx); phy_set_bb_reg(pAdapter, 0x914, BIT18 | BIT17 | BIT16, OFDM_ContinuousTx);
else else
phy_set_bb_reg(pAdapter, rOFDM1_LSTF, BIT30 | BIT29 | BIT28, OFDM_ContinuousTx); phy_set_bb_reg(pAdapter, rOFDM1_LSTF, BIT30 | BIT29 | BIT28, OFDM_ContinuousTx);
if (!IS_HARDWARE_TYPE_JAGUAR_ALL(pAdapter)) {
phy_set_bb_reg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000500); phy_set_bb_reg(pAdapter, rFPGA0_XA_HSSIParameter1, bMaskDWord, 0x01000500);
phy_set_bb_reg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000500); phy_set_bb_reg(pAdapter, rFPGA0_XB_HSSIParameter1, bMaskDWord, 0x01000500);
}
pMptCtx->bCckContTx = FALSE; pMptCtx->bCckContTx = FALSE;
pMptCtx->bOfdmContTx = TRUE; pMptCtx->bOfdmContTx = TRUE;
} /* mpt_StartOfdmContTx */ } /* mpt_StartOfdmContTx */
#if defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8821B) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8822C) || defined(CONFIG_RTL8814B)
#ifdef PHYDM_PMAC_TX_SETTING_SUPPORT
static void mpt_convert_phydm_txinfo_for_jaguar3(
RT_PMAC_TX_INFO pMacTxInfo, struct phydm_pmac_info *phydmtxinfo)
{
phydmtxinfo->en_pmac_tx = pMacTxInfo.bEnPMacTx;
phydmtxinfo->mode = pMacTxInfo.Mode;
phydmtxinfo->tx_rate = MRateToHwRate(mpt_to_mgnt_rate(pMacTxInfo.TX_RATE));
phydmtxinfo->tx_sc = pMacTxInfo.TX_SC;
phydmtxinfo->is_short_preamble = pMacTxInfo.bSPreamble;
phydmtxinfo->ndp_sound = pMacTxInfo.NDP_sound;
phydmtxinfo->bw = pMacTxInfo.BandWidth;
phydmtxinfo->m_stbc = pMacTxInfo.m_STBC;
phydmtxinfo->packet_period = pMacTxInfo.PacketPeriod;
phydmtxinfo->packet_count = pMacTxInfo.PacketCount;
phydmtxinfo->packet_pattern = pMacTxInfo.PacketPattern;
phydmtxinfo->sfd = pMacTxInfo.SFD;
phydmtxinfo->signal_field = pMacTxInfo.SignalField;
phydmtxinfo->service_field = pMacTxInfo.ServiceField;
phydmtxinfo->length = pMacTxInfo.LENGTH;
_rtw_memcpy(&phydmtxinfo->crc16,pMacTxInfo.CRC16, 2);
_rtw_memcpy(&phydmtxinfo->lsig , pMacTxInfo.LSIG,3);
_rtw_memcpy(&phydmtxinfo->ht_sig , pMacTxInfo.HT_SIG,6);
_rtw_memcpy(&phydmtxinfo->vht_sig_a , pMacTxInfo.VHT_SIG_A,6);
_rtw_memcpy(&phydmtxinfo->vht_sig_b , pMacTxInfo.VHT_SIG_B,4);
phydmtxinfo->vht_sig_b_crc = pMacTxInfo.VHT_SIG_B_CRC;
_rtw_memcpy(&phydmtxinfo->vht_delimiter,pMacTxInfo.VHT_Delimiter,4);
}
#endif
#if defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8821B) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C)
/* for HW TX mode */ /* for HW TX mode */
void mpt_ProSetPMacTx(PADAPTER Adapter) void mpt_ProSetPMacTx(PADAPTER Adapter)
{ {
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx); PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);
struct mp_priv *pmppriv = &Adapter->mppriv; struct mp_priv *pmppriv = &Adapter->mppriv;
RT_PMAC_TX_INFO PMacTxInfo = pMptCtx->PMacTxInfo; RT_PMAC_TX_INFO PMacTxInfo = pMptCtx->PMacTxInfo;
u32 u4bTmp; u32 u4bTmp;
struct dm_struct *p_dm_odm;
p_dm_odm = &pHalData->odmpriv;
#if 0 #if 0
PRINT_DATA("LSIG ", PMacTxInfo.LSIG, 3); PRINT_DATA("LSIG ", PMacTxInfo.LSIG, 3);
@ -2179,6 +2303,16 @@ void mpt_ProSetPMacTx(PADAPTER Adapter)
RTW_INFO("TXSC %d BandWidth %d PacketPeriod %d PacketCount %d PacketLength %d PacketPattern %d\n", PMacTxInfo.TX_SC, PMacTxInfo.BandWidth, PMacTxInfo.PacketPeriod, PMacTxInfo.PacketCount, RTW_INFO("TXSC %d BandWidth %d PacketPeriod %d PacketCount %d PacketLength %d PacketPattern %d\n", PMacTxInfo.TX_SC, PMacTxInfo.BandWidth, PMacTxInfo.PacketPeriod, PMacTxInfo.PacketCount,
PMacTxInfo.PacketLength, PMacTxInfo.PacketPattern); PMacTxInfo.PacketLength, PMacTxInfo.PacketPattern);
if (IS_HARDWARE_TYPE_JAGUAR3(Adapter)) {
#ifdef PHYDM_PMAC_TX_SETTING_SUPPORT
struct phydm_pmac_info phydm_mactxinfo;
mpt_convert_phydm_txinfo_for_jaguar3(PMacTxInfo, &phydm_mactxinfo);
phydm_set_pmac_tx(p_dm_odm, &phydm_mactxinfo, pMptCtx->mpt_rf_path);
#endif
return;
}
if (PMacTxInfo.bEnPMacTx == FALSE) { if (PMacTxInfo.bEnPMacTx == FALSE) {
if (pMptCtx->HWTxmode == CONTINUOUS_TX) { if (pMptCtx->HWTxmode == CONTINUOUS_TX) {
phy_set_bb_reg(Adapter, 0xb04, 0xf, 2); /* TX Stop*/ phy_set_bb_reg(Adapter, 0xb04, 0xf, 2); /* TX Stop*/
@ -2336,7 +2470,7 @@ void mpt_ProSetPMacTx(PADAPTER Adapter)
phy_set_bb_reg(Adapter, 0xb4c, 0x1ff, u4bTmp); phy_set_bb_reg(Adapter, 0xb4c, 0x1ff, u4bTmp);
if (IS_HARDWARE_TYPE_JAGUAR2(Adapter)) { if (IS_HARDWARE_TYPE_JAGUAR2(Adapter)) {
u4Byte offset = 0xb44; u32 offset = 0xb44;
if (IS_MPT_OFDM_RATE(PMacTxInfo.TX_RATE)) if (IS_MPT_OFDM_RATE(PMacTxInfo.TX_RATE))
phy_set_bb_reg(Adapter, offset, 0xc0000000, 0); phy_set_bb_reg(Adapter, offset, 0xc0000000, 0);
@ -2346,7 +2480,7 @@ void mpt_ProSetPMacTx(PADAPTER Adapter)
phy_set_bb_reg(Adapter, offset, 0xc0000000, 2); phy_set_bb_reg(Adapter, offset, 0xc0000000, 2);
} else if(IS_HARDWARE_TYPE_JAGUAR(Adapter)) { } else if(IS_HARDWARE_TYPE_JAGUAR(Adapter)) {
u4Byte offset = 0xb4c; u32 offset = 0xb4c;
if(IS_MPT_OFDM_RATE(PMacTxInfo.TX_RATE)) if(IS_MPT_OFDM_RATE(PMacTxInfo.TX_RATE))
phy_set_bb_reg(Adapter, offset, 0xc0000000, 0); phy_set_bb_reg(Adapter, offset, 0xc0000000, 0);

View File

@ -22,10 +22,10 @@
* OverView: Get shifted position of the BitMask * OverView: Get shifted position of the BitMask
* *
* Input: * Input:
* u4Byte BitMask, * u32 BitMask,
* *
* Output: none * Output: none
* Return: u4Byte Return the shift bit bit position of the mask * Return: u32 Return the shift bit bit position of the mask
*/ */
u32 u32
PHY_CalculateBitShift( PHY_CalculateBitShift(
@ -80,21 +80,21 @@ static RF_SHADOW_T RF_Shadow[RF6052_MAX_PATH][RF6052_MAX_REG];
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
u32 u32
PHY_RFShadowRead( PHY_RFShadowRead(
IN PADAPTER Adapter, PADAPTER Adapter,
IN enum rf_path eRFPath, enum rf_path eRFPath,
IN u32 Offset) u32 Offset)
{ {
return RF_Shadow[eRFPath][Offset].Value; return RF_Shadow[eRFPath][Offset].Value;
} /* PHY_RFShadowRead */ } /* PHY_RFShadowRead */
VOID void
PHY_RFShadowWrite( PHY_RFShadowWrite(
IN PADAPTER Adapter, PADAPTER Adapter,
IN enum rf_path eRFPath, enum rf_path eRFPath,
IN u32 Offset, u32 Offset,
IN u32 Data) u32 Data)
{ {
RF_Shadow[eRFPath][Offset].Value = (Data & bRFRegOffsetMask); RF_Shadow[eRFPath][Offset].Value = (Data & bRFRegOffsetMask);
RF_Shadow[eRFPath][Offset].Driver_Write = _TRUE; RF_Shadow[eRFPath][Offset].Driver_Write = _TRUE;
@ -104,9 +104,9 @@ PHY_RFShadowWrite(
BOOLEAN BOOLEAN
PHY_RFShadowCompare( PHY_RFShadowCompare(
IN PADAPTER Adapter, PADAPTER Adapter,
IN enum rf_path eRFPath, enum rf_path eRFPath,
IN u32 Offset) u32 Offset)
{ {
u32 reg; u32 reg;
/* Check if we need to check the register */ /* Check if we need to check the register */
@ -123,11 +123,11 @@ PHY_RFShadowCompare(
} /* PHY_RFShadowCompare */ } /* PHY_RFShadowCompare */
VOID void
PHY_RFShadowRecorver( PHY_RFShadowRecorver(
IN PADAPTER Adapter, PADAPTER Adapter,
IN enum rf_path eRFPath, enum rf_path eRFPath,
IN u32 Offset) u32 Offset)
{ {
/* Check if the address is error */ /* Check if the address is error */
if (RF_Shadow[eRFPath][Offset].ErrorOrNot == _TRUE) { if (RF_Shadow[eRFPath][Offset].ErrorOrNot == _TRUE) {
@ -141,9 +141,9 @@ PHY_RFShadowRecorver(
} /* PHY_RFShadowRecorver */ } /* PHY_RFShadowRecorver */
VOID void
PHY_RFShadowCompareAll( PHY_RFShadowCompareAll(
IN PADAPTER Adapter) PADAPTER Adapter)
{ {
enum rf_path eRFPath = RF_PATH_A; enum rf_path eRFPath = RF_PATH_A;
u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter); u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter);
@ -156,9 +156,9 @@ PHY_RFShadowCompareAll(
} /* PHY_RFShadowCompareAll */ } /* PHY_RFShadowCompareAll */
VOID void
PHY_RFShadowRecorverAll( PHY_RFShadowRecorverAll(
IN PADAPTER Adapter) PADAPTER Adapter)
{ {
enum rf_path eRFPath = RF_PATH_A; enum rf_path eRFPath = RF_PATH_A;
u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter); u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter);
@ -171,12 +171,12 @@ PHY_RFShadowRecorverAll(
} /* PHY_RFShadowRecorverAll */ } /* PHY_RFShadowRecorverAll */
VOID void
PHY_RFShadowCompareFlagSet( PHY_RFShadowCompareFlagSet(
IN PADAPTER Adapter, PADAPTER Adapter,
IN enum rf_path eRFPath, enum rf_path eRFPath,
IN u32 Offset, u32 Offset,
IN u8 Type) u8 Type)
{ {
/* Set True or False!!! */ /* Set True or False!!! */
RF_Shadow[eRFPath][Offset].Compare = Type; RF_Shadow[eRFPath][Offset].Compare = Type;
@ -184,12 +184,12 @@ PHY_RFShadowCompareFlagSet(
} /* PHY_RFShadowCompareFlagSet */ } /* PHY_RFShadowCompareFlagSet */
VOID void
PHY_RFShadowRecorverFlagSet( PHY_RFShadowRecorverFlagSet(
IN PADAPTER Adapter, PADAPTER Adapter,
IN enum rf_path eRFPath, enum rf_path eRFPath,
IN u32 Offset, u32 Offset,
IN u8 Type) u8 Type)
{ {
/* Set True or False!!! */ /* Set True or False!!! */
RF_Shadow[eRFPath][Offset].Recorver = Type; RF_Shadow[eRFPath][Offset].Recorver = Type;
@ -197,9 +197,9 @@ PHY_RFShadowRecorverFlagSet(
} /* PHY_RFShadowRecorverFlagSet */ } /* PHY_RFShadowRecorverFlagSet */
VOID void
PHY_RFShadowCompareFlagSetAll( PHY_RFShadowCompareFlagSetAll(
IN PADAPTER Adapter) PADAPTER Adapter)
{ {
enum rf_path eRFPath = RF_PATH_A; enum rf_path eRFPath = RF_PATH_A;
u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter); u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter);
@ -217,9 +217,9 @@ PHY_RFShadowCompareFlagSetAll(
} /* PHY_RFShadowCompareFlagSetAll */ } /* PHY_RFShadowCompareFlagSetAll */
VOID void
PHY_RFShadowRecorverFlagSetAll( PHY_RFShadowRecorverFlagSetAll(
IN PADAPTER Adapter) PADAPTER Adapter)
{ {
enum rf_path eRFPath = RF_PATH_A; enum rf_path eRFPath = RF_PATH_A;
u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter); u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter);
@ -236,9 +236,9 @@ PHY_RFShadowRecorverFlagSetAll(
} /* PHY_RFShadowCompareFlagSetAll */ } /* PHY_RFShadowCompareFlagSetAll */
VOID void
PHY_RFShadowRefresh( PHY_RFShadowRefresh(
IN PADAPTER Adapter) PADAPTER Adapter)
{ {
enum rf_path eRFPath = RF_PATH_A; enum rf_path eRFPath = RF_PATH_A;
u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter); u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter);

View File

@ -73,6 +73,12 @@
*/ */
#define HALMAC_MSG_LEVEL HALMAC_MSG_LEVEL_TRACE #define HALMAC_MSG_LEVEL HALMAC_MSG_LEVEL_TRACE
#ifdef DBG_IO
#define HALMAC_DBG_MONITOR_IO 1
#else
#define HALMAC_DBG_MONITOR_IO 0
#endif /*DBG_IO*/
/*[Driver] define the Rx FIFO expanding mode packet size unit for 8821C and 8822B */ /*[Driver] define the Rx FIFO expanding mode packet size unit for 8821C and 8822B */
/*Should be 8 Byte alignment*/ /*Should be 8 Byte alignment*/
#define HALMAC_RX_FIFO_EXPANDING_MODE_PKT_SIZE 80 /*Bytes*/ #define HALMAC_RX_FIFO_EXPANDING_MODE_PKT_SIZE 80 /*Bytes*/

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2017 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2017 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2017 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2017 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2017 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2017 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2017 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2017 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -460,6 +460,15 @@ static enum halmac_ret_status
chk_pinmux_valid_8822b(struct halmac_adapter *adapter, chk_pinmux_valid_8822b(struct halmac_adapter *adapter,
enum halmac_gpio_func gpio_func); enum halmac_gpio_func gpio_func);
static enum halmac_ret_status
pinmux_switch_8822b(struct halmac_adapter *adapter,
const struct halmac_gpio_pimux_list *list, u32 size,
u32 gpio_id, enum halmac_gpio_func gpio_func);
static enum halmac_ret_status
pinmux_record_8822b(struct halmac_adapter *adapter,
enum halmac_gpio_func gpio_func, u8 val);
/** /**
* pinmux_get_func_8822b() -get current gpio status * pinmux_get_func_8822b() -get current gpio status
* @adapter : the adapter of halmac * @adapter : the adapter of halmac
@ -559,12 +568,12 @@ pinmux_set_func_8822b(struct halmac_adapter *adapter,
if (status != HALMAC_RET_SUCCESS) if (status != HALMAC_RET_SUCCESS)
return status; return status;
status = pinmux_switch_88xx(adapter, list, list_size, gpio_id, status = pinmux_switch_8822b(adapter, list, list_size, gpio_id,
gpio_func); gpio_func);
if (status != HALMAC_RET_SUCCESS) if (status != HALMAC_RET_SUCCESS)
return status; return status;
status = pinmux_record_88xx(adapter, gpio_func, 1); status = pinmux_record_8822b(adapter, gpio_func, 1);
if (status != HALMAC_RET_SUCCESS) if (status != HALMAC_RET_SUCCESS)
return status; return status;
@ -646,6 +655,13 @@ pinmux_free_func_8822b(struct halmac_adapter *adapter,
case HALMAC_GPIO_FUNC_SW_IO_15: case HALMAC_GPIO_FUNC_SW_IO_15:
info->sw_io_15 = 0; info->sw_io_15 = 0;
break; break;
case HALMAC_GPIO_FUNC_S0_PAPE:
case HALMAC_GPIO_FUNC_S0_TRSW:
case HALMAC_GPIO_FUNC_S0_TRSWB:
case HALMAC_GPIO_FUNC_S1_PAPE:
case HALMAC_GPIO_FUNC_S1_TRSW:
case HALMAC_GPIO_FUNC_S1_TRSWB:
return HALMAC_RET_PINMUX_NOT_SUPPORT;
default: default:
return HALMAC_RET_SWITCH_CASE_ERROR; return HALMAC_RET_SWITCH_CASE_ERROR;
} }
@ -747,6 +763,13 @@ get_pinmux_list_8822b(struct halmac_adapter *adapter,
*list_size = ARRAY_SIZE(PINMUX_LIST_GPIO15_8822B); *list_size = ARRAY_SIZE(PINMUX_LIST_GPIO15_8822B);
*gpio_id = HALMAC_GPIO15; *gpio_id = HALMAC_GPIO15;
break; break;
case HALMAC_GPIO_FUNC_S0_PAPE:
case HALMAC_GPIO_FUNC_S0_TRSW:
case HALMAC_GPIO_FUNC_S0_TRSWB:
case HALMAC_GPIO_FUNC_S1_PAPE:
case HALMAC_GPIO_FUNC_S1_TRSW:
case HALMAC_GPIO_FUNC_S1_TRSWB:
return HALMAC_RET_PINMUX_NOT_SUPPORT;
default: default:
return HALMAC_RET_SWITCH_CASE_ERROR; return HALMAC_RET_SWITCH_CASE_ERROR;
} }
@ -842,6 +865,13 @@ chk_pinmux_valid_8822b(struct halmac_adapter *adapter,
if (info->sw_io_15 == 1) if (info->sw_io_15 == 1)
status = HALMAC_RET_PINMUX_USED; status = HALMAC_RET_PINMUX_USED;
break; break;
case HALMAC_GPIO_FUNC_S0_PAPE:
case HALMAC_GPIO_FUNC_S0_TRSW:
case HALMAC_GPIO_FUNC_S0_TRSWB:
case HALMAC_GPIO_FUNC_S1_PAPE:
case HALMAC_GPIO_FUNC_S1_TRSW:
case HALMAC_GPIO_FUNC_S1_TRSWB:
return HALMAC_RET_PINMUX_NOT_SUPPORT;
default: default:
return HALMAC_RET_SWITCH_CASE_ERROR; return HALMAC_RET_SWITCH_CASE_ERROR;
} }
@ -852,4 +882,171 @@ chk_pinmux_valid_8822b(struct halmac_adapter *adapter,
return status; return status;
} }
static enum halmac_ret_status
pinmux_switch_8822b(struct halmac_adapter *adapter,
const struct halmac_gpio_pimux_list *list, u32 size,
u32 gpio_id, enum halmac_gpio_func gpio_func)
{
u32 i;
u8 value8;
u16 switch_func;
const struct halmac_gpio_pimux_list *cur_list = list;
enum halmac_gpio_cfg_state *state;
struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
state = &adapter->halmac_state.gpio_cfg_state;
if (*state == HALMAC_GPIO_CFG_STATE_BUSY)
return HALMAC_RET_BUSY_STATE;
switch (gpio_func) {
case HALMAC_GPIO_FUNC_WL_LED:
switch_func = HALMAC_WL_LED;
break;
case HALMAC_GPIO_FUNC_SDIO_INT:
switch_func = HALMAC_SDIO_INT;
break;
case HALMAC_GPIO_FUNC_BT_HOST_WAKE1:
case HALMAC_GPIO_FUNC_BT_DEV_WAKE1:
switch_func = HALMAC_GPIO13_14_WL_CTRL_EN;
break;
case HALMAC_GPIO_FUNC_SW_IO_0:
case HALMAC_GPIO_FUNC_SW_IO_1:
case HALMAC_GPIO_FUNC_SW_IO_2:
case HALMAC_GPIO_FUNC_SW_IO_3:
case HALMAC_GPIO_FUNC_SW_IO_4:
case HALMAC_GPIO_FUNC_SW_IO_5:
case HALMAC_GPIO_FUNC_SW_IO_6:
case HALMAC_GPIO_FUNC_SW_IO_7:
case HALMAC_GPIO_FUNC_SW_IO_8:
case HALMAC_GPIO_FUNC_SW_IO_9:
case HALMAC_GPIO_FUNC_SW_IO_10:
case HALMAC_GPIO_FUNC_SW_IO_11:
case HALMAC_GPIO_FUNC_SW_IO_12:
case HALMAC_GPIO_FUNC_SW_IO_13:
case HALMAC_GPIO_FUNC_SW_IO_14:
case HALMAC_GPIO_FUNC_SW_IO_15:
switch_func = HALMAC_SW_IO;
break;
default:
return HALMAC_RET_SWITCH_CASE_ERROR;
}
for (i = 0; i < size; i++) {
if (gpio_id != cur_list->id) {
PLTFM_MSG_ERR("[ERR]offset:%X, value:%X, func:%X\n",
cur_list->offset, cur_list->value,
cur_list->func);
PLTFM_MSG_ERR("[ERR]id1 : %X, id2 : %X\n",
gpio_id, cur_list->id);
return HALMAC_RET_GET_PINMUX_ERR;
}
if (switch_func == cur_list->func)
break;
cur_list++;
}
if (i == size) {
PLTFM_MSG_ERR("[ERR]gpio func error:%X %X\n",
gpio_id, cur_list->id);
return HALMAC_RET_GET_PINMUX_ERR;
}
*state = HALMAC_GPIO_CFG_STATE_BUSY;
cur_list = list;
for (i = 0; i < size; i++) {
value8 = HALMAC_REG_R8(cur_list->offset);
value8 &= ~(cur_list->msk);
if (switch_func == cur_list->func) {
value8 |= (cur_list->value & cur_list->msk);
HALMAC_REG_W8(cur_list->offset, value8);
break;
}
value8 |= (~cur_list->value & cur_list->msk);
HALMAC_REG_W8(cur_list->offset, value8);
cur_list++;
}
*state = HALMAC_GPIO_CFG_STATE_IDLE;
return HALMAC_RET_SUCCESS;
}
static enum halmac_ret_status
pinmux_record_8822b(struct halmac_adapter *adapter,
enum halmac_gpio_func gpio_func, u8 val)
{
switch (gpio_func) {
case HALMAC_GPIO_FUNC_WL_LED:
adapter->pinmux_info.wl_led = val;
break;
case HALMAC_GPIO_FUNC_SDIO_INT:
adapter->pinmux_info.sdio_int = val;
break;
case HALMAC_GPIO_FUNC_BT_HOST_WAKE1:
adapter->pinmux_info.bt_host_wake = val;
break;
case HALMAC_GPIO_FUNC_BT_DEV_WAKE1:
adapter->pinmux_info.bt_dev_wake = val;
break;
case HALMAC_GPIO_FUNC_SW_IO_0:
adapter->pinmux_info.sw_io_0 = val;
break;
case HALMAC_GPIO_FUNC_SW_IO_1:
adapter->pinmux_info.sw_io_1 = val;
break;
case HALMAC_GPIO_FUNC_SW_IO_2:
adapter->pinmux_info.sw_io_2 = val;
break;
case HALMAC_GPIO_FUNC_SW_IO_3:
adapter->pinmux_info.sw_io_3 = val;
break;
case HALMAC_GPIO_FUNC_SW_IO_4:
adapter->pinmux_info.sw_io_4 = val;
break;
case HALMAC_GPIO_FUNC_SW_IO_5:
adapter->pinmux_info.sw_io_5 = val;
break;
case HALMAC_GPIO_FUNC_SW_IO_6:
adapter->pinmux_info.sw_io_6 = val;
break;
case HALMAC_GPIO_FUNC_SW_IO_7:
adapter->pinmux_info.sw_io_7 = val;
break;
case HALMAC_GPIO_FUNC_SW_IO_8:
adapter->pinmux_info.sw_io_8 = val;
break;
case HALMAC_GPIO_FUNC_SW_IO_9:
adapter->pinmux_info.sw_io_9 = val;
break;
case HALMAC_GPIO_FUNC_SW_IO_10:
adapter->pinmux_info.sw_io_10 = val;
break;
case HALMAC_GPIO_FUNC_SW_IO_11:
adapter->pinmux_info.sw_io_11 = val;
break;
case HALMAC_GPIO_FUNC_SW_IO_12:
adapter->pinmux_info.sw_io_12 = val;
break;
case HALMAC_GPIO_FUNC_SW_IO_13:
adapter->pinmux_info.sw_io_13 = val;
break;
case HALMAC_GPIO_FUNC_SW_IO_14:
adapter->pinmux_info.sw_io_14 = val;
break;
case HALMAC_GPIO_FUNC_SW_IO_15:
adapter->pinmux_info.sw_io_15 = val;
break;
default:
return HALMAC_RET_GET_PINMUX_ERR;
}
return HALMAC_RET_SUCCESS;
}
#endif /* HALMAC_8822B_SUPPORT */ #endif /* HALMAC_8822B_SUPPORT */

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -359,6 +359,8 @@ mount_api_8822b(struct halmac_adapter *adapter)
if (adapter->intf == HALMAC_INTERFACE_SDIO) { if (adapter->intf == HALMAC_INTERFACE_SDIO) {
#if HALMAC_SDIO_SUPPORT #if HALMAC_SDIO_SUPPORT
api->halmac_init_interface_cfg = init_sdio_cfg_8822b;
api->halmac_init_sdio_cfg = init_sdio_cfg_8822b;
api->halmac_mac_power_switch = mac_pwr_switch_sdio_8822b; api->halmac_mac_power_switch = mac_pwr_switch_sdio_8822b;
api->halmac_phy_cfg = phy_cfg_sdio_8822b; api->halmac_phy_cfg = phy_cfg_sdio_8822b;
api->halmac_pcie_switch = pcie_switch_sdio_8822b; api->halmac_pcie_switch = pcie_switch_sdio_8822b;
@ -417,6 +419,8 @@ init_trx_cfg_8822b(struct halmac_adapter *adapter, enum halmac_trx_mode mode)
u8 value8; u8 value8;
struct halmac_api *api = (struct halmac_api *)adapter->halmac_api; struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
enum halmac_ret_status status = HALMAC_RET_SUCCESS; enum halmac_ret_status status = HALMAC_RET_SUCCESS;
u8 en_fwff;
u16 value16;
adapter->trx_mode = mode; adapter->trx_mode = mode;
@ -428,10 +432,22 @@ init_trx_cfg_8822b(struct halmac_adapter *adapter, enum halmac_trx_mode mode)
return status; return status;
} }
en_fwff = HALMAC_REG_R8(REG_WMAC_FWPKT_CR) & BIT_FWEN;
if (en_fwff) {
HALMAC_REG_W8_CLR(REG_WMAC_FWPKT_CR, BIT_FWEN);
if (fwff_is_empty_88xx(adapter) != HALMAC_RET_SUCCESS)
PLTFM_MSG_ERR("[ERR]fwff is not empty\n");
}
value8 = 0; value8 = 0;
HALMAC_REG_W8(REG_CR, value8); HALMAC_REG_W8(REG_CR, value8);
value16 = HALMAC_REG_R16(REG_FWFF_PKT_INFO);
HALMAC_REG_W16(REG_FWFF_CTRL, value16);
value8 = MAC_TRX_ENABLE; value8 = MAC_TRX_ENABLE;
HALMAC_REG_W8(REG_CR, value8); HALMAC_REG_W8(REG_CR, value8);
if (en_fwff)
HALMAC_REG_W8_SET(REG_WMAC_FWPKT_CR, BIT_FWEN);
HALMAC_REG_W32(REG_H2CQ_CSR, BIT(31)); HALMAC_REG_W32(REG_H2CQ_CSR, BIT(31));
status = priority_queue_cfg_8822b(adapter, mode); status = priority_queue_cfg_8822b(adapter, mode);
@ -701,13 +717,15 @@ init_system_cfg_8822b(struct halmac_adapter *adapter)
struct halmac_api *api = (struct halmac_api *)adapter->halmac_api; struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
u32 tmp = 0; u32 tmp = 0;
u32 value32; u32 value32;
u8 value8;
PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__); PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
value32 = HALMAC_REG_R32(REG_CPU_DMEM_CON) | BIT_WL_PLATFORM_RST; value32 = HALMAC_REG_R32(REG_CPU_DMEM_CON) | BIT_WL_PLATFORM_RST;
HALMAC_REG_W32(REG_CPU_DMEM_CON, value32); HALMAC_REG_W32(REG_CPU_DMEM_CON, value32);
HALMAC_REG_W8(REG_SYS_FUNC_EN + 1, SYS_FUNC_EN); value8 = HALMAC_REG_R8(REG_SYS_FUNC_EN + 1) | SYS_FUNC_EN;
HALMAC_REG_W8(REG_SYS_FUNC_EN + 1, value8);
/*disable boot-from-flash for driver's DL FW*/ /*disable boot-from-flash for driver's DL FW*/
tmp = HALMAC_REG_R32(REG_MCUFW_CTRL); tmp = HALMAC_REG_R32(REG_MCUFW_CTRL);
@ -890,6 +908,10 @@ init_wmac_cfg_8822b(struct halmac_adapter *adapter)
HALMAC_REG_W8(REG_TCR + 2, WLAN_TX_FUNC_CFG2); HALMAC_REG_W8(REG_TCR + 2, WLAN_TX_FUNC_CFG2);
HALMAC_REG_W8(REG_TCR + 1, WLAN_TX_FUNC_CFG1); HALMAC_REG_W8(REG_TCR + 1, WLAN_TX_FUNC_CFG1);
HALMAC_REG_W8_SET(REG_WMAC_TRXPTCL_CTL + 4, BIT(1));
HALMAC_REG_W8_SET(REG_SND_PTCL_CTRL, BIT_R_DISABLE_CHECK_VHTSIGB_CRC);
HALMAC_REG_W32(REG_WMAC_OPTION_FUNCTION + 8, WLAN_MAC_OPT_FUNC2); HALMAC_REG_W32(REG_WMAC_OPTION_FUNCTION + 8, WLAN_MAC_OPT_FUNC2);
if (adapter->hw_cfg_info.trx_mode == HALMAC_TRNSFER_NORMAL) if (adapter->hw_cfg_info.trx_mode == HALMAC_TRNSFER_NORMAL)

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -42,7 +42,7 @@ struct halmac_intf_phy_para usb2_phy_param_8822b[] = {
{0xFFFF, 0x00, {0xFFFF, 0x00,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_ALL, HALMAC_INTF_PHY_CUT_ALL,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
}; };
struct halmac_intf_phy_para usb3_phy_param_8822b[] = { struct halmac_intf_phy_para usb3_phy_param_8822b[] = {
@ -50,11 +50,11 @@ struct halmac_intf_phy_para usb3_phy_param_8822b[] = {
{0x0001, 0xA841, {0x0001, 0xA841,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_D, HALMAC_INTF_PHY_CUT_D,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0xFFFF, 0x0000, {0xFFFF, 0x0000,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_ALL, HALMAC_INTF_PHY_CUT_ALL,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
}; };
struct halmac_intf_phy_para pcie_gen1_phy_param_8822b[] = { struct halmac_intf_phy_para pcie_gen1_phy_param_8822b[] = {
@ -62,47 +62,51 @@ struct halmac_intf_phy_para pcie_gen1_phy_param_8822b[] = {
{0x0001, 0xA841, {0x0001, 0xA841,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x0002, 0x60C6, {0x0002, 0x60C6,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x0008, 0x3596, {0x0008, 0x3596,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x0009, 0x321C, {0x0009, 0x321C,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x000A, 0x9623, {0x000A, 0x9623,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x001B, 0xE029,
HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_ALL,
HALMAC_INTF_PHY_PLATFORM_ASUS},
{0x0020, 0x94FF, {0x0020, 0x94FF,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x0021, 0xFFCF, {0x0021, 0xFFCF,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x0026, 0xC006, {0x0026, 0xC006,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x0029, 0xFF0E, {0x0029, 0xFF0E,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x002A, 0x1840, {0x002A, 0x1840,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0xFFFF, 0x0000, {0xFFFF, 0x0000,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_ALL, HALMAC_INTF_PHY_CUT_ALL,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
}; };
struct halmac_intf_phy_para pcie_gen2_phy_param_8822b[] = { struct halmac_intf_phy_para pcie_gen2_phy_param_8822b[] = {
@ -110,47 +114,47 @@ struct halmac_intf_phy_para pcie_gen2_phy_param_8822b[] = {
{0x0001, 0xA841, {0x0001, 0xA841,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x0002, 0x60C6, {0x0002, 0x60C6,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x0008, 0x3597, {0x0008, 0x3597,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x0009, 0x321C, {0x0009, 0x321C,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x000A, 0x9623, {0x000A, 0x9623,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x0020, 0x94FF, {0x0020, 0x94FF,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x0021, 0xFFCF, {0x0021, 0xFFCF,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x0026, 0xC006, {0x0026, 0xC006,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x0029, 0xFF0E, {0x0029, 0xFF0E,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0x002A, 0x3040, {0x002A, 0x3040,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_C, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
{0xFFFF, 0x0000, {0xFFFF, 0x0000,
HALMAC_IP_INTF_PHY, HALMAC_IP_INTF_PHY,
HALMAC_INTF_PHY_CUT_ALL, HALMAC_INTF_PHY_CUT_ALL,
HALMAC_INTF_PHY_PLATFORM_ALL}, HALMAC_INTF_PHY_PLATFORM_FOR_ALL},
}; };
#endif /* HALMAC_8822B_SUPPORT */ #endif /* HALMAC_8822B_SUPPORT */

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -58,6 +58,16 @@ static struct halmac_wlan_pwr_cfg TRANS_CARDDIS_TO_CARDEMU_8822B[] = {
static struct halmac_wlan_pwr_cfg TRANS_CARDEMU_TO_ACT_8822B[] = { static struct halmac_wlan_pwr_cfg TRANS_CARDEMU_TO_ACT_8822B[] = {
/* { offset, cut_msk, interface_msk, base|cmd, msk, value } */ /* { offset, cut_msk, interface_msk, base|cmd, msk, value } */
{0xFF0A,
HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_INTF_USB_MSK,
HALMAC_PWR_ADDR_MAC,
HALMAC_PWR_CMD_WRITE, 0xFF, 0},
{0xFF0B,
HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_INTF_USB_MSK,
HALMAC_PWR_ADDR_MAC,
HALMAC_PWR_CMD_WRITE, 0xFF, 0},
{0x0012, {0x0012,
HALMAC_PWR_CUT_ALL_MSK, HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_INTF_ALL_MSK, HALMAC_PWR_INTF_ALL_MSK,
@ -440,16 +450,6 @@ static struct halmac_wlan_pwr_cfg TRANS_CARDEMU_TO_SUS_8822B[] = {
static struct halmac_wlan_pwr_cfg TRANS_SUS_TO_CARDEMU_8822B[] = { static struct halmac_wlan_pwr_cfg TRANS_SUS_TO_CARDEMU_8822B[] = {
/* { offset, cut_msk, interface_msk, base|cmd, msk, value } */ /* { offset, cut_msk, interface_msk, base|cmd, msk, value } */
{0xFF0A,
HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_INTF_USB_MSK,
HALMAC_PWR_ADDR_MAC,
HALMAC_PWR_CMD_WRITE, 0xFF, 0},
{0xFF0B,
HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_INTF_USB_MSK,
HALMAC_PWR_ADDR_MAC,
HALMAC_PWR_CMD_WRITE, 0xFF, 0},
{0x0005, {0x0005,
HALMAC_PWR_CUT_ALL_MSK, HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_INTF_ALL_MSK, HALMAC_PWR_INTF_ALL_MSK,
@ -690,32 +690,32 @@ static struct halmac_wlan_pwr_cfg TRANS_ACT_TO_DEEP_LPS_8822B[] = {
HALMAC_PWR_CUT_ALL_MSK, HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_INTF_PCI_MSK, HALMAC_PWR_INTF_PCI_MSK,
HALMAC_PWR_ADDR_MAC, HALMAC_PWR_ADDR_MAC,
HALMAC_PWR_CMD_WRITE, 0xFF, 0xDE}, HALMAC_PWR_CMD_WRITE, 0xFF, 0xDC},
{0x0092, {0x0092,
HALMAC_PWR_CUT_ALL_MSK, HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_INTF_PCI_MSK, HALMAC_PWR_INTF_PCI_MSK,
HALMAC_PWR_ADDR_MAC, HALMAC_PWR_ADDR_MAC,
HALMAC_PWR_CMD_WRITE, 0xFF, 0x60}, HALMAC_PWR_CMD_WRITE, 0xFF, 0x20},
{0x0093, {0x0093,
HALMAC_PWR_CUT_ALL_MSK, HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_INTF_USB_MSK, HALMAC_PWR_INTF_USB_MSK,
HALMAC_PWR_ADDR_MAC, HALMAC_PWR_ADDR_MAC,
HALMAC_PWR_CMD_WRITE, 0xFF, 0x9B}, HALMAC_PWR_CMD_WRITE, 0xFF, 0x8},
{0x0092, {0x0092,
HALMAC_PWR_CUT_ALL_MSK, HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_INTF_USB_MSK, HALMAC_PWR_INTF_USB_MSK,
HALMAC_PWR_ADDR_MAC, HALMAC_PWR_ADDR_MAC,
HALMAC_PWR_CMD_WRITE, 0xFF, 0x60}, HALMAC_PWR_CMD_WRITE, 0xFF, 0x20},
{0x0093, {0x0093,
HALMAC_PWR_CUT_ALL_MSK, HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_INTF_SDIO_MSK, HALMAC_PWR_INTF_SDIO_MSK,
HALMAC_PWR_ADDR_MAC, HALMAC_PWR_ADDR_MAC,
HALMAC_PWR_CMD_WRITE, 0xFF, 0xA}, HALMAC_PWR_CMD_WRITE, 0xFF, 0x8},
{0x0092, {0x0092,
HALMAC_PWR_CUT_ALL_MSK, HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_INTF_SDIO_MSK, HALMAC_PWR_INTF_SDIO_MSK,
HALMAC_PWR_ADDR_MAC, HALMAC_PWR_ADDR_MAC,
HALMAC_PWR_CMD_WRITE, 0xFF, 0x60}, HALMAC_PWR_CMD_WRITE, 0xFF, 0x20},
{0x0090, {0x0090,
HALMAC_PWR_CUT_ALL_MSK, HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_INTF_ALL_MSK, HALMAC_PWR_INTF_ALL_MSK,

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -21,7 +21,7 @@
#if HALMAC_8822B_SUPPORT #if HALMAC_8822B_SUPPORT
#define HALMAC_8822B_PWR_SEQ_VER "V30" #define HALMAC_8822B_PWR_SEQ_VER "V31"
extern struct halmac_wlan_pwr_cfg *card_en_flow_8822b[]; extern struct halmac_wlan_pwr_cfg *card_en_flow_8822b[];
extern struct halmac_wlan_pwr_cfg *card_dis_flow_8822b[]; extern struct halmac_wlan_pwr_cfg *card_dis_flow_8822b[];

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -38,7 +38,7 @@ mac_pwr_switch_usb_8822b(struct halmac_adapter *adapter,
PLTFM_MSG_TRACE("[TRACE]%s\n", __func__); PLTFM_MSG_TRACE("[TRACE]%s\n", __func__);
PLTFM_MSG_TRACE("[TRACE]%x\n", pwr); PLTFM_MSG_TRACE("[TRACE]%x\n", pwr);
PLTFM_MSG_TRACE("[TRACE]8821C pwr seq ver = %s\n", PLTFM_MSG_TRACE("[TRACE]8822B pwr seq ver = %s\n",
HALMAC_8822B_PWR_SEQ_VER); HALMAC_8822B_PWR_SEQ_VER);
adapter->rpwm = HALMAC_REG_R8(0xFE58); adapter->rpwm = HALMAC_REG_R8(0xFE58);

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -588,10 +588,10 @@ cfg_bw_88xx(struct halmac_adapter *adapter, enum halmac_bw bw)
switch (bw) { switch (bw) {
case HALMAC_BW_80: case HALMAC_BW_80:
value32 |= BIT(8); value32 = value32 | BIT(8);
break; break;
case HALMAC_BW_40: case HALMAC_BW_40:
value32 |= BIT(7); value32 = value32 | BIT(7);
break; break;
case HALMAC_BW_20: case HALMAC_BW_20:
case HALMAC_BW_10: case HALMAC_BW_10:

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -90,6 +90,9 @@ get_c2h_dbg_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size);
static enum halmac_ret_status static enum halmac_ret_status
get_h2c_ack_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size); get_h2c_ack_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size);
static enum halmac_ret_status
get_scan_ch_notify_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size);
static enum halmac_ret_status static enum halmac_ret_status
get_scan_rpt_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size); get_scan_rpt_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size);
@ -99,6 +102,14 @@ get_h2c_ack_cfg_param_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size);
static enum halmac_ret_status static enum halmac_ret_status
get_h2c_ack_update_pkt_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size); get_h2c_ack_update_pkt_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size);
static enum halmac_ret_status
get_h2c_ack_send_scan_pkt_88xx(struct halmac_adapter *adapter, u8 *buf,
u32 size);
static enum halmac_ret_status
get_h2c_ack_drop_scan_pkt_88xx(struct halmac_adapter *adapter, u8 *buf,
u32 size);
static enum halmac_ret_status static enum halmac_ret_status
get_h2c_ack_update_datapkt_88xx(struct halmac_adapter *adapter, u8 *buf, get_h2c_ack_update_datapkt_88xx(struct halmac_adapter *adapter, u8 *buf,
u32 size); u32 size);
@ -138,6 +149,14 @@ static enum halmac_ret_status
send_h2c_update_packet_88xx(struct halmac_adapter *adapter, send_h2c_update_packet_88xx(struct halmac_adapter *adapter,
enum halmac_packet_id pkt_id, u8 *pkt, u32 size); enum halmac_packet_id pkt_id, u8 *pkt, u32 size);
static enum halmac_ret_status
send_h2c_send_scan_packet_88xx(struct halmac_adapter *adapter,
u8 index, u8 *pkt, u32 size);
static enum halmac_ret_status
send_h2c_drop_scan_packet_88xx(struct halmac_adapter *adapter,
struct halmac_drop_pkt_option *option);
static enum halmac_ret_status static enum halmac_ret_status
send_bt_coex_cmd_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size, send_bt_coex_cmd_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size,
u8 ack); u8 ack);
@ -172,6 +191,14 @@ static enum halmac_ret_status
get_update_packet_status_88xx(struct halmac_adapter *adapter, get_update_packet_status_88xx(struct halmac_adapter *adapter,
enum halmac_cmd_process_status *proc_status); enum halmac_cmd_process_status *proc_status);
static enum halmac_ret_status
get_send_scan_packet_status_88xx(struct halmac_adapter *adapter,
enum halmac_cmd_process_status *proc_status);
static enum halmac_ret_status
get_drop_scan_packet_status_88xx(struct halmac_adapter *adapter,
enum halmac_cmd_process_status *proc_status);
static enum halmac_ret_status static enum halmac_ret_status
pwr_sub_seq_parser_88xx(struct halmac_adapter *adapter, u8 cut, u8 intf, pwr_sub_seq_parser_88xx(struct halmac_adapter *adapter, u8 cut, u8 intf,
struct halmac_wlan_pwr_cfg *cmd); struct halmac_wlan_pwr_cfg *cmd);
@ -216,6 +243,9 @@ static enum halmac_packet_id
get_real_pkt_id_88xx(struct halmac_adapter *adapter, get_real_pkt_id_88xx(struct halmac_adapter *adapter,
enum halmac_packet_id pkt_id); enum halmac_packet_id pkt_id);
static u32
get_update_packet_page_size(struct halmac_adapter *adapter, u32 size);
/** /**
* ofld_func_cfg_88xx() - config offload function * ofld_func_cfg_88xx() - config offload function
* @adapter : the adapter of halmac * @adapter : the adapter of halmac
@ -535,6 +565,40 @@ set_hw_value_88xx(struct halmac_adapter *adapter, enum halmac_hw_id hw_id,
case HALMAC_HW_TXFIFO_LIFETIME: case HALMAC_HW_TXFIFO_LIFETIME:
cfg_txfifo_lt_88xx(adapter, cfg_txfifo_lt_88xx(adapter,
(struct halmac_txfifo_lifetime_cfg *)value); (struct halmac_txfifo_lifetime_cfg *)value);
break;
default:
return HALMAC_RET_PARA_NOT_SUPPORT;
}
PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
return HALMAC_RET_SUCCESS;
}
/**
* get_watcher_88xx() -get watcher value
* @adapter : the adapter of halmac
* @sel : id for driver to config
* @value : value, reference table to get data type
* Author :
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
get_watcher_88xx(struct halmac_adapter *adapter, enum halmac_watcher_sel sel,
void *value)
{
PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
if (!value) {
PLTFM_MSG_ERR("[ERR]null ptr-set hw value\n");
return HALMAC_RET_NULL_POINTER;
}
switch (sel) {
case HALMAC_WATCHER_SDIO_RN_FOOL_PROOFING:
*(u32 *)value = adapter->watcher.get_watcher.sdio_rn_not_align;
break;
default: default:
return HALMAC_RET_PARA_NOT_SUPPORT; return HALMAC_RET_PARA_NOT_SUPPORT;
} }
@ -694,6 +758,9 @@ parse_c2h_pkt_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
case C2H_SUB_CMD_ID_EFUSE_DATA: case C2H_SUB_CMD_ID_EFUSE_DATA:
status = get_efuse_data_88xx(adapter, c2h_pkt, c2h_size); status = get_efuse_data_88xx(adapter, c2h_pkt, c2h_size);
break; break;
case C2H_SUB_CMD_ID_SCAN_CH_NOTIFY:
status = get_scan_ch_notify_88xx(adapter, c2h_pkt, c2h_size);
break;
default: default:
PLTFM_MSG_WARN("[WARN]Sub cmd id!!\n"); PLTFM_MSG_WARN("[WARN]Sub cmd id!!\n");
status = HALMAC_RET_C2H_NOT_HANDLED; status = HALMAC_RET_C2H_NOT_HANDLED;
@ -800,6 +867,12 @@ get_h2c_ack_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
case H2C_SUB_CMD_ID_UPDATE_PKT_ACK: case H2C_SUB_CMD_ID_UPDATE_PKT_ACK:
status = get_h2c_ack_update_pkt_88xx(adapter, buf, size); status = get_h2c_ack_update_pkt_88xx(adapter, buf, size);
break; break;
case H2C_SUB_CMD_ID_SEND_SCAN_PKT_ACK:
status = get_h2c_ack_send_scan_pkt_88xx(adapter, buf, size);
break;
case H2C_SUB_CMD_ID_DROP_SCAN_PKT_ACK:
status = get_h2c_ack_drop_scan_pkt_88xx(adapter, buf, size);
break;
case H2C_SUB_CMD_ID_UPDATE_DATAPACK_ACK: case H2C_SUB_CMD_ID_UPDATE_DATAPACK_ACK:
status = get_h2c_ack_update_datapkt_88xx(adapter, buf, size); status = get_h2c_ack_update_datapkt_88xx(adapter, buf, size);
break; break;
@ -828,11 +901,56 @@ get_h2c_ack_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
return status; return status;
} }
static enum halmac_ret_status
get_scan_ch_notify_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
{
struct halmac_scan_rpt_info *scan_rpt_info = &adapter->scan_rpt_info;
PLTFM_MSG_TRACE("[TRACE]scan mode:%d\n", adapter->ch_sw_info.scan_mode);
if (adapter->ch_sw_info.scan_mode == 1) {
if (scan_rpt_info->avl_buf_size < 12) {
PLTFM_MSG_ERR("[ERR]ch_notify buffer full!!\n");
return HALMAC_RET_CH_SW_NO_BUF;
}
SCAN_CH_NOTIFY_SET_CH_NUM(scan_rpt_info->buf_wptr,
(u8)SCAN_CH_NOTIFY_GET_CH_NUM(buf));
SCAN_CH_NOTIFY_SET_NOTIFY_ID(scan_rpt_info->buf_wptr,
SCAN_CH_NOTIFY_GET_NOTIFY_ID(buf));
SCAN_CH_NOTIFY_SET_STATUS(scan_rpt_info->buf_wptr,
(u8)SCAN_CH_NOTIFY_GET_STATUS(buf));
SCAN_CH_NOTIFY_SET_TSF_0(scan_rpt_info->buf_wptr,
(u8)SCAN_CH_NOTIFY_GET_TSF_0(buf));
SCAN_CH_NOTIFY_SET_TSF_1(scan_rpt_info->buf_wptr,
(u8)SCAN_CH_NOTIFY_GET_TSF_1(buf));
SCAN_CH_NOTIFY_SET_TSF_2(scan_rpt_info->buf_wptr,
(u8)SCAN_CH_NOTIFY_GET_TSF_2(buf));
SCAN_CH_NOTIFY_SET_TSF_3(scan_rpt_info->buf_wptr,
(u8)SCAN_CH_NOTIFY_GET_TSF_3(buf));
SCAN_CH_NOTIFY_SET_TSF_4(scan_rpt_info->buf_wptr,
(u8)SCAN_CH_NOTIFY_GET_TSF_4(buf));
SCAN_CH_NOTIFY_SET_TSF_5(scan_rpt_info->buf_wptr,
(u8)SCAN_CH_NOTIFY_GET_TSF_5(buf));
SCAN_CH_NOTIFY_SET_TSF_6(scan_rpt_info->buf_wptr,
(u8)SCAN_CH_NOTIFY_GET_TSF_6(buf));
SCAN_CH_NOTIFY_SET_TSF_7(scan_rpt_info->buf_wptr,
(u8)SCAN_CH_NOTIFY_GET_TSF_7(buf));
scan_rpt_info->avl_buf_size = scan_rpt_info->avl_buf_size - 12;
scan_rpt_info->total_size = scan_rpt_info->total_size + 12;
scan_rpt_info->buf_wptr = scan_rpt_info->buf_wptr + 12;
}
return HALMAC_RET_SUCCESS;
}
static enum halmac_ret_status static enum halmac_ret_status
get_scan_rpt_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size) get_scan_rpt_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
{ {
u8 fw_rc; u8 fw_rc;
enum halmac_cmd_process_status proc_status; enum halmac_cmd_process_status proc_status;
struct halmac_scan_rpt_info *scan_rpt_info = &adapter->scan_rpt_info;
fw_rc = (u8)SCAN_STATUS_RPT_GET_H2C_RETURN_CODE(buf); fw_rc = (u8)SCAN_STATUS_RPT_GET_H2C_RETURN_CODE(buf);
proc_status = (HALMAC_H2C_RETURN_SUCCESS == proc_status = (HALMAC_H2C_RETURN_SUCCESS ==
@ -843,6 +961,19 @@ get_scan_rpt_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
adapter->halmac_state.scan_state.proc_status = proc_status; adapter->halmac_state.scan_state.proc_status = proc_status;
if (adapter->ch_sw_info.scan_mode == 1) {
scan_rpt_info->rpt_tsf_low =
((SCAN_STATUS_RPT_GET_TSF_3(buf) << 24) |
(SCAN_STATUS_RPT_GET_TSF_2(buf) << 16) |
(SCAN_STATUS_RPT_GET_TSF_1(buf) << 8) |
(SCAN_STATUS_RPT_GET_TSF_0(buf)));
scan_rpt_info->rpt_tsf_high =
((SCAN_STATUS_RPT_GET_TSF_7(buf) << 24) |
(SCAN_STATUS_RPT_GET_TSF_6(buf) << 16) |
(SCAN_STATUS_RPT_GET_TSF_5(buf) << 8) |
(SCAN_STATUS_RPT_GET_TSF_4(buf)));
}
PLTFM_MSG_TRACE("[TRACE]scan : %X\n", proc_status); PLTFM_MSG_TRACE("[TRACE]scan : %X\n", proc_status);
return HALMAC_RET_SUCCESS; return HALMAC_RET_SUCCESS;
@ -946,24 +1077,13 @@ get_h2c_ack_update_pkt_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
} }
static enum halmac_ret_status static enum halmac_ret_status
get_h2c_ack_update_datapkt_88xx(struct halmac_adapter *adapter, u8 *buf, get_h2c_ack_send_scan_pkt_88xx(struct halmac_adapter *adapter,
u32 size) u8 *buf, u32 size)
{
return HALMAC_RET_NOT_SUPPORT;
}
static enum halmac_ret_status
get_h2c_ack_run_datapkt_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
{
return HALMAC_RET_NOT_SUPPORT;
}
static enum halmac_ret_status
get_h2c_ack_ch_switch_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
{ {
u8 seq_num; u8 seq_num;
u8 fw_rc; u8 fw_rc;
struct halmac_scan_state *state = &adapter->halmac_state.scan_state; struct halmac_scan_pkt_state *state =
&adapter->halmac_state.scan_pkt_state;
enum halmac_cmd_process_status proc_status; enum halmac_cmd_process_status proc_status;
seq_num = (u8)H2C_ACK_HDR_GET_H2C_SEQ(buf); seq_num = (u8)H2C_ACK_HDR_GET_H2C_SEQ(buf);
@ -983,6 +1103,115 @@ get_h2c_ack_ch_switch_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
fw_rc = (u8)H2C_ACK_HDR_GET_H2C_RETURN_CODE(buf); fw_rc = (u8)H2C_ACK_HDR_GET_H2C_RETURN_CODE(buf);
state->fw_rc = fw_rc; state->fw_rc = fw_rc;
if (HALMAC_H2C_RETURN_SUCCESS == (enum halmac_h2c_return_code)fw_rc) {
proc_status = HALMAC_CMD_PROCESS_DONE;
state->proc_status = proc_status;
PLTFM_EVENT_SIG(HALMAC_FEATURE_SEND_SCAN_PACKET, proc_status,
NULL, 0);
} else {
proc_status = HALMAC_CMD_PROCESS_ERROR;
state->proc_status = proc_status;
PLTFM_EVENT_SIG(HALMAC_FEATURE_SEND_SCAN_PACKET, proc_status,
&state->fw_rc, 1);
}
return HALMAC_RET_SUCCESS;
}
static enum halmac_ret_status
get_h2c_ack_drop_scan_pkt_88xx(struct halmac_adapter *adapter,
u8 *buf, u32 size)
{
u8 seq_num;
u8 fw_rc;
struct halmac_drop_pkt_state *state =
&adapter->halmac_state.drop_pkt_state;
enum halmac_cmd_process_status proc_status;
seq_num = (u8)H2C_ACK_HDR_GET_H2C_SEQ(buf);
PLTFM_MSG_TRACE("[TRACE]Seq num : h2c->%d c2h->%d\n",
state->seq_num, seq_num);
if (seq_num != state->seq_num) {
PLTFM_MSG_ERR("[ERR]Seq num mismatch : h2c->%d c2h->%d\n",
state->seq_num, seq_num);
return HALMAC_RET_SUCCESS;
}
if (state->proc_status != HALMAC_CMD_PROCESS_SENDING) {
PLTFM_MSG_ERR("[ERR]not cmd sending\n");
return HALMAC_RET_SUCCESS;
}
fw_rc = (u8)H2C_ACK_HDR_GET_H2C_RETURN_CODE(buf);
state->fw_rc = fw_rc;
if (HALMAC_H2C_RETURN_SUCCESS == (enum halmac_h2c_return_code)fw_rc) {
proc_status = HALMAC_CMD_PROCESS_DONE;
state->proc_status = proc_status;
PLTFM_EVENT_SIG(HALMAC_FEATURE_DROP_SCAN_PACKET, proc_status,
NULL, 0);
} else {
proc_status = HALMAC_CMD_PROCESS_ERROR;
state->proc_status = proc_status;
PLTFM_EVENT_SIG(HALMAC_FEATURE_DROP_SCAN_PACKET, proc_status,
&state->fw_rc, 1);
}
return HALMAC_RET_SUCCESS;
}
static enum halmac_ret_status
get_h2c_ack_update_datapkt_88xx(struct halmac_adapter *adapter, u8 *buf,
u32 size)
{
return HALMAC_RET_NOT_SUPPORT;
}
static enum halmac_ret_status
get_h2c_ack_run_datapkt_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
{
return HALMAC_RET_NOT_SUPPORT;
}
static enum halmac_ret_status
get_h2c_ack_ch_switch_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
{
u8 seq_num;
u8 fw_rc;
struct halmac_scan_state *state = &adapter->halmac_state.scan_state;
struct halmac_scan_rpt_info *scan_rpt_info = &adapter->scan_rpt_info;
enum halmac_cmd_process_status proc_status;
seq_num = (u8)H2C_ACK_HDR_GET_H2C_SEQ(buf);
PLTFM_MSG_TRACE("[TRACE]Seq num : h2c->%d c2h->%d\n",
state->seq_num, seq_num);
if (seq_num != state->seq_num) {
PLTFM_MSG_ERR("[ERR]Seq num mismatch : h2c->%d c2h->%d\n",
state->seq_num, seq_num);
return HALMAC_RET_SUCCESS;
}
if (state->proc_status != HALMAC_CMD_PROCESS_SENDING) {
PLTFM_MSG_ERR("[ERR]not cmd sending\n");
return HALMAC_RET_SUCCESS;
}
fw_rc = (u8)H2C_ACK_HDR_GET_H2C_RETURN_CODE(buf);
state->fw_rc = fw_rc;
if (adapter->ch_sw_info.scan_mode == 1) {
scan_rpt_info->ack_tsf_low =
((CH_SWITCH_ACK_GET_TSF_3(buf) << 24) |
(CH_SWITCH_ACK_GET_TSF_2(buf) << 16) |
(CH_SWITCH_ACK_GET_TSF_1(buf) << 8) |
(CH_SWITCH_ACK_GET_TSF_0(buf)));
scan_rpt_info->ack_tsf_high =
((CH_SWITCH_ACK_GET_TSF_7(buf) << 24) |
(CH_SWITCH_ACK_GET_TSF_6(buf) << 16) |
(CH_SWITCH_ACK_GET_TSF_5(buf) << 8) |
(CH_SWITCH_ACK_GET_TSF_4(buf)));
}
if ((enum halmac_h2c_return_code)fw_rc == HALMAC_H2C_RETURN_SUCCESS) { if ((enum halmac_h2c_return_code)fw_rc == HALMAC_H2C_RETURN_SUCCESS) {
proc_status = HALMAC_CMD_PROCESS_RCVD; proc_status = HALMAC_CMD_PROCESS_RCVD;
state->proc_status = proc_status; state->proc_status = proc_status;
@ -1442,6 +1671,7 @@ update_packet_88xx(struct halmac_adapter *adapter, enum halmac_packet_id pkt_id,
enum halmac_ret_status status = HALMAC_RET_SUCCESS; enum halmac_ret_status status = HALMAC_RET_SUCCESS;
enum halmac_cmd_process_status *proc_status = enum halmac_cmd_process_status *proc_status =
&adapter->halmac_state.update_pkt_state.proc_status; &adapter->halmac_state.update_pkt_state.proc_status;
u8 *used_page = &adapter->halmac_state.update_pkt_state.used_page;
if (halmac_fw_validate(adapter) != HALMAC_RET_SUCCESS) if (halmac_fw_validate(adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_NO_DLFW; return HALMAC_RET_NO_DLFW;
@ -1468,6 +1698,8 @@ update_packet_88xx(struct halmac_adapter *adapter, enum halmac_packet_id pkt_id,
return status; return status;
} }
*used_page = (u8)get_update_packet_page_size(adapter, size);
if (packet_in_nlo_88xx(adapter, pkt_id)) { if (packet_in_nlo_88xx(adapter, pkt_id)) {
*proc_status = HALMAC_CMD_PROCESS_DONE; *proc_status = HALMAC_CMD_PROCESS_DONE;
adapter->nlo_flag = 1; adapter->nlo_flag = 1;
@ -1503,7 +1735,7 @@ send_h2c_update_packet_88xx(struct halmac_adapter *adapter,
UPDATE_PKT_SET_LOC(h2c_buf, pg_offset); UPDATE_PKT_SET_LOC(h2c_buf, pg_offset);
hdr_info.sub_cmd_id = SUB_CMD_ID_UPDATE_PKT; hdr_info.sub_cmd_id = SUB_CMD_ID_UPDATE_PKT;
hdr_info.content_size = 8; hdr_info.content_size = 4;
if (packet_in_nlo_88xx(adapter, pkt_id)) if (packet_in_nlo_88xx(adapter, pkt_id))
hdr_info.ack = 0; hdr_info.ack = 0;
else else
@ -1522,6 +1754,147 @@ send_h2c_update_packet_88xx(struct halmac_adapter *adapter,
return status; return status;
} }
enum halmac_ret_status
send_scan_packet_88xx(struct halmac_adapter *adapter, u8 index,
u8 *pkt, u32 size)
{
enum halmac_ret_status status = HALMAC_RET_SUCCESS;
enum halmac_cmd_process_status *proc_status =
&adapter->halmac_state.scan_pkt_state.proc_status;
if (halmac_fw_validate(adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_NO_DLFW;
if (adapter->fw_ver.h2c_version < 13)
return HALMAC_RET_FW_NO_SUPPORT;
if (size > UPDATE_PKT_RSVDPG_SIZE)
return HALMAC_RET_RSVD_PG_OVERFLOW_FAIL;
PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
if (*proc_status == HALMAC_CMD_PROCESS_SENDING) {
PLTFM_MSG_TRACE("[TRACE]Wait event(send_scan)\n");
return HALMAC_RET_BUSY_STATE;
}
*proc_status = HALMAC_CMD_PROCESS_SENDING;
status = send_h2c_send_scan_packet_88xx(adapter, index, pkt, size);
if (status != HALMAC_RET_SUCCESS)
return status;
PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
return HALMAC_RET_SUCCESS;
}
static enum halmac_ret_status
send_h2c_send_scan_packet_88xx(struct halmac_adapter *adapter,
u8 index, u8 *pkt, u32 size)
{
u8 h2c_buf[H2C_PKT_SIZE_88XX] = { 0 };
u16 seq_num = 0;
u16 pg_addr = adapter->txff_alloc.rsvd_h2c_info_addr;
u16 pg_offset;
struct halmac_h2c_header_info hdr_info;
enum halmac_ret_status status = HALMAC_RET_SUCCESS;
status = dl_rsvd_page_88xx(adapter, pg_addr, pkt, size);
if (status != HALMAC_RET_SUCCESS) {
PLTFM_MSG_ERR("[ERR]dl rsvd pg!!\n");
return status;
}
pg_offset = pg_addr - adapter->txff_alloc.rsvd_boundary;
SEND_SCAN_PKT_SET_SIZE(h2c_buf, size +
adapter->hw_cfg_info.txdesc_size);
SEND_SCAN_PKT_SET_INDEX(h2c_buf, index);
SEND_SCAN_PKT_SET_LOC(h2c_buf, pg_offset);
hdr_info.sub_cmd_id = SUB_CMD_ID_SEND_SCAN_PKT;
hdr_info.content_size = 8;
hdr_info.ack = 1;
set_h2c_pkt_hdr_88xx(adapter, h2c_buf, &hdr_info, &seq_num);
adapter->halmac_state.scan_pkt_state.seq_num = seq_num;
status = send_h2c_pkt_88xx(adapter, h2c_buf);
if (status != HALMAC_RET_SUCCESS) {
PLTFM_MSG_ERR("[ERR]send h2c!!\n");
reset_ofld_feature_88xx(adapter,
HALMAC_FEATURE_SEND_SCAN_PACKET);
return status;
}
return status;
}
enum halmac_ret_status
drop_scan_packet_88xx(struct halmac_adapter *adapter,
struct halmac_drop_pkt_option *option)
{
enum halmac_ret_status status = HALMAC_RET_SUCCESS;
enum halmac_cmd_process_status *proc_status =
&adapter->halmac_state.drop_pkt_state.proc_status;
if (halmac_fw_validate(adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_NO_DLFW;
if (adapter->fw_ver.h2c_version < 13)
return HALMAC_RET_FW_NO_SUPPORT;
PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
if (*proc_status == HALMAC_CMD_PROCESS_SENDING) {
PLTFM_MSG_TRACE("[TRACE]Wait event(drop_scan)\n");
return HALMAC_RET_BUSY_STATE;
}
*proc_status = HALMAC_CMD_PROCESS_SENDING;
status = send_h2c_drop_scan_packet_88xx(adapter, option);
if (status != HALMAC_RET_SUCCESS)
return status;
PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
return HALMAC_RET_SUCCESS;
}
static enum halmac_ret_status
send_h2c_drop_scan_packet_88xx(struct halmac_adapter *adapter,
struct halmac_drop_pkt_option *option)
{
u8 h2c_buf[H2C_PKT_SIZE_88XX] = { 0 };
u16 seq_num = 0;
struct halmac_h2c_header_info hdr_info;
enum halmac_ret_status status = HALMAC_RET_SUCCESS;
PLTFM_MSG_TRACE("[TRACE]%s\n", __func__);
DROP_SCAN_PKT_SET_DROP_ALL(h2c_buf, option->drop_all);
DROP_SCAN_PKT_SET_DROP_SINGLE(h2c_buf, option->drop_single);
DROP_SCAN_PKT_SET_DROP_IDX(h2c_buf, option->drop_index);
hdr_info.sub_cmd_id = SUB_CMD_ID_DROP_SCAN_PKT;
hdr_info.content_size = 8;
hdr_info.ack = 1;
set_h2c_pkt_hdr_88xx(adapter, h2c_buf, &hdr_info, &seq_num);
adapter->halmac_state.drop_pkt_state.seq_num = seq_num;
status = send_h2c_pkt_88xx(adapter, h2c_buf);
if (status != HALMAC_RET_SUCCESS) {
PLTFM_MSG_ERR("[ERR]send h2c!!\n");
reset_ofld_feature_88xx(adapter,
HALMAC_FEATURE_DROP_SCAN_PACKET);
return status;
}
return status;
}
enum halmac_ret_status enum halmac_ret_status
bcn_ie_filter_88xx(struct halmac_adapter *adapter, bcn_ie_filter_88xx(struct halmac_adapter *adapter,
struct halmac_bcn_ie_info *info) struct halmac_bcn_ie_info *info)
@ -1954,6 +2327,12 @@ ctrl_ch_switch_88xx(struct halmac_adapter *adapter,
if (adapter->fw_ver.h2c_version < 4) if (adapter->fw_ver.h2c_version < 4)
return HALMAC_RET_FW_NO_SUPPORT; return HALMAC_RET_FW_NO_SUPPORT;
if (adapter->ch_sw_info.total_size +
(adapter->halmac_state.update_pkt_state.used_page <<
TX_PAGE_SIZE_SHIFT_88XX) >
(u32)adapter->txff_alloc.rsvd_pg_num << TX_PAGE_SIZE_SHIFT_88XX)
return HALMAC_RET_RSVD_PG_OVERFLOW_FAIL;
PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__); PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
if (opt->switch_en == 0) if (opt->switch_en == 0)
@ -1997,6 +2376,7 @@ proc_ctrl_ch_switch_88xx(struct halmac_adapter *adapter,
u16 seq_num = 0; u16 seq_num = 0;
u16 pg_addr = adapter->txff_alloc.rsvd_h2c_info_addr; u16 pg_addr = adapter->txff_alloc.rsvd_h2c_info_addr;
struct halmac_h2c_header_info hdr_info; struct halmac_h2c_header_info hdr_info;
struct halmac_scan_rpt_info *scan_rpt_info = &adapter->scan_rpt_info;
enum halmac_ret_status status = HALMAC_RET_SUCCESS; enum halmac_ret_status status = HALMAC_RET_SUCCESS;
enum halmac_cmd_process_status *proc_status; enum halmac_cmd_process_status *proc_status;
@ -2004,7 +2384,8 @@ proc_ctrl_ch_switch_88xx(struct halmac_adapter *adapter,
PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__); PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
if (opt->nlo_en == 1 && adapter->nlo_flag != 1) if (adapter->halmac_state.update_pkt_state.used_page > 0 &&
opt->nlo_en == 1 && adapter->nlo_flag != 1)
PLTFM_MSG_WARN("[WARN]probe req is NOT nlo pkt!!\n"); PLTFM_MSG_WARN("[WARN]probe req is NOT nlo pkt!!\n");
if (cnv_scan_state_88xx(adapter, HALMAC_CMD_CNSTR_H2C_SENT) != if (cnv_scan_state_88xx(adapter, HALMAC_CMD_CNSTR_H2C_SENT) !=
@ -2014,6 +2395,7 @@ proc_ctrl_ch_switch_88xx(struct halmac_adapter *adapter,
*proc_status = HALMAC_CMD_PROCESS_SENDING; *proc_status = HALMAC_CMD_PROCESS_SENDING;
if (opt->switch_en != 0) { if (opt->switch_en != 0) {
pg_addr += adapter->halmac_state.update_pkt_state.used_page;
status = dl_rsvd_page_88xx(adapter, pg_addr, status = dl_rsvd_page_88xx(adapter, pg_addr,
adapter->ch_sw_info.buf, adapter->ch_sw_info.buf,
adapter->ch_sw_info.total_size); adapter->ch_sw_info.total_size);
@ -2021,6 +2403,7 @@ proc_ctrl_ch_switch_88xx(struct halmac_adapter *adapter,
PLTFM_MSG_ERR("[ERR]dl rsvd pg!!\n"); PLTFM_MSG_ERR("[ERR]dl rsvd pg!!\n");
return status; return status;
} }
adapter->halmac_state.update_pkt_state.used_page = 0;
} }
CH_SWITCH_SET_START(h2c_buf, opt->switch_en); CH_SWITCH_SET_START(h2c_buf, opt->switch_en);
@ -2038,6 +2421,7 @@ proc_ctrl_ch_switch_88xx(struct halmac_adapter *adapter,
CH_SWITCH_SET_SLOW_PERIOD(h2c_buf, opt->phase_2_period); CH_SWITCH_SET_SLOW_PERIOD(h2c_buf, opt->phase_2_period);
CH_SWITCH_SET_NORMAL_PERIOD_SEL(h2c_buf, opt->normal_period_sel); CH_SWITCH_SET_NORMAL_PERIOD_SEL(h2c_buf, opt->normal_period_sel);
CH_SWITCH_SET_SLOW_PERIOD_SEL(h2c_buf, opt->phase_2_period_sel); CH_SWITCH_SET_SLOW_PERIOD_SEL(h2c_buf, opt->phase_2_period_sel);
CH_SWITCH_SET_SCAN_MODE(h2c_buf, opt->scan_mode_en);
CH_SWITCH_SET_INFO_SIZE(h2c_buf, adapter->ch_sw_info.total_size); CH_SWITCH_SET_INFO_SIZE(h2c_buf, adapter->ch_sw_info.total_size);
hdr_info.sub_cmd_id = SUB_CMD_ID_CH_SWITCH; hdr_info.sub_cmd_id = SUB_CMD_ID_CH_SWITCH;
@ -2046,6 +2430,36 @@ proc_ctrl_ch_switch_88xx(struct halmac_adapter *adapter,
hdr_info.ack = 0; hdr_info.ack = 0;
else else
hdr_info.ack = 1; hdr_info.ack = 1;
if (opt->scan_mode_en == 1) {
adapter->ch_sw_info.scan_mode = 1;
if (!scan_rpt_info->buf) {
scan_rpt_info->buf =
(u8 *)PLTFM_MALLOC(SCAN_INFO_RSVDPG_SIZE);
if (!scan_rpt_info->buf)
return HALMAC_RET_NULL_POINTER;
} else {
PLTFM_MEMSET(scan_rpt_info->buf, 0,
SCAN_INFO_RSVDPG_SIZE);
}
scan_rpt_info->buf_wptr = scan_rpt_info->buf;
scan_rpt_info->buf_size = SCAN_INFO_RSVDPG_SIZE;
scan_rpt_info->avl_buf_size = SCAN_INFO_RSVDPG_SIZE;
scan_rpt_info->total_size = 0;
scan_rpt_info->ack_tsf_high = 0;
scan_rpt_info->ack_tsf_low = 0;
scan_rpt_info->rpt_tsf_high = 0;
scan_rpt_info->rpt_tsf_low = 0;
} else {
adapter->ch_sw_info.scan_mode = 0;
if (!scan_rpt_info->buf)
PLTFM_FREE(scan_rpt_info->buf, scan_rpt_info->buf_size);
scan_rpt_info->buf_wptr = NULL;
scan_rpt_info->buf_size = 0;
scan_rpt_info->avl_buf_size = 0;
scan_rpt_info->total_size = 0;
}
set_h2c_pkt_hdr_88xx(adapter, h2c_buf, &hdr_info, &seq_num); set_h2c_pkt_hdr_88xx(adapter, h2c_buf, &hdr_info, &seq_num);
adapter->halmac_state.scan_state.seq_num = seq_num; adapter->halmac_state.scan_state.seq_num = seq_num;
@ -2121,6 +2535,7 @@ enum halmac_ret_status
chk_txdesc_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size) chk_txdesc_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
{ {
u32 mac_clk = 0; u32 mac_clk = 0;
u8 value8;
enum halmac_ret_status status = HALMAC_RET_SUCCESS; enum halmac_ret_status status = HALMAC_RET_SUCCESS;
struct halmac_api *api = (struct halmac_api *)adapter->halmac_api; struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
@ -2146,6 +2561,14 @@ chk_txdesc_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
status = HALMAC_RET_TXDESC_SET_FAIL; status = HALMAC_RET_TXDESC_SET_FAIL;
} }
if (GET_TX_DESC_USE_MAX_TIME_EN(buf) == 1) {
value8 = (u8)GET_TX_DESC_AMPDU_MAX_TIME(buf);
if (value8 > HALMAC_REG_R8(REG_AMPDU_MAX_TIME_V1)) {
PLTFM_MSG_ERR("[ERR]txdesc - ampdu_max_time\n");
status = HALMAC_RET_TXDESC_SET_FAIL;
}
}
switch (BIT_GET_MAC_CLK_SEL(HALMAC_REG_R32(REG_AFE_CTRL1))) { switch (BIT_GET_MAC_CLK_SEL(HALMAC_REG_R32(REG_AFE_CTRL1))) {
case 0x0: case 0x0:
mac_clk = 80; mac_clk = 80;
@ -2401,12 +2824,23 @@ query_status_88xx(struct halmac_adapter *adapter,
status = get_dump_log_efuse_status_88xx(adapter, proc_status, status = get_dump_log_efuse_status_88xx(adapter, proc_status,
data, size); data, size);
break; break;
case HALMAC_FEATURE_DUMP_LOGICAL_EFUSE_MASK:
status = get_dump_log_efuse_mask_status_88xx(adapter,
proc_status,
data, size);
break;
case HALMAC_FEATURE_CHANNEL_SWITCH: case HALMAC_FEATURE_CHANNEL_SWITCH:
status = get_ch_switch_status_88xx(adapter, proc_status); status = get_ch_switch_status_88xx(adapter, proc_status);
break; break;
case HALMAC_FEATURE_UPDATE_PACKET: case HALMAC_FEATURE_UPDATE_PACKET:
status = get_update_packet_status_88xx(adapter, proc_status); status = get_update_packet_status_88xx(adapter, proc_status);
break; break;
case HALMAC_FEATURE_SEND_SCAN_PACKET:
status = get_send_scan_packet_status_88xx(adapter, proc_status);
break;
case HALMAC_FEATURE_DROP_SCAN_PACKET:
status = get_drop_scan_packet_status_88xx(adapter, proc_status);
break;
case HALMAC_FEATURE_IQK: case HALMAC_FEATURE_IQK:
status = get_iqk_status_88xx(adapter, proc_status); status = get_iqk_status_88xx(adapter, proc_status);
break; break;
@ -2453,6 +2887,24 @@ get_update_packet_status_88xx(struct halmac_adapter *adapter,
return HALMAC_RET_SUCCESS; return HALMAC_RET_SUCCESS;
} }
static enum halmac_ret_status
get_send_scan_packet_status_88xx(struct halmac_adapter *adapter,
enum halmac_cmd_process_status *proc_status)
{
*proc_status = adapter->halmac_state.scan_pkt_state.proc_status;
return HALMAC_RET_SUCCESS;
}
static enum halmac_ret_status
get_drop_scan_packet_status_88xx(struct halmac_adapter *adapter,
enum halmac_cmd_process_status *proc_status)
{
*proc_status = adapter->halmac_state.drop_pkt_state.proc_status;
return HALMAC_RET_SUCCESS;
}
/** /**
* cfg_drv_rsvd_pg_num_88xx() -config reserved page number for driver * cfg_drv_rsvd_pg_num_88xx() -config reserved page number for driver
* @adapter : the adapter of halmac * @adapter : the adapter of halmac
@ -2963,4 +3415,19 @@ get_real_pkt_id_88xx(struct halmac_adapter *adapter,
return real_pkt_id; return real_pkt_id;
} }
static u32
get_update_packet_page_size(struct halmac_adapter *adapter, u32 size)
{
struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
u32 txdesc_size;
u32 total;
api->halmac_get_hw_value(adapter, HALMAC_HW_TX_DESC_SIZE, &txdesc_size);
total = size + txdesc_size;
return (total & 0x7f) > 0 ?
(total >> TX_PAGE_SIZE_SHIFT_88XX) + 1 :
total >> TX_PAGE_SIZE_SHIFT_88XX;
}
#endif /* HALMAC_88XX_SUPPORT */ #endif /* HALMAC_88XX_SUPPORT */

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -42,6 +42,10 @@ enum halmac_ret_status
set_hw_value_88xx(struct halmac_adapter *adapter, enum halmac_hw_id hw_id, set_hw_value_88xx(struct halmac_adapter *adapter, enum halmac_hw_id hw_id,
void *value); void *value);
enum halmac_ret_status
get_watcher_88xx(struct halmac_adapter *adapter, enum halmac_watcher_sel sel,
void *value);
enum halmac_ret_status enum halmac_ret_status
set_h2c_pkt_hdr_88xx(struct halmac_adapter *adapter, u8 *hdr, set_h2c_pkt_hdr_88xx(struct halmac_adapter *adapter, u8 *hdr,
struct halmac_h2c_header_info *info, u16 *seq_num); struct halmac_h2c_header_info *info, u16 *seq_num);
@ -66,6 +70,14 @@ enum halmac_ret_status
update_packet_88xx(struct halmac_adapter *adapter, enum halmac_packet_id pkt_id, update_packet_88xx(struct halmac_adapter *adapter, enum halmac_packet_id pkt_id,
u8 *pkt, u32 size); u8 *pkt, u32 size);
enum halmac_ret_status
send_scan_packet_88xx(struct halmac_adapter *adapter, u8 index,
u8 *pkt, u32 size);
enum halmac_ret_status
drop_scan_packet_88xx(struct halmac_adapter *adapter,
struct halmac_drop_pkt_option *option);
enum halmac_ret_status enum halmac_ret_status
bcn_ie_filter_88xx(struct halmac_adapter *adapter, bcn_ie_filter_88xx(struct halmac_adapter *adapter,
struct halmac_bcn_ie_info *info); struct halmac_bcn_ie_info *info);

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -24,6 +24,7 @@
#define RSVD_CS_EFUSE_SIZE 24 #define RSVD_CS_EFUSE_SIZE 24
#define FEATURE_DUMP_PHY_EFUSE HALMAC_FEATURE_DUMP_PHYSICAL_EFUSE #define FEATURE_DUMP_PHY_EFUSE HALMAC_FEATURE_DUMP_PHYSICAL_EFUSE
#define FEATURE_DUMP_LOG_EFUSE HALMAC_FEATURE_DUMP_LOGICAL_EFUSE #define FEATURE_DUMP_LOG_EFUSE HALMAC_FEATURE_DUMP_LOGICAL_EFUSE
#define FEATURE_DUMP_LOG_EFUSE_MASK HALMAC_FEATURE_DUMP_LOGICAL_EFUSE_MASK
static enum halmac_cmd_construct_state static enum halmac_cmd_construct_state
efuse_cmd_cnstr_state_88xx(struct halmac_adapter *adapter); efuse_cmd_cnstr_state_88xx(struct halmac_adapter *adapter);
@ -533,6 +534,84 @@ dump_log_efuse_map_88xx(struct halmac_adapter *adapter,
return HALMAC_RET_SUCCESS; return HALMAC_RET_SUCCESS;
} }
enum halmac_ret_status
dump_log_efuse_mask_88xx(struct halmac_adapter *adapter,
enum halmac_efuse_read_cfg cfg)
{
u8 *map = NULL;
u32 size = adapter->hw_cfg_info.eeprom_size;
enum halmac_ret_status status = HALMAC_RET_SUCCESS;
enum halmac_cmd_process_status *proc_status;
proc_status = &adapter->halmac_state.efuse_state.proc_status;
if (cfg == HALMAC_EFUSE_R_FW &&
halmac_fw_validate(adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_NO_DLFW;
PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
PLTFM_MSG_TRACE("[TRACE]cfg = %d\n", cfg);
if (*proc_status == HALMAC_CMD_PROCESS_SENDING) {
PLTFM_MSG_WARN("[WARN]Wait event(efuse)\n");
return HALMAC_RET_BUSY_STATE;
}
if (efuse_cmd_cnstr_state_88xx(adapter) != HALMAC_CMD_CNSTR_IDLE) {
PLTFM_MSG_WARN("[WARN]Not idle(efuse)\n");
return HALMAC_RET_ERROR_STATE;
}
if (adapter->halmac_state.mac_pwr == HALMAC_MAC_POWER_OFF)
PLTFM_MSG_ERR("[ERR]Dump efuse in suspend\n");
*proc_status = HALMAC_CMD_PROCESS_IDLE;
adapter->evnt.log_efuse_mask = 1;
status = switch_efuse_bank_88xx(adapter, HALMAC_EFUSE_BANK_WIFI);
if (status != HALMAC_RET_SUCCESS) {
PLTFM_MSG_ERR("[ERR]switch efuse bank\n");
return status;
}
status = proc_dump_efuse_88xx(adapter, cfg);
if (status != HALMAC_RET_SUCCESS) {
PLTFM_MSG_ERR("[ERR]dump efuse\n");
return status;
}
if (adapter->efuse_map_valid == 1) {
*proc_status = HALMAC_CMD_PROCESS_DONE;
map = (u8 *)PLTFM_MALLOC(size);
if (!map) {
PLTFM_MSG_ERR("[ERR]malloc map\n");
return HALMAC_RET_MALLOC_FAIL;
}
PLTFM_MEMSET(map, 0xFF, size);
if (eeprom_mask_parser_88xx(adapter, adapter->efuse_map, map) !=
HALMAC_RET_SUCCESS) {
PLTFM_FREE(map, size);
return HALMAC_RET_EEPROM_PARSING_FAIL;
}
PLTFM_EVENT_SIG(HALMAC_FEATURE_DUMP_LOGICAL_EFUSE_MASK,
*proc_status, map, size);
adapter->evnt.log_efuse_mask = 0;
PLTFM_FREE(map, size);
}
if (cnv_efuse_state_88xx(adapter, HALMAC_CMD_CNSTR_IDLE) !=
HALMAC_RET_SUCCESS)
return HALMAC_RET_ERROR_STATE;
PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
return HALMAC_RET_SUCCESS;
}
/** /**
* read_logical_efuse_88xx() - read logical efuse map 1 byte * read_logical_efuse_88xx() - read logical efuse map 1 byte
* @adapter : the adapter of halmac * @adapter : the adapter of halmac
@ -1075,6 +1154,92 @@ eeprom_parser_88xx(struct halmac_adapter *adapter, u8 *phy_map, u8 *log_map)
return HALMAC_RET_SUCCESS; return HALMAC_RET_SUCCESS;
} }
enum halmac_ret_status
eeprom_mask_parser_88xx(struct halmac_adapter *adapter, u8 *phy_map,
u8 *log_mask)
{
u8 i;
u8 value8;
u8 blk_idx;
u8 word_en;
u8 valid;
u8 hdr;
u8 hdr2 = 0;
u32 eeprom_idx;
u32 efuse_idx = 0;
u32 prtct_efuse_size = adapter->hw_cfg_info.prtct_efuse_size;
struct halmac_hw_cfg_info *hw_info = &adapter->hw_cfg_info;
PLTFM_MEMSET(log_mask, 0xFF, hw_info->eeprom_size);
do {
value8 = *(phy_map + efuse_idx);
hdr = value8;
if ((hdr & 0x1f) == 0x0f) {
efuse_idx++;
value8 = *(phy_map + efuse_idx);
hdr2 = value8;
if (hdr2 == 0xff)
break;
blk_idx = ((hdr2 & 0xF0) >> 1) | ((hdr >> 5) & 0x07);
word_en = hdr2 & 0x0F;
} else {
blk_idx = (hdr & 0xF0) >> 4;
word_en = hdr & 0x0F;
}
if (hdr == 0xff)
break;
efuse_idx++;
if (efuse_idx >= hw_info->efuse_size - prtct_efuse_size - 1)
return HALMAC_RET_EEPROM_PARSING_FAIL;
for (i = 0; i < 4; i++) {
valid = (u8)((~(word_en >> i)) & BIT(0));
if (valid == 1) {
eeprom_idx = (blk_idx << 3) + (i << 1);
if ((eeprom_idx + 1) > hw_info->eeprom_size) {
PLTFM_MSG_ERR("[ERR]efuse idx:0x%X\n",
efuse_idx - 1);
PLTFM_MSG_ERR("[ERR]read hdr:0x%X\n",
hdr);
PLTFM_MSG_ERR("[ERR]read hdr2:0x%X\n",
hdr2);
return HALMAC_RET_EEPROM_PARSING_FAIL;
}
*(log_mask + eeprom_idx) = 0x00;
eeprom_idx++;
efuse_idx++;
if (efuse_idx > hw_info->efuse_size -
prtct_efuse_size - 1)
return HALMAC_RET_EEPROM_PARSING_FAIL;
*(log_mask + eeprom_idx) = 0x00;
efuse_idx++;
if (efuse_idx > hw_info->efuse_size -
prtct_efuse_size)
return HALMAC_RET_EEPROM_PARSING_FAIL;
}
}
} while (1);
adapter->efuse_end = efuse_idx;
return HALMAC_RET_SUCCESS;
}
static enum halmac_ret_status static enum halmac_ret_status
read_log_efuse_map_88xx(struct halmac_adapter *adapter, u8 *map) read_log_efuse_map_88xx(struct halmac_adapter *adapter, u8 *map)
{ {
@ -1755,6 +1920,19 @@ get_efuse_data_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
map, eeprom_size); map, eeprom_size);
adapter->evnt.log_efuse_map = 0; adapter->evnt.log_efuse_map = 0;
} }
if (adapter->evnt.log_efuse_mask == 1) {
if (eeprom_mask_parser_88xx(adapter, adapter->efuse_map,
map)
!= HALMAC_RET_SUCCESS) {
PLTFM_FREE(map, eeprom_size);
return HALMAC_RET_EEPROM_PARSING_FAIL;
}
PLTFM_EVENT_SIG(FEATURE_DUMP_LOG_EFUSE_MASK,
proc_status, map, eeprom_size);
adapter->evnt.log_efuse_mask = 0;
}
} else { } else {
proc_status = HALMAC_CMD_PROCESS_ERROR; proc_status = HALMAC_CMD_PROCESS_ERROR;
state->proc_status = proc_status; state->proc_status = proc_status;
@ -1770,6 +1948,12 @@ get_efuse_data_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
&state->fw_rc, 1); &state->fw_rc, 1);
adapter->evnt.log_efuse_map = 0; adapter->evnt.log_efuse_map = 0;
} }
if (adapter->evnt.log_efuse_mask == 1) {
PLTFM_EVENT_SIG(FEATURE_DUMP_LOG_EFUSE_MASK,
proc_status, &state->fw_rc, 1);
adapter->evnt.log_efuse_mask = 0;
}
} }
PLTFM_FREE(map, eeprom_size); PLTFM_FREE(map, eeprom_size);
@ -1810,6 +1994,9 @@ get_dump_phy_efuse_status_88xx(struct halmac_adapter *adapter,
} }
PLTFM_MEMSET(map, 0xFF, efuse_size); PLTFM_MEMSET(map, 0xFF, efuse_size);
PLTFM_MUTEX_LOCK(&adapter->efuse_mutex); PLTFM_MUTEX_LOCK(&adapter->efuse_mutex);
#if HALMAC_PLATFORM_WINDOWS
PLTFM_MEMCPY(map, adapter->efuse_map, efuse_size);
#else
PLTFM_MEMCPY(map, adapter->efuse_map, PLTFM_MEMCPY(map, adapter->efuse_map,
efuse_size - prtct_efuse_size); efuse_size - prtct_efuse_size);
PLTFM_MEMCPY(map + efuse_size - prtct_efuse_size + PLTFM_MEMCPY(map + efuse_size - prtct_efuse_size +
@ -1818,6 +2005,7 @@ get_dump_phy_efuse_status_88xx(struct halmac_adapter *adapter,
prtct_efuse_size + RSVD_CS_EFUSE_SIZE, prtct_efuse_size + RSVD_CS_EFUSE_SIZE,
prtct_efuse_size - RSVD_EFUSE_SIZE - prtct_efuse_size - RSVD_EFUSE_SIZE -
RSVD_CS_EFUSE_SIZE); RSVD_CS_EFUSE_SIZE);
#endif
PLTFM_MUTEX_UNLOCK(&adapter->efuse_mutex); PLTFM_MUTEX_UNLOCK(&adapter->efuse_mutex);
PLTFM_MEMCPY(data, map, *size); PLTFM_MEMCPY(data, map, *size);
@ -1874,6 +2062,52 @@ get_dump_log_efuse_status_88xx(struct halmac_adapter *adapter,
return HALMAC_RET_SUCCESS; return HALMAC_RET_SUCCESS;
} }
enum halmac_ret_status
get_dump_log_efuse_mask_status_88xx(struct halmac_adapter *adapter,
enum halmac_cmd_process_status *proc_status,
u8 *data, u32 *size)
{
u8 *map = NULL;
u32 eeprom_size = adapter->hw_cfg_info.eeprom_size;
struct halmac_efuse_state *state = &adapter->halmac_state.efuse_state;
*proc_status = state->proc_status;
if (!data)
return HALMAC_RET_NULL_POINTER;
if (!size)
return HALMAC_RET_NULL_POINTER;
if (*proc_status == HALMAC_CMD_PROCESS_DONE) {
if (*size < eeprom_size) {
*size = eeprom_size;
return HALMAC_RET_BUFFER_TOO_SMALL;
}
*size = eeprom_size;
map = (u8 *)PLTFM_MALLOC(eeprom_size);
if (!map) {
PLTFM_MSG_ERR("[ERR]malloc map\n");
return HALMAC_RET_MALLOC_FAIL;
}
PLTFM_MEMSET(map, 0xFF, eeprom_size);
if (eeprom_mask_parser_88xx(adapter, adapter->efuse_map, map) !=
HALMAC_RET_SUCCESS) {
PLTFM_FREE(map, eeprom_size);
return HALMAC_RET_EEPROM_PARSING_FAIL;
}
PLTFM_MEMCPY(data, map, *size);
PLTFM_FREE(map, eeprom_size);
}
return HALMAC_RET_SUCCESS;
}
enum halmac_ret_status enum halmac_ret_status
get_h2c_ack_phy_efuse_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size) get_h2c_ack_phy_efuse_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size)
{ {
@ -1907,4 +2141,118 @@ get_rsvd_efuse_size_88xx(struct halmac_adapter *adapter)
return adapter->hw_cfg_info.prtct_efuse_size; return adapter->hw_cfg_info.prtct_efuse_size;
} }
/**
* write_wifi_phy_efuse_88xx() - write wifi physical efuse
* @adapter : the adapter of halmac
* @offset : the efuse offset to be written
* @value : the value to be written
* Author : Yong-Ching Lin
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
write_wifi_phy_efuse_88xx(struct halmac_adapter *adapter, u32 offset, u8 value)
{
enum halmac_ret_status status = HALMAC_RET_SUCCESS;
enum halmac_cmd_process_status *proc_status;
proc_status = &adapter->halmac_state.efuse_state.proc_status;
PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
if (offset >= adapter->hw_cfg_info.efuse_size) {
PLTFM_MSG_ERR("[ERR]Offset is too large\n");
return HALMAC_RET_EFUSE_SIZE_INCORRECT;
}
if (*proc_status == HALMAC_CMD_PROCESS_SENDING) {
PLTFM_MSG_WARN("[WARN]Wait event(efuse)\n");
return HALMAC_RET_BUSY_STATE;
}
if (efuse_cmd_cnstr_state_88xx(adapter) != HALMAC_CMD_CNSTR_IDLE) {
PLTFM_MSG_WARN("[WARN]Not idle(efuse)\n");
return HALMAC_RET_ERROR_STATE;
}
status = switch_efuse_bank_88xx(adapter, HALMAC_EFUSE_BANK_WIFI);
if (status != HALMAC_RET_SUCCESS) {
PLTFM_MSG_ERR("[ERR]switch efuse bank\n");
return status;
}
status = write_hw_efuse_88xx(adapter, offset, value);
if (status != HALMAC_RET_SUCCESS) {
PLTFM_MSG_ERR("[ERR]write physical efuse\n");
return status;
}
if (cnv_efuse_state_88xx(adapter, HALMAC_CMD_CNSTR_IDLE) !=
HALMAC_RET_SUCCESS)
return HALMAC_RET_ERROR_STATE;
PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
return HALMAC_RET_SUCCESS;
}
/**
* read_wifi_phy_efuse_88xx() - read wifi physical efuse
* @adapter : the adapter of halmac
* @offset : the efuse offset to be read
* @size : the length to be read
* @value : pointer to the pre-allocated space where
the efuse content is to be copied
* Author : Yong-Ching Lin
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
read_wifi_phy_efuse_88xx(struct halmac_adapter *adapter, u32 offset, u32 size,
u8 *value)
{
enum halmac_ret_status status = HALMAC_RET_SUCCESS;
enum halmac_cmd_process_status *proc_status;
proc_status = &adapter->halmac_state.efuse_state.proc_status;
PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
if (offset >= adapter->hw_cfg_info.efuse_size ||
offset + size >= adapter->hw_cfg_info.efuse_size) {
PLTFM_MSG_ERR("[ERR] Wrong efuse index\n");
return HALMAC_RET_EFUSE_SIZE_INCORRECT;
}
if (*proc_status == HALMAC_CMD_PROCESS_SENDING) {
PLTFM_MSG_WARN("[WARN]Wait event(efuse)\n");
return HALMAC_RET_BUSY_STATE;
}
if (efuse_cmd_cnstr_state_88xx(adapter) != HALMAC_CMD_CNSTR_IDLE) {
PLTFM_MSG_WARN("[WARN]Not idle(efuse)\n");
return HALMAC_RET_ERROR_STATE;
}
status = switch_efuse_bank_88xx(adapter, HALMAC_EFUSE_BANK_WIFI);
if (status != HALMAC_RET_SUCCESS) {
PLTFM_MSG_ERR("[ERR]switch efuse bank\n");
return status;
}
status = read_hw_efuse_88xx(adapter, offset, size, value);
if (status != HALMAC_RET_SUCCESS) {
PLTFM_MSG_ERR("[ERR]read hw efuse\n");
return status;
}
if (cnv_efuse_state_88xx(adapter, HALMAC_CMD_CNSTR_IDLE) !=
HALMAC_RET_SUCCESS)
return HALMAC_RET_ERROR_STATE;
PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
return HALMAC_RET_SUCCESS;
}
#endif /* HALMAC_88XX_SUPPORT */ #endif /* HALMAC_88XX_SUPPORT */

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -27,6 +27,10 @@ dump_efuse_map_88xx(struct halmac_adapter *adapter,
enum halmac_ret_status enum halmac_ret_status
eeprom_parser_88xx(struct halmac_adapter *adapter, u8 *phy_map, u8 *log_map); eeprom_parser_88xx(struct halmac_adapter *adapter, u8 *phy_map, u8 *log_map);
enum halmac_ret_status
eeprom_mask_parser_88xx(struct halmac_adapter *adapter, u8 *phy_map,
u8 *log_mask);
enum halmac_ret_status enum halmac_ret_status
dump_efuse_map_bt_88xx(struct halmac_adapter *adapter, dump_efuse_map_bt_88xx(struct halmac_adapter *adapter,
enum halmac_efuse_bank bank, u32 size, u8 *map); enum halmac_efuse_bank bank, u32 size, u8 *map);
@ -54,6 +58,9 @@ get_log_efuse_size_88xx(struct halmac_adapter *adapter, u32 *size);
enum halmac_ret_status enum halmac_ret_status
dump_log_efuse_map_88xx(struct halmac_adapter *adapter, dump_log_efuse_map_88xx(struct halmac_adapter *adapter,
enum halmac_efuse_read_cfg cfg); enum halmac_efuse_read_cfg cfg);
enum halmac_ret_status
dump_log_efuse_mask_88xx(struct halmac_adapter *adapter,
enum halmac_efuse_read_cfg cfg);
enum halmac_ret_status enum halmac_ret_status
read_logical_efuse_88xx(struct halmac_adapter *adapter, u32 offset, u8 *value); read_logical_efuse_88xx(struct halmac_adapter *adapter, u32 offset, u8 *value);
@ -97,12 +104,24 @@ get_dump_log_efuse_status_88xx(struct halmac_adapter *adapter,
enum halmac_cmd_process_status *proc_status, enum halmac_cmd_process_status *proc_status,
u8 *data, u32 *size); u8 *data, u32 *size);
enum halmac_ret_status
get_dump_log_efuse_mask_status_88xx(struct halmac_adapter *adapter,
enum halmac_cmd_process_status *proc_status,
u8 *data, u32 *size);
enum halmac_ret_status enum halmac_ret_status
get_h2c_ack_phy_efuse_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size); get_h2c_ack_phy_efuse_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size);
u32 u32
get_rsvd_efuse_size_88xx(struct halmac_adapter *adapter); get_rsvd_efuse_size_88xx(struct halmac_adapter *adapter);
enum halmac_ret_status
write_wifi_phy_efuse_88xx(struct halmac_adapter *adapter, u32 offset, u8 value);
enum halmac_ret_status
read_wifi_phy_efuse_88xx(struct halmac_adapter *adapter, u32 offset, u32 size,
u8 *value);
#endif /* HALMAC_88XX_SUPPORT */ #endif /* HALMAC_88XX_SUPPORT */
#endif/* _HALMAC_EFUSE_88XX_H_ */ #endif/* _HALMAC_EFUSE_88XX_H_ */

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2017 - 2018 Realtek Corporation. All rights reserved. * Copyright(c) 2017 - 2019 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
@ -43,6 +43,7 @@ download_flash_88xx(struct halmac_adapter *adapter, u8 *fw_bin, u32 size,
u16 h2c_info_offset; u16 h2c_info_offset;
u32 pkt_size; u32 pkt_size;
u32 mem_offset; u32 mem_offset;
u32 cnt;
PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__); PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
@ -105,13 +106,15 @@ download_flash_88xx(struct halmac_adapter *adapter, u8 *fw_bin, u32 size,
mem_offset += pkt_size; mem_offset += pkt_size;
size -= pkt_size; size -= pkt_size;
while (((HALMAC_REG_R8(REG_MCUTST_I)) & BIT(0)) != 0) cnt = 1000;
PLTFM_DELAY_US(1000); while (((HALMAC_REG_R8(REG_MCUTST_I)) & BIT(0)) != 0) {
if (cnt == 0) {
if (((HALMAC_REG_R8(REG_MCUTST_I)) & BIT(0)) != 0) {
PLTFM_MSG_ERR("[ERR]dl flash!!\n"); PLTFM_MSG_ERR("[ERR]dl flash!!\n");
return HALMAC_RET_DLFW_FAIL; return HALMAC_RET_DLFW_FAIL;
} }
cnt--;
PLTFM_DELAY_US(1000);
}
} }
HALMAC_REG_W8(REG_FWHW_TXQ_CTRL + 2, restore[2]); HALMAC_REG_W8(REG_FWHW_TXQ_CTRL + 2, restore[2]);
@ -131,7 +134,7 @@ download_flash_88xx(struct halmac_adapter *adapter, u8 *fw_bin, u32 size,
* More details of status code can be found in prototype document * More details of status code can be found in prototype document
*/ */
enum halmac_ret_status enum halmac_ret_status
read_flash_88xx(struct halmac_adapter *adapter, u32 addr, u32 length) read_flash_88xx(struct halmac_adapter *adapter, u32 addr, u32 length, u8 *data)
{ {
struct halmac_api *api = (struct halmac_api *)adapter->halmac_api; struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
enum halmac_ret_status status; enum halmac_ret_status status;
@ -140,8 +143,10 @@ read_flash_88xx(struct halmac_adapter *adapter, u32 addr, u32 length)
u8 restore[3]; u8 restore[3];
u8 h2c_buf[H2C_PKT_SIZE_88XX] = {0}; u8 h2c_buf[H2C_PKT_SIZE_88XX] = {0};
u16 seq_num = 0; u16 seq_num = 0;
u16 h2c_info_addr = adapter->txff_alloc.rsvd_h2c_info_addr; u16 h2c_pg_addr = adapter->txff_alloc.rsvd_h2c_info_addr;
u16 rsvd_pg_addr = adapter->txff_alloc.rsvd_boundary; u16 rsvd_pg_addr = adapter->txff_alloc.rsvd_boundary;
u16 h2c_info_addr;
u32 cnt;
PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__); PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
@ -160,14 +165,14 @@ read_flash_88xx(struct halmac_adapter *adapter, u32 addr, u32 length)
value8 = (u8)(value8 & ~(BIT(6))); value8 = (u8)(value8 & ~(BIT(6)));
HALMAC_REG_W8(REG_FWHW_TXQ_CTRL + 2, value8); HALMAC_REG_W8(REG_FWHW_TXQ_CTRL + 2, value8);
HALMAC_REG_W16(REG_FIFOPAGE_CTRL_2, h2c_info_addr); HALMAC_REG_W16(REG_FIFOPAGE_CTRL_2, h2c_pg_addr);
value8 = HALMAC_REG_R8(REG_MCUTST_I); value8 = HALMAC_REG_R8(REG_MCUTST_I);
value8 |= BIT(0); value8 |= BIT(0);
HALMAC_REG_W8(REG_MCUTST_I, value8); HALMAC_REG_W8(REG_MCUTST_I, value8);
/* Construct H2C Content */ /* Construct H2C Content */
DOWNLOAD_FLASH_SET_SPI_CMD(h2c_buf, 0x03); DOWNLOAD_FLASH_SET_SPI_CMD(h2c_buf, 0x03);
DOWNLOAD_FLASH_SET_LOCATION(h2c_buf, h2c_info_addr - rsvd_pg_addr); DOWNLOAD_FLASH_SET_LOCATION(h2c_buf, h2c_pg_addr - rsvd_pg_addr);
DOWNLOAD_FLASH_SET_SIZE(h2c_buf, length); DOWNLOAD_FLASH_SET_SIZE(h2c_buf, length);
DOWNLOAD_FLASH_SET_START_ADDR(h2c_buf, addr); DOWNLOAD_FLASH_SET_START_ADDR(h2c_buf, addr);
@ -185,14 +190,30 @@ read_flash_88xx(struct halmac_adapter *adapter, u32 addr, u32 length)
return status; return status;
} }
while (((HALMAC_REG_R8(REG_MCUTST_I)) & BIT(0)) != 0) cnt = 5000;
while (((HALMAC_REG_R8(REG_MCUTST_I)) & BIT(0)) != 0) {
if (cnt == 0) {
PLTFM_MSG_ERR("[ERR]read flash!!\n");
return HALMAC_RET_FAIL;
}
cnt--;
PLTFM_DELAY_US(1000); PLTFM_DELAY_US(1000);
}
HALMAC_REG_W8_CLR(REG_MCUTST_I, BIT(0));
HALMAC_REG_W16(REG_FIFOPAGE_CTRL_2, rsvd_pg_addr); HALMAC_REG_W16(REG_FIFOPAGE_CTRL_2, rsvd_pg_addr);
HALMAC_REG_W8(REG_FWHW_TXQ_CTRL + 2, restore[2]); HALMAC_REG_W8(REG_FWHW_TXQ_CTRL + 2, restore[2]);
HALMAC_REG_W8(REG_BCN_CTRL, restore[1]); HALMAC_REG_W8(REG_BCN_CTRL, restore[1]);
HALMAC_REG_W8(REG_CR + 1, restore[0]); HALMAC_REG_W8(REG_CR + 1, restore[0]);
h2c_info_addr = h2c_pg_addr << TX_PAGE_SIZE_SHIFT_88XX;
status = dump_fifo_88xx(adapter, HAL_FIFO_SEL_TX, h2c_info_addr,
length, data);
if (status != HALMAC_RET_SUCCESS) {
PLTFM_MSG_ERR("[ERR]dump fifo!!\n");
return status;
}
PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__); PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
return HALMAC_RET_SUCCESS; return HALMAC_RET_SUCCESS;
@ -274,9 +295,12 @@ check_flash_88xx(struct halmac_adapter *adapter, u8 *fw_bin, u32 size,
u32 pkt_size; u32 pkt_size;
u32 start_page; u32 start_page;
u32 cnt; u32 cnt;
u8 *data;
pg_addr = adapter->txff_alloc.rsvd_h2c_info_addr; pg_addr = adapter->txff_alloc.rsvd_h2c_info_addr;
data = (u8 *)PLTFM_MALLOC(4096);
while (size != 0) { while (size != 0) {
start_page = ((pg_addr << 7) >> 12) + 0x780; start_page = ((pg_addr << 7) >> 12) + 0x780;
residue = (pg_addr << 7) & (4096 - 1); residue = (pg_addr << 7) & (4096 - 1);
@ -286,7 +310,7 @@ check_flash_88xx(struct halmac_adapter *adapter, u8 *fw_bin, u32 size,
else else
pkt_size = size; pkt_size = size;
read_flash_88xx(adapter, addr, 4096); read_flash_88xx(adapter, addr, 4096, data);
cnt = 0; cnt = 0;
while (cnt < pkt_size) { while (cnt < pkt_size) {
@ -295,6 +319,7 @@ check_flash_88xx(struct halmac_adapter *adapter, u8 *fw_bin, u32 size,
value8 = HALMAC_REG_R8(i); value8 = HALMAC_REG_R8(i);
if (*fw_bin != value8) { if (*fw_bin != value8) {
PLTFM_MSG_ERR("[ERR]check flash!!\n"); PLTFM_MSG_ERR("[ERR]check flash!!\n");
PLTFM_FREE(data, 4096);
return HALMAC_RET_FAIL; return HALMAC_RET_FAIL;
} }
@ -310,6 +335,8 @@ check_flash_88xx(struct halmac_adapter *adapter, u8 *fw_bin, u32 size,
size -= pkt_size; size -= pkt_size;
} }
PLTFM_FREE(data, 4096);
return HALMAC_RET_SUCCESS; return HALMAC_RET_SUCCESS;
} }

Some files were not shown because too many files have changed in this diff Show More